functional-dag
Loading...
Searching...
No Matches
fn_dag Namespace Reference

Classes

class  __dag_node
 Internal structure to support a mapping function.
 
class  __dag_source
 Internal structure to support a generator function.
 
class  _abstract_internal_dag_node
 An internal pure virtual interface for internal nodes.
 
class  _dag_base
 Abstract pure virtual class for all DAGs.
 
class  _internal_dag_node
 An internal class to encapsulate a function that transmutes input data to output data.
 
struct  construction_optionBuilder
 
class  dag
 The main DAG function that encapulates generation and mapping of the data across the DAG. More...
 
class  dag_fake_source
 A source that just returns null pointers. More...
 
class  dag_fanout_node
 Internal node to take data from parent and run children. More...
 
class  dag_manager
 The DAG manager manages all of the dags created by the user. More...
 
class  dag_node
 Interface for all external "mapping" lambdas. More...
 
class  dag_source
 Interface for all external generator lambdas. More...
 
struct  FLATBUFFERS_FINAL_CLASS
 Basic types.
 
class  GUID
 (Utility) For defining a globally unique UUIDv4 identifier. More...
 
class  library
 (Library related) A library defines what is needed to construct a dag tree. More...
 
struct  library_spec
 (Library related) A library spec defines the interface a dynamicly loaded library must define to participate. More...
 
struct  node_prop_spec
 (Library related) A node spec defines the basic properties of a node. More...
 
struct  node_specBuilder
 
struct  option_spec
 (Library related) This defines the options to a node, eg: how to configure it. More...
 
struct  option_valueBuilder
 
struct  pipe_specBuilder
 
struct  string_mappingBuilder
 

Typedefs

using construction_signature = bool(dag_manager<string> &, const node_spec &)
 
typedef struct fn_dag::option_spec option_spec
 (Library related) This defines the options to a node, eg: how to configure it.
 
typedef struct fn_dag::node_prop_spec node_prop_spec
 (Library related) A node spec defines the basic properties of a node.
 
typedef struct fn_dag::library_spec library_spec
 (Library related) A library spec defines the interface a dynamicly loaded library must define to participate.
 
using get_library_fn_type = library_spec()
 

Enumerations

enum  NODE_TYPE : int8_t {
  NODE_TYPE_SOURCE = 0 , NODE_TYPE_FILTER = 1 , NODE_TYPE_SINK = 2 , NODE_TYPE_UNDEFINED = 3 ,
  NODE_TYPE_MIN = NODE_TYPE_SOURCE , NODE_TYPE_MAX = NODE_TYPE_UNDEFINED
}
 A library is a list of functions that instantiate node sources and transmission nodes.
 
enum  OPTION_TYPE : int8_t {
  OPTION_TYPE_STRING = 0 , OPTION_TYPE_INT = 1 , OPTION_TYPE_BOOL = 2 , OPTION_TYPE_UNDEFINED = 3 ,
  OPTION_TYPE_MIN = OPTION_TYPE_STRING , OPTION_TYPE_MAX = OPTION_TYPE_UNDEFINED
}
 
enum  PS_TYPE : int8_t { PS_TYPE_THREAD = 0 , PS_TYPE_FORK = 1 , PS_TYPE_MIN = PS_TYPE_THREAD , PS_TYPE_MAX = PS_TYPE_FORK }
 
enum  error_codes : uint16_t {
  PARENT_NOT_FOUND = 0 , NULL_PTR_ERROR = 1 , NOT_ENOUGH_ELEMENTS = 2 , HEX_SIZE_INCORRECT = 3 ,
  DAG_NOT_FOUND = 4 , CONSTRUCTION_FAILED = 5 , NO_DETAILS = 6 , NO_CONSTRUCTOR = 7 ,
  PATH_DOES_NOT_EXIST = 8 , GUID_CONSTRUCTION_FAILED = 9 , SCHEMA_READ_ERROR = 10 , SERIALIZATION_ERROR = 11 ,
  JSON_PARSER_ERROR = 12 , PIPE_SPEC_ERROR = 13 , MODULE_TYPE_UNSUPPORTED = 14 , UNUSED = 15
}
 Error codes used by the functional dag. More...
 

Functions

const ::flatbuffers::TypeTable * GUID_valsTypeTable ()
 
 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT (8) GUID_vals FLATBUFFERS_FINAL_CLASS
 
 FLATBUFFERS_STRUCT_END (GUID_vals, 16)
 
const ::flatbuffers::TypeTable * option_valueTypeTable ()
 
const ::flatbuffers::TypeTable * construction_optionTypeTable ()
 
const ::flatbuffers::TypeTable * string_mappingTypeTable ()
 
const ::flatbuffers::TypeTable * node_specTypeTable ()
 
const ::flatbuffers::TypeTable * pipe_specTypeTable ()
 
const NODE_TYPE(& EnumValuesNODE_TYPE ())[4]
 
const char *const * EnumNamesNODE_TYPE ()
 
const char * EnumNameNODE_TYPE (NODE_TYPE e)
 
const OPTION_TYPE(& EnumValuesOPTION_TYPE ())[4]
 
