forked from cyberbotics/webots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathField.hpp
More file actions
127 lines (110 loc) · 3.69 KB
/
Field.hpp
File metadata and controls
127 lines (110 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright 1996-2023 Cyberbotics Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef FIELD_HPP
#define FIELD_HPP
#define WB_USING_CPP_API
#include <string>
#include <webots/Node.hpp>
#include "../../c/webots/types.h"
#ifdef MF_STRING
#undef MF_STRING
#endif
namespace webots {
class Node;
class Field {
public:
typedef enum {
NO_FIELD = 0x00,
SF_BOOL = 0x01,
SF_INT32,
SF_FLOAT,
SF_VEC2F,
SF_VEC3F,
SF_ROTATION,
SF_COLOR,
SF_STRING,
SF_NODE,
MF = 0x10,
MF_BOOL,
MF_INT32,
MF_FLOAT,
MF_VEC2F,
MF_VEC3F,
MF_ROTATION,
MF_COLOR,
MF_STRING,
MF_NODE
} Type;
std::string getName() const;
Type getType() const;
std::string getTypeName() const;
int getCount() const;
void enableSFTracking(int samplingPeriod);
void disableSFTracking();
bool getSFBool() const;
int getSFInt32() const;
double getSFFloat() const;
const double *getSFVec2f() const;
const double *getSFVec3f() const;
const double *getSFRotation() const;
const double *getSFColor() const;
std::string getSFString() const;
Node *getSFNode() const;
bool getMFBool(int index) const;
int getMFInt32(int index) const;
double getMFFloat(int index) const;
const double *getMFVec2f(int index) const;
const double *getMFVec3f(int index) const;
const double *getMFRotation(int index) const;
const double *getMFColor(int index) const;
std::string getMFString(int index) const;
Node *getMFNode(int index) const;
void setSFBool(bool value);
void setSFInt32(int value);
void setSFFloat(double value);
void setSFVec2f(const double values[2]);
void setSFVec3f(const double values[3]);
void setSFRotation(const double values[4]);
void setSFColor(const double values[3]);
void setSFString(const std::string &value);
void setMFBool(int index, bool value);
void setMFInt32(int index, int value);
void setMFFloat(int index, double value);
void setMFVec2f(int index, const double values[2]);
void setMFVec3f(int index, const double values[3]);
void setMFRotation(int index, const double values[4]);
void setMFColor(int index, const double values[3]);
void setMFString(int index, const std::string &value);
void insertMFBool(int index, bool value);
void insertMFInt32(int index, int value);
void insertMFFloat(int index, double value);
void insertMFVec2f(int index, const double values[2]);
void insertMFVec3f(int index, const double values[3]);
void insertMFRotation(int index, const double values[4]);
void insertMFColor(int index, const double values[3]);
void insertMFString(int index, const std::string &value);
void removeMF(int index);
void removeSF();
void importMFNodeFromString(int position, const std::string &nodeString);
void importSFNodeFromString(const std::string &nodeString);
// DO NOT USE THESE FUNCTIONS: THEY ARE RESERVED FOR INTERNAL USE:
static Field *findField(WbFieldRef ref);
static void cleanup();
private:
Field(WbFieldRef ref);
~Field() {}
WbFieldRef fieldRef;
};
} // namespace webots
#endif // FIELD_HPP