mrfioc2  2.3.0
Classes | Namespaces | Macros
object.h File Reference
#include <ostream>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <memory>
#include <stdexcept>
#include <typeinfo>
#include <compilerDependencies.h>
#include <epicsThread.h>
#include <epicsTypes.h>
#include "mrfCommon.h"
Include dependency graph for object.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  alarm_exception
 
class  mrf::opNotImplemented
 Requested operation is not implemented by the property. More...
 
struct  mrf::propertyBase
 An un-typed property. More...
 
struct  mrf::property< P >
 A bound, typed scalar property. More...
 
struct  mrf::property< P[1]>
 A bound, typed array property. More...
 
struct  mrf::property< void >
 A momentary/command. More...
 
struct  mrf::detail::unboundPropertyBase< C >
 An un-typed, un-bound property for class C. More...
 
class  mrf::detail::unboundProperty< C, P >
 An un-bound, typed scalar property. More...
 
class  mrf::detail::unboundProperty< C, P[1]>
 An un-bound, typed array property. More...
 
class  mrf::detail::unboundProperty< C, void >
 An un-bound momentary/command. More...
 
class  mrf::detail::propertyInstance< C, P >
 final scalar implementation More...
 
class  mrf::detail::propertyInstance< C, P[1]>
 final array implementation More...
 
class  mrf::detail::propertyInstance< C, void >
 
class  mrf::Object
 Base object inspection. More...
 
struct  mrf::Object::_compName
 
class  mrf::ObjectInst< C, Base >
 User implementation hook. More...
 

Namespaces

 mrf
 
 mrf::detail
 

Macros

#define EPICS_UNUSED
 
#define OBJECT_BEGIN2(klass, Base)
 
#define OBJECT_BEGIN(klass)   OBJECT_BEGIN2(klass, Object)
 
#define OBJECT_PROP1(NAME, GET)   props->insert(std::make_pair(static_cast<const char*>(NAME), detail::makeUnboundProperty(NAME, GET) ))
 
#define OBJECT_PROP2(NAME, GET, SET)   props->insert(std::make_pair(static_cast<const char*>(NAME), detail::makeUnboundProperty(NAME, GET, SET) ))
 
#define OBJECT_FACTORY(FN)   addFactory(klassname, FN)
 
#define OBJECT_END(klass)
 

Macro Definition Documentation

◆ EPICS_UNUSED

#define EPICS_UNUSED
Author
Michael Davidsaver mdavi.nosp@m.dsav.nosp@m.er@gm.nosp@m.ail..nosp@m.com

Defines a scheme for working with "properties". A property being a some methods (eg. pair of setter and getter) used to move a value in and out of an otherwise opaque object.

Properties are associated with a class by a property name which can be used to retrieve a property.

Method signatures supported

get/set of scalar value P

void klass::setter(P v); P klass::getter() const;

get/set of array value P

void klass::setter(const P* vals, epicsUInt32 nelem); epicsUInt32 klass::getter(P* vals, epicsUInt32 maxelem); // returns nelem

A momentery/command

void klass::execer();

Definition at line 88 of file object.h.

◆ OBJECT_BEGIN

#define OBJECT_BEGIN (   klass)    OBJECT_BEGIN2(klass, Object)

Definition at line 513 of file object.h.

◆ OBJECT_BEGIN2

#define OBJECT_BEGIN2 (   klass,
  Base 
)
Value:
namespace mrf {\
template<> ObjectInst<klass, Base>::m_props_t* ObjectInst<klass, Base>::m_props = 0; \
const char *klassname = #klass; (void)klassname; \
try { mrf::auto_ptr<m_props_t> props(new m_props_t); {
static int initObject()
Definition: flash.cpp:23

Definition at line 507 of file object.h.

◆ OBJECT_END

#define OBJECT_END (   klass)
Value:
} m_props = props.release(); return 1; \
} catch(std::exception& e) { \
std::cerr<<"Failed to build property table for "<<typeid(klass).name()<<"\n"<<e.what()<<"\n"; \
throw std::runtime_error("Failed to build"); \
}}} \
static int done_##klass EPICS_UNUSED = klass::initObject();
#define EPICS_UNUSED
Definition: object.h:88

Definition at line 523 of file object.h.

◆ OBJECT_FACTORY

#define OBJECT_FACTORY (   FN)    addFactory(klassname, FN)

Definition at line 521 of file object.h.

◆ OBJECT_PROP1

#define OBJECT_PROP1 (   NAME,
  GET 
)    props->insert(std::make_pair(static_cast<const char*>(NAME), detail::makeUnboundProperty(NAME, GET) ))

Definition at line 515 of file object.h.

◆ OBJECT_PROP2

#define OBJECT_PROP2 (   NAME,
  GET,
  SET 
)    props->insert(std::make_pair(static_cast<const char*>(NAME), detail::makeUnboundProperty(NAME, GET, SET) ))

Definition at line 518 of file object.h.