Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::com::entry::ServiceEntry Class Reference

Entry to find and offer a service. More...

#include <service_entry.h>

Inheritance diagram for ara::com::entry::ServiceEntry:
ara::com::entry::Entry

Public Member Functions

 ServiceEntry (ServiceEntry &&other)
 
ServiceEntryoperator= (ServiceEntry &&other)
 
uint32_t MinorVersion () const noexcept
 Get minor version. More...
 
virtual std::vector< uint8_t > Payload (uint8_t &optionIndex) const override
 Get entity payload. More...
 
- Public Member Functions inherited from ara::com::entry::Entry
 Entry (Entry &&other)
 
Entryoperator= (Entry &&other)
 
EntryType Type () const noexcept
 Get entry type. More...
 
uint16_t ServiceId () const noexcept
 Get service ID. More...
 
uint16_t InstanceId () const noexcept
 Get instance ID. More...
 
uint8_t MajorVersion () const noexcept
 Get major version. More...
 
uint32_t TTL () const noexcept
 Get TTL. More...
 
const std::vector< std::unique_ptr< option::Option > > & FirstOptions () const noexcept
 Get first (general) options. More...
 
void AddFirstOption (std::unique_ptr< option::Option > firstOption)
 Add a first (general) option. More...
 
const std::vector< std::unique_ptr< option::Option > > & SecondOptions () const noexcept
 Get second (specific) options. More...
 
void AddSecondOption (std::unique_ptr< option::Option > secondOption)
 Add a second (specific) option. More...
 

Static Public Member Functions

static std::unique_ptr< ServiceEntryCreateFindServiceEntry (uint16_t serviceId, uint32_t ttl=cInfiniteTtl, uint16_t instanceId=cAnyInstanceId, uint8_t majorVersion=cAnyMajorVersion, uint32_t minorVersion=cAnyMinorVersion)
 Find a service entry factory. More...
 
static std::unique_ptr< ServiceEntryCreateOfferServiceEntry (uint16_t serviceId, uint16_t instanceId, uint8_t majorVersion, uint32_t minorVersion, uint32_t ttl=cInfiniteTtl)
 Offer a service entry factory. More...
 
static std::unique_ptr< ServiceEntryCreateStopOfferEntry (uint16_t serviceId, uint16_t instanceId, uint8_t majorVersion, uint32_t minorVersion) noexcept
 Stop offer a service entry factory. More...
 
static std::unique_ptr< ServiceEntryDeserialize (const std::vector< uint8_t > &payload, std::size_t &offset, EntryType type, uint16_t serviceId, uint16_t instanceId, uint32_t ttl, uint8_t majorVersion)
 Deserialize a entry payload. More...
 

Static Public Attributes

static const uint32_t cAnyMinorVersion = 0xffffffff
 Any service minor version.
 
- Static Public Attributes inherited from ara::com::entry::Entry
static const uint16_t cAnyInstanceId = 0xffff
 Any service instance ID.
 
static const uint8_t cAnyMajorVersion = 0xff
 Any service major version.
 
static const uint8_t cOptionSizeBitLength = 4
 Option number field bit size.
 

Protected Member Functions

virtual bool ValidateOption (const option::Option *option) const noexcept override
 Validate an option for adding. More...
 
- Protected Member Functions inherited from ara::com::entry::Entry
 Entry (EntryType type, uint16_t serviceId, uint16_t instanceId, uint32_t ttl, uint8_t majorVersion=cAnyMajorVersion) noexcept
 Constructor. More...
 
bool ContainsOption (option::OptionType optionType) const noexcept
 Indicate whether the entry contains a specific option type or not. More...
 
virtual std::vector< uint8_t > BasePayload (uint8_t &optionIndex) const
 Get baseentity payload. More...
 

Detailed Description

Entry to find and offer a service.

Member Function Documentation

◆ CreateFindServiceEntry()

std::unique_ptr< ServiceEntry > ara::com::entry::ServiceEntry::CreateFindServiceEntry ( uint16_t  serviceId,
uint32_t  ttl = cInfiniteTtl,
uint16_t  instanceId = cAnyInstanceId,
uint8_t  majorVersion = cAnyMajorVersion,
uint32_t  minorVersion = cAnyMinorVersion 
)
static

Find a service entry factory.

Parameters
serviceIdService in interest ID
ttlEntry time to live
instanceIdService in interest instance ID
majorVersionService in interest major version
minorVersionService in interest minor version
Returns
Find service entry

◆ CreateOfferServiceEntry()

std::unique_ptr< ServiceEntry > ara::com::entry::ServiceEntry::CreateOfferServiceEntry ( uint16_t  serviceId,
uint16_t  instanceId,
uint8_t  majorVersion,
uint32_t  minorVersion,
uint32_t  ttl = cInfiniteTtl 
)
static

Offer a service entry factory.

Parameters
serviceIdService in interest ID
instanceIdService in interest instance ID
majorVersionService in interest major version
minorVersionService in interest minor version
ttlService offering lifetime
Returns
Offer service entry

◆ CreateStopOfferEntry()

std::unique_ptr< ServiceEntry > ara::com::entry::ServiceEntry::CreateStopOfferEntry ( uint16_t  serviceId,
uint16_t  instanceId,
uint8_t  majorVersion,
uint32_t  minorVersion 
)
staticnoexcept

Stop offer a service entry factory.

Parameters
serviceIdService in interest ID
instanceIdService in interest instance ID
majorVersionService in interest major version
minorVersionService in interest minor version
Returns
Stop service offering entry

◆ Deserialize()

std::unique_ptr< ServiceEntry > ara::com::entry::ServiceEntry::Deserialize ( const std::vector< uint8_t > &  payload,
std::size_t &  offset,
EntryType  type,
uint16_t  serviceId,
uint16_t  instanceId,
uint32_t  ttl,
uint8_t  majorVersion 
)
static

Deserialize a entry payload.

Parameters
payloadSerialized entry payload byte array
offsetDeserializing offset in the payload
typeEntry type
serviceIdService in interest ID
instanceIdService in interest instance ID
ttlEntry time to live
majorVersionService in interest major version
Returns
Deserialized entry
Exceptions
std::out_of_rangeThrows when the entry type is not a service entry

◆ MinorVersion()

uint32_t ara::com::entry::ServiceEntry::MinorVersion ( ) const
noexcept

Get minor version.

Returns
Service minor version

◆ Payload()

std::vector< uint8_t > ara::com::entry::ServiceEntry::Payload ( uint8_t &  optionIndex) const
overridevirtual

Get entity payload.

Parameters
optionIndexIndex of the last added option
Returns
Byte array

Implements ara::com::entry::Entry.

◆ ValidateOption()

bool ara::com::entry::ServiceEntry::ValidateOption ( const option::Option option) const
overrideprotectedvirtualnoexcept

Validate an option for adding.

Parameters
optionOption of interest
Returns
True if the option is valid; otherwise false

Reimplemented from ara::com::entry::Entry.