17 #include <pia/clone/clone_definitions.h> 18 #include <pia/clone/clone_EventCloneElementBase.h> 19 #include <pia/clone/clone_SerializePolicyDefinition.h> 38 template <
typename Value_,
size_t BUFFER_SIZE,
typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_> >
78 nn::Result
SetValue(
const Value& value,
bool isEnableSendDelay =
false);
99 return (GetHandlingEventToken() != NULL) ? &(
static_cast<const EventToken*
>(GetHandlingEventToken())->
GetValue()) : NULL;
109 return (GetHandlingEventToken() != NULL) ? (&GetHandlingEventToken()->GetClock()) : NULL;
119 return (GetHandlingEventToken() != NULL) ? GetHandlingEventToken()->GetSetterStationIndex() :
STATION_INDEX_INVALID;
129 return (GetHandlingEventToken() != NULL) ? GetHandlingEventToken()->GetIndex() : 0;
133 virtual size_t GetSize()
const 135 return SerializePolicy::GetSize();
140 class EventToken :
public EventTokenBase
144 : EventTokenBase(), m_Value()
156 virtual void Serialize(
void* pBuffer)
const;
157 virtual void Deserialize(
const void* cpBuffer);
164 class EventTokenBuffer :
public EventTokenBufferBase
170 virtual EventTokenBase* At(
int idx)
172 return &m_EventTokenArray[idx];
174 virtual const EventTokenBase* At(
int idx)
const 176 return &m_EventTokenArray[idx];
180 EventToken m_EventTokenArray[BUFFER_SIZE];
184 EventTokenBuffer m_EventTokenBuffer;
190 template <
typename Value,
size_t BUFFER_SIZE,
typename SerializePolicy>
193 m_EventTokenBuffer(
this)
195 PIA_COMPILE_ASSERT(BUFFER_SIZE >= cBufferSizeMin && BUFFER_SIZE <= cBufferSizeMax);
199 template <
typename Value,
size_t BUFFER_SIZE,
typename SerializePolicy>
202 EventTokenBase* pTokenBase;
203 Result r = SetValueCore(&pTokenBase, isEnableSendDelay);
204 if (r.IsSuccess() && pTokenBase != NULL)
206 EventToken* pToken =
static_cast<EventToken*
>(pTokenBase);
207 pToken->SetValue(value);
213 template <
typename Value,
size_t BUFFER_SIZE,
typename SerializePolicy>
216 SerializePolicy::Serialize(pBuffer, m_Value);
220 template <
typename Value,
size_t BUFFER_SIZE,
typename SerializePolicy>
223 SerializePolicy::Deserialize(&m_Value, cpBuffer);
227 template <
typename Value,
size_t BUFFER_SIZE,
typename SerializePolicy>
229 : EventTokenBufferBase(BUFFER_SIZE)
231 for (u32 i = 0; i < BUFFER_SIZE; ++i)
233 m_EventTokenArray[i].Init(pElement);
234 m_EventTokenArray[i].SetState(EventTokenBase::EVENT_TOKEN_STATE_EMPTY);
235 m_EventTokenArray[i].SetIndex(static_cast<Index>(i));
SerializePolicy_ SerializePolicy
Specifies the algorithm to use for serializing Value.
Definition: clone_EventCloneElement.h:50
Index GetEventIndex() const
Gets the index of the event currently being referenced.
Definition: clone_EventCloneElement.h:127
StationIndex GetSetterStationIndex() const
Gets the index of the station that raised the event being referenced.
Definition: clone_EventCloneElement.h:117
This is the base class for managing the sending and receiving of events.
Definition: clone_EventCloneElementBase.h:37
u32 ClockValue
Defines a type that holds a clock value.
Definition: clone_definitions.h:44
StationIndex
Enumerates StationIndex values.
Definition: platformCtr.h:44
EventCloneElement()
Instantiates the object with default parameters (default constructor).
ID indicating a station that is not present in the session.
Definition: platformCtr.h:59
nn::Result SetValue(const Value &value, bool isEnableSendDelay=false)
Raises an event.
Manages the sending and receiving of events.
Definition: clone_EventCloneElement.h:39
const Value * GetValue() const
Gets the pointer to the value for when the current event was raised.
Definition: clone_EventCloneElement.h:97
virtual ~EventCloneElement()
Destroys the object.
Definition: clone_EventCloneElement.h:62
Value_ Value
Specifies the argument type to be sent with this event.
Definition: clone_EventCloneElement.h:45
const Value * HandleNext()
References the next event.
Definition: clone_EventCloneElement.h:86
const ClockValue * GetClock() const
Gets the pointer to the issued time for when the current event was raised.
Definition: clone_EventCloneElement.h:107