Esempio n. 1
0
// fold functor example
static bool fun(const char *& acc, const data_t& data, const store_t& store,
        pos_t begin, pos_t end, bool has_next) {
    if (data.empty())
        return true;
    acc = data.str(store);
    std::cout << begin << ":" << end << ":" << has_next << ":" << acc << "\n";
    return true;
}
Esempio n. 2
0
// fold functor example
static bool fun(const char *& acc, const data_t& data, const store_t& store,
        pos_t, bool) {
    if (data.empty())
        return true;
    acc = data.str(store);
    std::cout << acc << std::endl;
    return true;
}
Esempio n. 3
0
/** Sets a new filter. However, the filter partitions are updated
 * cycle by cycle one after the other. Note: With the current implementation
 * the number of partitions of the new filter does not matter as long as it is 
 * equal or higher than the number of partitions of the current filter! If you 
 * set a filter which has less partitions than the current one, some of the 
 * partitions of the old filter will remain in the chain. So don't do that.
 * @param filter vector holding the transfer functions of the zero padded 
 * filter partitions in halfcomplex format (see also fftw3 documentation).
 * First element of \b filter is the first partition etc.
 */
void Convolver::set_filter_f(data_t& filter)
{
	if (filter.empty())
		return;

	// if more filter updates than convolutions happen
	if (!_waiting_queue.empty() && _waiting_queue.back().second == 0u)
	{
		_waiting_queue.pop_back();
	}

	_waiting_queue.push_back(std::pair<data_t, unsigned int>(filter, 0u));

}
Esempio n. 4
0
/** Sets the filter. 
 * The length of the impulse response is arbitrary. It automatically
 * performs zero padding if necessary and creates the required number of 
 * partitions. It is not very efficient since it calls 
 * \b Convolver::prepare_impulse_response(). It is provided for convenience.
 * If you have the filter's transfer function in halfcomplex format use
 * \b Convolver::set_filter_f() instead. 
 * @param filter impulse response of the filter
 */
void Convolver::set_filter_t(const data_t& filter)
{

	if (filter.empty())
	{
		WARNING("You are trying to use an empty filter.");
		return;
	}

	data_t buffer;

	// TODO: It would be more efficient to use _fft_plan and _fft_buffer etc.
	prepare_impulse_response(buffer, &filter[0], filter.size(), _frame_size);

	set_filter_f(buffer);
}
Esempio n. 5
0
 secure_comparator_t(const data_t& shared_secret)
     : comparator_(NULL)
 {
     if (shared_secret.empty()) {
         throw themispp::exception_t("Secure Comparator must have non-empty shared secret");
     }
     res_.reserve(512);
     comparator_ = secure_comparator_create();
     if (!comparator_) {
         throw themispp::exception_t("Secure Comparator construction failed");
     }
     themis_status_t status = secure_comparator_append_secret(comparator_,
                                                              &shared_secret[0],
                                                              shared_secret.size());
     if (THEMIS_SUCCESS != status) {
         throw themispp::exception_t("Secure Comparator failed to append secret", status);
     }
 }
Esempio n. 6
0
 bool isEmpty() const
 {
   return m_verts.empty();
 }