0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
clanguml::sequence_diagram::model::function Struct Reference

Participant mode representing a free function. More...

Detailed Description

Participant mode representing a free function.

Definition at line 226 of file participant.h.

#include <participant.h>

Public Types

enum class  message_render_mode { full , abbreviated , no_arguments }
 
- Public Types inherited from clanguml::sequence_diagram::model::participant
enum class  stereotype_t {
  participant = 0 , actor , boundary , control ,
  entity , database , collections , queue
}
 Enum representing stereotype of a participant. More...
 
- Public Types inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool >
using key_t = std::tuple< Args... >
 
using value_t = std::string
 
- Public Types inherited from clanguml::util::memoized< name_and_ns_tag, std::string >
using key_t = std::tuple< Args... >
 
using value_t = std::string
 

Public Member Functions

 function (const common::model::namespace_ &using_namespace)
 
 function (const function &)=delete
 
 function (function &&) noexcept=delete
 
functionoperator= (const function &)=delete
 
functionoperator= (function &&)=delete
 
std::string type_name () const override
 
std::string full_name_no_ns () const override
 
virtual std::string message_name (message_render_mode mode) const
 Render function name as message label.
 
bool is_const () const
 Check if function is const.
 
void is_const (bool c)
 Set whether the function is const.
 
bool is_void () const
 Check, if the function has no return value.
 
void is_void (bool v)
 Set whether the function has a return value.
 
bool is_static () const
 Check, if the function is static.
 
void is_static (bool s)
 Set whether the function is static.
 
bool is_operator () const
 Check, if the method is an operator.
 
void is_operator (bool o)
 Set whether the method is an operator.
 
bool is_cuda_kernel () const
 Check, if a functions is a call to CUDA Kernel.
 
void is_cuda_kernel (bool c)
 Set whether the method is a CUDA kernel call.
 
bool is_cuda_device () const
 Check, if a functions is a call to CUDA device.
 
void is_cuda_device (bool c)
 Set whether the method is a CUDA device call.
 
void return_type (const std::string &rt)
 Set functions return type.
 
const std::string & return_type () const
 Get function return type.
 
void add_parameter (const std::string &a)
 Add a function parameter.
 
const std::vector< std::string > & parameters () const
 Get the list of function parameters.
 
- Public Member Functions inherited from clanguml::sequence_diagram::model::participant
 participant (const participant &)=delete
 
 participant (participant &&) noexcept=delete
 
participantoperator= (const participant &)=delete
 
participantoperator= (participant &&)=delete
 
std::string type_name () const override
 
virtual std::string to_string () const
 Create a string representation of the participant.
 
- Public Member Functions inherited from clanguml::common::model::template_element
 ~template_element () override=default
 
bool is_template () const
 
void is_template (bool is_template)
 
int calculate_template_specialization_match (const template_element &other) const
 Calculate template specialization match with other class.
 
bool template_specialization_found () const
 
void template_specialization_found (bool found)
 
 element (namespace_ using_namespace, path_type pt=path_type::kNamespace)
 
- Public Member Functions inherited from clanguml::common::model::element
 element (namespace_ using_namespace, path_type pt=path_type::kNamespace)
 
 ~element () override=default
 
std::string name_and_ns () const
 
void set_namespace (const namespace_ &ns)
 
namespace_ get_namespace () const
 
namespace_ get_relative_namespace () const
 
const namespace_path () const
 
void set_module (const std::string &module)
 
std::optional< std::string > module () const
 
void set_module_private (const bool module_private)
 
bool module_private () const
 
virtual std::string full_name_no_ns () const
 
const namespace_using_namespace () const
 
- Public Member Functions inherited from clanguml::common::model::diagram_element
 diagram_element ()
 
 ~diagram_element () override=default
 
const eid_tid () const
 Returns diagram element id.
 
void set_id (eid_t id)
 
std::optional< eid_tparent_element_id () const
 
void set_parent_element_id (eid_t id)
 
virtual std::string alias () const
 Return elements' diagram alias.
 
void set_name (const std::string &name)
 
void set_name (const std::string &parent, const std::string &name)
 
