codac 2.0.0
Loading...
Searching...
No Matches
codac2::FunctionArgsList Class Reference

A container class to manage a collection of function arguments. More...

#include <codac2_FunctionArgsList.h>

Public Member Functions

 FunctionArgsList ()=default
 Default constructor. It creates an empty list of arguments.
 FunctionArgsList (const FunctionArgsList &args)
 Copy constructor.
 FunctionArgsList (std::initializer_list< std::reference_wrapper< VarBase > > args)
 Constructor to initialize a FunctionArgsList from an initializer list of references to VarBase objects.
 FunctionArgsList (const std::vector< std::reference_wrapper< VarBase > > &args)
 Constructor to initialize a FunctionArgsList from a vector of of references to VarBase objects.
Index total_size () const
 Calculates the total size of the function arguments, as the sum of the sizes of each argument.

Detailed Description

A container class to manage a collection of function arguments.

Constructor & Destructor Documentation

◆ FunctionArgsList() [1/3]

codac2::FunctionArgsList::FunctionArgsList ( const FunctionArgsList & args)
inline

Copy constructor.

Each argument is deep-copied using its arg_copy() method.

Parameters
argsThe FunctionArgsList to copy from.
63 : std::vector<std::shared_ptr<VarBase>>(args.size())
64 {
65 size_t i = 0;
66 for(const auto& arg : args)
67 base::operator[](i++) = arg->arg_copy();
68 compute_unique_arg_names();
69 }

◆ FunctionArgsList() [2/3]

codac2::FunctionArgsList::FunctionArgsList ( std::initializer_list< std::reference_wrapper< VarBase > > args)
inline

Constructor to initialize a FunctionArgsList from an initializer list of references to VarBase objects.

Each argument is deep-copied by calling its arg_copy() on the referenced objects.

Parameters
argsAn initializer list of references to VarBase objects.
80 : FunctionArgsList(std::vector<std::reference_wrapper<VarBase>>(args))
81 { }
FunctionArgsList()=default
Default constructor. It creates an empty list of arguments.

◆ FunctionArgsList() [3/3]

codac2::FunctionArgsList::FunctionArgsList ( const std::vector< std::reference_wrapper< VarBase > > & args)
inline

Constructor to initialize a FunctionArgsList from a vector of of references to VarBase objects.

Each argument is deep-copied by calling its arg_copy() on the referenced objects.

Parameters
argsAn initializer list of references to VarBase objects.
92 {
93 for(const auto& arg : args)
94 push_back(arg.get().arg_copy());
95 compute_unique_arg_names();
96 }

Member Function Documentation

◆ total_size()

Index codac2::FunctionArgsList::total_size ( ) const
inline

Calculates the total size of the function arguments, as the sum of the sizes of each argument.

Returns
The sum of the sizes of all arguments.
111 {
112 return _total_args_size;
113 }

The documentation for this class was generated from the following file: