4 #ifndef YARP_THRIFT_GENERATOR_STRUCT_SurfaceMeshWithBoundingBox 5 #define YARP_THRIFT_GENERATOR_STRUCT_SurfaceMeshWithBoundingBox 7 #include <yarp/os/Wire.h> 8 #include <yarp/os/idl/WireTypes.h> 9 #include <iCub/data3D/Box3D.h> 10 #include <iCub/data3D/SurfaceMesh.h> 14 class SurfaceMeshWithBoundingBox;
19 class iCub::data3D::SurfaceMeshWithBoundingBox :
public yarp::os::idl::WirePortable {
26 SurfaceMeshWithBoundingBox() {
30 SurfaceMeshWithBoundingBox(
const SurfaceMesh& mesh,
const Box3D& boundingBox) : mesh(mesh), boundingBox(boundingBox) {
34 SurfaceMeshWithBoundingBox(
const SurfaceMeshWithBoundingBox& __alt) : WirePortable(__alt) {
35 this->mesh = __alt.mesh;
36 this->boundingBox = __alt.boundingBox;
40 const SurfaceMeshWithBoundingBox& operator = (
const SurfaceMeshWithBoundingBox& __alt) {
41 this->mesh = __alt.mesh;
42 this->boundingBox = __alt.boundingBox;
47 bool read(yarp::os::idl::WireReader& reader);
48 bool read(yarp::os::ConnectionReader& connection);
49 bool write(yarp::os::idl::WireWriter& writer);
50 bool write(yarp::os::ConnectionWriter& connection);
53 bool write_mesh(yarp::os::idl::WireWriter& writer);
54 bool nested_write_mesh(yarp::os::idl::WireWriter& writer);
55 bool write_boundingBox(yarp::os::idl::WireWriter& writer);
56 bool nested_write_boundingBox(yarp::os::idl::WireWriter& writer);
57 bool read_mesh(yarp::os::idl::WireReader& reader);
58 bool nested_read_mesh(yarp::os::idl::WireReader& reader);
59 bool read_boundingBox(yarp::os::idl::WireReader& reader);
60 bool nested_read_boundingBox(yarp::os::idl::WireReader& reader);
64 yarp::os::ConstString toString();
67 typedef yarp::os::idl::Unwrapped<iCub::data3D::SurfaceMeshWithBoundingBox > unwrapped;
69 class Editor :
public yarp::os::Wire,
public yarp::os::PortWriter {
75 obj =
new SurfaceMeshWithBoundingBox;
77 yarp().setOwner(*
this);
80 Editor(SurfaceMeshWithBoundingBox& obj) {
84 yarp().setOwner(*
this);
87 bool edit(SurfaceMeshWithBoundingBox& obj,
bool dirty =
true) {
88 if (obj_owned)
delete this->obj;
96 if (obj_owned)
delete obj;
99 bool isValid()
const {
103 SurfaceMeshWithBoundingBox& state() {
return *obj; }
105 void begin() { group++; }
109 if (group==0&&is_dirty) communicate();
111 void set_mesh(
const SurfaceMesh& mesh) {
118 void set_boundingBox(
const Box3D& boundingBox) {
119 will_set_boundingBox();
120 obj->boundingBox = boundingBox;
121 mark_dirty_boundingBox();
123 did_set_boundingBox();
125 const SurfaceMesh& get_mesh() {
128 const Box3D& get_boundingBox() {
129 return obj->boundingBox;
131 virtual bool will_set_mesh() {
return true; }
132 virtual bool will_set_boundingBox() {
return true; }
133 virtual bool did_set_mesh() {
return true; }
134 virtual bool did_set_boundingBox() {
return true; }
138 bool read(yarp::os::ConnectionReader& connection);
139 bool write(yarp::os::ConnectionWriter& connection);
142 SurfaceMeshWithBoundingBox *obj;
148 if (group!=0)
return;
149 if (yarp().canWrite()) {
157 void mark_dirty_mesh() {
158 if (is_dirty_mesh)
return;
160 is_dirty_mesh =
true;
163 void mark_dirty_boundingBox() {
164 if (is_dirty_boundingBox)
return;
166 is_dirty_boundingBox =
true;
169 void dirty_flags(
bool flag) {
171 is_dirty_mesh = flag;
172 is_dirty_boundingBox = flag;
173 dirty_count = flag ? 2 : 0;
178 bool is_dirty_boundingBox;