Here are a few hints about the core classes inside MGS :
class Diplomat {
public:
virtual void MgsSendMessage(EMgsMessage) = 0;
virtual EMgsState GetState() = 0;
virtual class mgent * GetEntity() = 0;
virtual class DataDescriptor * GetSettingsData() = 0;
virtual int SearchScriptByKeyword(char *) = 0;
virtual int SearchScriptByDescription(const char *) = 0;
virtual class OutData * GetOutDataStream() = 0;
};
The Diplomat is the most important class inside MGS. When the DLL is being initialized for software scripting through BeginSoftScript, a Diplomat is being built.
// data types currently handled by DataDescriptor
enum DataType {
MGSScalar,
MGSInteger,
MGSString,
MGSStringList,
MGSVector,
MGSVectorList,
MGSInDataObject };
class DataDescriptor
{
public:
virtual ~DataDescriptor() { };
// use this to retrieve all alternates names
virtual void GetAlternates(int &,char * []) = 0;
// use this to retrieve the keywords and data types for a given alternate
virtual void GetKeywords(int alternate,int &,char * [],DataType []) = 0;
virtual short int Search(char * n,DataType & d) = 0;
// setting the data
virtual void Set(char *,int) = 0; // MGSInteger
virtual void Set(char *,vec_t) = 0; // MGSScalar
virtual void Set(char *,vec3_t) = 0; // MGSVector
virtual void Set(char *,char *) = 0; // MGSString and MGSStringList
virtual void Set(char *,class InData *) = 0; // MGSInDataObject
virtual void Set(char *,class InData2 *) = 0; //++timo there should be a mix with above
// called to check wether all required data has been carefully initialized
// generates an error, destroys all objects and returns RunMGS with error code
virtual void CheckValidity() = 0;
virtual PointList * RequestPointList(char *) = 0;
// call this member to request an InData2 object .. soft scripting
virtual InData2 * RequestInDataSoft() = 0;
// reading current value for a keyword
virtual void Read(char *,int &) = 0;
virtual void Read(char *,vec_t &) = 0;
virtual short int IsFilled(char *) = 0;
};
The DataDescriptor is used for general data exchange between the DLL and the main App. When in software mode, if a script is requested, an MGS entity is built and a DataDescriptor returned.
class mgentInternal : public mgent
{
public:
virtual void genere(class OutData *) = 0;
virtual void translate(const vector) = 0;
virtual void translate(const vec3_t);
virtual void rotate(const vector,const vector) = 0;
virtual void rotate(const vec3_t,const vec3_t);
virtual class DataDescriptor * GetDataDescriptor() = 0;
// computes the entity according to parsed data
virtual void compute() = 0;
};
All the MGS features are implemented in mgentInternal subclasses. Adding a new feature is very simple, it requires creating a new mgentInternal subclass, and register it inside the framework.