Value objects
Package defining the value object class.
Defined classes are used as an interface across multiple packages: architecture, infra, and runtime. CARET uses value objects to avoid unexpectedly overwritten.
CallbackChain
#
Bases: MessageContext
TYPE_NAME = 'callback_chain'
class-attribute
instance-attribute
#
Callback chain.
Latency is calculated from callback durations in the node path. When a path within a node passes through multiple callbacks, it is assumed that messages are passed between callbacks by a buffer of queue size 1 (ex. a member variable that stores a single message). If the queue size is larger than 1, the node latency may be calculated to be small.
CallbackGroupStructValue
#
Bases: ValueObject
, Summarizable
Callback group value object.
callback_group_name: str
property
#
Get callback group name.
Returns:
Type | Description |
---|---|
str
|
Callback group name. |
callback_group_type: CallbackGroupType
property
#
callback_group_type_name: str
property
#
Get callback_group_type name.
Returns:
Type | Description |
---|---|
CallbackGroupType name
|
|
callback_names: tuple[str, ...]
property
#
Get callback names.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Callback names which are added to the callback group. |
callbacks: tuple[CallbackStructValue, ...]
property
#
Get callbacks.
Returns:
Type | Description |
---|---|
tuple[CallbackStructValue, ...]
|
Callbacks which are added to the callback group. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
node name |
__init__(callback_group_type, node_name, callback_values, callback_group_name)
#
Construct callback group value object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_group_type |
CallbackGroupType
|
callback group type |
required |
node_name |
str
|
node name |
required |
callback_values |
tuple[CallbackStructValue, ...]
|
callback values |
required |
callback_group_name |
str
|
callback group name |
required |
CallbackGroupType
#
Bases: ValueObject
Callback group type class.
The types of callback groups are as follows:
- MUTUALLY_EXCLUSIVE
- REENTRANT
CallbackGroupValue
#
Bases: ValueObject
Callback group value object.
callback_group_id: str
property
#
Get callback group id.
Returns:
Type | Description |
---|---|
str
|
Callback group id. |
callback_group_name: str | None
property
#
Get callback group name.
Returns:
Type | Description |
---|---|
str | None
|
Callback group name. |
callback_group_type: CallbackGroupType
property
#
callback_ids: tuple[str, ...]
property
#
Get callback ids.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
callback ids added to the callback group. |
node_id: str
property
#
Get node id.
Returns:
Type | Description |
---|---|
str
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name which includes the callback group. |
__init__(callback_group_type_name, node_name, node_id, callback_ids, callback_group_id, *, callback_group_name=None)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_group_type_name |
str
|
callback group type name: ['mutually_exclusive' / 'reentrant' / 'UNDEFINED'] |
required |
node_name |
str
|
node name. |
required |
node_id |
str
|
Identification of the node, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_ids |
tuple[str, ...]
|
Identification of the callback, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_group_id |
str
|
Identification of the callback group, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_group_name |
str | None
|
callback group name, by default None. If None, it is generated automatically. |
None
|
CallbackStructValue
#
Bases: Summarizable
Callback value base class.
callback_name: str
property
#
Get callback name.
Returns:
Type | Description |
---|---|
str
|
Callback name. |
callback_type: CallbackType
abstractmethod
property
#
callback_type_name: str
property
#
Get callback type name.
Returns:
Type | Description |
---|---|
str
|
Callback type name. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
publish_topics: tuple[PublishTopicInfoValue, ...] | None
property
#
Get publisher topic info.
Returns:
Type | Description |
---|---|
tuple[PublishTopicInfoValue, ...] | None
|
publish topics |
service_name: str | None
property
#
Get service name.
Returns:
Type | Description |
---|---|
str | None
|
Service name. |
subscribe_topic_name: str | None
property
#
Get subscribe topic name.
Returns:
Type | Description |
---|---|
str | None
|
Subscribe topic name. |
summary: Summary
abstractmethod
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
symbol: str
property
#
Get callback symbol name.
Returns:
Type | Description |
---|---|
str
|
Callback symbol name. |
__init__(node_name, symbol, subscribe_topic_name, service_name, publish_topics, construction_order, callback_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
subscribe_topic_name |
str | None
|
Topic name which the callback subscribes. |
required |
service_name |
str | None
|
Service name which the service callback service. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str
|
Callback name. |
required |
CallbackType
#
Bases: ValueObject
callback group type class.
type_name: str
property
#
Return callback type name.
Returns:
Type | Description |
---|---|
str
|
Type name. |
__init__(name)
#
Construct callback type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Callback type name ['timer_callback', 'subscription_callback', 'service_callback']. |
required |
__str__()
#
Convert to string.
Returns:
Type | Description |
---|---|
str
|
Type name. |
CallbackValue
#
Bases: ValueObject
Value object class for representing a callback.
This class has minimal information and no structure. It's used as the return value of ArchitectureReader.
callback_id: str
property
#
Get callback id.
Callback id is is used to bind. Callback id should be the same if the node name and other properties are the same. If any properties is different, it should be a different callback id.
Returns:
Type | Description |
---|---|
str
|
Callback unique id. |
callback_name: str | None
property
#
Get callback name.
Returns:
Type | Description |
---|---|
str
|
Callback name. |
Note:
Different architecture_readers may return different values.
callback_type: CallbackType
abstractmethod
property
#
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_id: str
property
#
Get node id.
Returns:
Type | Description |
---|---|
str
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
publish_topics: tuple[PublishTopicInfoValue, ...] | None
property
#
Get publisher topic info.
Returns:
Type | Description |
---|---|
tuple[PublishTopicInfoValue, ...]] | None
|
publish topics |
Note:
Since callback publishes multiple topics, there are multiple publish topic names & construction_order.
service_name: str | None
property
#
Get service name.
Returns:
Type | Description |
---|---|
str
|
Service name. |
subscribe_topic_name: str | None
property
#
Get subscription topic name.
Returns:
Type | Description |
---|---|
str | None
|
Topic name which the callback subscribes. |
Note:
Only one subscription callback have a single subscribe topic name.
symbol: str
property
#
Get callback symbol name.
Returns:
Type | Description |
---|---|
str
|
Callback symbol name. |
__init__(callback_id, node_name, node_id, symbol, subscribe_topic_name, service_name, publish_topics, construction_order, *, callback_name=None)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_id |
str
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
subscribe_topic_name |
str | None
|
Topic name which the callback subscribes. |
required |
service_name |
str | None
|
Service name which the callback service. |
required |
publish_topics |
tuple[PublishTopicInfoValue] | None
|
publishes information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str | None
|
Callback name, by default None. This argument is used by ArchitectureReaderYaml. |
None
|
DiffNode
#
__init__(left_node, right_node)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left_node |
NodeStructValue
|
Node in architecture. |
required |
right_node |
NodeStructValue
|
Node in architecture. |
required |
diff_node_pubs()
#
Compare two nodes of architecture objects and return the difference of publish topic names.
Returns:
Type | Description |
---|---|
tuple[tuple[str, ...], tuple[str, ...]]
|
Returns publish topic names that exist only in the respective nodes. |
diff_node_subs()
#
Compare two nodes of architecture objects and return the difference of subscribe topic names.
Returns:
Type | Description |
---|---|
tuple[tuple[str, ...], tuple[str, ...]]
|
Returns subscribe topic names that exist only in the respective nodes. |
ExecutorStructValue
#
Bases: ValueObject
, Summarizable
Executor info for architecture.
callback_group_names: tuple[str, ...]
property
#
Get callback group names.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Callback group names. |
callback_groups: tuple[CallbackGroupStructValue, ...]
property
#
Get callback groups.
Returns:
Type | Description |
---|---|
tuple[CallbackGroupStructValue, ...]
|
Construct callback group value object. |
callback_names: tuple[str, ...]
property
#
Get callback name list.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Callback names. |
callbacks: tuple[CallbackStructValue, ...]
property
#
executor_name: str
property
#
Get executor name.
Returns:
Type | Description |
---|---|
str
|
Executor name. |
executor_type: ExecutorType
property
#
executor_type_name: str
property
#
Get executor type name.
Returns:
Type | Description |
---|---|
str
|
Executor type name. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(executor_type, callback_group_values, executor_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
executor_type |
ExecutorType
|
Executor type. |
required |
callback_group_values |
tuple[CallbackGroupStructValue, ...]
|
Callback group values. |
required |
executor_name |
str
|
Executor name. |
required |
ExecutorType
#
Bases: ValueObject
executor type class.
ExecutorValue
#
Bases: ValueObject
Executor value class.
callback_group_ids: tuple[str, ...]
property
#
Get callback group ids.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Callback group id list. |
executor_name: str | None
property
#
Get executor name.
Returns:
Type | Description |
---|---|
str | None
|
Executor name. |
executor_type: ExecutorType
property
#
__init__(executor_type_name, callback_group_ids, *, executor_name=None)
#
Get executor type name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
executor_type_name |
str
|
Executor type name. |
required |
callback_group_ids |
tuple[str, ...]
|
Callback group ids. |
required |
executor_name |
str | None
|
Executor name. |
None
|
InheritUniqueStamp
#
Bases: MessageContext
TYPE_NAME = 'inherit_unique_stamp'
class-attribute
instance-attribute
#
Inherit header timestamp.
Latency is calculated for pub/sub messages with the same timestamp value. If the input timestamp is not unique, it may calculate an incorrect value.
context_type: MessageContextType
property
#
verify()
#
Get verify.
Returns:
Type | Description |
---|---|
bool
|
Same or difference. |
MessageContext
#
Bases: ValueObject
, Summarizable
Structured message context value.
callbacks: tuple[CallbackStructValue, ...] | None
property
#
Get callbacks.
Returns:
Type | Description |
---|---|
tuple[CallbackStructValue, ...] | None
|
Callback struct values. |
context_type: MessageContextType
abstractmethod
property
#
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
publisher_construction_order: int | None
property
#
Get publisher topic name.
Returns:
Type | Description |
---|---|
int | None
|
Publisher construction order. |
publisher_topic_name: str | None
property
#
Get publisher topic name.
Returns:
Type | Description |
---|---|
str | None
|
Publisher topic name. |
subscription_construction_order: int | None
property
#
Get subscription construction order.
Returns:
Type | Description |
---|---|
int | None
|
Subscription construction order. |
subscription_topic_name: str | None
property
#
Get subscription topic name.
Returns:
Type | Description |
---|---|
str | None
|
Subscription topic name. |
type_name: str
property
#
Get type name.
Returns:
Type | Description |
---|---|
str
|
Type name. |
__init__(node_name, message_context_dict, subscription, publisher, child)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
message_context_dict |
dict
|
Message context dict. |
required |
subscription |
SubscriptionStructValue | None
|
Target subscription value. |
required |
publisher |
PublisherStructValue | None
|
Target publisher. |
required |
child |
tuple[CallbackStructValue, ...] | None
|
Child elements. |
required |
create_instance(context_type_name, context_dict, node_name, subscription, publisher, child)
staticmethod
#
Get create instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context_type_name |
str
|
Context type name. |
required |
context_dict |
dict
|
Context dict. |
required |
node_name |
str
|
Node name. |
required |
subscription |
SubscriptionStructValue | None
|
Target subscription value. |
required |
publisher |
PublisherStructValue | None
|
Target publisher. |
required |
child |
tuple[CallbackStructValue, ...] | None
|
Child elements. |
required |
Returns:
Type | Description |
---|---|
MessageContext
|
Message context. |
is_applicable_path(subscription, publisher, callbacks)
#
Get applicable path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subscription |
SubscriptionStructValue | None
|
Target subscription value. |
required |
publisher |
PublisherStructValue | None
|
Target publisher value. |
required |
callbacks |
tuple[CallbackStructValue, ...] | None
|
Target callbacks. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if applicable path, false otherwise. |
to_dict()
#
Get to dict.
Returns:
Type | Description |
---|---|
dict
|
Dict. |
verify()
abstractmethod
#
Get verify.
Returns:
Type | Description |
---|---|
bool
|
Verify or not. |
MessageContextType
#
Bases: ValueObject
Message context type.
type_name: str
property
#
Get type name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
str |
Type name. |
required |
__init__(type_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type_name |
str
|
Type name. |
required |
__str__()
#
Get type name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
str |
Type name. |
required |
NodePathStructValue
#
Bases: ValueObject
, Summarizable
StructValue object class for representing a node path.
This class is a structure that includes other related StructValue classes, such as callbacks, and used as the return value of Architecture object. In CARET, the node path is defined as from subscribe to publish.
callback_names: tuple[str, ...] | None
property
#
Get callback names.
Returns:
Type | Description |
---|---|
tuple[str, ...] | None
|
Callback names of all child elements that comprise the node path. |
callbacks: tuple[CallbackStructValue, ...] | None
property
#
Get callbacks.
Returns:
Type | Description |
---|---|
tuple[CallbackStructValue, ...] | None
|
Callbacks in all child elements that comprise the node path. |
child: tuple[CallbackStructValue | VariablePassingStructValue, ...] | None
property
#
Get child elements.
Returns:
Type | Description |
---|---|
tuple[CallbackStructValue | VariablePassingStructValue, ...] | None
|
Child elements for this node path. |
message_context: MessageContext | None
property
#
Get message context.
Returns:
Type | Description |
---|---|
MessageContext | None
|
Message context for this node path. |
message_context_type: MessageContextType | None
property
#
Get message context type.
Returns:
Type | Description |
---|---|
MessageContextType | None
|
Message context type for this node path. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
publish_topic_name: str | None
property
#
Get a topic name to publish.
Returns:
Type | Description |
---|---|
str | None
|
Topic name to publish. |
publisher: PublisherStructValue | None
property
#
publisher_construction_order: int | None
property
#
Get a construction order of publisher.
Returns:
Type | Description |
---|---|
int | None
|
Construction order of publisher. |
subscribe_topic_name: str | None
property
#
Get a topic name to subscribe to.
Returns:
Type | Description |
---|---|
str | None
|
Topic name to subscribe to. |
subscription: SubscriptionStructValue | None
property
#
Get subscription.
Returns:
Type | Description |
---|---|
SubscriptionStructValue | None
|
Subscription to subscribe to. |
subscription_callback: SubscriptionCallbackStructValue | None
property
#
Get subscription callback.
Returns:
Type | Description |
---|---|
SubscriptionCallbackStructValue | None
|
Subscription callback for this node path. |
subscription_construction_order: int | None
property
#
Get a construction order of subscription.
Returns:
Type | Description |
---|---|
int | None
|
Construction order of subscription. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
variable_passings: tuple[VariablePassingStructValue, ...] | None
property
#
Get variable passings.
Returns:
Type | Description |
---|---|
tuple[VariablePassingStructValue, ...] | None
|
Variable passings in all child elements that comprise the node path. |
__init__(node_name, subscription, publisher, child, message_context)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
subscription |
SubscriptionStructValue | None
|
Subscription which the node path subscribes. |
required |
publisher |
PublisherStructValue | None
|
Publisher which the node path publishes. |
required |
child |
tuple[CallbackStructValue | VariablePassingStructValue, ...] | None
|
Child elements of a node path. Required only when message_context is callback_chain. |
required |
message_context |
MessageContext | None
|
Message Context. Used to define node latency. |
required |
NodePathValue
#
Bases: ValueObject
Value object class for representing a node path.
This class has minimal information and no structure, and used as the return value of ArchitectureReader. In CARET, the node path is defined as from subscribe to publish.
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
publish_topic_name: str | None
property
#
Get a topic name to publish.
Returns:
Type | Description |
---|---|
str | None
|
Topic name to publish. |
publisher_construction_order: int | None
property
#
Get a construction order of publisher.
Returns:
Type | Description |
---|---|
int | None
|
Construction order of publisher. |
subscribe_topic_name: str | None
property
#
Get a topic name to subscribe to.
Returns:
Type | Description |
---|---|
str | None
|
Topic name to subscribe to. |
subscription_construction_order: int | None
property
#
Get a construction order of subscription.
Returns:
Type | Description |
---|---|
int | None
|
Construction order of subscription. |
__init__(node_name, subscribe_topic_name, publish_topic_name, publisher_construction_order, subscription_construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
subscribe_topic_name |
str | None
|
Topic name which the node-path subscribes. |
required |
publish_topic_name |
str | None
|
Topic name which the node-path publishes. |
required |
publisher_construction_order |
int | None
|
construction order of publisher. |
required |
subscription_construction_order |
int | None
|
construction order of subscription. |
required |
NodeStructValue
#
Bases: ValueObject
, Summarizable
StructValue object class for representing a node.
This class is a structure that includes other related StructValue classes, such as callbacks, and used as the return value of Architecture object.
callback_group_names: tuple[str, ...] | None
property
#
Get callback group names.
Returns:
Type | Description |
---|---|
tuple[str, ...] | None
|
Callback group names that the node contains. |
callback_groups: tuple[CallbackGroupStructValue, ...] | None
property
#
Get callback groups.
Returns:
Type | Description |
---|---|
tuple[CallbackGroupStructValue, ...] | None
|
Callback groups that the node contains. |
callback_names: tuple[str, ...] | None
property
#
Get callback names.
Returns:
Type | Description |
---|---|
tuple[str, ...] | None
|
Callback names that the node contains. |
callbacks: tuple[CallbackStructValue, ...] | None
property
#
Get callbacks.
Returns:
Type | Description |
---|---|
tuple[CallbackStructValue, ...] | None
|
Callbacks that the node contains. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
paths: tuple[NodePathStructValue, ...]
property
#
Get node paths.
Node paths are defined by subscription and publisher pair.
Returns:
Type | Description |
---|---|
tuple[NodePathStructValue, ...]
|
Node paths that the node contains. |
publish_topic_names: tuple[str, ...]
property
#
Get topic names to publish.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Topic names to publish. |
publishers: tuple[PublisherStructValue, ...]
property
#
service_names: tuple[str, ...]
property
#
Get service names.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Service names that the node contains. |
services: tuple[ServiceStructValue, ...]
property
#
Get services.
Returns:
Type | Description |
---|---|
tuple[ServiceStructValue, ...]
|
Services that the node contains. |
subscribe_topic_names: tuple[str, ...]
property
#
Get topic names to subscribe to.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Topic names to subscribe to. |
subscriptions: tuple[SubscriptionStructValue, ...]
property
#
Get subscriptions.
Returns:
Type | Description |
---|---|
tuple[SubscriptionStructValue, ...]
|
Subscriptions to subscribe to. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
timers: tuple[TimerStructValue, ...]
property
#
variable_passings: tuple[VariablePassingStructValue, ...] | None
property
#
Get variable passings.
Returns:
Type | Description |
---|---|
tuple[VariablePassingStructValue, ...] | None
|
Variable passings in all child elements that the node contains. |
__init__(node_name, publishers, subscriptions_info, services_info, timers, node_paths, callback_groups, variable_passings)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
publishers |
tuple[PublisherStructValue, ...]
|
Publishers in the node. |
required |
subscriptions_info |
tuple[SubscriptionStructValue, ...]
|
Subscriptions info in the node. |
required |
services_info |
tuple[ServiceStructValue, ...]
|
Services info in the node. |
required |
timers |
tuple[TimerStructValue, ...]
|
Timers in the node. |
required |
node_paths |
tuple[NodePathStructValue, ...]
|
Node paths in the node. |
required |
callback_groups |
tuple[CallbackGroupStructValue, ...] | None
|
Callback groups in the node. |
required |
variable_passings |
tuple[VariablePassingStructValue, ...] | None
|
Variable passings in the node. |
required |
get_path(subscribe_topic_name, subscription_construction_order, publish_topic_name, publisher_construction_order)
#
Get node path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subscribe_topic_name |
str | None
|
Topic name to which the node subscribes. |
required |
subscription_construction_order |
int | None
|
Construction order to which the node subscribes. |
required |
publish_topic_name |
str | None
|
Topic name to which the node publishes. |
required |
publisher_construction_order |
int | None
|
Construction order to which the node publishes. |
required |
Returns:
Type | Description |
---|---|
NodePathStructValue
|
Node path that matches the condition. |
Raises:
Type | Description |
---|---|
ItemNotFoundError
|
Occurs when no items were found. |
MultipleItemFoundError
|
Occurs when several items were found. |
get_publisher(publish_topic_name, construction_order)
#
Get publisher.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
publish_topic_name |
str
|
Publisher topic name to get. |
required |
construction_order |
int | None
|
Construction order to get. |
required |
Returns:
Type | Description |
---|---|
PublisherStructValue
|
A publisher that matches the condition. |
Raises:
Type | Description |
---|---|
ItemNotFoundError
|
Occurs when no items were found. |
get_service(service_name, construction_order)
#
Get service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
Service name to get. |
required |
construction_order |
int | None
|
Construction order to get. |
required |
Returns:
Type | Description |
---|---|
ServiceStructValue
|
Service instance that matches the condition. |
Raises:
Type | Description |
---|---|
ItemNotFoundError
|
Occurs when no items were found. |
get_subscription(subscribe_topic_name, construction_order)
#
Get subscription.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subscribe_topic_name |
str
|
Topic name to get. |
required |
construction_order |
int | None
|
Construction order to get. |
required |
Returns:
Type | Description |
---|---|
SubscriptionStructValue
|
Subscription instance that matches the condition. |
Raises:
Type | Description |
---|---|
ItemNotFoundError
|
Occurs when no items were found. |
get_timer(timer_period, construction_order)
#
Get timer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timer_period |
int
|
Timer period to get. |
required |
construction_order |
int | None
|
Construction order to get. |
required |
Returns:
Type | Description |
---|---|
TimerStructValue
|
A timer that matches the condition. |
Raises:
Type | Description |
---|---|
ItemNotFoundError
|
Occurs when no items were found. |
NodeValue
#
Bases: ValueObject
Value object class for representing a node.
This class has minimal information and no structure, and used as the return value of ArchitectureReader.
node_id: str | None
property
#
Get node id.
Returns:
Type | Description |
---|---|
str | None
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
__init__(node_name, node_id)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
node_id |
str | None
|
Identification of the node, a value that can be identified when retrieved from the Architecture reader. |
required |
NodeValueWithId
#
Bases: NodeValue
Value object class for representing a node path.
This class has minimal information and no structure, and used as the return value of ArchitectureReader.
node_id: str
property
#
Get node id.
Returns:
Type | Description |
---|---|
str
|
Node id. |
__init__(node_name, node_id)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
node_id |
str | None
|
Identification of the node, a value that can be identified when retrieved from the Architecture reader. |
required |
PathValue
#
Bases: ValueObject
Path name alias.
node_path_values: tuple[NodePathValue, ...]
property
#
path_name: str
property
#
Get path name.
Returns:
Type | Description |
---|---|
str
|
Path name. |
__init__(alias, node_path_values)
#
Construct an instance.
Returns:
Name | Type | Description |
---|---|---|
alias |
str
|
Alias. |
node_path_values |
tuple[NodePathValue, ...]
|
Node path values. |
PublishTopicInfoValue
#
Bases: ValueObject
PublishTopic info.
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
topic_name: str
property
#
Get topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name. |
__init__(topic_name, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
topic_name |
str
|
Topic name. |
required |
construction_order |
int
|
Construction order of the publisher. |
required |
PublisherStructValue
#
Bases: ValueObject
, Summarizable
Structured publisher value.
callback_names: tuple[str, ...] | None
property
#
Get callback names.
Returns:
Type | Description |
---|---|
tuple[str, ...] | None
|
Callback names. |
callbacks: tuple[CallbackStructValue, ...] | None
property
#
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
topic_name: str
property
#
Get topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name. |
__init__(node_name, topic_name, callback_values, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
topic_name |
str
|
Topic name. |
required |
callback_values |
tuple[CallbackStructValue, ...] | None
|
Callback values. |
required |
construction_order |
int
|
Construction order. |
required |
PublisherValue
#
Bases: ValueObject
Publisher value.
callback_ids: tuple[str, ...] | None
property
#
Get callback ids.
Returns:
Type | Description |
---|---|
tuple[str, ...]
|
Callback ids. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_id: str
property
#
Get node id.
Returns:
Type | Description |
---|---|
str
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node id. |
topic_name: str
property
#
Get topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name. |
__init__(topic_name, node_name, node_id, callback_ids, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
topic_name |
str
|
Topic name. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str
|
Node id. |
required |
callback_ids |
tuple[str, ...] | None
|
Callback id. |
required |
construction_order |
int
|
Construction order. |
required |
__str__()
#
Get message.
Returns:
Type | Description |
---|---|
str
|
Message. |
Qos
#
Bases: ValueObject
, Summarizable
Qos info.
Note:
Currently, only DEPTH is supported, but it is desirable to support other QoS by adding trace points.
ServiceCallbackStructValue
#
Bases: CallbackStructValue
, ValueObject
Structured service callback value.
callback_type: CallbackType
property
#
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(node_name, symbol, service_name, publish_topics, construction_order, callback_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
symbol |
str
|
Symbol name of the service callback. |
required |
service_name |
str
|
Service name which the service callback service. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the service callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str
|
Service callback name. This argument is used by ArchitectureReaderYaml. |
required |
ServiceCallbackValue
#
Bases: CallbackValue
Value object class for representing a service.
callback_type: CallbackType
property
#
service_name: str
property
#
Get service name.
Returns:
Type | Description |
---|---|
str
|
Service name. |
__init__(callback_id, node_name, node_id, symbol, service_name, publish_topics, construction_order, *, callback_name=None)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_id |
str
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
symbol |
str
|
Symbol name of the service callback. |
required |
service_name |
str
|
Service name which the service callback service. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the service callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str | None
|
Service callback name, by default None. This argument is used by ArchitectureReaderYaml. |
None
|
ServiceStructValue
#
Bases: ValueObject
, Summarizable
Service info.
callback: ServiceCallbackStructValue | None
property
#
callback_name: str | None
property
#
Get callback name.
Returns:
Type | Description |
---|---|
str | None
|
Callback name. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
service_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(node_name, service_name, callback_info, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
service_name |
str
|
Service name. |
required |
callback_info |
ServiceCallbackStructValue | None
|
Static info of callback. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
ServiceValue
#
Bases: ValueObject
Service info.
callback_id: str | None
property
#
Get callback id.
Returns:
Type | Description |
---|---|
str | None
|
Callback unique id. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_id: str | None
property
#
Get node id.
Returns:
Type | Description |
---|---|
str | None
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
service_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
__init__(service_name, node_name, node_id, callback_id, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
Service name. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str | None
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_id |
str | None
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
SubscriptionCallbackStructValue
#
Bases: CallbackStructValue
, ValueObject
Structured subscription callback value.
callback_type: CallbackType
property
#
subscribe_topic_name: str
property
#
Get subscription topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name which the callback subscribes. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(node_name, symbol, subscribe_topic_name, publish_topics, construction_order, callback_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
subscribe_topic_name |
str
|
Topic name which the callback subscribes. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str
|
Callback name. |
required |
SubscriptionCallbackValue
#
Bases: CallbackValue
Subscription callback value.
callback_type: CallbackType
property
#
subscribe_topic_name: str
property
#
Get subscription topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name which the callback subscribes. |
__init__(callback_id, node_name, node_id, symbol, subscribe_topic_name, publish_topics, construction_order, *, callback_name=None)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_id |
str
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
subscribe_topic_name |
str
|
Topic name which the callback subscribes. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str | None
|
Callback name, by default None. This argument is used by ArchitectureReaderYaml. |
None
|
SubscriptionStructValue
#
Bases: ValueObject
, Summarizable
Subscription info.
callback: SubscriptionCallbackStructValue | None
property
#
callback_name: str | None
property
#
Get callback name.
Returns:
Type | Description |
---|---|
str | None
|
Callback name |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
topic_name: str
property
#
Get a topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name of this subscription. |
__eq__(other)
#
Check whether self object equals to given instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
Any
|
Comparison target. |
required |
Returns:
Type | Description |
---|---|
bool
|
Compares the values of the published properties and returns True only if they all match. False otherwise. |
__hash__()
#
Calculate hash value.
Returns:
Type | Description |
---|---|
int
|
A hash value calculated from all of the publicly available property values by recursively referencing them. |
References
https://www.baeldung.com/java-hashcode
__init__(node_name, topic_name, callback_info, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
topic_name |
str
|
Topic name. |
required |
callback_info |
SubscriptionCallbackStructValue | None
|
Static info of callback. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
SubscriptionValue
#
Bases: ValueObject
Subscription info.
callback_id: str | None
property
#
Get callback id.
Returns:
Type | Description |
---|---|
str | None
|
Callback unique id. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_id: str | None
property
#
Get node id.
Returns:
Type | Description |
---|---|
str | None
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
topic_name: str
property
#
Get a topic name.
Returns:
Type | Description |
---|---|
str
|
Topic name of this communication. |
__init__(topic_name, node_name, node_id, callback_id, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
topic_name |
str
|
Topic name. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str | None
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_id |
str | None
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
Tilde
#
Bases: MessageContext
TYPE_NAME = 'tilde'
class-attribute
instance-attribute
#
Tilde.
Latency is calculated from tilde.
context_type: MessageContextType
property
#
__init__(node_name, message_context_dict, subscription, publisher, callbacks)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
message_context_dict |
dict
|
Message context dict. |
required |
subscription |
SubscriptionStructValue | None
|
Target subscription value. |
required |
publisher |
PublisherStructValue | None
|
Target publisher. |
required |
callbacks |
tuple[CallbackStructValue, ...] | None
|
Callbacks. |
required |
is_applicable_path(subscription, publisher, callbacks)
#
Get applicable path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subscription |
SubscriptionStructValue | None
|
Target subscription value. |
required |
publisher |
PublisherStructValue | None
|
Target publisher value. |
required |
callbacks |
tuple[CallbackStructValue, ...] | None
|
Target callbacks. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if applicable path, false otherwise. |
verify()
#
Get verify.
Returns:
Type | Description |
---|---|
bool
|
Verify or not. |
TimerCallbackStructValue
#
Bases: CallbackStructValue
, ValueObject
Structured timer callback value.
callback_type: CallbackType
property
#
period_ns: int
property
#
Get period.
Returns:
Type | Description |
---|---|
int
|
Period of the timer. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(node_name, symbol, period_ns, publish_topics, construction_order, callback_name)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
period_ns |
int
|
Period of the timer. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str
|
Callback name, by default None. This argument is used by ArchitectureReaderYaml. |
required |
TimerCallbackValue
#
Bases: CallbackValue
Value object class for representing a timer.
This class has minimal information and no structure, and used as the return value of ArchitectureReader.
callback_type: CallbackType
property
#
period_ns: int
property
#
Get period.
Returns:
Type | Description |
---|---|
int
|
Period of the timer. |
__init__(callback_id, node_name, node_id, symbol, period_ns, publish_topics, construction_order, *, callback_name=None)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_id |
str
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
symbol |
str
|
Symbol name of the callback. |
required |
period_ns |
int
|
Period of the timer. |
required |
publish_topics |
tuple[PublishTopicInfoValue, ...] | None
|
Topic information which the callback publishes. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
callback_name |
str | None
|
Callback name, by default None. This argument is used by ArchitectureReaderYaml. |
None
|
TimerStructValue
#
Bases: ValueObject
, Summarizable
Timer info.
callback: TimerCallbackStructValue | None
property
#
callback_name: str | None
property
#
Get callback name.
Returns:
Type | Description |
---|---|
str | None
|
Callback name. |
construction_order: int | None
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int | None
|
Construction order. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
period_ns: int
property
#
Get period.
Returns:
Type | Description |
---|---|
int
|
Period of the timer. |
__init__(node_name, period_ns, callback_info, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
period_ns |
int
|
Period of the timer. |
required |
callback_info |
TimerCallbackStructValue | None
|
Static info of callback. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
TimerValue
#
Bases: ValueObject
Timer info.
callback_id: str | None
property
#
Get callback id.
Returns:
Type | Description |
---|---|
str | None
|
Callback unique id. |
construction_order: int
property
#
Get construction order.
Returns:
Type | Description |
---|---|
int
|
Construction order. |
node_id: str | None
property
#
Get node id.
Returns:
Type | Description |
---|---|
str | None
|
Node id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
period: int
property
#
Get period.
Returns:
Type | Description |
---|---|
int
|
Period of the timer. |
__init__(period, node_name, node_id, callback_id, construction_order)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
period |
int
|
Period of the timer. |
required |
node_name |
str
|
Node name. |
required |
node_id |
str | None
|
Node unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_id |
str | None
|
Callback unique id, a value that can be identified when retrieved from the Architecture reader. |
required |
construction_order |
int
|
Order of instance creation within the identical node. |
required |
UseLatestMessage
#
Bases: MessageContext
ValueObject
#
Value object base class.
Classes that inherit from this class will become immutable ValueObjects, and eq and hash will be calculated based on public properties.
Note:
Since the hash value is immutable, inherited classes can be used as a dictionary type key. It is also suitable for cache use and does not unintentionally change properties.
__eq__(right)
#
Check whether self object equals to given instance [override].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
right |
Any
|
Comparison target. |
required |
Returns:
Type | Description |
---|---|
bool
|
Recursively compares the values of the published properties and returns True only if they all match. False otherwise. |
__hash__()
#
Calculate hash value.
Returns:
Type | Description |
---|---|
int
|
A hash value calculated from all of the publicly available property values by recursively referencing them. |
References
https://www.baeldung.com/java-hashcode
__str__()
#
Convert to string.
Returns:
Type | Description |
---|---|
str
|
Yaml format strings created by recursively access properties. |
VariablePassingStructValue
#
Bases: ValueObject
, Summarizable
variable passing info.
callback_name_read
property
#
Get read-side callback name.
Returns:
Type | Description |
---|---|
str
|
Read-side callback name. |
callback_name_write: str
property
#
Get write-side callback name.
Returns:
Type | Description |
---|---|
str
|
Write-side callback name. |
callback_read: CallbackStructValue
property
#
Get read-side callback.
Returns:
Type | Description |
---|---|
str
|
Read-side callback. |
callback_write: CallbackStructValue
property
#
Get write-side callback.
Returns:
Type | Description |
---|---|
str
|
Write-side callback. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
summary: Summary
property
#
Get summary.
Returns:
Type | Description |
---|---|
Summary
|
Summary about value objects and runtime data objects. |
__init__(node_name, callback_write, callback_read)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
callback_write |
CallbackStructValue
|
Write callback. |
required |
callback_read |
CallbackStructValue
|
Read callback. |
required |
VariablePassingValue
#
Bases: ValueObject
variable passing info.
callback_id_read: str
property
#
Get read-side callback id.
Returns:
Type | Description |
---|---|
str
|
Read-side callback id. |
callback_id_write: str
property
#
Get write-side callback id.
Returns:
Type | Description |
---|---|
str
|
Write-side callback id. |
node_name: str
property
#
Get node name.
Returns:
Type | Description |
---|---|
str
|
Node name. |
__init__(node_name, callback_id_write, callback_id_read)
#
Construct an instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_name |
str
|
Node name. |
required |
callback_id_write |
str
|
Unique id of write callback, a value that can be identified when retrieved from the Architecture reader. |
required |
callback_id_read |
str
|
Unique id of read callback, a value that can be identified when retrieved from the Architecture reader. |
required |