File kernel/src/utils/SiconosTools/Tools.hpp#

Go to the source code of this file

Various useful functions and typedef.

Defines

PRINTSEQUENCE_H#

Typedefs

typedef std::deque<bool> AllocationFlags#

A vector of unsigned integers used in some cases in kernel.

Type used for inside-class allocation checking

Functions

template<class T>
std::string toString(const T &obj)#

A function to convert any type to std::string.

template<class Seq>
void purge(Seq &c)#

to purge a STL container of pointers, assuming it owns all its pointers.

Parameters:

a – STL sequence container

template<class InpIt>
void purge(InpIt begin, InpIt end)#

to purge a STL container of pointers, assuming it owns all its pointers.

Parameters:
  • iterator – equal to a container.begin()

  • iterator – equal to a container.end()

template<class Seq>
void purge(Seq &c, const std::vector<bool> &isAllocatedIn)#

to purge a STL container of pointers; only pointers owned by the container, ie for which second arg corresponding value is true, are deleted.

Parameters:
  • a – STL sequence container

  • a – std::vector<bool>

template<class InpIt>
void purge(InpIt begin, InpIt end, const std::vector<bool> &isAllocatedIn)#

to purge a STL container of pointers, assuming it owns all its pointers.

Parameters:
  • iterator – equal to a container.begin()

  • iterator – equal to a container.end()

template<class T, class SPT, class U>
void setObject(SPT &obj, const U &val)#

To copy a value into an object ( created if required)

Parameters:
  • a – smart pointer to T (SPT): the object to be filled - Must have op= and copy constructor from U.

  • type – U param, the value to be assigned.

template<class S, class G>
std::shared_ptr<S> setOfGraph(std::shared_ptr<G> g)#

Graph -> Set conversion.

template<typename Iter>
void print(Iter first, Iter last, const char *nm = "", const char *sep = "\n", std::ostream &os = std::cout)#

Print the contents of any sequence - From Thinking in C++, vol 2 p365.

Parameters:
  • first, any – iterator, beginning of the sequence

  • last, any – iterator, end of the sequence

  • char*, optional – message on top of output, default “”

  • char*, separator – between sequence elements, default new line

  • ostream, output – destination, default std::cout