int get_field_number(const char* field_name) const { safe_assert(is_struct(), "Attempted to access field of a non-struct element."); return mxGetFieldNumber(array, field_name); }
void Suite::AddScenario(Scenario* scenario) { safe_assert(scenario != NULL); scenarios_.push_back(scenario); }
int ExecutionTracker::checkSemaphoreValue(sem_t * sem) { int a = -1; int * semval = &a; safe_assert(Originals::sem_getvalue(sem, semval) == OPERATION_SUCCESSFUL); return a; }
ExecutionTree* ExecutionTree::get_child(int i) { safe_assert(BETWEEN(0, i, int(children_.size())-1)); return children_[i]; }
SETUP() { safe_assert(counter == NULL); counter = new NBCounter(); }
void set_cell_index2d(const size_t i, const size_t j, matwrap contents) { safe_assert(array != NULL, "dereferenced null mxArray"); mxSetCell(array, i + j*rows(), contents.array); }
bool ExecutionTree::child_covered(int i /*= 0*/) { safe_assert(BETWEEN(0, i, int(children_.size())-1)); ExecutionTree* c = child(i); return c != NULL && c->covered(); }
bool is_struct() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxIsStruct(array); }
bool is_double() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetClassID(array) == mxDOUBLE_CLASS; }
matwrap get_cell(size_t index) const { safe_assert(array != NULL, "dereferenced null mxArray"); safe_assert(mxGetClassID(array) == mxCELL_CLASS, "Attempted to access a cell in a non-cell array."); return mxGetCell(array, index); }
bool is_cell() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxIsCell(array); }
size_t size() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetNumberOfElements(array); }
const char* get_classname() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetClassName(array); } // end of is class
bool is_class(const char* classname) const { safe_assert(array != NULL, "dereferenced null mxArray"); safe_assert(classname != NULL, "Invalid classname argument"); return mxIsClass(array, classname); } // end of is class
double* get_double_array() { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetPr(array); }
bool is_uint32() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetClassID(array) == mxUINT32_CLASS; }
double& mat_index2d(const size_t i, const size_t j) { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetPr(array)[ i + j*rows()]; }
bool is_string() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetClassID(array) == mxCHAR_CLASS; }
matwrap get_cell_index2d(const size_t i, const size_t j) { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetCell(array, i + j*rows()); }
void as_string(char* str_buffer, size_t buffer_len) { safe_assert(str_buffer != NULL, "NULL string buffer"); int error = mxGetString(array, str_buffer, buffer_len); safe_assert(!error, "Error processing string!"); }
void ExecutionTree::set_child(ExecutionTree* node, int i) { safe_assert(BETWEEN(0, i, int(children_.size())-1)); children_[i] = node; }
const mwSize* get_dimensions() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetDimensions(array); }
thrID StrictTracker::pickNextSchedulingChoice(SchedPointInfo * s) { deadlockCheck(); bool didNotGoPastEndOfReplayLog = false; safe_assert(didNotGoPastEndOfReplayLog); return INVALID_THREAD; }
size_t cols() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetN(array); }
bool RandomActiveTester::reenableThreadIfLegal(thrID thr) { safe_assert(active_testing_paused[thr]); active_testing_paused[thr] = false; disableThread(thr); return false; }
const mwSize get_num_dimensions() const { safe_assert(array != NULL, "dereferenced null mxArray"); return mxGetNumberOfDimensions(array); }
void ExecutionTracker::gunlock() { safe_assert(Originals::pthread_mutex_trylock(global_lock) != OPERATION_SUCCESSFUL); lock_count--; Originals::pthread_mutex_unlock(global_lock); }
template<typename T> T* get_data() { safe_assert(array != NULL, "dereferenced null mxArray"); return reinterpret_cast<T*>(mxGetData(array)); }
//TODO: locks or no? void ExecutionTracker::waitWakeThread(thrID target) { log->waitWakeThread(target); sem_t * pause = wait_sem_map[target]; safe_assert(pause != NULL); safe_assert(Originals::sem_post(pause) == OPERATION_SUCCESSFUL); }
matwrap get_field(const int field_id) const { safe_assert(is_struct(), "Attempted to access field of a non-struct element."); safe_assert(field_id < get_number_of_fields(), "Invalid field id!"); return mxGetFieldByNumber(array,0,field_id); }