DbcSignal.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2015-2020, Dataspeed Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Dataspeed Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef _DBC_SIGNAL_HPP
36 #define _DBC_SIGNAL_HPP
37 
38 #include <string>
39 #include <iosfwd>
40 #include <set>
41 
42 typedef enum {
45 } ByteOrder;
46 
47 typedef enum {
50 } Sign;
51 
52 typedef enum {
56 } Multiplexor;
57 
58 
64 class Signal {
65 
66  typedef std::set<std::string> toList;
67  // The name of the Signal in the DBC-File
68  std::string name;
69  // The Byteorder of the Signal (@see: endianess)
71  // The Startbit inside the Message of this Signal. Allowed values are 0-63
72  unsigned short startBit;
73  // The Length of the Signal. It can be anything between 1 and 64
74  unsigned short length;
75  // If the Data contained in the Signal is signed or unsigned Data
77  // Depending on the information given above one can calculate the minimum of this Signal
78  double minimum;
79  // Depending on the information given above one can calculate the maximum of this Signal
80  double maximum;
81  // The Factor for calculating the physical value: phys = digits * factor + offset
82  double factor;
83  // The offset for calculating the physical value: phys = digits * factor + offset
84  double offset;
85  // String containing an associated unit.
86  std::string unit;
87  // Contains weather the Signal is Multiplexed and if it is, multiplexNum contains multiplex number
89  // Contains the multiplex Number if the Signal is multiplexed
90  unsigned short multiplexNum;
91  // Contains to which Control Units in the CAN-Network the Signal shall be sent
92  toList to;
93 
94 public:
95  // Overload of operator>> to allow parsing from DBC Streams
96  friend std::istream& operator>>(std::istream& in, Signal& sig);
97 
98  // Getter for all the Values contained in a Signal
99  const std::string& getName() const { return name; }
100  ByteOrder getByteOrder() const { return order; }
101  unsigned short getStartbit() const { return startBit; }
102  unsigned short getLength() const { return length; }
103  Sign getSign() const { return sign; }
104  double getMinimum() const { return minimum; }
105  double getMaximum() const { return maximum; }
106  double getFactor() const { return factor; }
107  double getOffset() const { return offset; }
108  const std::string& getUnit() const { return unit; }
110  unsigned short getMultiplexedNumber() const { return multiplexNum; }
111  const toList& getTo() const { return to; }
112 
113 };
114 
115 #endif /* _DBC_SIGNAL_HPP */
116 
Sign getSign() const
Definition: DbcSignal.hpp:103
std::string name
Definition: DbcSignal.hpp:68
const toList & getTo() const
Definition: DbcSignal.hpp:111
std::string unit
Definition: DbcSignal.hpp:86
Sign
Definition: DbcSignal.hpp:47
friend std::istream & operator>>(std::istream &in, Signal &sig)
Definition: DbcSignal.cpp:70
double getFactor() const
Definition: DbcSignal.hpp:106
Multiplexor multiplexor
Definition: DbcSignal.hpp:88
ByteOrder
Definition: DbcSignal.hpp:42
std::set< std::string > toList
Definition: DbcSignal.hpp:66
const std::string & getName() const
Definition: DbcSignal.hpp:99
Multiplexor getMultiplexor() const
Definition: DbcSignal.hpp:109
unsigned short length
Definition: DbcSignal.hpp:74
ByteOrder order
Definition: DbcSignal.hpp:70
unsigned short getStartbit() const
Definition: DbcSignal.hpp:101
Multiplexor
Definition: DbcSignal.hpp:52
unsigned short getLength() const
Definition: DbcSignal.hpp:102
double offset
Definition: DbcSignal.hpp:84
ByteOrder getByteOrder() const
Definition: DbcSignal.hpp:100
double minimum
Definition: DbcSignal.hpp:78
double factor
Definition: DbcSignal.hpp:82
const std::string & getUnit() const
Definition: DbcSignal.hpp:108
double getMaximum() const
Definition: DbcSignal.hpp:105
unsigned short getMultiplexedNumber() const
Definition: DbcSignal.hpp:110
unsigned short startBit
Definition: DbcSignal.hpp:72
Sign sign
Definition: DbcSignal.hpp:76
double getOffset() const
Definition: DbcSignal.hpp:107
double getMinimum() const
Definition: DbcSignal.hpp:104
unsigned short multiplexNum
Definition: DbcSignal.hpp:90
double maximum
Definition: DbcSignal.hpp:80
toList to
Definition: DbcSignal.hpp:92


dataspeed_can_tools
Author(s): Micho Radovnikovich
autogenerated on Thu Jul 9 2020 03:41:59