My Project
Loading...
Searching...
No Matches
LibThread::SetTrigger Class Reference

Public Member Functions

 SetTrigger (long count_init)
 
virtual bool ready ()
 
virtual bool accept (leftv arg)
 
virtual void activate (leftv arg)
 
virtual void execute ()
 
- Public Member Functions inherited from LibThread::Trigger
 Trigger ()
 
- Public Member Functions inherited from LibThread::Job
 Job ()
 
 ~Job ()
 
void addDep (Job *job)
 
void addDep (vector< Job * > &jobs)
 
void addDep (long ndeps, Job **jobs)
 
void addNotify (vector< Job * > &jobs)
 
void addNotify (Job *job)
 
void run ()
 
- Public Member Functions inherited from LibThread::SharedObject
 SharedObject ()
 
virtual ~SharedObject ()
 
void set_type (int type_init)
 
int get_type ()
 
void set_name (std::string &name_init)
 
void set_name (const char *s)
 
std::string & get_name ()
 
void incref (int by=1)
 
long decref ()
 
long getref ()
 
virtual BOOLEAN op2 (int op, leftv res, leftv a1, leftv a2)
 
virtual BOOLEAN op3 (int op, leftv res, leftv a1, leftv a2, leftv a3)
 

Private Attributes

vector< bool > set
 
long count
 

Additional Inherited Members

- Data Fields inherited from LibThread::Job
ThreadPoolpool
 
long prio
 
size_t id
 
long pending_index
 
vector< Job * > deps
 
vector< Job * > notify
 
vector< Trigger * > triggers
 
vector< string > args
 
string result
 
void * data
 
bool fast
 
bool done
 
bool queued
 
bool running
 
bool cancelled
 

Detailed Description

Definition at line 2052 of file shared.cc.

Constructor & Destructor Documentation

◆ SetTrigger()

LibThread::SetTrigger::SetTrigger ( long count_init)
inline

Definition at line 2057 of file shared.cc.

2057 : Trigger(), count(0),
2058 set(count_init) {
2059 }
vector< bool > set
Definition shared.cc:2054

Member Function Documentation

◆ accept()

virtual bool LibThread::SetTrigger::accept ( leftv arg)
inlinevirtual

Implements LibThread::Trigger.

Definition at line 2064 of file shared.cc.

2064 {
2065 return arg->Typ() == INT_CMD;
2066 }
int Typ()
Definition subexpr.cc:1048
@ INT_CMD
Definition tok.h:96

◆ activate()

virtual void LibThread::SetTrigger::activate ( leftv arg)
inlinevirtual

Implements LibThread::Trigger.

Definition at line 2067 of file shared.cc.

2067 {
2068 if (!ready()) {
2069 long value = (long) arg->Data();
2070 if (value < 0 || value >= count) return;
2071 if (set[value]) return;
2072 set[value] = true;
2073 count++;
2074 }
2075 }
virtual bool ready()
Definition shared.cc:2060
void * Data()
Definition subexpr.cc:1192

◆ execute()

virtual void LibThread::SetTrigger::execute ( )
inlinevirtual

Implements LibThread::Job.

Definition at line 2076 of file shared.cc.

2076 {
2077 // do nothing
2078 }

◆ ready()

virtual bool LibThread::SetTrigger::ready ( )
inlinevirtual

Reimplemented from LibThread::Job.

Definition at line 2060 of file shared.cc.

2060 {
2061 if (!Trigger::ready()) return false;
2062 return count == set.size();
2063 }
virtual bool ready()
Definition shared.cc:1600

Field Documentation

◆ count

long LibThread::SetTrigger::count
private

Definition at line 2055 of file shared.cc.

◆ set

vector<bool> LibThread::SetTrigger::set
private

Definition at line 2054 of file shared.cc.


The documentation for this class was generated from the following file: