
st.membrane.ContentController.stc Maven / Gradle / Ivy
template st.membrane.ContentController : st.common.ComponentHelper implements st.membrane.ControllerGenerator { st.interfaces.IDLDefinition idl2c = st.interfaces.IDL2C; $${
// -----------------------------------------------------------------------------
// Implementation of the ControllerGenerator interface
// -----------------------------------------------------------------------------
ControllerGlobalDecl(definition, controller) ::= <<
#include "fractal/internal/CCdelegate.h"
/* declare internal interfaces descriptor. This structure is defined in the
membrane implementation (i.e. in 'ctrl_impl.c' file) */
extern struct __component_InternalItfsDescriptor _internalItfs_descriptor;
>>
ControllerData(definition, controller) ::= <<
struct __component_ContentDescriptor *contentDesc;
>>
nbDynamicSubComponent(definition) ::= <<
>>
ControllerGlobalDataStaticInit(definition, controller) ::= <<
fractal_api_Component instance_name##_dynamicSubComponent[]; \
struct __component_ContentDescriptor instance_name##_contentDesc = { \
sizeof(instance_name.__component_internal_data.components)/sizeof(fractal_api_Component), \
(fractal_api_Component *) & instance_name.__component_internal_data.components, \
sizeof(instance_name##_dynamicSubComponent)/sizeof(fractal_api_Component), \
instance_name##_dynamicSubComponent, \
& _internalItfs_descriptor \
};
>>
ControllerDataStaticInit(definition, controller) ::= <<
/* contentDesc */ &instance_name##_contentDesc,
>>
ControllerDataFactoryNew(definition, controller) ::= <<
newInstance->__component_internal_data.contentDesc =
(struct __component_ContentDescriptor*) CALL_PTR((memory_api_Allocator) allocItf, alloc)(sizeof(struct __component_ContentDescriptor));
if (newInstance->__component_internal_data.contentDesc == NULL)
goto error_contentDesc;
newInstance->__component_internal_data.contentDesc->nbStaticSubComponent =
sizeof(newInstance->__component_internal_data.components)/sizeof(fractal_api_Component);
newInstance->__component_internal_data.contentDesc->staticSubComponents =
(fractal_api_Component*) & newInstance->__component_internal_data.components;
newInstance->__component_internal_data.contentDesc->nbDynamicSubComponent = ;
newInstance->__component_internal_data.contentDesc->dynamicSubComponents =
(fractal_api_Component*) CALL_PTR((memory_api_Allocator) allocItf, alloc)(sizeof(fractal_api_Component) * newInstance->__component_internal_data.contentDesc->nbDynamicSubComponent);
if (newInstance->__component_internal_data.contentDesc->dynamicSubComponents == NULL)
goto error_content_dynamicSubComponents;
>>
factoryInitBinding(definition, binding) ::= <<
newInstance->__component_internal_data.contentDesc->bindingDesc[i].clientComponent =
(fractal_api_Component) ;
newInstance->__component_internal_data.contentDesc->bindingDesc[i].clientItfName =
__COMPONENT_STRINGIFY_ITF_NAME([]);
newInstance->__component_internal_data.contentDesc->bindingDesc[i].serverComponent =
(fractal_api_Component) ;
newInstance->__component_internal_data.contentDesc->bindingDesc[i].serverItfName =
__COMPONENT_STRINGIFY_ITF_NAME([]);
i++;
>>
subComponentPointer(subComponentName) ::= <<
newInstance
/**/ newInstance->__component_internal_data.components.
>>
ControllerDataFactoryNewClear(definition, controller) ::= <<
CALL_PTR((memory_api_Allocator) allocItf, free)(newInstance->__component_internal_data.contentDesc->dynamicSubComponents);
error_content_dynamicSubComponents :
CALL_PTR((memory_api_Allocator) allocItf, free)(newInstance->__component_internal_data.contentDesc);
error_contentDesc :
>>
ControllerDataFactoryDestroy(definition, controller) ::= <<
CALL_PTR((memory_api_Allocator) allocItf, free)(destroyInstance->__component_internal_data.contentDesc->dynamicSubComponents);
CALL_PTR((memory_api_Allocator) allocItf, free)(destroyInstance->__component_internal_data.contentDesc);
>>
ControllerImplementation(definition, controller, interfaceDefinitions) ::= <<
/* -----------------------------------------------------------------------------
Implementation of the ContentController interface
----------------------------------------------------------------------------- */
>>
// -----------------------------------------------------------------------------
// Internal templates
// -----------------------------------------------------------------------------
initInternalItfsDescriptor(definition) ::= <<
struct __component_InternalClientItfDescriptor _internalClientItf_descriptor[] = {
};
struct __component_InternalServerItfDescriptor _internalServerItf_descriptor[] = {
};
struct __component_InternalItfsDescriptor _internalItfs_descriptor = {
sizeof(_internalClientItf_descriptor)/sizeof(struct __component_InternalClientItfDescriptor),
_internalClientItf_descriptor,
sizeof(_internalServerItf_descriptor)/sizeof(struct __component_InternalServerItfDescriptor),
_internalServerItf_descriptor
};
>>
initInternalClientItfDescriptor(definition, itf) ::= <<
,
,
>>
initInternalClientItfDescriptor1(definition, itf, index) ::= <<
__COMPONENT_INIT_INTERNAL_CLIENT_ITF_DESCRIPTOR(, [], [])
>>
initInternalServerItfDescriptor(definition, itf) ::= <<
,
,
>>
initInternalServerItfDescriptor1(definition, itf, index) ::= <<
__COMPONENT_INIT_INTERNAL_SERVER_ITF_DESCRIPTOR(, [])
>>
initControllerServerItfDescriptor(definition, itf) ::= <<
,
,
>>
initControllerServerItfDescriptor1(definition, itf, index) ::= <<
__COMPONENT_INIT_CONTROLLER_SERVER_ITF_DESCRIPTOR(, [])
>>
getFcSubComponents(definition) ::= <<
int METH(contentController, getFcSubComponents)(fractal_api_Component subComponents[])
{
return __component_getFcSubComponents(subComponents,
);
}
>>
addFcSubComponent(definition) ::= <<
int METH(contentController, addFcSubComponent)(fractal_api_Component subComponent)
{
return __component_addFcSubComponents(subComponent,
);
}
>>
removeFcSubComponent(definition) ::= <<
int METH(contentController, removeFcSubComponent)(fractal_api_Component subComponent)
{
return __component_removeFcSubComponents(subComponent,
);
}
>>
addFcSubBinding(definition) ::= <<
int METH(contentController, addFcSubBinding)(fractal_api_Component clientComponent,
__MIND_STRING_TYPEDEF clientItfName, fractal_api_Component serverComponent,
__MIND_STRING_TYPEDEF serverItfName)
{
return __component_addFcSubBinding(clientComponent, clientItfName, serverComponent, serverItfName,
, CONTEXT_PTR_ACCESS);
}
>>
removeFcSubBinding(definition) ::= <<
int METH(contentController, removeFcSubBinding)(fractal_api_Component clientComponent,
__MIND_STRING_TYPEDEF clientItfName)
{
return __component_removeFcSubBinding(clientComponent, clientItfName,
, CONTEXT_PTR_ACCESS);
}
>>
contentDescPointer(definition) ::= <<
CONTEXT_PTR_ACCESS->__component_internal_data.contentDesc
>>
}$$
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy