My Project
NPLMessage.h
1 #pragma once
2 #include "util/StringBuilder.h"
3 #include "util/PoolBase.h"
4 
5 #include <boost/noncopyable.hpp>
6 #include <boost/shared_ptr.hpp>
7 #include <boost/enable_shared_from_this.hpp>
8 
9 namespace NPL
10 {
15  {
18  MSG_TYPE_COMMAND_BEGIN,
19  MSG_TYPE_RESET,
26  };
27 
32  struct NPLMessage:
33  public ParaEngine::PoolBase<NPLMessage>,
35  private boost::noncopyable
36  {
37  public:
38  NPLMessage();
39  ~NPLMessage();
40  public:
44  std::string m_filename;
47  };
48 
49 
51  //
52  // NPL packet structures
53  //
55 #ifdef OLD_CODE
56  /* Specifies packing alignment for NPL packet structures.*/
57 #pragma pack(push,1)
58 
61  struct PKG_ActivateNeuron
62  {
63  // TODO: make variable length transmission.
65  char sFilePath[MAX_FILENAME_LEN];
66 
67  // TODO: make variable length transmission.
69  char sUIReceviers[MAX_FILENAME_LEN];
70 
72  int nCodeLength;
73  public:
74  PKG_ActivateNeuron()
75  {
76  sFilePath[0] = '\0';
77  sUIReceviers[0] = '\0';
78  nCodeLength = 0;
79  }
81  const char* GetSCode()
82  {
83  if(nCodeLength==0)
84  return NULL;
85  else
86  return (const char*)((byte*)this)+sizeof(PKG_ActivateNeuron);
87  }
88  };
89 
93  struct PKG_ActivateGlia
94  {
96  bool bActivate;
97  // TODO: make variable length transmission.
99  char sFilePath[MAX_FILENAME_LEN];
100 
101  // TODO: make variable length transmission.
103  char sDNSServerName[MAX_FILENAME_LEN];
104 
106  int nCodeLength;
107 
108  public:
109  PKG_ActivateGlia()
110  {
111  bActivate = true;
112  sFilePath[0] = '\0';
113  sDNSServerName[0] = '\0';
114  nCodeLength = 0;
115  }
116  public:
118  int GetPackageSize() const {
119  return sizeof(PKG_ActivateGlia);
120  }
122  const char* GetSCode()
123  {
124  if(nCodeLength==0)
125  return NULL;
126  else
127  return (const char*)((byte*)this)+sizeof(PKG_ActivateGlia);
128  }
129  };
130 #pragma pack(pop)
131 #endif
132 }
define this to enable debugging of NPL code in visual studio
Definition: INPL.h:9
NPLMessageType m_type
message type
Definition: NPLMessage.h:42
ParaEngine::StringBuilder m_code
must be secure code.
Definition: NPLMessage.h:46
NPLMessageType
message type in NPLMessage
Definition: NPLMessage.h:14
if one wants to create and delete many objects of the same type per frame, derive your class from Poo...
Definition: PoolBase.h:60
std::string m_filename
NPL or dll file name.
Definition: NPLMessage.h:44
exit the runtime state
Definition: NPLMessage.h:21
an NPL message in the message queue.
Definition: NPLMessage.h:32
single-threaded reference counted base class for boost::intrusive_ptr all boost::intrusive_ptr<T>, should derive from this class.
Definition: intrusive_ptr.h:75
A NON-thread-safe, mutable sequence of characters(Binary is also possible).
Definition: StringBuilder.h:9
load without activation
Definition: NPLMessage.h:25
normal file activation
Definition: NPLMessage.h:17
frame move tick
Definition: NPLMessage.h:23