hpp-core 6.0.0
Implement basic classes for canonical path planning for kinematic chains.
Loading...
Searching...
No Matches
parameter.hh
Go to the documentation of this file.
1//
2// Copyright 2018 CNRS
3//
4// Author: Florent Lamiraux, Joseph Mirabel
5//
6
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are
9// met:
10//
11// 1. Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13//
14// 2. Redistributions in binary form must reproduce the above copyright
15// notice, this list of conditions and the following disclaimer in the
16// documentation and/or other materials provided with the distribution.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29// DAMAGE.
30
31#ifndef HPP_CORE_PARAMETER_HH
32#define HPP_CORE_PARAMETER_HH
33
34#include <cassert>
35#include <hpp/core/config.hh>
36#include <hpp/core/fwd.hh>
37#include <iostream>
38#include <string>
39#include <typeinfo>
40
41namespace hpp {
42namespace core {
43/*
44class Parameter;
45class DYNAMIC_GRAPH_DLLAPI EitherType {
46public:
47 EitherType(const Parameter& value);
48 ~EitherType();
49 operator bool () const;
50 operator unsigned () const;
51 operator int () const;
52 operator float () const;
53 operator double () const;
54 operator std::string () const;
55 operator Vector () const;
56 operator Eigen::MatrixXd () const;
57 operator Eigen::Matrix4d () const;
58private:
59 const Parameter* value_;
60};
61*/
62
64 public:
81 explicit Parameter(const bool& value);
82 explicit Parameter(const size_type& value);
83 explicit Parameter(const value_type& value);
84 explicit Parameter(const std::string& value);
85 explicit Parameter(const vector_t& value);
86 explicit Parameter(const matrix_t& value);
88 Parameter(const Parameter& value);
90 explicit Parameter();
91 // operator assignement
94 Type type() const;
95
107 // const EitherType value () const;
109 static std::string typeName(Type type);
110
112 HPP_CORE_DLLAPI friend std::ostream& operator<<(std::ostream& os,
113 const Parameter& value);
114
115 public:
116 // friend class EitherType;
117 bool boolValue() const;
120 std::string stringValue() const;
124
125 const void* const value_;
126};
127
129 public:
130 ParameterDescription(Parameter::Type type, std::string name,
131 std::string doc = "",
132 Parameter defaultValue = Parameter())
133 : name_(name), doc_(doc), type_(type), defaultValue_(defaultValue) {}
134
135 ParameterDescription() : type_(Parameter::NONE) {}
136
137 const std::string& name() const { return name_; }
138 const Parameter::Type& type() const { return type_; }
139 const std::string& doc() const { return doc_; }
140 const Parameter& defaultValue() const;
141
142 private:
143 std::string name_;
144 std::string doc_;
145 Parameter::Type type_;
146 Parameter defaultValue_;
147};
148} // namespace core
149} // namespace hpp
150
151#endif // HPP_CORE_PARAMETER_HH
Definition parameter.hh:128
ParameterDescription(Parameter::Type type, std::string name, std::string doc="", Parameter defaultValue=Parameter())
Definition parameter.hh:130
ParameterDescription()
Definition parameter.hh:135
const std::string & name() const
Definition parameter.hh:137
const Parameter::Type & type() const
Definition parameter.hh:138
const std::string & doc() const
Definition parameter.hh:139
const Parameter & defaultValue() const
Definition parameter.hh:63
Parameter(const value_type &value)
matrix_t matrixValue() const
Parameter()
Construct an empty parameter (None)
Type
Definition parameter.hh:65
@ STRING
Definition parameter.hh:72
@ VECTOR
as vector_t
Definition parameter.hh:74
@ NONE
Definition parameter.hh:66
@ BOOL
Definition parameter.hh:67
@ FLOAT
as value_type
Definition parameter.hh:71
@ MATRIX
as matrix_t
Definition parameter.hh:76
@ INT
as size_type
Definition parameter.hh:69
Type type() const
Return the type of the value.
Parameter operator=(const Parameter &value)
value_type floatValue() const
bool boolValue() const
HPP_CORE_DLLAPI friend std::ostream & operator<<(std::ostream &os, const Parameter &value)
Output in a stream.
Parameter(const matrix_t &value)
Type type_
Definition parameter.hh:123
static std::string typeName(Type type)
Return the name of the type.
Parameter(const std::string &value)
size_type intValue() const
Parameter(const Parameter &value)
Copy constructor.
Parameter(const bool &value)
Parameter(const size_type &value)
Parameter(const vector_t &value)
std::string stringValue() const
const void *const value_
Definition parameter.hh:125
vector_t vectorValue() const
#define HPP_CORE_DLLAPI
Definition config.hh:88
pinocchio::value_type value_type
Definition fwd.hh:174
pinocchio::vector_t vector_t
Definition fwd.hh:220
pinocchio::size_type size_type
Definition fwd.hh:173
pinocchio::matrix_t matrix_t
Definition fwd.hh:162
Definition bi-rrt-planner.hh:35