ANSC_STATUS SlapOboInitialize ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PSLAP_OBJ_BROKER_OBJECT pMyObject = (PSLAP_OBJ_BROKER_OBJECT)hThisObject; ULONG i = 0; /* * Until you have to simulate C++ object-oriented programming style with standard C, you don't * appreciate all the nice little things come with C++ language and all the dirty works that * have been done by the C++ compilers. Member initialization is one of these things. While in * C++ you don't have to initialize all the member fields inherited from the base class since * the compiler will do it for you, such is not the case with C. */ AnscLcoInitialize((ANSC_HANDLE)pMyObject); /* * Although we have initialized some of the member fields in the "create" member function, we * repeat the work here for completeness. While this simulation approach is pretty stupid from * a C++/Java programmer perspective, it's the best we can get for universal embedded network * programming. Before we develop our own operating system (don't expect that to happen any * time soon), this is the way things gonna be. */ pMyObject->Oid = SLAP_OBJ_BROKER_OID; pMyObject->Create = SlapOboCreate; pMyObject->Remove = SlapOboRemove; pMyObject->EnrollObjects = SlapOboEnrollObjects; pMyObject->Initialize = SlapOboInitialize; pMyObject->PathName = NULL; pMyObject->hSlapObjEntity = (ANSC_HANDLE)NULL; pMyObject->hSlapObjProxy = (ANSC_HANDLE)NULL; pMyObject->HashIndex = 0; pMyObject->IsRemoveable = SlapOboIsRemoveable; pMyObject->SetPathName = SlapOboSetPathName; pMyObject->GetObjBroker = SlapOboGetObjBroker; pMyObject->AddObjBroker = SlapOboAddObjBroker; pMyObject->DelObjBroker = SlapOboDelObjBroker; pMyObject->DelAllObjBrokers = SlapOboDelAllObjBrokers; for ( i = 0; i < SLAP_OBO_OBO_TABLE_SIZE; i++ ) { AnscQueueInitializeHeader(&pMyObject->OboTable[i]); } AnscInitializeLock(&pMyObject->OboTableLock); return ANSC_STATUS_SUCCESS; }
ANSC_STATUS SlapSpoInitialize ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PSLAP_SRV_PROXY_OBJECT pMyObject = (PSLAP_SRV_PROXY_OBJECT)hThisObject; /* * Until you have to simulate C++ object-oriented programming style with standard C, you don't * appreciate all the nice little things come with C++ language and all the dirty works that * have been done by the C++ compilers. Member initialization is one of these things. While in * C++ you don't have to initialize all the member fields inherited from the base class since * the compiler will do it for you, such is not the case with C. */ AnscLcoInitialize((ANSC_HANDLE)pMyObject); /* * Although we have initialized some of the member fields in the "create" member function, we * repeat the work here for completeness. While this simulation approach is pretty stupid from * a C++/Java programmer perspective, it's the best we can get for universal embedded network * programming. Before we develop our own operating system (don't expect that to happen any * time soon), this is the way things gonna be. */ pMyObject->Oid = SLAP_SRV_PROXY_OID; pMyObject->Create = SlapSpoCreate; pMyObject->Remove = SlapSpoRemove; pMyObject->EnrollObjects = SlapSpoEnrollObjects; pMyObject->Initialize = SlapSpoInitialize; pMyObject->CallTimeout = 0; pMyObject->ObjName = NULL; pMyObject->ObjType = 0; pMyObject->ObjMode = SLAP_SPO_OBJ_MODE_acquired; pMyObject->hSlapGoaObj = (ANSC_HANDLE)NULL; pMyObject->hSlapUoaIf = (ANSC_HANDLE)NULL; pMyObject->hSlapGoaIf = (ANSC_HANDLE)NULL; pMyObject->hSlapPoaIf = (ANSC_HANDLE)NULL; pMyObject->GetCallTimeout = SlapSpoGetCallTimeout; pMyObject->SetCallTimeout = SlapSpoSetCallTimeout; pMyObject->GetObjName = SlapSpoGetObjName; pMyObject->SetObjName = SlapSpoSetObjName; pMyObject->GetObjType = SlapSpoGetObjType; pMyObject->SetObjType = SlapSpoSetObjType; pMyObject->GetObjMode = SlapSpoGetObjMode; pMyObject->SetObjMode = SlapSpoSetObjMode; pMyObject->GetSlapGoaObj = SlapSpoGetSlapGoaObj; pMyObject->SetSlapGoaObj = SlapSpoSetSlapGoaObj; pMyObject->GetSlapUoaIf = SlapSpoGetSlapUoaIf; pMyObject->SetSlapUoaIf = SlapSpoSetSlapUoaIf; pMyObject->GetSlapGoaIf = SlapSpoGetSlapGoaIf; pMyObject->SetSlapGoaIf = SlapSpoSetSlapGoaIf; pMyObject->GetSlapPoaIf = SlapSpoGetSlapPoaIf; pMyObject->SetSlapPoaIf = SlapSpoSetSlapPoaIf; pMyObject->Reset = SlapSpoReset; pMyObject->Engage = SlapSpoEngage; pMyObject->Cancel = SlapSpoCancel; pMyObject->InvokeDispatch = SlapSpoInvokeDispatch; pMyObject->PoaToGoaParamList = SlapSpoPoaToGoaParamList; pMyObject->GoaToPoaParamList = SlapSpoGoaToPoaParamList; pMyObject->PoaToGoaVariable = SlapSpoPoaToGoaVariable; pMyObject->GoaToPoaVariable = SlapSpoGoaToPoaVariable; return ANSC_STATUS_SUCCESS; }