ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::UnaryOp Class Reference

Op with a single argument. More...

#include <Op.h>

Collaboration diagram for coco::UnaryOp:

Public Member Functions

 UnaryOp ()
 
 UnaryOp (const UnaryOp &)=delete
 
 UnaryOp (UnaryOp &&)=delete
 
virtual ~UnaryOp ()=default
 
uint32_t arity (void) const final
 Return the number of arguments (# of child Ops)
 
Oparg (uint32_t n) const final
 Return N-th argument.
 
std::set< Object * > uses (void) const final
 Return a set of object(s) used during execution.
 
Oparg (void) const
 
void arg (Op *arg)
 
- Public Member Functions inherited from coco::Op
virtual ~Op ()
 
template<typename T >
accept (IVisitor< T > *v) const
 
template<typename T >
accept (IVisitor< T > &v) const
 
template<typename T >
accept (IVisitor< T > &&v) const
 
void accept (IMutator *m)
 
void accept (IMutator &m)
 
void accept (IMutator &&m)
 
Instrparent (void) const
 
Opup (void) const
 Return a pointer to the parent Op.
 
- Public Member Functions inherited from coco::Entity
virtual ~Entity ()=default
 
Modulemodule (void) const
 

Detailed Description

Op with a single argument.

Definition at line 183 of file Op.h.

Constructor & Destructor Documentation

◆ UnaryOp() [1/3]

coco::UnaryOp::UnaryOp ( )
explicit

Definition at line 65 of file Op.cpp.

65 : _arg{this}
66{
67 // DO NOTHING
68}

◆ UnaryOp() [2/3]

coco::UnaryOp::UnaryOp ( const UnaryOp )
delete

◆ UnaryOp() [3/3]

coco::UnaryOp::UnaryOp ( UnaryOp &&  )
delete

◆ ~UnaryOp()

virtual coco::UnaryOp::~UnaryOp ( )
virtualdefault

Member Function Documentation

◆ arg() [1/3]

void coco::UnaryOp::arg ( Op arg)
inline

Definition at line 203 of file Op.h.

203{ _arg.child(arg); }
Op * child(void) const
Definition Part.h:40
Op * arg(void) const
Definition Op.h:202

References arg(), and coco::Part::child().

◆ arg() [2/3]

Op * coco::UnaryOp::arg ( uint32_t  n) const
finalvirtual

◆ arg() [3/3]

Op * coco::UnaryOp::arg ( void  ) const
inline

Definition at line 202 of file Op.h.

202{ return _arg.child(); }

References coco::Part::child().

Referenced by arg(), and uses().

◆ arity()

uint32_t coco::UnaryOp::arity ( void  ) const
finalvirtual

Return the number of arguments (# of child Ops)

Implements coco::Op.

Definition at line 70 of file Op.cpp.

71{
72 // There is only one argument
73 return 1;
74}

◆ uses()

std::set< Object * > coco::UnaryOp::uses ( void  ) const
finalvirtual

Return a set of object(s) used during execution.

NOTE There is no 'def' method as Op is not allowed to define a new object

Implements coco::Op.

Definition at line 82 of file Op.cpp.

83{
84 std::set<Object *> res;
85
86 if (auto ifm = arg())
87 {
88 for (auto obj : ifm->uses())
89 {
90 res.insert(obj);
91 }
92 }
93
94 return res;
95}
std::set< Object * > uses(void) const final
Return a set of object(s) used during execution.
Definition Op.cpp:82

References arg().


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