OTest2
A C++ testing framework
|
Go to the documentation of this file.
20 #ifndef OTest2_INCLUDE_OTEST2_OBJECTREPEATERMULTIIMPL_H_
21 #define OTest2_INCLUDE_OTEST2_OBJECTREPEATERMULTIIMPL_H_
33 template<
typename Object_,
typename Repeater_>
36 std::string section_path;
38 std::shared_ptr<Repeater_> repeater_object;
42 const std::string& section_path_) :
43 section_path(section_path_),
58 const Context& context_)
const override {
60 if(repeater_object ==
nullptr)
63 return repeater_object->hasNextRun(context_);
69 std::ostringstream oss_;
76 const std::string& case_name_,
79 return std::make_shared<Object_>(context_, section_path, std::ref(repeater_object));
83 template<
typename Object_,
typename Repeater_>
97 const std::string& section_path_)
const {
98 return std::make_shared<ObjectRepeaterMultiRoot<Object_, Repeater_> >(section_path_);
102 template<
typename Parent_,
typename Object_,
typename Repeater_>
108 std::shared_ptr<Repeater_>&);
112 std::string section_path;
114 std::shared_ptr<Repeater_> repeater_object;
119 const std::string& section_path_) :
120 factory_method(factory_method_),
121 section_path(section_path_),
124 assert(factory_method !=
nullptr);
137 const Context& context_)
const override {
139 if(repeater_object ==
nullptr)
142 return repeater_object->hasNextRun(context_);
148 std::ostringstream oss_;
155 const std::string& case_name_,
158 auto parent_typed_(std::dynamic_pointer_cast<Parent_>(parent_));
159 assert(parent_typed_ !=
nullptr);
160 return (parent_typed_.get()->*factory_method)(context_, section_path, repeater_object);
164 template<
typename Parent_,
typename Object_,
typename Repeater_>
175 factory_method(factory_method_) {
189 const std::string& section_path_)
const {
190 return std::make_shared<ObjectRepeaterMultiNested<Parent_, Object_, Repeater_> >(factory_method, section_path_);
Generic interface of a repeater of a testing object (this repeater is not a part of the OTest2 API)
virtual bool hasNextRun(const Context &context_) const override
Check whether next run of the object is planned.
ObjectRepeaterMultiRoot & operator=(const ObjectRepeaterMultiRoot &)=delete
virtual ObjectScenarioPtr createObject(const Context &context_, const std::string &case_name_, ObjectPtr parent_) override
Create the testing object.
std::shared_ptr< ObjectScenario > ObjectScenarioPtr
Shared pointer of a testing object scheduled by the scenario.
virtual ~ObjectRepeaterMultiNested()=default
This is a simple object keeping path to current testing object.
virtual ~ObjectRepeaterMultiRoot()=default
ObjectRepeaterMultiNested< Parent_, Object_, Repeater_ >::FactoryMethod FactoryMethod
virtual ObjectScenarioPtr createObject(const Context &context_, const std::string &case_name_, ObjectPtr parent_) override
Create the testing object.
ObjectRepeaterFactoryMultiRoot & operator=(const ObjectRepeaterFactoryMultiRoot &)=delete
virtual void modifyObjectPath(const Context &context_, ObjectPath &path_) const override
Change current object path.
ObjectRepeaterMultiRoot(const std::string §ion_path_)
virtual bool hasNextRun(const Context &context_) const override
Check whether next run of the object is planned.
virtual ~ObjectRepeaterFactoryMultiRoot()=default
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
ObjectScenarioPtr(Parent_::* FactoryMethod)(const Context &, const std::string &, std::shared_ptr< Repeater_ > &)
virtual ~ObjectRepeaterFactoryMultiNested()=default
virtual void modifyObjectPath(const Context &context_, ObjectPath &path_) const override
Change current object path.
ObjectRepeaterFactoryMultiRoot()=default
std::shared_ptr< ObjectRepeater > ObjectRepeaterPtr
Shared pointer of the object repeater objects.
ObjectRepeaterFactoryMultiNested(FactoryMethod factory_method_)
virtual ObjectRepeaterPtr createRepeater(const Context &context_, const std::string §ion_path_) const
Create repeater object.
ObjectRepeaterMultiNested(FactoryMethod factory_method_, const std::string §ion_path_)
ObjectRepeaterFactoryMultiNested & operator=(const ObjectRepeaterFactoryMultiNested &)=delete
Factory of object repeater objects.
ObjectRepeaterMultiNested & operator=(const ObjectRepeaterMultiNested &)=delete
void appendParameter(const std::string &name_, const std::string &value_)
Append parameter to current testing object.
virtual ObjectRepeaterPtr createRepeater(const Context &context_, const std::string §ion_path_) const
Create repeater object.