std::string name () const
 
virtual std::string type_name () const
 
std::string full_name (bool relative) const
 Return the elements fully qualified name.
 
std::vector< relationship > & relationships ()
 
const std::vector< relationship > & relationships () const
 
void add_relationship (relationship &&cr)
 
void append (const decorated_element &e)
 
bool is_nested () const
 
void nested (bool nested)
 
bool complete () const
 
void complete (bool completed)
 
void remove_duplicate_relationships ()
 
virtual void apply_filter (const diagram_filter &filter, const std::set< eid_t > &removed)
 
- Public Member Functions inherited from clanguml::common::model::decorated_element
virtual ~decorated_element ()=default
 
bool skip () const
 
bool skip_relationship () const
 
std::pair< relationship_t, std::string > get_relationship () const
 
std::string style_spec () const
 
const std::vector< std::shared_ptr< decorators::decorator > > & decorators () const
 
void add_decorators (const std::vector< std::shared_ptr< decorators::decorator > > &decorators)
 
void append (const decorated_element &de)
 
std::optional< comment_tcomment () const
 
void set_comment (const comment_t &c)
 
virtual std::optional< std::string > doxygen_link () const
 
- Public Member Functions inherited from clanguml::common::model::source_location
 source_location ()=default
 
 source_location (std::string f, unsigned int l)
 
const std::string & file () const
 
void set_file (const std::string &file)
 
const std::string & file_relative () const
 
void set_file_relative (const std::string &file)
 
const std::string & translation_unit () const
 
void set_translation_unit (const std::string &translation_unit)
 
unsigned int line () const
 
void set_line (const unsigned line)
 
unsigned int column () const
 
void set_column (const unsigned column)
 
unsigned int location_id () const
 
void set_location_id (unsigned int h)
 
- Public Member Functions inherited from clanguml::util::memoized< full_name_tag_t, std::string, bool >
auto memoize (bool is_complete, F &&f, Args... args) const
 
void invalidate (Args... args) const
 
- Public Member Functions inherited from clanguml::util::memoized< name_and_ns_tag, std::string >
auto memoize (bool is_complete, F &&f, Args... args) const
 
void invalidate (Args... args) const
 
- Public Member Functions inherited from clanguml::common::model::template_trait
std::ostream & render_template_params (std::ostream &ostr, const common::model::namespace_ &using_namespace, bool relative) const
 
void add_template (template_parameter &&tmplt)
 
const std::vector< template_parameter > & template_params () const
 
int calculate_template_specialization_match (const template_trait &other) const
 Wrapper around calculate_template_params_specialization_match()
 
- Public Member Functions inherited from clanguml::common::model::stylable_element
void set_style (const std::string &style)
 
std::optional< std::string > style () const
 

Protected Member Functions

std::string full_name_impl (bool relative=true) const override
 
- Protected Member Functions inherited from clanguml::common::model::element
std::string full_name_impl (bool relative) const override
 
virtual std::string name_and_ns_impl () const
 
virtual std::string full_name_impl (bool) const
 

Private Attributes

bool is_const_ {false}
 
bool is_void_ {false}
 
bool is_static_ {false}
 
bool is_operator_ {false}
 
bool is_cuda_kernel_ {false}
 
bool is_cuda_device_ {false}
 
std::string return_type_
 
std::vector< std::string > parameters_
 

Additional Inherited Members

- Public Attributes inherited from clanguml::sequence_diagram::model::participant
stereotype_t stereotype_ {stereotype_t::participant}
 

Member Enumeration Documentation

◆ message_render_mode

Enumerator
full 
abbreviated 
no_arguments 

Definition at line 227 of file participant.h.

Constructor & Destructor Documentation

◆ function() [1/3]

clanguml::sequence_diagram::model::function::function ( const common::model::namespace_ using_namespace)

Definition at line 115 of file participant.cc.

117{
118}

◆ function() [2/3]

clanguml::sequence_diagram::model::function::function ( const function )
delete

◆ function() [3/3]

clanguml::sequence_diagram::model::function::function ( function &&  )
deletenoexcept

Member Function Documentation

◆ add_parameter()

void clanguml::sequence_diagram::model::function::add_parameter ( const std::string &  a)

Add a function parameter.

Note
In sequence diagrams we don't care about relationships from function or method parameters, so we don't need to model them in detail.
Parameters
aFunction parameter label including name and type

Definition at line 179 of file participant.cc.

179{ parameters_.push_back(a); }

◆ full_name_impl()

std::string clanguml::sequence_diagram::model::function::full_name_impl ( bool  relative = true) const
overrideprotectedvirtual

Return elements full name.

Returns
Fully qualified elements name.

Reimplemented from clanguml::common::model::element.

Reimplemented in clanguml::sequence_diagram::model::method, clanguml::sequence_diagram::model::objc_method, and clanguml::sequence_diagram::model::function_template.

Definition at line 120 of file participant.cc.

121{
122 return fmt::format("{}({}){}", participant::full_name_impl(relative),
123 fmt::join(parameters_, ","), is_const() ? " const" : "");
124}

◆ full_name_no_ns()

std::string clanguml::sequence_diagram::model::function::full_name_no_ns ( ) const
overridevirtual

Return elements full name but without namespace.

Returns
Elements full name without namespace.

Reimplemented from clanguml::common::model::element.

Reimplemented in clanguml::sequence_diagram::model::function_template.

Definition at line 126 of file participant.cc.

127{
128 return fmt::format("{}({}){}", element::full_name_no_ns(),
129 fmt::join(parameters_, ","), is_const() ? " const" : "");
130}

◆ is_const() [1/2]

bool clanguml::sequence_diagram::model::function::is_const ( ) const

Check if function is const.

Returns
True, if function is const

Definition at line 151 of file participant.cc.

151{ return is_const_; }

◆ is_const() [2/2]

void clanguml::sequence_diagram::model::function::is_const ( bool  c)

Set whether the function is const.

Parameters
cTrue, if function is const

Definition at line 153 of file participant.cc.

153{ is_const_ = c; }

◆ is_cuda_device() [1/2]

bool clanguml::sequence_diagram::model::function::is_cuda_device ( ) const

Check, if a functions is a call to CUDA device.

Returns
True, if the method is a CUDA device call

Definition at line 171 of file participant.cc.

171{ return is_cuda_device_; }

◆ is_cuda_device() [2/2]

void clanguml::sequence_diagram::model::function::is_cuda_device ( bool  c)

Set whether the method is a CUDA device call.

Parameters
vTrue, if the method is a CUDA device call

Definition at line 173 of file participant.cc.

173{ is_cuda_device_ = c; }

◆ is_cuda_kernel() [1/2]

bool clanguml::sequence_diagram::model::function::is_cuda_kernel ( ) const

Check, if a functions is a call to CUDA Kernel.

Returns
True, if the method is a CUDA kernel call

Definition at line 167 of file participant.cc.

167{ return is_cuda_kernel_; }

◆ is_cuda_kernel() [2/2]

void clanguml::sequence_diagram::model::function::is_cuda_kernel ( bool  c)

Set whether the method is a CUDA kernel call.

Parameters
vTrue, if the method is a CUDA kernel call

Definition at line 169 of file participant.cc.

169{ is_cuda_kernel_ = c; }

◆ is_operator() [1/2]

bool clanguml::sequence_diagram::model::function::is_operator ( ) const

Check, if the method is an operator.

Returns
True, if the method is an operator

Definition at line 163 of file participant.cc.

163{ return is_operator_; }

◆ is_operator() [2/2]

void clanguml::sequence_diagram::model::function::is_operator ( bool  o)

Set whether the method is an operator.

Parameters
vTrue, if the method is an operator

Definition at line 165 of file participant.cc.

165{ is_operator_ = o; }

◆ is_static() [1/2]

bool clanguml::sequence_diagram::model::function::is_static ( ) const

Check, if the function is static.

Returns
True, if the function is static

Definition at line 159 of file participant.cc.

159{ return is_static_; }

◆ is_static() [2/2]

void clanguml::sequence_diagram::model::function::is_static ( bool  s)

Set whether the function is static.

Parameters
vTrue, if the function is static

Definition at line 161 of file participant.cc.

161{ is_static_ = s; }

◆ is_void() [1/2]

bool clanguml::sequence_diagram::model::function::is_void ( ) const

Check, if the function has no return value.

Returns
True, if the function has no return value

Definition at line 155 of file participant.cc.

155{ return is_void_; }

◆ is_void() [2/2]

void clanguml::sequence_diagram::model::function::is_void ( bool  v)

Set whether the function has a return value.

Parameters
vTrue, if the function has no return value

Definition at line 157 of file participant.cc.

157{ is_void_ = v; }

◆ message_name()

std::string clanguml::sequence_diagram::model::function::message_name ( message_render_mode  mode) const
virtual

Render function name as message label.

Parameters
modeFunction argument render mode
Returns
Message label

Reimplemented in clanguml::sequence_diagram::model::method, clanguml::sequence_diagram::model::objc_method, and clanguml::sequence_diagram::model::function_template.

Definition at line 132 of file participant.cc.

133{
134 constexpr auto kAbbreviatedMethodArgumentsLength{15};
135
137 return fmt::format("{}(){}", name(), is_const() ? " const" : "");
138 }
140 return fmt::format("{}({}){}", name(),
142 fmt::format("{}", fmt::join(parameters_, ",")),
143 kAbbreviatedMethodArgumentsLength),
144 is_const() ? " const" : "");
145 }
146
147 return fmt::format("{}({}){}", name(), fmt::join(parameters_, ","),
148 is_const() ? " const" : "");
149}

◆ operator=() [1/2]

function & clanguml::sequence_diagram::model::function::operator= ( const function )
delete

◆ operator=() [2/2]

function & clanguml::sequence_diagram::model::function::operator= ( function &&  )
delete

◆ parameters()

const std::vector< std::string > & clanguml::sequence_diagram::model::function::parameters ( ) const

Get the list of function parameters.

Returns
List of function parameters

Definition at line 181 of file participant.cc.

182{
183 return parameters_;
184}

◆ return_type() [1/2]

const std::string & clanguml::sequence_diagram::model::function::return_type ( ) const

Get function return type.

Returns
Return type

Definition at line 177 of file participant.cc.

177{ return return_type_; }

◆ return_type() [2/2]

void clanguml::sequence_diagram::model::function::return_type ( const std::string &  rt)

Set functions return type.

Parameters
rtReturn type

Definition at line 175 of file participant.cc.

175{ return_type_ = rt; }

◆ type_name()

std::string clanguml::sequence_diagram::model::function::type_name ( ) const
inlineoverridevirtual

Get the type name of the diagram element.

Returns
Type name of the diagram element.

Reimplemented from clanguml::common::model::diagram_element.

Reimplemented in clanguml::sequence_diagram::model::method, clanguml::sequence_diagram::model::objc_method, and clanguml::sequence_diagram::model::function_template.

Definition at line 241 of file participant.h.

241{ return "function"; }

Member Data Documentation

◆ is_const_

bool clanguml::sequence_diagram::model::function::is_const_ {false}
private

Definition at line 382 of file participant.h.

◆ is_cuda_device_

bool clanguml::sequence_diagram::model::function::is_cuda_device_ {false}
private

Definition at line 387 of file participant.h.

◆ is_cuda_kernel_

bool clanguml::sequence_diagram::model::function::is_cuda_kernel_ {false}
private

Definition at line 386 of file participant.h.

◆ is_operator_

bool clanguml::sequence_diagram::model::function::is_operator_ {false}
private

Definition at line 385 of file participant.h.

◆ is_static_

bool clanguml::sequence_diagram::model::function::is_static_ {false}
private

Definition at line 384 of file participant.h.

◆ is_void_

bool clanguml::sequence_diagram::model::function::is_void_ {false}
private

Definition at line 383 of file participant.h.

◆ parameters_

std::vector<std::string> clanguml::sequence_diagram::model::function::parameters_
private

Definition at line 389 of file participant.h.

◆ return_type_

std::string clanguml::sequence_diagram::model::function::return_type_
private

Definition at line 388 of file participant.h.


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