15 #ifndef CORGI_COMPONENTS_GRAPH_H_
16 #define CORGI_COMPONENTS_GRAPH_H_
20 #include "breadboard/event.h"
21 #include "breadboard/graph.h"
22 #include "breadboard/graph_factory.h"
23 #include "breadboard/graph_state.h"
27 namespace component_library {
29 BREADBOARD_DECLARE_EVENT(kAdvanceFrameEventId)
54 *
this = std::move(other);
61 SerializableGraphState&
operator=(SerializableGraphState&& other) {
62 filename = std::move(other.filename);
63 graph_state = std::move(other.graph_state);
77 SerializableGraphState(
const SerializableGraphState&) { assert(
false); }
78 SerializableGraphState& operator=(
const SerializableGraphState&) {
93 std::vector<SerializableGraphState>
graphs;
117 graphs = std::move(other.graphs);
206 return &advance_frame_broadcaster_;
210 breadboard::GraphFactory* graph_factory_;
211 breadboard::NodeEventBroadcaster advance_frame_broadcaster_;
225 #endif // CORGI_COMPONENTS_GRAPH_H_
void EntityPostLoadFixup(corgi::EntityRef &entity)
Fixes up a given Entity.
std::unique_ptr< uint8_t, std::function< void(uint8_t *)> > RawDataUniquePtr
A pointer type for exported raw data.
Definition: component_interface.h:63
GraphData & operator=(GraphData &&other)
The move assignment operator for GraphData.
Definition: graph.h:116
A Component is an object that encapsulates all data and logic for Entities of a particular type...
Definition: component.h:43
GraphData()
The default constructor for an empty GraphData.
Definition: graph.h:102
Manages the event graphs for any Entity that wishes to utilize the event system.
Definition: graph.h:135
virtual RawDataUniquePtr ExportRawData(const corgi::EntityRef &entity) const
Serializes a GraphComponent's data for a given Entity.
breadboard::NodeEventBroadcaster * advance_frame_broadcaster()
Definition: graph.h:205
virtual void AddFromRawData(corgi::EntityRef &entity, const void *raw_data)
Deserialize a flat binary buffer to create and populate an Entity from raw data.
int WorldTime
A typedef that represents time in the game.
Definition: entity_common.h:49
SerializableGraphState(SerializableGraphState &&other)
Move constructor for a SerializableGraphState.
Definition: graph.h:53
virtual void InitEntity(EntityRef &)
Override this function with code that should be executed when an Entity is added to the Component...
Definition: component.h:407
Contains the graph state information, as well as the filename for serialization.
Definition: graph.h:39
const corgi::EntityRef & graph_entity() const
Definition: graph.h:201
SerializableGraphState()
Default constructor for a SerializableGraphState.
Definition: graph.h:47
breadboard::NodeEventBroadcaster broadcaster
A NodeEventBroadcaster that broadcasts events to any registered NodeEventListeners.
Definition: graph.h:99
A reference object for pointing into the vector pool. It acts as a pointer for vector pool elements a...
Definition: vector_pool.h:72
Contains the data for each Entity registered with the GraphComponent.
Definition: graph.h:89
void PostLoadFixup()
Fixes up all loaded Entities.
SerializableGraphState & operator=(SerializableGraphState &&other)
Move assignment operator for SerializableGraphState.
Definition: graph.h:61
breadboard::NodeEventBroadcaster * GetCreateBroadcaster(corgi::EntityRef entity)
Get the broadcaster for a given Entity.
#define CORGI_REGISTER_COMPONENT(ComponentType, DataType)
Definition: component_id_lookup.h:48
std::unique_ptr< breadboard::GraphState > graph_state
The Breadboard graph state data.
Definition: graph.h:44
virtual void UpdateAllEntities(corgi::WorldTime delta_time)
Broadcasts a kAdvanceFrameEventId event to update all Entities' graphs.
std::string filename
The filename for serialization.
Definition: graph.h:41
virtual void Init()
Initialize the GraphComponent.
virtual ~GraphComponent()
Destructor for GraphComponent.
Definition: graph.h:160
GraphData(GraphData &&other)
The move constructor for a GraphData.
Definition: graph.h:108
std::vector< SerializableGraphState > graphs
A vector of all the graph states.
Definition: graph.h:93