/** * @file HelloWorldImpl.c * * Implements the HelloWorld_Greetings interface. */ #include #include "VMCFCoreImpl.h" /* Define required module/interface macros. */ #define VMCF_SUPERCLASS VMCFCore_CFObject #define VMCF_THISMODULE HelloWorld #define VMCF_THISCLASS HelloWorld_Greetings /* Include super-interface header(s). */ #include "VMCFObjectImpl.h" /* * Include our implementation header * Note: #define/#undef VMCF_IMPL-bracket the #include statement, iff providing * interface implementations in a shared library. */ //#define VMCF_IMPL #include "HelloWorldImpl.h" //#undef VMCF_IMPL /* Define any instance variables in the VMCF_INSTANCE_TYPE structure. */ typedef struct VMCF_INSTANCE_TYPE { unsigned int counter; } VMCF_INSTANCE_TYPE; /* Define our 'class' (IDL interface with instance variables). */ VMCF_DEFINE_CLASS; /* Object initializer - no additional arguments other than the standard ones. */ VMCF_PROTO_INIT((HelloWorld_Greetings self, CORBA_boolean activate, CORBA_Environment *env)) { VMCF_INSTANCE_TYPE *inst = VMCF_GET_SELF_DATA(self); inst->counter = 0; VMCF_INIT_EPILOGUE(self, activate, env); } /* This interface's finalizer. */ VMCF_DEFINE_FINI_BEGIN { } VMCF_DEFINE_FINI_END; /* Overwrite CFObject's 'name' attribute but not its 'probe' method. */ CORBA_string server_HelloWorld_Greetings__get_name(HelloWorld_Greetings self, CORBA_Environment *env) { CORBA_string res = "Some hello world name"; CORBA_string tmp = VMCF_CHAIN_TO_SUPER_SERVER(_get_name, (self, env)); printf("Super says: %s\n", tmp); CORBA_free(tmp); tmp = CORBA_string_alloc(strlen(res) + 1); strcpy(tmp, res); return tmp; } //VMCF_DEFINE_CHAINED_GET_NAME; VMCF_DEFINE_CHAINED_PROBE; /* IDL method implementation(s). */ void server_HelloWorld_Greetings_hello(HelloWorld_Greetings self, CORBA_string name, CORBA_Environment *env) { VMCF_INSTANCE_TYPE *inst = VMCF_GET_SELF_DATA(self); VMCFCore_CFObjectImpl_lock(self); inst->counter++; VMCFCore_CFObjectImpl_unlock(self); (void)env; printf("Hello, %s\n", name); }