gepetto-viewer-corba 5.8.0
Corba server for gepetto-viewer
Loading...
Searching...
No Matches
conversions.hh
Go to the documentation of this file.
1// Created by Joseph Mirabel in December 2020.
2// Copyright (c) 2020 LAAS-CNRS. All rights reserved.
3//
4
5#ifndef GEPETTO_VIEWER_CORBA_CONVERSIONS_HH
6#define GEPETTO_VIEWER_CORBA_CONVERSIONS_HH
7
8#include <assert.h>
9#include <omniORB4/CORBA.h>
10
11#include <gepetto/viewer/corba/graphical-interface.hh>
12
13namespace gepetto {
14namespace viewer {
15namespace corba {
16using namespace ::gepetto::corbaserver;
17
18#if __cplusplus >= 201103L
19
20template <typename Scalar>
21PositionSeq positionSeq(
22 std::initializer_list<std::initializer_list<Scalar> > l) {
23 Position* posSeq = PositionSeq::allocbuf((CORBA::ULong)l.size());
24
25 PositionSeq seq((CORBA::ULong)l.size(), (CORBA::ULong)l.size(), posSeq);
26 CORBA::ULong i = 0;
27 for (const std::initializer_list<Scalar>& el : l) {
28 assert(el.size() == 3);
29 const Scalar* f = el.begin();
30 posSeq[i][0] = static_cast<float>(*(f++));
31 posSeq[i][1] = static_cast<float>(*(f++));
32 posSeq[i][2] = static_cast<float>(*(f++));
33 ++i;
34 }
35 return seq;
36}
37
38#endif // __cplusplus >= 201103L
39
40} // end of namespace corba
41} // end of namespace viewer
42} // end of namespace gepetto
43
44#endif // GEPETTO_VIEWER_CORBA_CONVERSIONS_HH
Definition graphical-interface.idl:9
float Position[3]
Definition graphical-interface.idl:22
sequence< Position > PositionSeq
Definition graphical-interface.idl:27
Definition url.hh:24