const char *const * EnumNamesOPTION_TYPE ()
 
const char * EnumNameOPTION_TYPE (OPTION_TYPE e)
 
const PS_TYPE(& EnumValuesPS_TYPE ())[2]
 
const char *const * EnumNamesPS_TYPE ()
 
const char * EnumNamePS_TYPE (PS_TYPE e)
 
inline ::flatbuffers::Offset< option_value > Createoption_value (::flatbuffers::FlatBufferBuilder &_fbb, fn_dag::OPTION_TYPE type=fn_dag::OPTION_TYPE_UNDEFINED, uint32_t int_value=0, bool bool_value=false, ::flatbuffers::Offset<::flatbuffers::String > string_value=0)
 
inline ::flatbuffers::Offset< option_value > Createoption_valueDirect (::flatbuffers::FlatBufferBuilder &_fbb, fn_dag::OPTION_TYPE type=fn_dag::OPTION_TYPE_UNDEFINED, uint32_t int_value=0, bool bool_value=false, const char *string_value=nullptr)
 
inline ::flatbuffers::Offset< construction_option > Createconstruction_option (::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String > name=0, ::flatbuffers::Offset< fn_dag::option_value > value=0)
 
inline ::flatbuffers::Offset< construction_option > Createconstruction_optionDirect (::flatbuffers::FlatBufferBuilder &_fbb, const char *name=nullptr, ::flatbuffers::Offset< fn_dag::option_value > value=0)
 
inline ::flatbuffers::Offset< string_mapping > Createstring_mapping (::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String > key=0, ::flatbuffers::Offset<::flatbuffers::String > value=0)
 
inline ::flatbuffers::Offset< string_mapping > Createstring_mappingDirect (::flatbuffers::FlatBufferBuilder &_fbb, const char *key=nullptr, const char *value=nullptr)
 
inline ::flatbuffers::Offset< node_spec > Createnode_spec (::flatbuffers::FlatBufferBuilder &_fbb, const fn_dag::GUID_vals *target_id=nullptr, ::flatbuffers::Offset<::flatbuffers::String > name=0, fn_dag::PS_TYPE residence=fn_dag::PS_TYPE_THREAD, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset< fn_dag::string_mapping > > > wires=0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset< fn_dag::construction_option > > > options=0)
 
inline ::flatbuffers::Offset< node_spec > Createnode_specDirect (::flatbuffers::FlatBufferBuilder &_fbb, const fn_dag::GUID_vals *target_id=nullptr, const char *name=nullptr, fn_dag::PS_TYPE residence=fn_dag::PS_TYPE_THREAD, const std::vector<::flatbuffers::Offset< fn_dag::string_mapping > > *wires=nullptr, const std::vector<::flatbuffers::Offset< fn_dag::construction_option > > *options=nullptr)
 
inline ::flatbuffers::Offset< pipe_spec > Createpipe_spec (::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset< fn_dag::node_spec > > > sources=0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset< fn_dag::node_spec > > > nodes=0)
 
inline ::flatbuffers::Offset< pipe_spec > Createpipe_specDirect (::flatbuffers::FlatBufferBuilder &_fbb, const std::vector<::flatbuffers::Offset< fn_dag::node_spec > > *sources=nullptr, const std::vector<::flatbuffers::Offset< fn_dag::node_spec > > *nodes=nullptr)
 
const ::flatbuffers::TypeTable * NODE_TYPETypeTable ()
 
const ::flatbuffers::TypeTable * OPTION_TYPETypeTable ()
 
const ::flatbuffers::TypeTable * PS_TYPETypeTable ()
 
const fn_dag::pipe_spec * Getpipe_spec (const void *buf)
 
const fn_dag::pipe_spec * GetSizePrefixedpipe_spec (const void *buf)
 
bool Verifypipe_specBuffer (::flatbuffers::Verifier &verifier)
 
bool VerifySizePrefixedpipe_specBuffer (::flatbuffers::Verifier &verifier)
 
void Finishpipe_specBuffer (::flatbuffers::FlatBufferBuilder &fbb, ::flatbuffers::Offset< fn_dag::pipe_spec > root)
 
void FinishSizePrefixedpipe_specBuffer (::flatbuffers::FlatBufferBuilder &fbb, ::flatbuffers::Offset< fn_dag::pipe_spec > root)
 
const error_codes(& EnumValueserror_codes ())[16]
 
const char *const * EnumNameserror_codes ()
 
const char * EnumNameerror_codes (error_codes e)
 
const ::flatbuffers::TypeTable * error_codesTypeTable ()
 
template<typename Out>
dag_source< Out > * fn_source (function< unique_ptr< Out >()> _run_fn)
 A wrapper function that constructs a generator wrapper for your generator function.
 
template<typename In, typename Out>
dag_node< In, Out > * fn_call (function< unique_ptr< Out >(const In *const)> _run_fn)
 A wrapper function that constructs a mapping wrapper for your mapping function.
 
template<typename T>
bool operator== (const GUID< T > &_left, const GUID< T > &_right)
 Equality operator.
 
