feat(test): add network manager singleton reset
This commit is contained in:
@@ -100,6 +100,18 @@ std::optional<enzo::nt::OpId> enzo::nt::NetworkManager::getDisplayOp()
|
||||
return displayOp_;
|
||||
}
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
void enzo::nt::NetworkManager::_reset()
|
||||
{
|
||||
delete instancePtr_;
|
||||
instancePtr_ = nullptr;
|
||||
|
||||
gopStore_.clear();
|
||||
maxOpId_=0;
|
||||
displayOp_.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
enzo::nt::NetworkManager* enzo::nt::NetworkManager::instancePtr_ = nullptr;
|
||||
std::unordered_map<enzo::nt::OpId, std::unique_ptr<enzo::nt::GeometryOperator>> enzo::nt::NetworkManager::gopStore_;
|
||||
|
||||
|
||||
@@ -17,24 +17,31 @@ public:
|
||||
|
||||
static NetworkManager* getInstance();
|
||||
|
||||
// functions
|
||||
static OpId addOperator();
|
||||
void setDisplayOp(OpId opId);
|
||||
static std::optional<OpId> getDisplayOp();
|
||||
static bool isValidOp(nt::OpId opId);
|
||||
static GeometryOperator& getGeoOperator(nt::OpId opId);
|
||||
void setDisplayOp(OpId opId);
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
static void _reset();
|
||||
#endif
|
||||
|
||||
private:
|
||||
static NetworkManager* instancePtr_;
|
||||
NetworkManager() {};
|
||||
|
||||
static std::unordered_map<enzo::nt::OpId, std::unique_ptr<enzo::nt::GeometryOperator>> gopStore_;
|
||||
|
||||
// functions
|
||||
static void cookOp(enzo::nt::OpId opId);
|
||||
static std::vector<enzo::nt::OpId> getDependencyGraph(enzo::nt::OpId opId);
|
||||
|
||||
// variables
|
||||
// store for geometry operators
|
||||
static std::unordered_map<enzo::nt::OpId, std::unique_ptr<enzo::nt::GeometryOperator>> gopStore_;
|
||||
// the highest operator id currently stored
|
||||
inline static enzo::nt::OpId maxOpId_=0;
|
||||
|
||||
// operator selected for displaying in the viewport
|
||||
inline static std::optional<OpId> displayOp_=std::nullopt;
|
||||
signals:
|
||||
void updateDisplay(enzo::geo::Geometry& geometry);
|
||||
|
||||
Reference in New Issue
Block a user