Ariles
boost_optional.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2017-2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 #include <boost/optional.hpp>
14 #include "../internal/helpers.h"
15 
16 namespace ariles2
17 {
18  template <class t_Value>
19  class PointerHandler<boost::optional<t_Value> >
20  {
21  public:
22  typedef boost::optional<t_Value> Pointer;
23  typedef t_Value Value;
24 
25 
26  public:
27  static void allocate(Pointer &ptr)
28  {
29  ptr = t_Value();
30  }
31 
32  static void reset(Pointer &ptr)
33  {
34  ptr = boost::none;
35  }
36 
37  static bool isNull(const Pointer &ptr)
38  {
39  return (boost::none == ptr);
40  }
41  };
42 } // namespace ariles2
43 
44 #define ARILES2_POINTER_TYPE boost::optional
ariles2
Definition: basic.h:16
ariles2::PointerHandler< boost::optional< t_Value > >::isNull
static bool isNull(const Pointer &ptr)
Definition: boost_optional.h:37
ariles2::PointerHandler< boost::optional< t_Value > >::allocate
static void allocate(Pointer &ptr)
Definition: boost_optional.h:27
ariles2::PointerHandler
class ARILES2_VISIBILITY_ATTRIBUTE PointerHandler
Definition: helpers.h:150
ariles2::PointerHandler< boost::optional< t_Value > >::Value
t_Value Value
Definition: boost_optional.h:23
ariles2::PointerHandler< boost::optional< t_Value > >::Pointer
boost::optional< t_Value > Pointer
Definition: boost_optional.h:22
ariles2::PointerHandler< boost::optional< t_Value > >::reset
static void reset(Pointer &ptr)
Definition: boost_optional.h:32
generic_pointer.h