CodeWriter.h
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 #pragma once
25 
26 // STD/STL
27 #include <memory>
28 #include <map>
29 #include <vector>
30 #include <typeinfo>
31 #include <typeindex>
32 
33 // ArmarX
36 
38 
43 
45 {
46  class CodeWriter
47  {
48  public:
49  CodeWriter() = delete;
50  CodeWriter(const std::string& producerName, const std::vector<std::string>& additionalIncludesFromXMLFile):
52  additionalIncludes(additionalIncludesFromXMLFile)
53  {}
54 
55  virtual ~CodeWriter() = default;
56 
57  virtual void generateTypeObjects(const std::vector<typereader::GenerateObjectInfo>&) = 0;
58  virtual void generateTypeIntEnums(const std::vector<typereader::GenerateIntEnumInfo>&) = 0;
59 
60  std::vector<MetaClassPtr> getTypeClasses() const
61  {
62  return typeClasses;
63  }
64 
65  std::vector<MetaEnumPtr> getTypeEnums() const // TODO: Create Meta Enum class to abstract away cpp details
66  {
67  return typeEnums;
68  }
69 
70  protected:
71  virtual void addSpecificReaderMethods() = 0;
72  virtual void addSpecificWriterMethods() = 0;
73 
74  protected:
75  std::vector<MetaClassPtr> typeClasses;
76  std::vector<MetaEnumPtr> typeEnums;
77 
78  std::string producerName;
79  std::vector<codegenerator::WriterInfo> dictDataWriters;
80  std::vector<codegenerator::WriterInfo> intEnumDataWriters;
81 
82  std::vector<codegenerator::ReaderInfo> dictDataReaders;
83  std::vector<codegenerator::ReaderInfo> intEnumDataReaders;
84 
85  std::vector<codegenerator::StaticReaderInfo> staticDictDataReaders;
86  std::vector<codegenerator::StaticReaderInfo> staticIntEnumDataReaders;
87 
88  std::vector<codegenerator::WriterInfo> initialDictTypeWriters;
89  std::vector<codegenerator::WriterInfo> initialIntEnumTypeWriters;
90 
91  std::vector<std::string> additionalIncludes;
92  };
93 }
armarx::aron::codegenerator::CodeWriter::intEnumDataReaders
std::vector< codegenerator::ReaderInfo > intEnumDataReaders
Definition: CodeWriter.h:83
armarx::aron::codegenerator::CodeWriter::staticDictDataReaders
std::vector< codegenerator::StaticReaderInfo > staticDictDataReaders
Definition: CodeWriter.h:85
All.h
armarx::aron::codegenerator::CodeWriter::typeEnums
std::vector< MetaEnumPtr > typeEnums
Definition: CodeWriter.h:76
ReaderInfo.h
armarx::aron::codegenerator::CodeWriter::staticIntEnumDataReaders
std::vector< codegenerator::StaticReaderInfo > staticIntEnumDataReaders
Definition: CodeWriter.h:86
armarx::aron::codegenerator::CodeWriter::initialIntEnumTypeWriters
std::vector< codegenerator::WriterInfo > initialIntEnumTypeWriters
Definition: CodeWriter.h:89
armarx::aron::codegenerator::CodeWriter::addSpecificWriterMethods
virtual void addSpecificWriterMethods()=0
armarx::aron::codegenerator
Definition: CodeWriter.h:44
armarx::aron::codegenerator::CodeWriter::CodeWriter
CodeWriter(const std::string &producerName, const std::vector< std::string > &additionalIncludesFromXMLFile)
Definition: CodeWriter.h:50
armarx::aron::codegenerator::CodeWriter::getTypeEnums
std::vector< MetaEnumPtr > getTypeEnums() const
Definition: CodeWriter.h:65
armarx::aron::codegenerator::CodeWriter::addSpecificReaderMethods
virtual void addSpecificReaderMethods()=0
CppClass.h
armarx::aron::codegenerator::CodeWriter::~CodeWriter
virtual ~CodeWriter()=default
CppEnum.h
armarx::aron::codegenerator::CodeWriter::dictDataReaders
std::vector< codegenerator::ReaderInfo > dictDataReaders
Definition: CodeWriter.h:82
armarx::aron::codegenerator::CodeWriter::generateTypeObjects
virtual void generateTypeObjects(const std::vector< typereader::GenerateObjectInfo > &)=0
armarx::aron::codegenerator::CodeWriter::additionalIncludes
std::vector< std::string > additionalIncludes
Definition: CodeWriter.h:91
WriterInfo.h
armarx::aron::codegenerator::CodeWriter::dictDataWriters
std::vector< codegenerator::WriterInfo > dictDataWriters
Definition: CodeWriter.h:79
GenerateTypeInfo.h
armarx::aron::codegenerator::CodeWriter::initialDictTypeWriters
std::vector< codegenerator::WriterInfo > initialDictTypeWriters
Definition: CodeWriter.h:88
armarx::aron::codegenerator::CodeWriter::CodeWriter
CodeWriter()=delete
GenerateIntEnumInfo.h
armarx::aron::codegenerator::CodeWriter::producerName
std::string producerName
Definition: CodeWriter.h:78
armarx::aron::codegenerator::CodeWriter::getTypeClasses
std::vector< MetaClassPtr > getTypeClasses() const
Definition: CodeWriter.h:60
armarx::aron::codegenerator::CodeWriter::generateTypeIntEnums
virtual void generateTypeIntEnums(const std::vector< typereader::GenerateIntEnumInfo > &)=0
armarx::aron::codegenerator::CodeWriter::intEnumDataWriters
std::vector< codegenerator::WriterInfo > intEnumDataWriters
Definition: CodeWriter.h:80
armarx::aron::codegenerator::CodeWriter
Definition: CodeWriter.h:46
armarx::aron::codegenerator::CodeWriter::typeClasses
std::vector< MetaClassPtr > typeClasses
Definition: CodeWriter.h:75