Skip to content

Commit

Permalink
remove explicit but default equivalents
Browse files Browse the repository at this point in the history
  • Loading branch information
JoGei committed Dec 6, 2021
1 parent a629dff commit eff549b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 71 deletions.
21 changes: 4 additions & 17 deletions include/etiss/fault/Fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ class Fault : public etiss::ToString

Fault(); ///< Constructor: Generates a new Fault with unique ID
Fault(int nullid);
Fault(const Fault &cpy);
Fault &operator=(const Fault &cpy);
#if CXX0X_UP_SUPPORTED
Fault(Fault &&cpy);
Fault &operator=(Fault &&cpy);
#endif

public:
std::string name_{ "" };
Expand All @@ -109,23 +103,16 @@ class Fault : public etiss::ToString
class FaultRef : public etiss::ToString
{
private:
std::unique_ptr<Fault> fault_{ nullptr }; ///< referenced Fault
std::string name_{ "" }; ///< string identifier, used to resolve actual reference via fault_
mutable Fault fault_; ///< referenced Fault, needs to be resolved during sim. runtime
std::string name_{ "" }; ///< string identifier, used to resolve actual reference via fault_

public:
std::string toString() const; ///< operator<< can be used.

FaultRef();
FaultRef(const FaultRef &cpy);
FaultRef &operator=(const FaultRef &cpy);
#if CXX0X_UP_SUPPORTED
FaultRef(FaultRef &&cpy);
FaultRef &operator=(FaultRef &&cpy);
#endif
bool is_set() const { return (fault_->name_ == name_); }
bool is_set() const { return (fault_.name_ == name_); }
bool set_fault_reference(const std::string &identifier);
bool resolve_reference() const;
const Fault &get_fault() const { return *fault_; }
const Fault &get_fault() const { return fault_; }
const std::string &get_name() const { return name_; }
};

Expand Down
55 changes: 1 addition & 54 deletions src/fault/Fault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,32 +264,6 @@ Fault::Fault() : id_(uniqueFaultId())

Fault::Fault(int nullid) : id_(nullid) {}

Fault::Fault(const Fault &cpy)
{
*this = cpy;
}

Fault &Fault::operator=(const Fault &cpy)
{
name_ = cpy.name_;
id_ = cpy.id_;
triggers = cpy.triggers;
actions = cpy.actions;
return *this;
}

#if CXX0X_UP_SUPPORTED
Fault::Fault(Fault &&cpy)
{
operator=(cpy);
}
Fault &Fault::operator=(Fault &&cpy)
{
operator=((const Fault &)cpy);
return *this;
}
#endif

std::string Fault::toString() const
{

Expand Down Expand Up @@ -326,33 +300,6 @@ bool Fault::isResoved() const
return true;
}

FaultRef::FaultRef() : fault_(std::make_unique<Fault>()) {}

FaultRef::FaultRef(const FaultRef &cpy) : FaultRef()
{
*this = cpy;
}

FaultRef &FaultRef::operator=(const FaultRef &cpy)
{
name_ = cpy.get_name();
*fault_ = cpy.get_fault();

return *this;
}

#if CXX0X_UP_SUPPORTED
FaultRef::FaultRef(FaultRef &&cpy)
{
operator=(cpy);
}
FaultRef &FaultRef::operator=(FaultRef &&cpy)
{
operator=((const FaultRef &)cpy);
return *this;
}
#endif

std::string FaultRef::toString() const
{

Expand Down Expand Up @@ -383,7 +330,7 @@ bool FaultRef::resolve_reference() const
{
if (it.second.name_ == name_)
{
*fault_ = it.second;
fault_ = it.second;
return true;
}
}
Expand Down

0 comments on commit eff549b

Please sign in to comment.