Writer.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5  * Karlsruhe Institute of Technology (KIT), all rights reserved.
6  *
7  * ArmarX is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * ArmarX is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * @author Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 
25 // Simox
26 #include <SimoxUtility/algorithm/string.h>
27 
28 // Header
29 #include "Writer.h"
30 
31 // ArmarX
32 
34 {
35 
36  // Function to convert camel case
37  // string to snake case string
38  std::string camelToSnake(const std::string& str)
39  {
40 
41  // Empty String
42  std::string result = "";
43 
44  // Append first character(in lower case)
45  // to result string
46  char c = std::tolower(str[0]);
47  result+=(char(c));
48 
49  // Traverse the string from
50  // ist index to last index
51  for (unsigned int i = 1; i < str.length(); i++) {
52 
53  char ch = str[i];
54 
55  // Check if the character is upper case
56  // then append '_' and such character
57  // (in lower case) to result string
58  if (std::isupper(ch)) {
59  result = result + '_';
60  result+=char(std::tolower(ch));
61  }
62 
63  // If the character is lower case then
64  // add such character into result string
65  else {
66  result = result + ch;
67  }
68  }
69 
70  // return the result
71  return result;
72  }
73 
74  Writer::Writer(const std::string& producerName, const std::vector<std::string>& additionalIncludesFromXMLFile) :
75  CodeWriter(producerName, additionalIncludesFromXMLFile)
76  {
79  }
80 
82  {
83  // DictData stuff
84  {
85  {
87  toAron.methodName = "toAron";
88  toAron.returnType = "armarx::aron::data::DictPtr";
89  toAron.writerClassType = "armarx::aron::data::writer::VariantWriter";
90  toAron.include =
91  "<RobotAPI/libraries/aron/core/data/rw/writer/variant/VariantWriter.h>";
92  toAron.enforceConversion = "armarx::aron::data::Dict::DynamicCastAndCheck";
93  toAron.override = true;
94  dictDataWriters.push_back(toAron);
95  }
96  {
97  codegenerator::WriterInfo toAronDTO;
98  toAronDTO.methodName = "toAronDTO";
99  toAronDTO.returnType = "armarx::aron::data::dto::DictPtr";
100  toAronDTO.writerClassType = "armarx::aron::data::writer::VariantWriter";
101  toAronDTO.include =
102  "<RobotAPI/libraries/aron/core/data/rw/writer/variant/VariantWriter.h>";
103  toAronDTO.enforceConversion = "armarx::aron::data::Dict::DynamicCastAndCheck";
104  toAronDTO.enforceMemberAccess = "->toAronDictDTO()";
105  toAronDTO.override = true;
106  dictDataWriters.push_back(toAronDTO);
107  }
108  {
109  // The toAron Serializer is visible by default
110  codegenerator::WriterInfo ToAronType;
111  ToAronType.methodName = "ToAronType";
112  ToAronType.returnType = "armarx::aron::type::ObjectPtr";
113  ToAronType.writerClassType = "armarx::aron::type::writer::VariantWriter";
114  ToAronType.include =
115  "<RobotAPI/libraries/aron/core/type/rw/writer/variant/VariantWriter.h>";
116  ToAronType.enforceConversion = "armarx::aron::type::Object::DynamicCastAndCheck";
117  initialDictTypeWriters.push_back(ToAronType);
118  }
119  {
120  // The toAron Serializer is visible by default
121  codegenerator::WriterInfo ToAronTypeDTO;
122  ToAronTypeDTO.methodName = "ToAronTypeDTO";
123  ToAronTypeDTO.returnType = "armarx::aron::type::dto::AronObjectPtr";
124  ToAronTypeDTO.writerClassType = "armarx::aron::type::writer::VariantWriter";
125  ToAronTypeDTO.include =
126  "<RobotAPI/libraries/aron/core/type/rw/writer/variant/VariantWriter.h>";
127  ToAronTypeDTO.enforceConversion = "armarx::aron::type::Object::DynamicCastAndCheck";
128  ToAronTypeDTO.enforceMemberAccess = "->toAronObjectDTO()";
129  initialDictTypeWriters.push_back(ToAronTypeDTO);
130  }
131  }
132 
133  // IntEnum stuff
134  {
135  {
137  toAron.methodName = "toAron";
138  toAron.returnType = "armarx::aron::data::IntPtr";
139  toAron.writerClassType = "armarx::aron::data::writer::VariantWriter";
140  toAron.include =
141  "<RobotAPI/libraries/aron/core/data/rw/writer/variant/VariantWriter.h>";
142  toAron.enforceConversion = "armarx::aron::data::Int::DynamicCastAndCheck";
143  toAron.override = true;
144  intEnumDataWriters.push_back(toAron);
145  }
146  {
147  codegenerator::WriterInfo toAronDTO;
148  toAronDTO.methodName = "toAronDTO";
149  toAronDTO.returnType = "armarx::aron::data::dto::AronIntPtr";
150  toAronDTO.writerClassType = "armarx::aron::data::writer::VariantWriter";
151  toAronDTO.include =
152  "<RobotAPI/libraries/aron/core/data/rw/writer/variant/VariantWriter.h>";
153  toAronDTO.enforceConversion = "armarx::aron::data::Int::DynamicCastAndCheck";
154  toAronDTO.enforceMemberAccess = "->toAronIntDTO()";
155  toAronDTO.override = true;
156  intEnumDataWriters.push_back(toAronDTO);
157  }
158  {
159  // The toAron Serializer is visible by default
160  codegenerator::WriterInfo ToAronType;
161  ToAronType.methodName = "ToAronType";
162  ToAronType.returnType = "armarx::aron::type::IntEnumPtr";
163  ToAronType.writerClassType = "armarx::aron::type::writer::VariantWriter";
164  ToAronType.include =
165  "<RobotAPI/libraries/aron/core/type/rw/writer/variant/VariantWriter.h>";
166  ToAronType.enforceConversion = "armarx::aron::type::IntEnum::DynamicCastAndCheck";
167  initialIntEnumTypeWriters.push_back(ToAronType);
168  }
169  {
170  // The toAron Serializer is visible by default
171  codegenerator::WriterInfo ToAronTypeDTO;
172  ToAronTypeDTO.methodName = "ToAronTypeDTO";
173  ToAronTypeDTO.returnType = "armarx::aron::type::dto::IntEnumPtr";
174  ToAronTypeDTO.writerClassType = "armarx::aron::type::writer::VariantWriter";
175  ToAronTypeDTO.include =
176  "<RobotAPI/libraries/aron/core/type/rw/writer/variant/VariantWriter.h>";
177  ToAronTypeDTO.enforceConversion = "armarx::aron::type::IntEnum::DynamicCastAndCheck";
178  ToAronTypeDTO.enforceMemberAccess = "->toIntEnumDTO()";
179  initialIntEnumTypeWriters.push_back(ToAronTypeDTO);
180  }
181  }
182  }
183 
185  {
186  // Dict stuff
187  {
188  {
190  fromAron.methodName = "FromAron";
191  fromAron.argumentType = "armarx::aron::data::DictPtr";
192  fromAron.returnType = OWN_TYPE_NAME;
193  staticDictDataReaders.push_back(fromAron);
194  }
195  {
197  fromAronDTO.methodName = "FromAron";
198  fromAronDTO.argumentType = "armarx::aron::data::dto::DictPtr";
199  fromAronDTO.returnType = OWN_TYPE_NAME;
200  staticDictDataReaders.push_back(fromAronDTO);
201  }
202  {
204  fromAron.methodName = "fromAron";
205  fromAron.argumentType = "armarx::aron::data::DictPtr";
206  fromAron.readerClassType = "armarx::aron::data::reader::VariantReader";
207  fromAron.include = "<RobotAPI/libraries/aron/core/data/rw/reader/variant/VariantReader.h>";
208  fromAron.override = true;
209  dictDataReaders.push_back(fromAron);
210  }
211  {
212  codegenerator::ReaderInfo fromAronDTO;
213  fromAronDTO.methodName = "fromAron";
214  fromAronDTO.argumentType = "armarx::aron::data::dto::DictPtr";
215  fromAronDTO.readerClassType = "armarx::aron::data::reader::VariantReader";
216  fromAronDTO.include = "<RobotAPI/libraries/aron/core/data/rw/reader/variant/VariantReader.h>";
217  fromAronDTO.enforceConversion = "std::make_shared<armarx::aron::data::Dict>";
218  fromAronDTO.override = true;
219  dictDataReaders.push_back(fromAronDTO);
220  }
221  }
222 
223  // IntEnum stuff
224  {
225  {
227  fromAron.methodName = "FromAron";
228  fromAron.argumentType = "armarx::aron::data::IntPtr";
229  fromAron.returnType = OWN_TYPE_NAME;
231  }
232  {
234  fromAronDTO.methodName = "FromAron";
235  fromAronDTO.argumentType = "armarx::aron::data::dto::AronIntPtr";
236  fromAronDTO.returnType = OWN_TYPE_NAME;
237  staticIntEnumDataReaders.push_back(fromAronDTO);
238  }
239  {
241  fromAron.methodName = "fromAron";
242  fromAron.argumentType = "armarx::aron::data::IntPtr";
243  fromAron.readerClassType = "armarx::aron::data::reader::VariantReader";
244  fromAron.include = "<RobotAPI/libraries/aron/core/data/rw/reader/variant/VariantReader.h>";
245  fromAron.override = true;
246  intEnumDataReaders.push_back(fromAron);
247  }
248  {
249  codegenerator::ReaderInfo fromAronDTO;
250  fromAronDTO.methodName = "fromAron";
251  fromAronDTO.argumentType = "armarx::aron::data::dto::AronIntPtr";
252  fromAronDTO.readerClassType = "armarx::aron::data::reader::VariantReader";
253  fromAronDTO.include =
254  "<RobotAPI/libraries/aron/core/data/rw/reader/variant/VariantReader.h>";
255  fromAronDTO.enforceConversion = "std::make_shared<armarx::aron::data::Int>";
256  fromAronDTO.override = true;
257  intEnumDataReaders.push_back(fromAronDTO);
258  }
259  }
260  }
261 
262 
263  void Writer::generateTypeObjects(const std::vector<typereader::GenerateObjectInfo>& generateObjects)
264  {
265  for (const auto& publicGenerateObjectType : generateObjects)
266  {
267  const auto type = publicGenerateObjectType.correspondingType;
268 
269  //std::cout << "Generating: " << nav->getName() << std::endl;
270 
271  // Convert to Object type and create class object
272  ARMARX_CHECK_NOT_NULL(type);
273 
274  generator::ObjectClass generator(*type);
275  CppClassPtr c = setupBasicCppClass(publicGenerateObjectType, generator);
276  setupMemberFields(c, publicGenerateObjectType.doc_members, generator);
277 
278  // check for templates
279  if (!type->getTemplates().empty())
280  {
281  std::vector<std::string> tmpl;
282  std::vector<std::string> tmpl_requires;
283  for (auto& t : type->getTemplates())
284  {
285  tmpl_requires.push_back("armarx::aron::cpp::isAronGeneratedObject<" + t + ">");
286  tmpl.push_back("class " + t);
287  }
288  std::string templateDef = "template <" + simox::alg::join(tmpl, ", ") + ">";
289  std::string requiresDef = "requires " + simox::alg::join(tmpl_requires, " && ");
290  c->setTemplates(templateDef + "\n" + requiresDef);
291  }
292 
293  // check for inheritance
294  if (type->getExtends() != nullptr)
295  {
296  generator::ObjectClass extendsSerializer(*type->getExtends());
297  c->addInherit("public " + extendsSerializer.getFullInstantiatedCppTypename());
298  }
299  else
300  {
301  c->addInherit("public armarx::aron::cpp::AronGeneratedObject<" + generator.getFullClassCppTypename() + ">");
302  }
303 
304  // Writermethods
306  {
307  if (info.returnType == OWN_TYPE_NAME)
308  {
309  info.returnType = generator.getFullClassCppTypename();
310  }
311 
312  if (!info.include.empty())
313  {
314  c->addInclude(info.include);
315  }
316 
318  c->addPublicMethod(convert);
319  }
320 
321  // Add methods to set the member variables
322  // also resolve the original class name if the return type is set to special
324  {
325  if (info.returnType == OWN_TYPE_NAME)
326  {
327  info.returnType = generator.getFullClassCppTypename();
328  }
329  if (info.argumentType == OWN_TYPE_NAME)
330  {
331  info.argumentType = generator.getFullClassCppTypename();
332  }
333 
335  c->addPublicMethod(convert);
336  }
337 
338  // Add methods to set the member variables
340  {
341  if (info.argumentType == OWN_TYPE_NAME)
342  {
343  info.argumentType = generator.getFullClassCppTypename();
344  }
345 
346  if (!info.include.empty())
347  {
348  c->addInclude(info.include);
349  }
350 
352  c->addPublicMethod(convert);
353  }
354 
355  // Typewritermethods
357  {
358  if (info.returnType == OWN_TYPE_NAME)
359  {
360  info.returnType = generator.getFullClassCppTypename();
361  }
362 
363  if (!info.include.empty())
364  {
365  c->addInclude(info.include);
366  }
368  c->addPublicMethod(convert);
369  }
370 
371  typeClasses.push_back(c);
372  }
373  }
374 
375  void Writer::generateTypeIntEnums(const std::vector<typereader::GenerateIntEnumInfo>& generateIntEnums)
376  {
377  for (const auto& publicGenerateIntEnumType : generateIntEnums)
378  {
379  const auto& nav = publicGenerateIntEnumType.correspondingType;
381 
382  generator::IntEnumClass generator(*nav);
383 
384  // Create enum class and add to enums
385  CppEnumPtr enumrepresentation = setupEnumPtr(publicGenerateIntEnumType, generator);
386  typeEnums.push_back(enumrepresentation);
387 
388  // Generate aron wrapper class and add to classes
389  CppClassPtr c = setupBasicCppClass(publicGenerateIntEnumType, generator);
390  c->addInclude("<RobotAPI/libraries/aron/core/data/variant/primitive/Int.h>");
391 
392  setupMemberFields(c, publicGenerateIntEnumType.doc_values, generator);
393 
394  c->addInherit("public armarx::aron::cpp::AronGeneratedIntEnum<" + generator.getFullClassCppTypename() + ">");
395 
396  // ctor
397  c->addCtor(generator.toEnumCtor(c->getName()));
398 
399  CppMethodPtr toString = generator.toToStringMethod();
400  c->addPublicMethod(toString);
401 
402  CppMethodPtr fromString = generator.toFromStringMethod();
403  c->addPublicMethod(fromString);
404 
405  CppMethodPtr intConversion = generator.toIntMethod();
406  c->addPublicMethod(intConversion);
407 
408  CppMethodPtr enumAssignment = generator.toEnumAssignmentMethod();
409  c->addPublicMethod(enumAssignment);
410 
411  CppMethodPtr enumAssignment2 = generator.toCopyAssignmentMethod();
412  c->addPublicMethod(enumAssignment2);
413 
414  CppMethodPtr enumAssignment3 = generator.toIntAssignmentMethod();
415  c->addPublicMethod(enumAssignment3);
416 
417  // Writermethods
419  {
420  if (info.returnType == OWN_TYPE_NAME)
421  {
422  info.returnType = generator.getFullClassCppTypename();
423  }
424 
425  if (!info.include.empty())
426  {
427  c->addInclude(info.include);
428  }
429 
431  c->addPublicMethod(convert);
432  }
433 
434  // Add methods to set the member variables
435  // also resolve the original class name if the return type is set to special
437  {
438  if (info.returnType == OWN_TYPE_NAME)
439  {
440  info.returnType = generator.getFullClassCppTypename();
441  }
442  if (info.argumentType == OWN_TYPE_NAME)
443  {
444  info.argumentType = generator.getFullClassCppTypename();
445  }
446 
448  c->addPublicMethod(convert);
449  }
450 
451  // Add methods to set the member variables
453  {
454  if (info.argumentType == OWN_TYPE_NAME)
455  {
456  info.argumentType = generator.getFullClassCppTypename();
457  }
458 
459  if (!info.include.empty())
460  {
461  c->addInclude(info.include);
462  }
464  c->addPublicMethod(convert);
465  }
466 
467  // Typewritermethods
469  {
470  if (info.returnType == OWN_TYPE_NAME)
471  {
472  info.returnType = generator.getFullClassCppTypename();
473  }
474 
475  if (!info.include.empty())
476  {
477  c->addInclude(info.include);
478  }
480  c->addPublicMethod(convert);
481  }
482 
483  typeClasses.push_back(c);
484  }
485  }
486 
488  {
489  const auto& type = gen.getType();
490  if (type.getMaybe() != type::Maybe::NONE)
491  {
492  // Should not happen since we check the maybe flag on creation of the generator. However, better to double check
493  throw error::ValueNotValidException(__PRETTY_FUNCTION__, "Somehow the maybe flag of a top level object declaration is set. This is not valid!", std::to_string((int) type.getMaybe()) + " aka " + type::defaultconversion::string::Maybe2String.at(type.getMaybe()), type.getPath());
494  }
495 
496  const std::string classCppTypename = gen.getClassCppTypename();
497 
498  std::vector<std::string> namespaces = info.getNamespaces();
499  std::string rawObjectName = info.getNameWithoutNamespace();
500  namespaces.push_back(simox::alg::to_lower(camelToSnake(rawObjectName)) + "_details");
501 
502  std::string enumdoc = "The enum definition of the enum of the auogenerated class '" + gen.getFullClassCppTypename() + "'.";
503  CppEnumPtr e = std::make_shared<CppEnum>(namespaces, "Enum");
504  auto enumFields = gen.toEnumFields();
505 
506  ARMARX_CHECK(enumFields.size() > 0);
507 
508  for (const auto& field : enumFields)
509  {
510  e->addField(field);
511  }
512 
513  return e;
514  }
515 
517  {
518  const auto& type = gen.getType();
519  if (type.getMaybe() != type::Maybe::NONE)
520  {
521  // Should not happen since we check the maybe flag on creation of the generator. However, better to double check
522  throw error::ValueNotValidException(__PRETTY_FUNCTION__, "Somehow the maybe flag of a top level object declaration is set. This is not valid!", std::to_string((int) type.getMaybe()) + " aka " + type::defaultconversion::string::Maybe2String.at(type.getMaybe()), type.getPath());
523  }
524 
525  const std::string classCppTypename = gen.getClassCppTypename();
526 
527  std::vector<std::string> namespaces = info.getNamespaces();
528  std::string rawObjectName = info.getNameWithoutNamespace();
529 
530  CppClassPtr c = std::make_shared<CppClass>(namespaces, rawObjectName);
531  // Add includes and guard
532  std::string classDoc = "******************************************\n"
533  "* AUTOGENERATED CLASS. Please do NOT edit.\n"
534  "******************************************\n";
535 
536  if (!info.doc_author.empty() or !info.doc_brief.empty())
537  {
538  classDoc += (info.doc_brief.empty() ? "" : " * @brief " + info.doc_brief + "\n");
539  classDoc += (info.doc_author.empty() ? "" : " * @author " + info.doc_author + "\n");
540  }
541 
542  c->addClassDoc(classDoc);
543 
544  // add generator includes (e.g. coming from dto types)
545  for (const auto& s : gen.getRequiredIncludes())
546  {
547  if (!s.empty())
548  {
549  c->addInclude(s);
550  }
551  }
552 
553  // add predefined includes from generator app (e.g. coming from aron includes)
554  for (const std::string& s : additionalIncludes)
555  {
556  if (!s.empty())
557  {
558  c->addInclude(simox::alg::replace_last(s, ".aron.generated.codesuffix", ".aron.generated.h"));
559  }
560  }
561 
562  // always add aron includes
563  c->addInclude("<RobotAPI/libraries/aron/core/aron_conversions.h>");
564  c->addInclude("<RobotAPI/libraries/aron/core/rw.h>");
565  c->addInclude("<RobotAPI/libraries/aron/core/codegeneration/cpp/AronGeneratedClass.h>");
566  c->addInclude("<RobotAPI/libraries/aron/core/codegeneration/cpp/AronGeneratedObject.h>");
567  c->addInclude("<RobotAPI/libraries/aron/core/codegeneration/cpp/AronGeneratedIntEnum.h>");
568 
569  // ctor
570  c->addCtor(gen.toCtor(c->getName()));
571  c->addCtor(gen.toCopyCtor(c->getName()));
572 
573  // dtor
574  c->addPublicMethod(gen.toDtor(c->getName()));
575 
576  // Generic methods
577  //std::cout << "Generate equals method" << std::endl;
578  CppMethodPtr equals = gen.toEqualsMethod();
579  c->addPublicMethod(equals);
580 
581  //std::cout << "Generate reset method" << std::endl;
582  CppMethodPtr resetHard = gen.toResetHardMethod();
583  c->addPublicMethod(resetHard);
584 
585  //std::cout << "Generate init method" << std::endl;
586  CppMethodPtr resetSoft = gen.toResetSoftMethod();
587  c->addPublicMethod(resetSoft);
588 
589  //std::cout << "Generate writeInit method" << std::endl;
590  CppMethodPtr writeType = gen.toWriteTypeMethod();
591  c->addPublicMethod(writeType);
592 
593  //std::cout << "Generate write method" << std::endl;
595  c->addPublicMethod(write);
596 
597  //std::cout << "Generate read method" << std::endl;
599  c->addPublicMethod(read);
600  return c;
601  }
602 
603  void Writer::setupMemberFields(CppClassPtr& c, const std::map<std::string, std::string>& doc_members, const generator::ObjectClass& o) const
604  {
605  auto publicFields = o.getPublicVariableDeclarations(c->getName());
606  for (const auto& f : publicFields)
607  {
608  if (auto it = doc_members.find(f->getName()); it != doc_members.end())
609  {
610  f->setDoc("@brief " + it->second);
611  }
612  c->addPublicField(f);
613  }
614  }
615 
616  void Writer::setupMemberFields(CppClassPtr& c, const std::map<std::string, std::string>& doc_members, const generator::IntEnumClass& o) const
617  {
618  auto publicFields = o.getPublicVariableDeclarations(camelToSnake(c->getName()));
619  for (const auto& f : publicFields)
620  {
621  if (auto it = doc_members.find(f->getName()); it != doc_members.end())
622  {
623  f->setDoc("@brief " + it->second);
624  }
625  c->addPublicField(f);
626  }
627  }
628 }
629 
630 
631 
632 
633 
armarx::aron::codegenerator::cpp::Generator::getFullInstantiatedCppTypename
std::string getFullInstantiatedCppTypename() const
Definition: Generator.cpp:116
armarx::aron::codegenerator::cpp::Generator::toResetHardMethod
CppMethodPtr toResetHardMethod() const
Definition: Generator.cpp:264
armarx::aron::codegenerator::cpp
Definition: AnyObject.cpp:29
armarx::aron::codegenerator::cpp::Generator::getFullClassCppTypename
std::string getFullClassCppTypename() const
Definition: Generator.cpp:168
armarx::aron::codegenerator::ReaderInfo::argumentType
std::string argumentType
Definition: ReaderInfo.h:35
str
std::string str(const T &t)
Definition: UserAssistedSegmenterGuiWidgetController.cpp:42
armarx::aron::codegenerator::ReaderInfo::methodName
std::string methodName
Definition: ReaderInfo.h:34
armarx::aron::codegenerator::WriterInfo::writerClassType
std::string writerClassType
Definition: WriterInfo.h:36
armarx::aron::codegenerator::cpp::Generator::toCtor
CppCtorPtr toCtor(const std::string &) const
Definition: Generator.cpp:191
armarx::aron::codegenerator::cpp::generator::ObjectClass
Definition: ObjectClass.h:31
armarx::aron::codegenerator::cpp::Generator::toSpecializedDataWriterMethod
CppMethodPtr toSpecializedDataWriterMethod(const WriterInfo &info) const
Definition: Generator.cpp:374
armarx::aron::codegenerator::CodeWriter::intEnumDataReaders
std::vector< codegenerator::ReaderInfo > intEnumDataReaders
Definition: CodeWriter.h:83
armarx::aron::codegenerator::cpp::Writer::generateTypeObjects
virtual void generateTypeObjects(const std::vector< typereader::GenerateObjectInfo > &) override
Definition: Writer.cpp:263
armarx::aron::codegenerator::WriterInfo::enforceMemberAccess
std::string enforceMemberAccess
Definition: WriterInfo.h:39
armarx::aron::codegenerator::cpp::Writer::addSpecificReaderMethods
virtual void addSpecificReaderMethods() override
Definition: Writer.cpp:184
armarx::aron::codegenerator::cpp::generator::ObjectClass::getPublicVariableDeclarations
std::vector< CppFieldPtr > getPublicVariableDeclarations(const std::string &) const final
Definition: ObjectClass.cpp:85
armarx::CppClassPtr
std::shared_ptr< CppClass > CppClassPtr
Definition: CppClass.h:36
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::aron::codegenerator::CodeWriter::staticDictDataReaders
std::vector< codegenerator::StaticReaderInfo > staticDictDataReaders
Definition: CodeWriter.h:85
armarx::aron::codegenerator::WriterInfo::returnType
std::string returnType
Definition: WriterInfo.h:35
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toFromStringMethod
CppMethodPtr toFromStringMethod() const
Definition: IntEnumClass.cpp:319
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toEnumCtor
CppCtorPtr toEnumCtor(const std::string &) const
Definition: IntEnumClass.cpp:211
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toIntMethod
CppMethodPtr toIntMethod() const
Definition: IntEnumClass.cpp:232
armarx::aron::codegenerator::cpp::Generator::toResetSoftMethod
CppMethodPtr toResetSoftMethod() const
Definition: Generator.cpp:247
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::aron::codegenerator::CodeWriter::typeEnums
std::vector< MetaEnumPtr > typeEnums
Definition: CodeWriter.h:76
armarx::aron::codegenerator::cpp::generator::IntEnumClass::getPublicVariableDeclarations
std::vector< CppFieldPtr > getPublicVariableDeclarations(const std::string &) const final
Definition: IntEnumClass.cpp:51
armarx::aron::codegenerator::cpp::camelToSnake
std::string camelToSnake(const std::string &str)
Definition: Writer.cpp:38
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toToStringMethod
CppMethodPtr toToStringMethod() const
Definition: IntEnumClass.cpp:305
armarx::aron::codegenerator::CodeWriter::staticIntEnumDataReaders
std::vector< codegenerator::StaticReaderInfo > staticIntEnumDataReaders
Definition: CodeWriter.h:86
armarx::aron::codegenerator::ReaderInfo::readerClassType
std::string readerClassType
Definition: ReaderInfo.h:36
armarx::convert
armem::articulated_object::ArticulatedObject convert(const VirtualRobot::Robot &obj, const armem::Time &timestamp)
Definition: ArticulatedObjectLocalizerDynamicSimulation.cpp:194
armarx::aron::codegenerator::CodeWriter::initialIntEnumTypeWriters
std::vector< codegenerator::WriterInfo > initialIntEnumTypeWriters
Definition: CodeWriter.h:89
armarx::aron::codegenerator::cpp::Generator::toDtor
CppMethodPtr toDtor(const std::string &) const
Definition: Generator.cpp:229
armarx::aron::codegenerator::ReaderInfo::include
std::string include
Definition: ReaderInfo.h:37
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
armarx::aron::codegenerator::ReaderInfo
Definition: ReaderInfo.h:32
armarx::aron::codegenerator::cpp::Generator::toWriteTypeMethod
CppMethodPtr toWriteTypeMethod() const
Definition: Generator.cpp:281
armarx::aron::codegenerator::StaticReaderInfo::returnType
std::string returnType
Definition: ReaderInfo.h:48
armarx::aron::codegenerator::WriterInfo::enforceConversion
std::string enforceConversion
Definition: WriterInfo.h:38
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toIntAssignmentMethod
CppMethodPtr toIntAssignmentMethod() const
Definition: IntEnumClass.cpp:281
armarx::aron::codegenerator::cpp::Generator::toSpecializedStaticDataReaderMethod
CppMethodPtr toSpecializedStaticDataReaderMethod(const StaticReaderInfo &info) const
Definition: Generator.cpp:416
armarx::CppEnumPtr
std::shared_ptr< CppEnum > CppEnumPtr
Definition: CppEnum.h:55
armarx::aron::error::ValueNotValidException
The ValueNotValidException class.
Definition: Exception.h:145
armarx::aron::codegenerator::StaticReaderInfo::methodName
std::string methodName
Definition: ReaderInfo.h:46
armarx::aron::codegenerator::cpp::Writer::setupEnumPtr
CppEnumPtr setupEnumPtr(const typereader::GenerateInfo &info, const generator::IntEnumClass &gen) const
Definition: Writer.cpp:487
armarx::aron::codegenerator::CodeWriter::dictDataReaders
std::vector< codegenerator::ReaderInfo > dictDataReaders
Definition: CodeWriter.h:82
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toEnumFields
std::vector< CppEnumFieldPtr > toEnumFields() const
Definition: IntEnumClass.cpp:221
armarx::aron::read
requires data::isReader< ReaderT > void read(ReaderT &aron_r, typename ReaderT::InputType &input, Eigen::Matrix< EigenT, rows, cols, options > &ret)
Definition: eigen.h:20
armarx::aron::typereader::GenerateInfo::getNameWithoutNamespace
std::string getNameWithoutNamespace() const
Definition: GenerateInfo.h:45
armarx::CppMethodPtr
std::shared_ptr< CppMethod > CppMethodPtr
Definition: CppMethod.h:32
armarx::aron::codegenerator::cpp::Generator::getRequiredIncludes
virtual std::vector< std::string > getRequiredIncludes() const
Definition: Generator.cpp:476
armarx::aron::codegenerator::CodeWriter::additionalIncludes
std::vector< std::string > additionalIncludes
Definition: CodeWriter.h:91
armarx::aron::codegenerator::cpp::Generator::toReadMethod
CppMethodPtr toReadMethod() const
Definition: Generator.cpp:339
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toCopyAssignmentMethod
CppMethodPtr toCopyAssignmentMethod() const
Definition: IntEnumClass.cpp:246
armarx::aron::codegenerator::ReaderInfo::override
bool override
Definition: ReaderInfo.h:40
Writer.h
armarx::aron::codegenerator::cpp::Generator::toEqualsMethod
CppMethodPtr toEqualsMethod() const
Definition: Generator.cpp:456
armarx::aron::codegenerator::CodeWriter::dictDataWriters
std::vector< codegenerator::WriterInfo > dictDataWriters
Definition: CodeWriter.h:79
armarx::aron::codegenerator::StaticReaderInfo::argumentType
std::string argumentType
Definition: ReaderInfo.h:47
armarx::aron::typereader::GenerateInfo
A top-level struct for type-generation information.
Definition: GenerateInfo.h:37
armarx::aron::codegenerator::WriterInfo::methodName
std::string methodName
Definition: WriterInfo.h:34
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
armarx::aron::codegenerator::cpp::generator::detail::SpecializedGeneratorBase::getType
virtual const type::Variant & getType() const override
Definition: SpecializedGenerator.h:46
armarx::aron::codegenerator::CodeWriter::initialDictTypeWriters
std::vector< codegenerator::WriterInfo > initialDictTypeWriters
Definition: CodeWriter.h:88
armarx::aron::codegenerator::ReaderInfo::enforceConversion
std::string enforceConversion
Definition: ReaderInfo.h:38
armarx::aron::typereader::GenerateInfo::doc_brief
std::string doc_brief
Definition: GenerateInfo.h:41
armarx::aron::codegenerator::cpp::Writer::Writer
Writer()=delete
armarx::aron::typereader::GenerateInfo::doc_author
std::string doc_author
Definition: GenerateInfo.h:42
armarx::aron::toAron
void toAron(T &dto, const T &bo)
Framework for converting ARON DTOs (Data Transfer Objects) to C++ BOs (Business Objects) and back.
Definition: aron_conversions.h:74
armarx::aron::codegenerator::StaticReaderInfo
Definition: ReaderInfo.h:44
armarx::aron::similarity::FloatSimilarity::NONE
@ NONE
Definition: FloatSimilarity.h:11
armarx::aron::codegenerator::WriterInfo::override
bool override
Definition: WriterInfo.h:40
armarx::aron::codegenerator::cpp::Generator::getType
virtual const type::Variant & getType() const =0
armarx::viz::toString
const char * toString(InteractionFeedbackType type)
Definition: Interaction.h:27
armarx::aron::codegenerator::WriterInfo::include
std::string include
Definition: WriterInfo.h:37
armarx::aron::write
requires data::isWriter< WriterT > void write(WriterT &aron_w, const Eigen::Matrix< EigenT, rows, cols, options > &input, typename WriterT::ReturnType &ret, const armarx::aron::Path &aron_p=armarx::aron::Path())
Definition: eigen.h:134
armarx::aron::codegenerator::CodeWriter::intEnumDataWriters
std::vector< codegenerator::WriterInfo > intEnumDataWriters
Definition: CodeWriter.h:80
armarx::aron::codegenerator::cpp::Generator::toSpecializedDataReaderMethod
CppMethodPtr toSpecializedDataReaderMethod(const ReaderInfo &info) const
Definition: Generator.cpp:395
armarx::aron::codegenerator::cpp::Writer::addSpecificWriterMethods
virtual void addSpecificWriterMethods() override
Definition: Writer.cpp:81
armarx::aron::typereader::GenerateInfo::getNamespaces
std::vector< std::string > getNamespaces() const
Definition: GenerateInfo.h:65
armarx::aron::codegenerator::cpp::Generator::toSpecializedTypeWriterMethod
CppMethodPtr toSpecializedTypeWriterMethod(const WriterInfo &info) const
Definition: Generator.cpp:437
armarx::aron::codegenerator::cpp::Generator::toWriteMethod
CppMethodPtr toWriteMethod() const
Definition: Generator.cpp:308
armarx::aron::codegenerator::cpp::Generator
Definition: Generator.h:65
armarx::aron::codegenerator::cpp::Generator::getClassCppTypename
std::string getClassCppTypename() const
Definition: Generator.cpp:162
armarx::aron::codegenerator::cpp::Writer::setupMemberFields
void setupMemberFields(CppClassPtr &, const std::map< std::string, std::string > &doc_members, const generator::ObjectClass &) const
Definition: Writer.cpp:603
armarx::aron::codegenerator::cpp::Generator::toCopyCtor
CppCtorPtr toCopyCtor(const std::string &) const
Definition: Generator.cpp:209
armarx::aron::codegenerator::cpp::generator::IntEnumClass::toEnumAssignmentMethod
CppMethodPtr toEnumAssignmentMethod() const
Definition: IntEnumClass.cpp:264
armarx::aron::fromAron
void fromAron(const T &dto, T &bo)
Definition: aron_conversions.h:79
armarx::aron::codegenerator::cpp::Writer::setupBasicCppClass
CppClassPtr setupBasicCppClass(const typereader::GenerateInfo &info, const Generator &gen) const
Definition: Writer.cpp:516
armarx::aron::codegenerator::CodeWriter
Definition: CodeWriter.h:46
armarx::aron::codegenerator::cpp::generator::IntEnumClass
Definition: IntEnumClass.h:34
armarx::aron::codegenerator::CodeWriter::typeClasses
std::vector< MetaClassPtr > typeClasses
Definition: CodeWriter.h:75
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx::aron::codegenerator::WriterInfo
Definition: WriterInfo.h:32
armarx::aron::type::defaultconversion::string::Maybe2String
const std::map< type::Maybe, std::string > Maybe2String
Definition: Descriptor.h:125
armarx::aron::codegenerator::cpp::Writer::generateTypeIntEnums
virtual void generateTypeIntEnums(const std::vector< typereader::GenerateIntEnumInfo > &) override
Definition: Writer.cpp:375