template<typename T>
bool operator< (const GUID< T > &_left, const GUID< T > &_right)
 Less than operator.
 
expected< vector< fs::directory_entry >, error_codes > get_all_available_libs (const fs::directory_entry &_library_path)
 Similar to load_all_available_libs, this function will retreive compatible libraries in the directory.
 
expected< string, error_codes > fsys_serialize (const uint8_t *const _buffer_in)
 (Beta) This function will take a spec in and serialize it back out to JSON.
 

Detailed Description


___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

___ .___ |_ \ __| _/____ ____ / \ ______ / __ |__ \ / ___\ / /\ \ /_____/ / /_/ | / __ _/ /_/ > /_/ __\ ____ |(____ /___ /

\/ \//_____/

Author
ndepa.nosp@m.lma@.nosp@m.alum..nosp@m.mit..nosp@m.edu

Enumeration Type Documentation

◆ error_codes

enum fn_dag::error_codes : uint16_t

Error codes used by the functional dag.

Enumerator
PARENT_NOT_FOUND 

The parent of the node you are attaching to the dag was not found.

NULL_PTR_ERROR 

The node you are trying to add is null.

NOT_ENOUGH_ELEMENTS 

Not enough UUID elements to parse.

HEX_SIZE_INCORRECT 

A section of the UUID isn't long enough.

DAG_NOT_FOUND 

When deserializing, the required dag wasn't found.

CONSTRUCTION_FAILED 

Constructing the node when deserializing failed.

NO_DETAILS 

The lib that was loaded did not include details.

NO_CONSTRUCTOR 

The lib that was loaded has no constructor function.

PATH_DOES_NOT_EXIST 

The path requested for the load or library was not found.

GUID_CONSTRUCTION_FAILED 

When the GUID was being constructed, something went wrong.

SCHEMA_READ_ERROR 

This is catastrophic. It means an embedded string was incorrect.

SERIALIZATION_ERROR 

When trying to serialize a dag to JSON, something failed in serializer.

JSON_PARSER_ERROR 

When trying to read a JSON specification, the JSON was malformed.

PIPE_SPEC_ERROR 

This shouldn't happen. It means the JSON loaded but did not conform to DAG structure.

MODULE_TYPE_UNSUPPORTED 

This means the library is trying to load a node that isn't yet supported.

Function Documentation

◆ fn_call()

template<typename In, typename Out>
dag_node< In, Out > * fn_dag::fn_call ( function< unique_ptr< Out >(const In *const)> _run_fn)

A wrapper function that constructs a mapping wrapper for your mapping function.

Use this function if you don't need any state to maintain in your source node. If your mapping funciton is stateless, this can be a helpful function to use and wrap your lambda around.

Parameters
_run_fnA lambda function that outputs Out typed data when called with In type data.
Returns
A wrapped, compatible, dag node for the dag tree.

◆ fn_source()

template<typename Out>
dag_source< Out > * fn_dag::fn_source ( function< unique_ptr< Out >()> _run_fn)

A wrapper function that constructs a generator wrapper for your generator function.

Use this function if you don't need any state to maintain in your source node. If your generator is stateless, this can be a helpful function to use and wrap your lambda around.

Parameters
_run_fnA lambda function that outputs Out typed data when called
Returns
A wrapped, compatible, source node for the dag tree.

◆ fsys_serialize()

expected< string, error_codes > fn_dag::fsys_serialize ( const uint8_t *const _buffer_in)

(Beta) This function will take a spec in and serialize it back out to JSON.

Since the DAG does not contain all of the information available for serialization, this function will take a pipe_spec as a flatbuffer in byte buffer format. It will check the basic structure and then serialize it into JSON. Since the schema is needed for serialization, it makes sense to have it here. The beta functionality here is only due to the inconvienience of dealing with pipe specs without helper functions. For an example, check out the lib_test.cpp unit test example of constructing a pipe_spec.

Parameters
_buffer_inThe byte buffer in to be serialized to JSON.
Returns
The contents of a JSON file to be written out if necessary.

◆ get_all_available_libs()

expected< vector< fs::directory_entry >, error_codes > fn_dag::get_all_available_libs ( const fs::directory_entry & _library_path)
nodiscard

Similar to load_all_available_libs, this function will retreive compatible libraries in the directory.

This function iterates through a directory and returns the compatible dynamicly loadable library.

Parameters
_library_pathA path where many .so and .dylibs are expected to be.
Returns
A list of compatible files or an error code if unsucessful.

◆ operator<()

template<typename T>
bool fn_dag::operator< ( const GUID< T > & _left,
const GUID< T > & _right )

Less than operator.

This function checks to see if the GUID on the left is less than the GUID on the right. This function is required for sorting in general.

Parameters
_leftOne GUID to check.
_rightAnother GUID to check.
Returns
True if left is less than right, otherwise false.

◆ operator==()

template<typename T>
bool fn_dag::operator== ( const GUID< T > & _left,
const GUID< T > & _right )

Equality operator.

This function checks to see if two GUIDs of the same underlying type are equal.

Parameters
_leftOne GUID to check.
_rightAnother GUID to check.
Returns
True if equal, false otherwise.