Example #1
0
void EventAddress::parseAddress (const ssi_char_t *address) {

    if (address == 0 || address[0] == '\0') {
        return;
    }

    size_t len = strlen (address);

    ssi_char_t *chunks[2];

    if (address[0] == '@') {
        chunks[0] = 0;
        chunks[1] = ssi_strcpy (address + 1);
    } else if (address[len-1] == '@') {
        chunks[0] = ssi_strcpy (address);
        chunks[0][len-1] = '\0';
        chunks[1] = 0;
    } else {
        ssi_size_t n_chunks = ssi_split_string_count (address, '@');
        if (n_chunks != 2) {
            ssi_wrn ("malformed event address '%s'", address);
            return;
        }
        ssi_split_string (2, chunks, address, '@');
    }

    parseNames (chunks[0], _n_events, &_events);
    parseNames (chunks[1], _n_sender, &_sender);

    delete[] chunks[0];
    delete[] chunks[1];
}
Example #2
0
Example::Example(const Example &example) {

	_func = example._func;
	_arg = example._arg;
	_name = ssi_strcpy(example._name);
	_info = ssi_strcpy(example._info);
}
Example #3
0
bool ISReClass::setReClass (ssi_size_t n_classes,
	const ssi_char_t **class_names,
	ssi_size_t n_class_ids, 
	ssi_size_t *class_ids) { 

	if (_ids) {
		release ();
	}

	if (n_class_ids != _samples.getSize ()) {
		ssi_wrn ("#ids differs from #samples");
		return false;
	} 

	_n_classes = n_classes;
	_class_names = new ssi_char_t *[_n_classes];
	for (ssi_size_t i = 0; i < n_classes; i++) {
		_class_names[i] = ssi_strcpy (class_names[i]);
	}
	_n_ids = n_class_ids;
	_ids = new ssi_size_t[_n_ids];
	_n_ids_per_class = new ssi_size_t[_n_classes];

	for (ssi_size_t i = 0; i < _n_classes; i++) {
		_n_ids_per_class[i] = 0;
	}
	for (ssi_size_t i = 0; i < _n_ids; i++) {
		_ids[i] = class_ids[i];
		_n_ids_per_class[class_ids[i]]++;
	}

	return true;
}
Example #4
0
void StringList::add (const ssi_char_t *filename) {

	SSI_DBG (SSI_LOG_LEVEL_DEBUG, "add new entry: %s\n", filename);

	ssi_char_t *new_filename = ssi_strcpy (filename);
	_strings.push_back (new_filename);
}
Example #5
0
void Evaluation::init_conf_mat (ISamples &samples) {

	_n_classes = samples.getClassSize ();

	// store class names
	_class_names = new ssi_char_t *[_n_classes];
	for (ssi_size_t i = 0; i < _n_classes; i++) {
		_class_names[i] = ssi_strcpy (samples.getClassName (i));
	}

	// allocate confussion matrix
	_conf_mat_ptr = new ssi_size_t *[_n_classes];
	_conf_mat_data = new ssi_size_t[_n_classes * _n_classes];
	for (ssi_size_t i = 0; i < _n_classes; ++i) {
		_conf_mat_ptr[i] = _conf_mat_data + i*_n_classes;
	}

	// set all elements in the confussion matrix to zero
	for (ssi_size_t i = 0; i < _n_classes; ++i) {
		for (ssi_size_t j = 0; j < _n_classes; ++j) {
			_conf_mat_ptr[i][j] = 0;
		}
	}

	_n_unclassified = 0;
	_n_classified = 0;	
}
Example #6
0
QRSDetection::QRSDetection (const ssi_char_t *file) 
:	_file (0),
	_bandpass (0),
	_diff (0),
	_pre (0),
	_pre_low (0),
	_listener (0),
	_frame_count (0),
	_signal_level (0),
	_noise_level (0),
	_thres1 (0),
	_thres2 (0),
	_pulsed (false),
	_n_R (0),
	_samples_since_last_R (0),
	_head_RR (0),
	_history_RR (0),
	_sum_RR (0),
	_average_RR (0),
	_low_limit_RR (0),
	_high_limit_RR (0),
	_last_R (0),
	_rising (true),
	_send_etuple (false),
	_first_call (true)
	{

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #7
0
ssi_size_t Evaluation::cutString(const ssi_char_t *str, ssi_size_t n_cut_max, ssi_char_t *cut) {

	if (n_cut_max == 0 || !cut) {
		return 0;
	}

	if (!str || str[0] == '\0') {
		cut[0] = '\0';
		return 0;
	}

	ssi_size_t n_str = ssi_strlen(str);
	if (n_cut_max > n_str) {
		ssi_strcpy(cut, str);
		return n_str;
	}

	ssi_size_t n_front = (n_cut_max-1) / 2;
	ssi_size_t n_back = (n_cut_max - 1) - n_front;
	for (ssi_size_t i = 0; i < n_front; i++) {
		cut[i] = str[i];
	}
	for (ssi_size_t i = 0; i < n_back; i++) {
		cut[n_cut_max-2-i] = str[n_str-1-i];
	}
	cut[n_cut_max-1] = '\0';

	return n_cut_max-1;
}
Example #8
0
    Tensorflow::Tensorflow(const ssi_char_t *file)
            : _file(0),
              _trainer(0),
              _is_loaded(false),
              _probs(0),
              _handler(0),
              _n_classes(0),
              _merged_sample_dimension(0),
              _consumer_sr(0),
              _consumer_dim(0),
              _consumer_byte(0),
              _consumer_num(0),
              _n_metas(0),
              _metas(0),
              _del_trainer(false),
              ssi_log_level(SSI_LOG_LEVEL_DEFAULT) {

        if (file) {
            if (!OptionList::LoadXML(file, &_options)) {
                OptionList::SaveXML(file, &_options);
            }
            _file = ssi_strcpy(file);
        }

    }
Example #9
0
    void Tensorflow::consume_enter(ssi_size_t stream_in_num,
                                   ssi_stream_t stream_in[]) {

        _n_classes = 4;
        _probs = new ssi_real_t[_n_classes];

        _class_names = new ssi_char_t *[_n_classes];
        /*
        for (ssi_size_t i = 0; i < _n_classes; i++) {
            _class_names[i] = ssi_strcpy (samples.getClassName (i));
        } */
        _class_names[0] = ssi_strcpy("Ambient_Animals");
        _class_names[1] = ssi_strcpy("Rain");
        _class_names[2] = ssi_strcpy("Running_Water");
        _class_names[3] = ssi_strcpy("Traffic");
    }
Example #10
0
		void FileAnnotationWriter::setTier(const ssi_char_t *tier) {
			Lock lock(_tier_mutex);

			delete[] _tier; _tier = 0;
			if (tier) {
				_tier = ssi_strcpy(tier);
			}
		}
Example #11
0
		void FileAnnotationWriter::setLabel(const ssi_char_t *label) {
			Lock lock(_label_mutex);

			delete[] _label; _label = 0;
			if (label) {
				_label = ssi_strcpy(label);
			}
		}
Example #12
0
	Statistics::Statistics(const ssi_char_t *file /*= 0*/) : _file(0), _res(0), _tmp_arr(0), _dim(0), _old_num_real(0), _running_stats(0)
	{
		if (file) {
			if (!OptionList::LoadXML(file, &_options)) {
				OptionList::SaveXML(file, &_options);
			}
			_file = ssi_strcpy(file);
		}
	}
Example #13
0
	StreamTransformer::StreamTransformer(const ssi_char_t *file) : _file(0), _lastValueX(0), _lastValueY(0) {

		if (file) {
            if (!OptionList::LoadXML(file, &_options)) {
                OptionList::SaveXML(file, &_options);
			}
			_file = ssi_strcpy(file);
		}
	}
Example #14
0
void Window::setTitle(const ssi_char_t *title) {

	Thread::setName(title);
	ssi_strcpy(_title, title);

	if (_hWnd) {
		::SendMessage((HWND)_hWnd, WM_SETTEXT, ssi_strlen(title) + 1, (LPARAM)title);
	}
}
Example #15
0
Energy::Energy (const ssi_char_t *file)
	: _file (0) {

	if (file) {
		if (!OptionList::LoadXML (file, _options)) {
			OptionList::SaveXML (file, _options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #16
0
CheckBox::CheckBox (const ssi_char_t *name, 
	bool checked)
	: _parent(0),
	_checked (checked),
	_callback (0),
	_hWnd (0),
	_hCheckBox (0) {

	_name = ssi_strcpy(name);
}
Example #17
0
void QRSDetection::transform_enter (ssi_stream_t &stream_in,
	ssi_stream_t &stream_out,
	ssi_size_t xtra_stream_in_num,
	ssi_stream_t xtra_stream_in[]) {

	//bandpass
	Butfilt *bandpass = ssi_pcast (Butfilt, Factory::Create (Butfilt::GetCreateName (), 0, false));
	bandpass->getOptions()->type = Butfilt::BAND;
	bandpass->getOptions()->norm = false;
	bandpass->getOptions()->high = 15;
	bandpass->getOptions()->low = 5;
	bandpass->getOptions()->order = 13;
	_bandpass = bandpass;
	ssi_stream_init (_bandpass_stream, 0, _bandpass->getSampleDimensionOut (stream_in.dim), _bandpass->getSampleBytesOut (stream_in.byte), _bandpass->getSampleTypeOut (stream_in.type), stream_in.sr);
	_bandpass->transform_enter (stream_in, _bandpass_stream);

	//diff
	Derivative *diff = ssi_pcast(Derivative, Factory::Create (Derivative::GetCreateName (), 0, false));
	ssi_strcpy (diff->getOptions()->names, "1st");
	_diff = diff;
	ssi_stream_init (_diff_stream, 0, _diff->getSampleDimensionOut (_bandpass_stream.dim), _diff->getSampleBytesOut (_bandpass_stream.byte), _diff->getSampleTypeOut (_bandpass_stream.type), _bandpass_stream.sr);
	_diff->transform_enter (_bandpass_stream, _diff_stream);

	//qrs-pre-process
	QRSPreProcess *pre = ssi_pcast(QRSPreProcess, Factory::Create (QRSPreProcess::GetCreateName (), 0, false));
	_pre = pre;
	ssi_stream_init (_pre_stream, 0, _pre->getSampleDimensionOut (_diff_stream.dim), _pre->getSampleBytesOut (_diff_stream.byte), _pre->getSampleTypeOut (_diff_stream.type), _diff_stream.sr);
	_pre->transform_enter(_diff_stream, _pre_stream);

	Butfilt *pre_low = ssi_create (Butfilt, 0, false);
	pre_low->getOptions()->zero = true;
	pre_low->getOptions()->norm = false;
	pre_low->getOptions ()->low = 6.4;
	pre_low->getOptions ()->order = 3;
	pre_low->getOptions ()->type = Butfilt::LOW;	
	_pre_low = pre_low;
	ssi_stream_init (_pre_low_stream, 0, _pre_low->getSampleDimensionOut (_pre_stream.dim), _pre_low->getSampleBytesOut (_pre_stream.byte), _pre_low->getSampleTypeOut (_pre_stream.type), _pre_stream.sr);
	_pre_low->transform_enter(_pre_stream, _pre_low_stream);

	//qrs-detect
	ssi_size_t sample_dimension = _pre_low_stream.dim;
	_pulsed = false;
	_n_R = 0;
	_samples_since_last_R = 0;
	_sum_RR = 0;
	_average_RR = 0.0f;
	_history_RR = new ssi_size_t[_options.depthRR];
	_last_R = 0;
	for (ssi_size_t k = 0; k < _options.depthRR; k++) {
		_history_RR[k] = 0;
	}

	_first_call = true;
		
}
Example #18
0
bool SampleList::setClassName(ssi_size_t class_index, const ssi_char_t *class_name)
{
	if (class_index >= _classes.size())
	{
		return false;
	}

	delete[] _classes[class_index];
	_classes[class_index] = ssi_strcpy(class_name);

	return true;	
}
Example #19
0
bool SampleList::setUserName(ssi_size_t user_index, const ssi_char_t *user_name)
{
	if (user_index >= _users.size())
	{
		return false;
	}

	delete[] _classes[user_index];
	_classes[user_index] = ssi_strcpy(user_name);

	return true;
}
Example #20
0
MvgConDiv::MvgConDiv (const ssi_char_t *file)
: _file (0),
	_mvgs (0),
	_mvgl (0) {

	if (file) {
		if (!OptionList::LoadXML (file, _options)) {
			OptionList::SaveXML (file, _options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #21
0
PythonObject::PythonObject (const ssi_char_t *file)
	: _file (0), 
	_helper(0) 
{

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #22
0
Fisher::Fisher (const ssi_char_t *file) 
	: _basis (0),
	_file (0),
	_is_build (false) {	

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #23
0
ssi_size_t ISMergeSample::update_class_list (const ssi_char_t *name) {

	// check if already in list...
	for (ssi_size_t i = 0; i < _n_classes; i++) {
		if (strcmp (name, _class_names[i]) == 0) {
			return i;
		}
	}

	// otherwise add user name
	_class_names[_n_classes++] = ssi_strcpy (name);
	return _n_classes-1;
}
Example #24
0
OSMelspec::OSMelspec (const ssi_char_t *file)
	: _file (0),
	_filterCoeffs (0),
	_filterCfs (0),
	_chanMap (0) {

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #25
0
Rank::Rank (const ssi_char_t *file) :
	_model (0),
	_n_scores (0),
	_scores (0),
	_file (0) {

	if (file) {
		if (!OptionList::LoadXML (file, _options)) {
			OptionList::SaveXML (file, _options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #26
0
DimensionSelector::DimensionSelector (const ssi_char_t *file) 
	: _file (0),
	_n_selected (0),
	_max_selected(0),
	_selector(0) {

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #27
0
AudioConvert::AudioConvert (const ssi_char_t *file)
	: _file (0),
	_short_to_float (false) {

	if (file) {

		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	
	}
}
Example #28
0
Butfilt::Butfilt (const ssi_char_t *file)
	: _iir (0),
	_coefs (0),
	_first_sample (0),
	_file (0) {

	if (file) {
		if (!OptionList::LoadXML (file, _options)) {
			OptionList::SaveXML (file, _options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #29
0
AudioActivity::AudioActivity (const ssi_char_t *file)
: _file (0),
	_convert_input (false),
	_convert (0),
	_feature (0) {

	if (file) {
		if (!OptionList::LoadXML (file, _options)) {
			OptionList::SaveXML (file, _options);
		}
		_file = ssi_strcpy (file);
	}
}
Example #30
0
SignalPainter::SignalPainter (const ssi_char_t *file)
	: _n_windows(0),
	_window (0),
	_canvas (0),
	_client (0),
	_file (0) {

	if (file) {
		if (!OptionList::LoadXML(file, &_options)) {
			OptionList::SaveXML(file, &_options);
		}
		_file = ssi_strcpy (file);
	}
}