nancygold's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Thursday, August 8th, 2024

    Time Event
    10:52a
    This shit is still alive!
    https://github.com/TorqueGameEngines/Torque3D/
    >3 hours ago

    So SOLID it hurts...
    https://github.com/TorqueGameEngines/Torque3D/blob/development/Engine/source/console/simObject.h
    class SimObject: public ConsoleObject, public TamlCallbacks
    {
       public:
       
          typedef ConsoleObject Parent;
    
          friend class SimManager;
          friend class SimGroup;
          friend class SimNameDictionary;
          friend class SimManagerNameDictionary;
          friend class SimIdDictionary;
    
          /// @name Notification
          /// @{
          
          struct Notify
          {
             enum Type
             {
                ClearNotify,   ///< Notified when the object is cleared.
                DeleteNotify,  ///< Notified when the object is deleted.
                ObjectRef,     ///< Cleverness to allow tracking of references.
                Invalid        ///< Mark this notification as unused (used in freeNotify).
             } type;
             
             void *ptr;        ///< Data (typically referencing or interested object).
             Notify *next;     ///< Next notification in the linked list.
          };
    
          /// @}
    
          /// Flags passed to SimObject::write 
          enum WriteFlags
          {
             SelectedOnly         = BIT( 0 ), ///< Indicates that only objects marked as selected should be outputted. Used in SimSet.
             NoName               = BIT( 1 ), ///< Indicates that the object name should not be saved.
             IgnoreCanSave        = BIT( 2 ), ///< Write out even if CannotSave=true.
          };
    
       private:
    
          /// Flags for use in mFlags
          enum
          {
             Deleted           = BIT( 0 ),    ///< This object is marked for deletion.
             Removed           = BIT( 1 ),    ///< This object has been unregistered from the object system.
             Added             = BIT( 3 ),    ///< This object has been registered with the object system.
             Selected          = BIT( 4 ),    ///< This object has been marked as selected. (in editor)
             Expanded          = BIT( 5 ),    ///< This object has been marked as expanded. (in editor)
             ModStaticFields   = BIT( 6 ),    ///< The object allows you to read/modify static fields
             ModDynamicFields  = BIT( 7 ),    ///< The object allows you to read/modify dynamic fields
             AutoDelete        = BIT( 8 ),    ///< Delete this object when the last ObjectRef is gone.
             CannotSave        = BIT( 9 ),    ///< Object should not be saved.
             EditorOnly        = BIT( 10 ),   ///< This object is for use by the editor only.
             NoNameChange      = BIT( 11 ),   ///< Whether changing the name of this object is allowed.
             Hidden            = BIT( 12 ),   ///< Object is hidden in editors.
             Locked            = BIT( 13 ),   ///< Object is locked in editors.
          };
          
          // dictionary information stored on the object
          StringTableEntry mObjectName;
          StringTableEntry mOriginalName;
          SimObject*       nextNameObject;
          SimObject*       nextManagerNameObject;
          SimObject*       nextIdObject;
    
          StringTableEntry mInheritFrom;
          bool    mPrototype;
          /// SimGroup we're contained in, if any.
          SimGroup*   mGroup;
          
          /// Flags internal to the object management system.
          BitSet32    mFlags;
    
          StringTableEntry    mProgenitorFile;
    
          /// Object we are copying fields from.
          SimObject* mCopySource;
    
          /// Table of dynamic fields assigned to this object.
          SimFieldDictionary *mFieldDictionary;
    
          /// Buffer to store textual representation of this object's numeric ID in.
          char mIdString[ 11 ];
          
          /// @name Serialization
          /// @{
    
          /// Path to file this SimObject was loaded from.
          StringTableEntry mFilename;
    
          /// The line number that the object was declared on if it was loaded from a file.
          S32 mDeclarationLine;
          
          /// @}
    
          /// @name Notification
          /// @{
          
          /// List of notifications added to this object.
          Notify* mNotifyList;
    
          static SimObject::Notify *mNotifyFreeList;
          static SimObject::Notify *allocNotify();     ///< Get a free Notify structure.
          static void freeNotify(SimObject::Notify*);  ///< Mark a Notify structure as free.
    
          /// @}
    
          static bool _setCanSave( void* object, const char* index, const char* data );
          static const char* _getCanSave( void* object, const char* data );
          
          static const char* _getHidden( void* object, const char* data )
             { if( static_cast< SimObject* >( object )->isHidden() ) return "1"; return "0"; }
          static const char* _getLocked( void* object, const char* data )
             { if( static_cast< SimObject* >( object )->isLocked() ) return "1"; return "0"; }
          static bool _setHidden( void* object, const char* index, const char* data )
             { static_cast< SimObject* >( object )->setHidden( dAtob( data ) ); return false; }
          static bool _setLocked( void* object, const char* index, const char* data )
             { static_cast< SimObject* >( object )->setLocked( dAtob( data ) ); return false; }
    
          // Namespace protected set methods
          static bool setClass( void *object, const char *index, const char *data )
             { static_cast<SimObject*>(object)->setClassNamespace(data); return false; };
          static bool setSuperClass(void *object, const char *index, const char *data)     
             { static_cast<SimObject*>(object)->setSuperClassNamespace(data); return false; };
    
                static bool writeObjectName(void* obj, StringTableEntry pFieldName)
             { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mObjectName != NULL && simObject->mObjectName != StringTable->EmptyString(); }
          static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName)  
             { return static_cast<SimObject*>(obj)->mCanSaveFieldDictionary == false; }
          static bool writeInternalName(void* obj, StringTableEntry pFieldName)          
             { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mInternalName != NULL && simObject->mInternalName != StringTable->EmptyString(); }
          static bool setParentGroup(void* obj, const char* data);
          static bool writeParentGroup(void* obj, StringTableEntry pFieldName)           
             { return static_cast<SimObject*>(obj)->mGroup != NULL; }
          static bool writeSuperclass(void* obj, StringTableEntry pFieldName)            
             { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mSuperClassName != NULL && simObject->mSuperClassName != StringTable->EmptyString(); }
          static bool writeClass(void* obj, StringTableEntry pFieldName)                 
             { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mClassName != NULL && simObject->mClassName != StringTable->EmptyString(); }
          static bool writeClassName(void* obj, StringTableEntry pFieldName)
             { SimObject* simObject = static_cast<SimObject*>(obj); return simObject->mClassName != NULL && simObject->mClassName != StringTable->EmptyString(); }
    
          
          // Group hierarchy protected set method 
          static bool setProtectedParent(void *object, const char *index, const char *data);
    
          // Object name protected set method
          static bool setProtectedName(void *object, const char *index, const char *data);
    
          // Sets object to inherit default values from
          static bool setInheritFrom(void* object, const char* index, const char* data);
    
       public:
          inline void setProgenitorFile(const char* pFile) { mProgenitorFile = StringTable->insert(pFile); }
          inline StringTableEntry getProgenitorFile(void) const { return mProgenitorFile; }
          static bool _doPrototype(void* object, const char* index, const char* data);
       protected:
          /// Taml callbacks.
          void onTamlPreWrite(void) override {}
          void onTamlPostWrite(void) override {}
          void onTamlPreRead(void) override {}
          void onTamlPostRead(const TamlCustomNodes& customNodes) override {}
          void onTamlAddParent(SimObject* pParentObject) override {}
          void onTamlCustomWrite(TamlCustomNodes& customNodes) override {}
          void onTamlCustomRead(const TamlCustomNodes& customNodes) override;
       
          /// Id number for this object.
          SimObjectId mId;
          
          /// Internal name assigned to the object.  Not set by default.
          StringTableEntry mInternalName;
          
          static bool          smForceId;   ///< Force a registered object to use the given Id.  Cleared upon use.
          static SimObjectId   smForcedId;  ///< The Id to force upon the object.  Poor object.
          
          /// @name Serialization
          /// @{
          
          /// Whether dynamic fields should be saved out in serialization.  Defaults to true.
          bool mCanSaveFieldDictionary;
          
          /// @}
    
          /// @name Persistent IDs
          /// @{
          
          /// Persistent ID assigned to this object.  Allows to unambiguously refer to this
          /// object in serializations regardless of stream object ordering.
          SimPersistID* mPersistentId;
          
          static bool _setPersistentID( void* object, const char* index, const char* data );
             
          /// @}
          
          /// @name Namespace management
          /// @{
          
          /// The namespace in which method lookup for this object begins.
          Namespace* mNameSpace;
    
          /// Name of namespace to use as class namespace.
          StringTableEntry mClassName;
          
          /// Name of namespace to use as class super namespace.
          StringTableEntry mSuperClassName;
    
          /// Perform namespace linking on this object.
          void linkNamespaces();
          
          /// Undo namespace linking on this object.
          void unlinkNamespaces();
          
          /// @}
    
          /// Called when the object is selected in the editor.
          virtual void _onSelected() {}
    
          /// Called when the object is unselected in the editor.
          virtual void _onUnselected() {}
       
          /// We can provide more detail, like object name and id.
          String _getLogMessage(const char* fmt, va_list args) const override;
       
          DEFINE_CREATE_METHOD
          {
             T* object = new T;
             object->incRefCount();
             return object;
          }
    
          
          // EngineObject.
          void _destroySelf() override;
    




    Current Mood: amused
    1:15p
    Another non-euclidean video game
    https://www.youtube.com/watch?v=E7XU4PosgXY

    Basically some points in space act as "blackholes" compressing space




    Current Mood: amused

    << Previous Day 2024/08/08
    [Calendar]
    Next Day >>

About LJ.Rossia.org