Skip to content

Commit cfde278

Browse files
Colin Wardhitman-codehq
authored andcommitted
Add return value to RRemoteFactory::setLocal()
This method now returns the previous setting of the useLocal property, so that it can be restored at a later date.
1 parent e3b349b commit cfde278

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

RemoteFactory.h

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class RRemoteFactory
3535

3636
RRemoteFactory() : m_useLocal(false) { }
3737

38+
~RRemoteFactory()
39+
{
40+
close();
41+
}
42+
3843
int openRemote();
3944

4045
void close();
@@ -62,12 +67,26 @@ class RRemoteFactory
6267
m_serverPort = a_port;
6368
}
6469

65-
/**< Set this to true when the RRemoteFactory instance is configured to be used for remote
66-
* access, but there is a need to temporarily access the local file system
70+
/**
71+
* Sets a remote factory temporarily to local mode.
72+
* Set this to true when the RRemoteFactory instance is configured to be used for remote access,
73+
* but there is a need to temporarily access the local file system. This is only meant to be a
74+
* temporary change, and you should restore the old setting as quickly as possible.
75+
*
76+
* Note that this method is only useful for remote factories. It will have no effect for local ones.
77+
*
78+
* @date Tuesday 23-Jul-2024 8:44 am, Code HQ Tokyo Tsukuda
79+
* @param a_useLocal true to treat the factory as a local factory, or false as a remote one
80+
* @return The previous remote setting of the remote factory
6781
*/
68-
void useLocal(bool a_useLocal)
82+
83+
bool useLocal(bool a_useLocal)
6984
{
85+
bool oldSetting = m_useLocal;
86+
7087
m_useLocal = a_useLocal;
88+
89+
return oldSetting;
7190
}
7291
};
7392

0 commit comments

Comments
 (0)