VSM C++ SDK
Vehicle Specific Modules SDK
utils.h File Reference

Various common utilities. More...

#include <memory>
#include <ugcs/vsm/debug.h>
#include <ugcs/vsm/exception.h>
#include <type_traits>
#include <ugcs/vsm/regex.h>

Go to the source code of this file.

Classes

class  ugcs::vsm::internal::Shared_getter< T, Shared_base >
 Helper class for working with classes which are derived from std::enable_shared_from_this. More...
 
class  ugcs::vsm::internal::Shared_getter< T, void >
 Specialization for class which is not derived from std::enable_shared_from_this. More...
 
class  ugcs::vsm::internal::Shared_getter< T, T >
 Specialization for class which is directly derived from std::enable_shared_from_this. More...
 

Namespaces

 ugcs
 UGCS root namespace.
 
 ugcs::vsm
 All VSM SDK functionality resides in this namespace.
 

Macros

#define DEFINE_COMMON_CLASS(__class_name, ...)
 Use this macro to define some common attributes for a class. More...
 

Functions

template<typename T , typename... Args>
std::unique_ptr< T > std::make_unique (Args &&...args)
 Method for creating non sharable objects, until this method is added to C++14. More...
 
uint32_t ugcs::vsm::Get_application_instance_id ()
 Return instance id which is randomly generated on the first call.
 
uint64_t ugcs::vsm::Get_random_seed ()
 Return a random number on each call. More...
 

Variables

regex::regex_constants::syntax_option_type ugcs::vsm::platform_independent_filename_regex_matching_flag
 This flag is used to support case insensitive file systems in regular expression matching. More...
 

Detailed Description

Various common utilities.

Macro Definition Documentation

#define DEFINE_COMMON_CLASS (   __class_name,
  ... 
)
Value:
public: \
\ \
typedef std::shared_ptr<__class_name> Ptr; \
\ \
typedef std::weak_ptr<__class_name> Weak_ptr; \
\ \
template <typename... Args> \
static Ptr \
Create(Args &&... args) \
{ \
return std::make_shared<__class_name>(std::forward<Args>(args)...); \
} \
\
private: \
friend Shared_getter; \ \ \
Ptr \
Shared_from_this() \
{ \
return Shared_getter::Get(this); \
}
Helper class for working with classes which are derived from std::enable_shared_from_this.
Definition: utils.h:72
T Get() const
Get the value of underlying type.
Definition: endian.h:324

Use this macro to define some common attributes for a class.

Parameters
__class_nameName for the class being defined.
...Name of the class used as a template parameter when deriving from std::enable_shared_from_this.
Examples:
async_workflow.cpp.

Function Documentation

template<typename T , typename... Args>
std::unique_ptr<T> std::make_unique ( Args &&...  args)

Method for creating non sharable objects, until this method is added to C++14.