| VRS - The Virtual Rendering System |
| version 3.3 |
00001 #ifndef VRS_SCENESPY_H 00002 #define VRS_SCENESPY_H 00003 00004 #include <vrs/polyattribute.h> 00005 00006 namespace VRS { 00007 00008 class Callback; 00009 class SceneThing; 00010 00011 /*------------------------- 00012 C L A S S I F I E D 00013 -------------------------*/ 00014 // this class can be inserted into SceneThings and executes callbacks 00015 // when the it is pushed to or popped from the attribute stack. 00016 class VRS_CORE_API SceneSpy : public PolyAttribute 00017 { 00018 00019 public: 00020 enum Task { PRIMARY, SECONDARY }; 00021 00022 SceneSpy(SO<Callback> task1 = 0, SO<Callback> task2 = 0, bool stealth = false); 00023 00025 void briefing(SO<Callback> primTask, SO<Callback> secTask); 00026 00028 SO<Callback> torture(Task t) const; 00029 00032 void infiltrate(SO<SceneThing> location); 00033 void withdraw(SO<SceneThing> location); 00034 00036 bool stealth() const { return m_stealth; } 00037 void setStealth(bool s) { m_stealth = s; } 00038 00039 00044 typedef SceneSpy THIS_CLASS; 00045 typedef PolyAttribute BASE_CLASS; 00046 typedef THIS_CLASS VRS_ThisClass; 00047 typedef BASE_CLASS VRS_BaseClass; 00048 virtual bool isEqual(const ::VRS::SharedObj* other) const 00049 { 00050 if(!other) { return false; } 00051 if(this == other) { return true; } 00052 if(ClassInfoVRS() != other->classInfoVRS()) { return false; } 00053 return operator==(static_cast<const THIS_CLASS&>(*other)); 00054 } 00055 static const ::VRS::ClassInfo* ClassInfoVRS() 00056 { 00057 static const ::VRS::ClassInfo cInfo( 00058 typeid(THIS_CLASS), 00059 BASE_CLASS::ClassInfoVRS() 00060 ); 00061 return &cInfo; 00062 } 00063 virtual const ::VRS::ClassInfo* classInfoVRS() const 00064 { 00065 return ClassInfoVRS(); 00066 } 00067 static const ::VRS::ID& ClassNameVRS() 00068 { 00069 return ClassInfoVRS()->name(); 00070 } 00071 virtual VRS::VisitorBase::VisitMode accept(VRS::VisitorBase& visitor); 00072 // } 00073 VRS_SERIALIZABLE(SceneSpy); 00074 00075 private: 00076 SO<Callback> m_primaryTask, m_secondaryTask; 00077 bool m_stealth; 00078 }; 00079 00080 } // namespace VRS 00081 00082 #endif // VRS_SCENESPY_H