Vuo  2.0.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
VuoSerializable Class Referenceabstract

Description

Base class for VuoTypes implemented as private polymorphic class sets.

See also
VuoUiThemeBase and VuoUiButtonGroup

Definition at line 24 of file VuoSerializable.hh.

Public Types

typedef VuoSerializable *(* Constructor) (json_object *)
 A makeFromJson method. More...
 

Public Member Functions

virtual json_objectgetJson ()
 Serializes this instance's data. More...
 
std::string getType () const
 Returns this instance's specialized type. More...
 
virtual char * getSummary ()=0
 Outputs a summary of this instance's data, to be shown in port popovers. More...
 
virtual bool operator== (const VuoSerializable &that)=0
 Returns true if this instance is equivalent to that instance. More...
 
virtual bool operator< (const VuoSerializable &that)=0
 Returns true if this instance sorts before that instance. More...
 
 VuoSerializable ()
 Registers an instance of a VuoSerializable subclass with VuoHeap. More...
 
virtual ~VuoSerializable ()
 Does nothing. More...
 

Static Public Member Functions

static bool registerSubclass (std::string type, Constructor makeFromJson)
 Informs this base class of the presence of a subclass, so it can be instantiated from JSON. More...
 
static void destroy (void *t)
 Deletes an instance of a VuoSerializable subclass. More...
 
static VuoSerializablemakeFromJson (json_object *js)
 Creates an instance of a VuoSerializable subclass from JSON. More...
 

Static Public Attributes

static std::string type = ""
 The subtype's class name. More...
 

Member Typedef Documentation

◆ Constructor

typedef VuoSerializable*(* VuoSerializable::Constructor) (json_object *)

A makeFromJson method.

Definition at line 27 of file VuoSerializable.hh.

Constructor & Destructor Documentation

◆ VuoSerializable()

VuoSerializable::VuoSerializable ( )

Registers an instance of a VuoSerializable subclass with VuoHeap.

Definition at line 89 of file VuoSerializable.cc.

◆ ~VuoSerializable()

VuoSerializable::~VuoSerializable ( )
virtual

Does nothing.

Definition at line 97 of file VuoSerializable.cc.

Member Function Documentation

◆ destroy()

void VuoSerializable::destroy ( void *  t)
static

Deletes an instance of a VuoSerializable subclass.

To be called only by VuoHeap.

Definition at line 106 of file VuoSerializable.cc.

◆ getJson()

json_object * VuoSerializable::getJson ( )
virtual

Serializes this instance's data.

Reimplemented in VuoUiThemeSliderRounded, VuoUiThemeToggleRounded, VuoUiThemeButtonRounded, VuoUiThemeTextFieldRounded, and VuoUiThemeGroup.

Definition at line 64 of file VuoSerializable.cc.

◆ getSummary()

virtual char* VuoSerializable::getSummary ( )
pure virtual

Outputs a summary of this instance's data, to be shown in port popovers.

Implemented in VuoUiThemeSliderRounded, VuoUiThemeToggleRounded, VuoUiThemeButtonRounded, VuoUiThemeTextFieldRounded, and VuoUiThemeGroup.

◆ getType()

std::string VuoSerializable::getType ( ) const

Returns this instance's specialized type.

Can't simply access the type member, since C++'s static dereferencing means it will always return the local variable's type, instead of the instance's actual specialized type.

Definition at line 77 of file VuoSerializable.cc.

◆ makeFromJson()

VuoSerializable * VuoSerializable::makeFromJson ( json_object js)
static

Creates an instance of a VuoSerializable subclass from JSON.

Definition at line 47 of file VuoSerializable.cc.

◆ operator<()

virtual bool VuoSerializable::operator< ( const VuoSerializable that)
pure virtual

Returns true if this instance sorts before that instance.

Implemented in VuoUiThemeSliderRounded, VuoUiThemeToggleRounded, VuoUiThemeButtonRounded, VuoUiThemeTextFieldRounded, and VuoUiThemeGroup.

◆ operator==()

virtual bool VuoSerializable::operator== ( const VuoSerializable that)
pure virtual

Returns true if this instance is equivalent to that instance.

Implemented in VuoUiThemeSliderRounded, VuoUiThemeToggleRounded, VuoUiThemeButtonRounded, VuoUiThemeTextFieldRounded, and VuoUiThemeGroup.

◆ registerSubclass()

bool VuoSerializable::registerSubclass ( std::string  _type,
Constructor  makeFromJson 
)
static

Informs this base class of the presence of a subclass, so it can be instantiated from JSON.

Instead of calling this directly, use VuoSerializableRegister.

Definition at line 34 of file VuoSerializable.cc.

Member Data Documentation

◆ type

std::string VuoSerializable::type = ""
static

The subtype's class name.

Definition at line 30 of file VuoSerializable.hh.


The documentation for this class was generated from the following files: