ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnc::ArtifactClass Class Reference

Represents a class. More...

#include <ArtifactModel.h>

Collaboration diagram for nnc::ArtifactClass:

Public Member Functions

 ArtifactClass (const std::string &class_name)
 
void accept (IArtifactGenerator *g) const override
 This is the core function of each artifact entity and is implemented by all concrete classes in the hierarchy.
 
std::shared_ptr< ArtifactClassVariablevar (bool is_public, const std::string &type_name, const std::string &var_name, const std::list< std::shared_ptr< ArtifactExpr > > &dimensions={}, const std::list< std::shared_ptr< ArtifactExpr > > &initializers={})
 Creates a class member variable.
 
std::shared_ptr< ArtifactClassFunctionfunc (bool is_public, const std::string &ret_type_name, const std::string &func_name, const std::list< std::shared_ptr< ArtifactVariable > > &params={})
 Creates a class member function.
 
const std::list< std::shared_ptr< ArtifactClassVariable > > & publicVariables () const
 
const std::list< std::shared_ptr< ArtifactClassVariable > > & privateVariables () const
 
const std::list< std::shared_ptr< ArtifactClassFunction > > & publicFunctions () const
 
const std::list< std::shared_ptr< ArtifactClassFunction > > & privateFunctions () const
 
ArtifactBlockgetConstrBlock ()
 
const ArtifactBlockgetConstrBlock () const
 
- Public Member Functions inherited from nnc::ArtifactNamed
 ArtifactNamed (std::string name)
 
const std::string & name () const
 
- Public Member Functions inherited from nnc::ArtifactEntity
virtual ~ArtifactEntity ()=default
 
virtual bool isBlock () const
 If this entity represents something containing a block of instructions.
 

Additional Inherited Members

- Protected Member Functions inherited from nnc::ArtifactEntity
 ArtifactEntity ()=default
 

Detailed Description

Represents a class.

Definition at line 597 of file ArtifactModel.h.

Constructor & Destructor Documentation

◆ ArtifactClass()

nnc::ArtifactClass::ArtifactClass ( const std::string &  class_name)
inlineexplicit

Definition at line 600 of file ArtifactModel.h.

600: ArtifactNamed(class_name) {}
ArtifactNamed(std::string name)

Member Function Documentation

◆ accept()

void nnc::ArtifactClass::accept ( IArtifactGenerator g) const
inlineoverridevirtual

This is the core function of each artifact entity and is implemented by all concrete classes in the hierarchy.

Implements nnc::ArtifactEntity.

Definition at line 602 of file ArtifactModel.h.

602{ g->visit(this); }

Referenced by TEST(), and TEST().

◆ func()

std::shared_ptr< ArtifactClassFunction > nnc::ArtifactClass::func ( bool  is_public,
const std::string &  ret_type_name,
const std::string &  func_name,
const std::list< std::shared_ptr< ArtifactVariable > > &  params = {} 
)
inline

Creates a class member function.

Parameters
is_public- if the created function be public.
ret_type_name
func_name
params
Returns

Definition at line 644 of file ArtifactModel.h.

645 {})
646 {
647 if (is_public)
648 {
649 auto func = std::make_shared<ArtifactClassFunction>(this, ret_type_name, func_name, params);
650 _publicFunctions.push_back(func);
651 return func;
652 }
653 else
654 {
655 auto func = std::make_shared<ArtifactClassFunction>(this, ret_type_name, func_name, params);
656 _privateFunctions.push_back(func);
657 return func;
658 }
659 }
std::shared_ptr< ArtifactClassFunction > func(bool is_public, const std::string &ret_type_name, const std::string &func_name, const std::list< std::shared_ptr< ArtifactVariable > > &params={})
Creates a class member function.

Referenced by TEST().

◆ getConstrBlock() [1/2]

ArtifactBlock * nnc::ArtifactClass::getConstrBlock ( )
inline

Definition at line 681 of file ArtifactModel.h.

681{ return &_constrBlock; }

Referenced by nnc::ArtifactGeneratorCppCode::visit().

◆ getConstrBlock() [2/2]

const ArtifactBlock * nnc::ArtifactClass::getConstrBlock ( ) const
inline

Definition at line 683 of file ArtifactModel.h.

683{ return &_constrBlock; }

◆ privateFunctions()

const std::list< std::shared_ptr< ArtifactClassFunction > > & nnc::ArtifactClass::privateFunctions ( ) const
inline

Definition at line 676 of file ArtifactModel.h.

677 {
678 return _privateFunctions;
679 }

Referenced by nnc::ArtifactGeneratorCppCode::visit(), and nnc::ArtifactGeneratorCppDecl::visit().

◆ privateVariables()

const std::list< std::shared_ptr< ArtifactClassVariable > > & nnc::ArtifactClass::privateVariables ( ) const
inline

Definition at line 666 of file ArtifactModel.h.

667 {
668 return _privateVariables;
669 }

Referenced by nnc::ArtifactGeneratorCppCode::visit(), and nnc::ArtifactGeneratorCppDecl::visit().

◆ publicFunctions()

const std::list< std::shared_ptr< ArtifactClassFunction > > & nnc::ArtifactClass::publicFunctions ( ) const
inline

Definition at line 671 of file ArtifactModel.h.

672 {
673 return _publicFunctions;
674 }

Referenced by nnc::ArtifactGeneratorCppCode::visit(), and nnc::ArtifactGeneratorCppDecl::visit().

◆ publicVariables()

const std::list< std::shared_ptr< ArtifactClassVariable > > & nnc::ArtifactClass::publicVariables ( ) const
inline

Definition at line 661 of file ArtifactModel.h.

662 {
663 return _publicVariables;
664 }

◆ var()

std::shared_ptr< ArtifactClassVariable > nnc::ArtifactClass::var ( bool  is_public,
const std::string &  type_name,
const std::string &  var_name,
const std::list< std::shared_ptr< ArtifactExpr > > &  dimensions = {},
const std::list< std::shared_ptr< ArtifactExpr > > &  initializers = {} 
)
inline

Creates a class member variable.

Parameters
is_public- if the created variable be public.
type_name
var_name
dimensions
initializer
constructors
Returns

Definition at line 615 of file ArtifactModel.h.

616 {},
617 const std::list<std::shared_ptr<ArtifactExpr>> &initializers = {})
618 {
619 if (is_public)
620 {
621 auto var = std::make_shared<ArtifactClassVariable>(this, type_name, var_name, dimensions,
622 initializers);
623 _publicVariables.push_back(var);
624 return var;
625 }
626 else
627 {
628 auto var = std::make_shared<ArtifactClassVariable>(this, type_name, var_name, dimensions,
629 initializers);
630 _privateVariables.push_back(var);
631 return var;
632 }
633 }
std::shared_ptr< ArtifactClassVariable > var(bool is_public, const std::string &type_name, const std::string &var_name, const std::list< std::shared_ptr< ArtifactExpr > > &dimensions={}, const std::list< std::shared_ptr< ArtifactExpr > > &initializers={})
Creates a class member variable.

The documentation for this class was generated from the following file: