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

Detailed Description

Sequence diagram callee type filter.

Definition at line 327 of file diagram_filter.h.

#include <diagram_filter.h>

Public Member Functions

 callee_filter (filter_t type, std::vector< config::callee_type > callee_types)
 
 ~callee_filter () override=default
 
tvl::value_t match (const diagram &d, const sequence_diagram::model::participant &p) const override
 
- Public Member Functions inherited from clanguml::common::model::filter_visitor
 filter_visitor (filter_t type)
 
virtual ~filter_visitor ()=default
 
virtual tvl::value_t match (const diagram &d, const common::model::element &e) const
 
virtual tvl::value_t match (const diagram &d, const common::model::relationship &r) const
 
virtual tvl::value_t match (const diagram &d, const common::model::relationship_t &r) const
 
virtual tvl::value_t match (const diagram &d, const common::model::access_t &a) const
 
virtual tvl::value_t match (const diagram &d, const common::model::namespace_ &ns) const
 
virtual tvl::value_t match (const diagram &d, const common::model::source_file &f) const
 
virtual tvl::value_t match (const diagram &d, const common::model::source_location &f) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::class_method &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::class_member &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::objc_method &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::objc_member &m) const
 
virtual tvl::value_t match (const diagram &d, const sequence_diagram::model::participant &p) const
 
bool is_inclusive () const
 
bool is_exclusive () const
 
filter_t type () const
 
filter_mode_t mode () const
 
void set_mode (filter_mode_t mode)
 

Private Attributes

std::vector< config::callee_typecallee_types_
 

Constructor & Destructor Documentation

◆ callee_filter()

clanguml::common::model::callee_filter::callee_filter ( filter_t  type,
std::vector< config::callee_type callee_types 
)

Definition at line 724 of file diagram_filter.cc.

727 , callee_types_{std::move(callee_types)}
728{
729}

◆ ~callee_filter()

clanguml::common::model::callee_filter::~callee_filter ( )
overridedefault

Member Function Documentation

◆ match()

tvl::value_t clanguml::common::model::callee_filter::match ( const diagram d,
const sequence_diagram::model::participant p 
) const
overridevirtual

Reimplemented from clanguml::common::model::filter_visitor.

Definition at line 731 of file diagram_filter.cc.

733{
734 using sequence_diagram::model::class_;
735 using sequence_diagram::model::function;
736 using sequence_diagram::model::method;
737 using sequence_diagram::model::participant;
738
739 auto is_lambda = [&d](const method &m) {
740 auto class_participant =
741 dynamic_cast<const sequence_diagram::model::diagram &>(d)
742 .get_participant<class_>(m.class_id());
743 if (!class_participant)
744 return false;
745
746 return class_participant.value().is_lambda();
747 };
748
750 callee_types_.begin(), callee_types_.end(), [&p, is_lambda](auto ct) {
751 auto is_function = [](const participant *p) {
752 return dynamic_cast<const function *>(p) != nullptr;
753 };
754
755 auto is_cuda_kernel = [](const participant *p) {
756 const auto *f = dynamic_cast<const function *>(p);
757 return (f != nullptr) && (f->is_cuda_kernel());
758 };
759
760 auto is_cuda_device = [](const participant *p) {
761 const auto *f = dynamic_cast<const function *>(p);
762 return (f != nullptr) && (f->is_cuda_device());
763 };
764
765 switch (ct) {
767 return p.type_name() == "method";
769 return p.type_name() == "method" &&
770 ((method &)p).is_constructor();
772 return p.type_name() == "method" &&
773 ((method &)p).is_assignment();
775 return is_function(&p) && ((function &)p).is_operator();
777 return p.type_name() == "method" &&
778 ((method &)p).is_defaulted();
780 return is_function(&p) && ((function &)p).is_static();
782 return p.type_name() == "function";
784 return p.type_name() == "function_template";
786 return p.type_name() == "method" && is_lambda((method &)p);
788 return is_cuda_kernel(&p);
790 return is_cuda_device(&p);
791 }
792
793 return false;
794 });
795
796 if ((type() == filter_t::kInclusive && tvl::is_false(res)) ||
797 (type() == filter_t::kExclusive && tvl::is_true(res))) {
798 LOG_TRACE(
799 "Participant {} rejected by callee_filter", p.full_name(false));
800 }
801
802 return res;
803}

Member Data Documentation

◆ callee_types_

std::vector<config::callee_type> clanguml::common::model::callee_filter::callee_types_
private

Definition at line 336 of file diagram_filter.h.


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