Skip to content

ModelEntities Header

mitchell-conrad edited this page Jan 19, 2021 · 1 revision

Table of Contents

Header

A Header entity allows modellers to include a C++ header in the code gen of a Component or a Class.

The text inserted into the code field is put into a different location based on the selected value in the header_location field.

  • CPP - The code will be inserted at the top of the .cpp file generated for that Component/Class
  • Header - The code will be inserted at the top of the .h file generated for that Component/Class
  • Class Declaration - The code will be inserted at the end of the class definition in the .h file
Below is an example generated code where multiple Header entities, each with a different header_location, have been included:

exampleimpl.h

#ifndef COMPONENT_EXAMPLEIMPL_H
#define COMPONENT_EXAMPLEIMPL_H
#include "exampleint.h"

// Injecting Header Code [header_location = Header]
#include <header> // This is where the header code will be located

class ExampleImpl : public ::ExampleInt 
{
      public:
	   ExampleImpl(const std::string& name);

           // Injecting Header Code [header_location = Class Declaration]
	   CustomClass my_custom_class; // This is where the class declaration code will be located
}

#endif

exampleimpl.cpp

#include "exampleimpl.h"

// Injecting Header Code [header_location = CPP]
#include <CPP> // This is where the CPP code will be located

ExampleImpl::ExampleImpl(const std::string& name) : ExampleInt(name) {
        
};

Parent

Can be adopted by the below entities:

Children

This entity cannot adopt any children.

Dependents

This entity does not have any dependent entities.

Dependencies

This entity does not depend on any entities.

Editable Data Fields

  • code - pops up a text editor where the header to be inserted is to be placed
  • header_location - sets the location to one of the following:
    • CPP
    • Class Declaration
    • Header
  • label - sets the label

Edges

This entity does not have any visible edges attached to it.

Clone this wiki locally