dtlmod::Engine

class Engine

A class that interface the Stream defined by users and the Transport methods that actually handle data movement and storage.

Public Types

enum class Type

An enum that defines the type of Engine supported by the DTL.

Values:

enumerator Undefined

The Engine Type has not nee specified yet.

enumerator File

File Engine. Relies on files written to and read from a file system to transport data from publisher(s) to subscriber(s).

enumerator Staging

Staging Engine. Relies on communications to to transport data from publisher(s) to subscriber(s).

Public Functions

void begin_transaction()

Start a transaction on an Engine.

All put and get operations must take place within a transaction (in a sense close to that used for databases). When multiple actors have opened the same Stream and thus subscribed to the same Engine, only one of them has to do the following when a transaction begins, this function is a no-op for the other subscribers:

  1. if no transaction is currently in progress, start one, exit otherwise

  2. if this is the first transaction for that Engine, create a synchronization barrier among all the subscribers.

  3. Otherwise, wait for the completion of the simulated activities started by the previous transaction.

void close()

Close the Engine associated to a Stream.

This function is called by all the actors that have opened that Stream. The first subscriber to enter that function waits for the completion of the activities of last transaction on that Engine. Then all the subscribers are synchronized before the Engine is properly closed (and destroyed).

void end_transaction()

End a transaction on an Engine.

This function first synchronizes all the subscribers thanks to the internal barrier. When the last subscriber enters the barrier, all the simulated activities registered for the current transaction are started.

Then it marks the transaction as done.

void get(std::shared_ptr<Variable> var)

Get a Variable from the DTL.

The actual data transport is delegated to the Transport method associated to the Engine.

Parameters:

var – The Variable to get in the DTL (Have to do an Inquire first).

inline const char *get_cname() const

Helper function to print out the name of the Engine.

Returns:

the corresponding C-string

inline unsigned int get_current_transaction() const

Get the id of the current transaction (on the Publish side).

Returns:

The id of the ongoing transaction.

inline const std::string &get_name() const

Helper function to print out the name of the Engine.

Returns:

the corresponding string

void put(std::shared_ptr<Variable> var, size_t simulated_size_in_bytes)

Put a Variable in the DTL using a specific Engine.

The actual data transport is delegated to the Transport method associated to the Engine.

Parameters:
  • var – The variable to put in the DTL

  • simulated_size_in_bytes – The size of the (subset of) the Variable