VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtAgentDefinition.h
Go to the documentation of this file.
00001 /****************************************************************************** 
00002 ** Copyright (c) 2010 MAK Technologies, Inc. 
00003 ** All rights reserved. 
00004 ******************************************************************************/ 
00005 /****************************************************************************** 
00006 ** $RCSfile: DtAgentDefinition.h,v $ $Revision: 1.15 $ $State: Exp $ 
00007 ******************************************************************************/ 
00008  
00012  
00013 #ifndef DtSceneObjectDefinition_H_ 
00014 #define DtSceneObjectDefinition_H_ 
00015  
00016 #include <vrvCore/vrvCore.h>
00017 #include <vrvCore/DtMessageMemberCall.h>
00018 #include <vrvUtil/templateUtil.h>
00019 
00020 #include <map>
00021 #include <string>
00022  
00023 namespace makVrv 
00024 {
00025 
00026    class DtDe;
00027 
00035    template <typename ObjectClass>
00036    class DtAgentDefinition
00037    {
00038    public:
00039 
00040       typedef std::map<unsigned int,DtMessageMemberCall<ObjectClass>*> CallMap;
00041 
00043       DtAgentDefinition(const std::string& className)
00044       {
00045          myClassName = className;
00046       }
00047 
00048       virtual ~DtAgentDefinition()
00049       {
00050          DtClearAndDeletePointersInMap(myCallMap);
00051       }
00052 
00054       virtual bool doCall(DtDe& de,unsigned int function,ObjectClass* o, DtMessage& message);
00055 
00057       virtual void handle(DtDe& de, ObjectClass* o,DtMessage& msg);      
00058 
00060       virtual void bindFunction(unsigned int function,DtMessageMemberCall<ObjectClass>* member);
00061 
00062       virtual const std::string& className() const
00063       {
00064          return myClassName;
00065       }
00066 
00067       virtual bool containsClassName(const std::string& className)
00068       {
00069          return myClassName == className;
00070       }
00071 
00072    protected:
00073       std::string myClassName;
00074       CallMap myCallMap;
00075    };
00076 
00086    template <typename BaseClassDefinition, typename ObjectClass>
00087    class DtInheritedAgentDefinition 
00088    : public DtAgentDefinition<ObjectClass>
00089    , public BaseClassDefinition
00090    {
00091    public:
00092 
00093       DtInheritedAgentDefinition(const std::string& className)
00094       : DtAgentDefinition<ObjectClass>(className)
00095       , BaseClassDefinition(className)
00096       {
00097          myClassName = className;
00098       }
00099 
00100       virtual ~DtInheritedAgentDefinition()
00101       {
00102          DtClearAndDeletePointersInMap(myCallMap);
00103       }
00104 
00105       typedef std::map<unsigned int,DtMessageMemberCall<ObjectClass>*> CallMap;
00106 
00109       virtual bool doCall(DtDe& de,unsigned int function,ObjectClass* o, DtMessage& message);
00110 
00114       virtual void handle(DtDe& de,ObjectClass* o,DtMessage& msg);
00115 
00117       virtual void bindFunction(unsigned int function,DtMessageMemberCall<ObjectClass>* member);
00118 
00120       virtual const std::string& className() const
00121       {
00122          return myClassName;
00123       }
00124 
00125       virtual bool containsClassName(const std::string& className)
00126       {
00127          return myClassName == className ||  
00128             DtAgentDefinition<ObjectClass>::containsClassName(className) ||
00129             BaseClassDefinition::containsClassName(className);
00130       }
00131 
00132    protected:
00133       std::string myClassName;
00134       CallMap myCallMap;
00135    };
00136 } 
00137  
00138 #define DtAgentDefinition_INL_ 
00139 #include "DtAgentDefinition.inl" 
00140 #undef DtAgentDefinition_INL_ 
00141  
00142 #endif 
00143  

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)