2 #include "util/mutex.h" 3 #include "NPLMemPool.h" 6 #include <boost/noncopyable.hpp> 7 #include <boost/shared_ptr.hpp> 8 #include <boost/enable_shared_from_this.hpp> 69 void SetRelativePath(
const char* sPath,
int nCount=-1);
76 void ToString(
string & output);
81 void FromString(
const char* filename);
94 public boost::enable_shared_from_this<NPLRuntimeAddress>,
95 private boost::noncopyable
99 :m_sHost(sHost), m_sPort(sPort), m_sNID(sNID){};
101 inline const std::string& GetHost()
const {
return m_sHost;}
102 inline const std::string& GetPort()
const {
return m_sPort;}
103 inline const std::string& GetNID()
const {
return m_sNID;}
104 inline void SetNID(
const char* nid) {m_sNID = nid;}
105 inline void SetNID(
const std::string& nid) {m_sNID = nid;}
111 const std::string m_sHost;
112 const std::string m_sPort;
127 NPLAddress(
const char* sAddress){m_sAddress = sAddress;};
146 list <NPLAddress> m_listReceivers;
151 bool empty(){
return m_listReceivers.empty();};
156 m_listReceivers.push_back(
NPLAddress(sAddress));
160 m_listReceivers.clear();
165 string sReceivers =
"";
166 list<NPLAddress>::iterator itCurCP, itEndCP = m_listReceivers.end();
167 for( itCurCP = m_listReceivers.begin(); itCurCP != itEndCP; ++ itCurCP){
168 sReceivers += (*itCurCP).ToString() +
";";
177 while( sReceivers[nTo]!=
'\0'){
178 if(sReceivers[nTo] ==
';'){
180 sAddress.assign(sReceivers+nFrom, nTo-nFrom);
181 AddReceiver(sAddress.c_str());
190 struct NPLTimer :
public boost::enable_shared_from_this<NPLTimer>,
191 private boost::noncopyable
193 const string m_nplFile;
194 const string m_sCode;
208 NPLTimer(
const string& nplFile,
const string& sCode,
float fInterval);
213 NPLTimer(
const string& nplFile,
const string& sCode, DWORD dwInterval);
224 void Change(
int dueTime,
int period);
233 bool Tick(NPLRuntimeState_ptr runtime_state, DWORD nTickCount = 0);
245 NPLServerInfo(
const string& sNID,
const string& sIP,
const string& sPort,
bool bTrusted=
true)
246 :m_sNID(sNID), m_sIP(sIP), m_sPort(sPort), m_bTrusted(bTrusted){};
Information of the local or a remote server.
Definition: NPLCommon.h:242
string ToString()
convert to string.
Definition: NPLCommon.h:137
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
void Cleanup()
clean up
Definition: NPLCommon.h:159
string sDNSServerName
the DNS file name.
Definition: NPLCommon.h:47
bool empty()
returns true if the receiver is empty.
Definition: NPLCommon.h:151
string sRuntimeStateName
the runtime state name that the file belongs to.
Definition: NPLCommon.h:32
string m_sPort
port of the server.
Definition: NPLCommon.h:254
string sRelativePath
the relative file path of the NPL file in the Runtime's file system.
Definition: NPLCommon.h:42
NOT USED YET: a list of NPL runtime address.
Definition: NPLCommon.h:143
std::basic_string< char, std::char_traits< char >, ParaEngine::CNPLPool_Char_alloc<> > NPLString
NPL String can be used instead of std::string, for strings which are created and deleted very regular...
Definition: NPLCommon.h:19
a globally unique name of a NPL file name instance.
Definition: NPLCommon.h:26
void AddReceiver(const char *sAddress)
add a new receiver from a string
Definition: NPLCommon.h:154
string GetPort()
TODO: get the port component in the address.
Definition: NPLCommon.h:135
string GetIP()
TODO: get the IP address component in the address.
Definition: NPLCommon.h:133
Obsoleted: the address of NPL runtime environment.
Definition: NPLCommon.h:122
bool IsLocal()
whether the address is the local address
Definition: NPLCommon.h:131
The globally unique address of NPL runtime.
Definition: NPLCommon.h:93
void FromString(const char *sReceivers)
append UI receivers from string.
Definition: NPLCommon.h:174
Check to see if it is a tick.
Definition: Tick.h:5
string m_sIP
this can be IP addresses or domain name, such as "localhost", "server.paraengine.com" ...
Definition: NPLCommon.h:252
string ToString()
convert to string.
Definition: NPLCommon.h:164
This class can be used as a custom allocator for stl containers, which constantly create and delete s...
Definition: NPLMemPool.h:11
bool m_bTrusted
whether we trust this server, if true, we will automatically connect to it when there is a NPL activa...
Definition: NPLCommon.h:257
cross platform mutex
Definition: mutex.h:95
string sNID
the NPL runtime server ID that the file belongs to.
Definition: NPLCommon.h:38
string m_sNID
NID of the NPL server.
Definition: NPLCommon.h:247
timer struct
Definition: NPLCommon.h:190