Itasca C++ Interface
Loading...
Searching...
No Matches
ikernelbase.h
1#pragma once
2
3#include "security/interface/isecurity.h"
4#include "shared/interface/signal.h"
5
6namespace itascaxd {
7 class IKernelBase {
8 public:
9 class Skip {
10 public:
11 inline bool any() const { return thingsToSkip_.size()>0; }
12 inline void skip(TType t,bool b=true);
13 inline void combine(const Skip &s) { for (auto &t : s.thingsToSkip_) skip(t,true); }
14 inline bool operator()(TType t) const { return std::find(thingsToSkip_.begin(),thingsToSkip_.end(),t)!=thingsToSkip_.end(); }
15 private:
16 FArray<TType,3> thingsToSkip_;
17 };
18
19 shared::Signal<const string &> saveModelStateSignal;
20 shared::Signal<bool> modelChangedNotice;
21 shared::Signal<bool> projectChangedNotice;
22 shared::Signal<const string &,const string &> startProcessingFile;// fullPathName, type
23 shared::Signal<const string &,const string &> stopProcessingFile; // fullPathName, type
24 shared::Signal<const string &> saveModelState; // name
25 shared::Signal<bool> cyclingChangeNotice; // When cycling starts/stops
26 shared::Signal<const string &> projectRestored;
27 shared::Signal<const string &> projectSaved;
28 shared::Signal<bool> resultsIntervalActiveChanged;
29
30 virtual void securityCheck(security::Check check = security::Check::Normal) = 0;
31 };
32
33 inline void IKernelBase::Skip::skip(TType t,bool b) {
34 const bool exist = operator()(t);
35 if (b and not exist)
36 thingsToSkip_.push_back(t);
37 if (not b and exist) {
38 auto it = std::remove(thingsToSkip_.begin(),thingsToSkip_.end(),t);
39 thingsToSkip_.resize(it-thingsToSkip_.begin());
40 }
41 }
42
43} // namespace itascaxd
44// EoF
An array class that attempts to minimize unnecessary heap access.
Definition farray.h:25
void push_back(const T &t)
Adds a new element to the end of the array, increasing the array size by one.
Definition farray.h:83
iterator begin()
Definition farray.h:130
iterator end()
Definition farray.h:139
size_type size() const
Definition farray.h:53
Definition ikernelbase.h:9
Definition ikernelbase.h:7
void resize(size_type i, const T &t=T())
Definition farray.h:261
uint32 TType
class type indicator
Definition basedef.h:46
Itasca Library standard namespace, specific to 2D or 3D.
Definition icontactmodule.h:4