Gyoto
Classes | Namespaces | Macros
GyotoObject.h File Reference

Introspectable objects. More...

#include "GyotoConfig.h"
#include "GyotoSmartPointer.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  Gyoto::Object
 Object with properties. More...
 

Namespaces

namespace  Gyoto
 Namespace for the Gyoto library.
 

Macros

#define GYOTO_OBJECT_ACCESSORS_STRING(method)
 Declare a pair of accessors to string member in a class declaration. More...
 
#define GYOTO_OBJECT_ACCESSORS(type, method)
 Declare a pair of accessors to scalar member in a class declaration. More...
 
#define GYOTO_OBJECT_ACCESSORS_UNIT(method)
 Declare a quadruplet of accessors to double member that supports unit. More...
 
#define GYOTO_OBJECT
 Declare class::properties and class::getProperties() More...
 
#define GYOTO_OBJECT_THREAD_SAFETY    virtual bool isThreadSafe() const
 Declare virtual bool isThreadSafe() const. More...
 

Detailed Description

Introspectable objects.

Macro Definition Documentation

◆ GYOTO_OBJECT

#define GYOTO_OBJECT
Value:
static Property const properties[]; \
virtual Property const * getProperties() const; \
static const std::string builtinPluginValue; \
virtual void plugins(std::vector<std::string> const & plugname); \
virtual std::vector<std::string> plugins() const

Declare class::properties and class::getProperties()

Any derived class that does define Properties (i.e. the macro GYOTO_PROPERTY_START() is called somewhere in the .C file) must call the GYOTO_OBJECT macro in a "public:" section of the class declaration. Else, the property list is inherited from the direct parent, and calling GYOTO_PROPERTY_START() in the .C file leads to a compile-time error.

◆ GYOTO_OBJECT_ACCESSORS

#define GYOTO_OBJECT_ACCESSORS (   type,
  method 
)
Value:
virtual void method(type); \
virtual type method() const;

Declare a pair of accessors to scalar member in a class declaration.

The accessors must also be defined in the .C file, which can be done using GYOTO_PROPERTY_ACCESSORS

Parameters
typedata type of the memebr beeing accessed. Any scalar type (double, long, size_t, SmartPointer<Metric::Generic> etc).
methodname of the accessors.

◆ GYOTO_OBJECT_ACCESSORS_STRING

#define GYOTO_OBJECT_ACCESSORS_STRING (   method)
Value:
virtual void method(std::string const&); \
virtual std::string method() const;

Declare a pair of accessors to string member in a class declaration.

The accessors must also be defined in the .C file

Parameters
methodname of the accessors.

◆ GYOTO_OBJECT_ACCESSORS_UNIT

#define GYOTO_OBJECT_ACCESSORS_UNIT (   method)
Value:
GYOTO_OBJECT_ACCESSORS(double, method) \
virtual void method(double, std::string const &); \
virtual double method(std::string const &) const;
#define GYOTO_OBJECT_ACCESSORS(type, method)
Declare a pair of accessors to scalar member in a class declaration.
Definition: GyotoObject.h:60

Declare a quadruplet of accessors to double member that supports unit.

The accessors must also be defined in the .C file.

Parameters
methodname of the accessors.

◆ GYOTO_OBJECT_THREAD_SAFETY

#define GYOTO_OBJECT_THREAD_SAFETY    virtual bool isThreadSafe() const

Declare virtual bool isThreadSafe() const.

Use this to declare that the object is not (or not always) thread safe. The corresponding definition of isThreadSafe() must exist. If the object is always thread unsafe (e.g. Lorene Metrics of Python based objects), you can simply use GYOTO_PROPERTY_THREAD_SAFETY in the corresponding .C file.