1.1.4 OcaBlockFactory

Class Hierarchy:

OcaRoot : OcaWorker : OcaBlockFactory

class OcaBlockFactory : OcaWorker

Factory to create custom block instances. Used only in reconfigurable devices. The idea is that you instantiate a factory once, populate it with proto-objects and proto-signal paths, then use it subsequently to instantiate identical blocks. In this context, proto-object means a prototype of a block member. Unbound objects are identified by proto-object numbers (PONo’s) instead of actual object numbers. PONos are unique within the factory, and are converted to globally unique object numbers ONos) in all new block instances that the factory builds. Correspondingly, proto-signal path means a signal path expressed in terms of PONos rather than ONos. When the factory constructs a block, it converts all of its unbound signal paths to normal (bound) signal paths by mapping its PONos into ONos. The factory also holds a list of proto-blockports which are OcaPorts that are allocated to new blocks the factory builds. As well, the proto-objects in the factory may contain lists of their own proto-ports. Together, the factory’s proto-ports and its members’ proto-ports are used to define the factory’s set of proto-signal paths. Factories may be predefined at time of device manufacture, or constructed “on the fly” by controllers. To create a factory, the controller calls a block’s CreateMember(…) method with the ClassID of this class (OcaBlockFactory). Factories ignore which block creates them, so it makes no difference which block’s CreateMember(…) method is used. It will usually make the most sense to use the Root Block’s method. To add proto-objects, proto-ports, and proto-signal paths to a block factory, the controller calls the factory’s DefineProtoMember(…), DefineProtoPort(…), and DefineProtoSignalPath(…) methods, respectively.

Properties:

static const OcaClassID ClassID = "1.1.4"

This property is an override of the OcaRoot property.

This property has id 1.1.

static const OcaClassVersionNumber ClassVersion = 2

This property has id 1.2.

OcaList<OcaProtoPort> ProtoPorts

List of proto-ports for built objects. The factory itself has no ports.

This property has id 3.1.

OcaList<OcaProtoObjectIdentification> ProtoMembers

List of prot-object identifiers of proto-members in the block.

This property has id 3.2.

OcaMap<OcaUint16, OcaProtoSignalPath> ProtoSignalPaths

List of proto-signal paths in the block.

This property has id 3.3.

OcaGlobalTypeIdentifier GlobalType

Global block type identifier for reusable blocks. Added in version 2 of this class.

This property has id 3.4.

Properties inherited from 1.1 OcaWorker:

Methods:

OcaStatus DefineProtoPort(OcaString name, OcaPortMode portmode, OcaProtoPortID &id)

Defines a proto-port in the factory. If proto-port already exists, it is replaced with the one from this call. The return value indicates whether the proto-port was successfully added.

This method has id 3.1.

  • name: Input parameter.

  • portmode: Input parameter.

  • id: Output parameter.

OcaStatus UndefineProtoPort(OcaProtoPortID ProtoPortID)

Deletes a proto-port from the factory. The return value indicates whether the proto-port was successfully deleted.

This method has id 3.2.

OcaStatus GetProtoPorts(OcaList<OcaProtoPort> &Ports)

Gets the factory’s list of proto-ports. The return value indicates whether the list was successfully retrieved.

This method has id 3.3.

  • Ports: Output parameter.

OcaStatus DefineProtoMember(OcaClassID ClassIdentification, variant ConstructionParameters, OcaProtoONo &ProtoObjectNumber)

Defines a proto-member of the given class in the factory. The most current version of the class is used. The return value indicates whether the proto-member was successfully defined.

This method has id 3.4.

OcaStatus DefineProtoMemberUsingFactory(OcaONo FactoryONo, OcaProtoONo &ProtoObjectNumber)

Defines a proto-member which will be instantiated by a specified factory when the block is built. The return value indicates whether the proto-member was successfully defined.

This method has id 3.5.

OcaStatus UndefineProtoMember(OcaProtoONo ProtoObjectNumber)

Deletes a proto-member from the factory. Deletes all proto-signal paths attached to its ports. The return value indicates whether the member was successfully deleted.

This method has id 3.6.

OcaStatus GetProtoMembers(OcaList<OcaProtoObjectIdentification> &Members)

Gets the factory’s list of proto-members. Does not recurse inner proto-blocks. The return value indicates whether the list was successfully retrieved.

This method has id 3.7.

OcaStatus DefineProtoSignalPath(OcaProtoSignalPath Path, OcaUint16 &Index)

Defines a proto-signal path in the factory. The return value indicates whether the proto-signal path was successfully defined.

This method has id 3.8.

  • Path: Input parameter.

  • Index: Output parameter.

OcaStatus UndefineProtoSignalPath(OcaUint16 &Index)

Deletes a proto-signal path from the factory. The return value indicates whether the signal path was successfully added.

This method has id 3.9.

  • Index: Output parameter.

OcaStatus GetProtoSignalPaths(OcaMap<OcaUint16, OcaProtoSignalPath> &Members)

Gets the factory’s list of proto-signal paths. Map key is proto-signal path ID. Does not recurse inner proto-blocks. The return value indicates whether the list was successfully retrieved.

This method has id 3.10.

OcaStatus GetGlobalType(OcaGlobalTypeIdentifier &GlobalType)

Gets the global type identifier for blocks created by this factory. The return value indicates whether the identifier was successfully retrieved. Added in version 2 of this class.

This method has id 3.11.

OcaStatus SetGlobalType(OcaGlobalTypeIdentifier GlobalType)

Sets the global type identifier for blocks created by this factory. The return value indicates whether the identifier was successfully set. Added in version 2 of this class.

This method has id 3.12.

Methods inherited from 1.1 OcaWorker: