interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/vos/vosdefs.hh File Reference

Go to the source code of this file.

Namespaces

Defines

Typedefs


Define Documentation

#define __socklen_t_defined   1

Definition at line 121 of file vosdefs.hh.

#define BEGIN_REGISTER_EXTENDERS ( cl   )     BEGIN_REGISTER_METAOBJECT_FACTORIES(cl)

Definition at line 181 of file vosdefs.hh.

#define BEGIN_REGISTER_METAOBJECT_FACTORIES ( cl   ) 

Value:

class Register##cl {                                                \
    public:                                                            \
    Register##cl()                                                      \
    {
Use these macros to define a static registration class for a metaobject.

This lets you register metaobject factories automatically when your library is loaded.

You must also use the REGISTERS_METAOBJECT_FACTORIES macro in a public header file as well.

Example:

        BEGIN_REGISTER_METAOBJECT_FACTORIES(Example)
            Site::addLocalMetaObjectFactory(typeid(Example).name(), &LocalExample::new_LocalExample);
            Site::addLocalMetaObjectFactory(typeid(LocalExample).name(), &LocalExample::new_LocalExample);
            Site::addLocalMetaObjectFactory("example:example", &LocalExample::new_LocalExample);

            Site::addRemoteMetaObjectFactory(typeid(Example).name(), "example:example", &RemoteExample::new_RemoteExample);
            Site::addRemoteMetaObjectFactory(typeid(RemoteExample).name(), "example:example", &RemoteExample::new_RemoteExample);
            Site::addRemoteMetaObjectFactory("example:example", "example:example", &RemoteExample::new_RemoteExample);
        END_REGISTER_METAOBJECT_FACTORIES(Example)

If your metaobject does not need seperate Local and Remote behavior, you only need one class, for which you can register the same remote and local factory.

Parameters:
cl A symbol that uniquely identifies this registration (e.g. use the MetaObject class name)

Definition at line 169 of file vosdefs.hh.

#define DLLEXPORT

Definition at line 135 of file vosdefs.hh.

#define DLLIMPORT

Definition at line 136 of file vosdefs.hh.

#define END_REGISTER_EXTENDERS ( cl   )     END_REGISTER_METAOBJECT_FACTORIES(cl)

Definition at line 182 of file vosdefs.hh.

#define END_REGISTER_METAOBJECT_FACTORIES ( cl   ) 

Value:

}                                                                   \
    };                                                                  \
    DLLEXPORT Register##cl Register##cl##_globalstatic;

Definition at line 175 of file vosdefs.hh.

#define IMPORT_METAOBJECT_FACTORIES ( cl   ) 

Value:

class Register##cl { };                                    \
    extern DLLIMPORT Register##cl Register##cl##_globalstatic; \
    static Register##cl &Register##cl##_localref = Register##cl##_globalstatic;
You must use this macro in a public header file for every use of VOS_METAOBJECT_FACTORY or BEGIN_REGISTER_EXTENDERS.

(It grabs a reference to the registration cleass, forcing the dynamic library loader to initialize it)

Parameters:
cl Class name: use the same argument you used in defining the factory registration class.

Definition at line 254 of file vosdefs.hh.

#define REGISTER_METAOBJECT_FACTORIES ( ns,
cl,
type,
factfn   ) 

Value:

class Register##ns##_##cl { \
    public: \
        Register##ns##_##cl() { \
            Site::addLocalMetaObjectFactory(typeid(ns::cl).name(), factfn); \
            Site::addLocalMetaObjectFactory(type, factfn); \
            Site::addRemoteMetaObjectFactory(typeid(ns::cl).name(), type, factfn); \
            Site::addRemoteMetaObjectFactory(type, type, factfn); \
        } \
    }; \
    DLLEXPORT Register##ns##_cl Register##ns##_cl##_globalstatic;
Alternate macro for registering extender factories.

Use this macro when you want to use the same MetaObject class for both local and remote objects, and don't need to do anything special at registration. It creates a registration class named from a namespace and class name, containing a constructor which registers the same factory function for local and remote metaobject creation.

You must also use the REGISTERS_METAOBJECT_FACTORIES macro in a public header file as well, using <ns>_<cl> as its argument (see below)

Parameters:
ns Namespace
cl Class name
type Type string, should be the same string that getVOSType() returns.
factfn Static method that returns an instance of your class (as a VOS::MetaObject*), given a "super object" (of type VOS::VobjectBase*) and a type string.
For example, imagine you have a metaobject class called ExampleClass. It is in a namespace called EG. It might be declared in a header file like this:
        #include <vos/vos/vos.hh>
        ...
        namespace EG {
            class ExampleClass : public VOS::MetaObject {
            public:
                ExampleClass(VOS::VobjectBase* s);
                VOS::MetaObject* new_ExampleClass(VOS::VobjectBase* s, const std::string& t) {
                   return new ExampleClass(s);
                }
                ...
            };
        }

Somewhere in the definition (i.e. in your ".cc" or ".cpp" file), include this macro call:

        REGISTER_METAOBJECT_FACTORIES(EG, ExampleClass, "example:example", &EG::ExampleClass::new_ExampleClass)
        }

Now to the public header file, add this:

        ...
        REGISTERS_METAOBJECT_FACTORIES(EG_ExampleClass)
        ...

Definition at line 235 of file vosdefs.hh.

#define REGISTERS_METAOBJECT_FACTORIES ( cl   )     IMPORT_METAOBJECT_FACTORIES(cl)

Definition at line 259 of file vosdefs.hh.

#define SETSOCKOPT_PARAM4_CAST   int*

Definition at line 114 of file vosdefs.hh.

#define SOL_TCP   (getprotobyname("tcp")->p_proto)

Definition at line 107 of file vosdefs.hh.

#define SSL   void

Definition at line 103 of file vosdefs.hh.

#define SSL_CTX   void

Definition at line 101 of file vosdefs.hh.

#define VOS_API

Definition at line 57 of file vosdefs.hh.

#define VOS_DEFAULT_TIMEOUT   45.0

Definition at line 125 of file vosdefs.hh.

#define X509   void

Definition at line 100 of file vosdefs.hh.

#define X509_STORE_CTX   void

Definition at line 102 of file vosdefs.hh.


Typedef Documentation

typedef int socklen_t

Definition at line 120 of file vosdefs.hh.