hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6f280d962a471063fe4aeb16ed23bc49b5e6925e | 5,856 | cpp | C++ | src/gromacs/linearalgebra/gmx_lapack/dlasd3.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 384 | 2015-01-02T19:44:15.000Z | 2022-03-27T15:13:15.000Z | src/gromacs/linearalgebra/gmx_lapack/dlasd3.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 168 | 2017-05-27T14:43:32.000Z | 2021-04-12T08:07:11.000Z | src/gromacs/linearalgebra/gmx_lapack/dlasd3.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 258 | 2015-01-19T11:19:57.000Z | 2022-03-18T08:59:52.000Z | #include <cmath>
#include "../gmx_blas.h"
#include "../gmx_lapack.h"
void
F77_FUNC(dlasd3,DLASD3)(int *nl,
int *nr,
int *sqre,
int *k,
double *d__,
double *q,
int *ldq,
double *dsigma,
double *u,
int *ldu,
double *u2,
int *ldu2,
double *vt,
int *ldvt,
double *vt2,
int *ldvt2,
int *idxc,
int *ctot,
double *z__,
int *info)
{
int q_dim1, q_offset, u_dim1, u_offset, u2_dim1, u2_offset, vt_dim1,
vt_offset, vt2_dim1, vt2_offset, i__1, i__2;
double d__2;
int i__, j, m, n, jc;
double rho;
int nlp1, nlp2, nrp1;
double temp;
int ctemp;
int ktemp;
int c__1 = 1;
int c__0 = 0;
double zero = 0.0;
double one = 1.0;
--d__;
q_dim1 = *ldq;
q_offset = 1 + q_dim1;
q -= q_offset;
--dsigma;
u_dim1 = *ldu;
u_offset = 1 + u_dim1;
u -= u_offset;
u2_dim1 = *ldu2;
u2_offset = 1 + u2_dim1;
u2 -= u2_offset;
vt_dim1 = *ldvt;
vt_offset = 1 + vt_dim1;
vt -= vt_offset;
vt2_dim1 = *ldvt2;
vt2_offset = 1 + vt2_dim1;
vt2 -= vt2_offset;
--idxc;
--ctot;
--z__;
/* Function Body */
*info = 0;
if (*nl < 1) {
*info = -1;
} else if (*nr < 1) {
*info = -2;
} else if (*sqre != 1 && *sqre != 0) {
*info = -3;
}
n = *nl + *nr + 1;
m = n + *sqre;
nlp1 = *nl + 1;
nlp2 = *nl + 2;
if (*k == 1) {
d__[1] = std::abs(z__[1]);
F77_FUNC(dcopy,DCOPY)(&m, &vt2[vt2_dim1 + 1], ldvt2, &vt[vt_dim1 + 1], ldvt);
if (z__[1] > 0.) {
F77_FUNC(dcopy,DCOPY)(&n, &u2[u2_dim1 + 1], &c__1, &u[u_dim1 + 1], &c__1);
} else {
i__1 = n;
for (i__ = 1; i__ <= i__1; ++i__) {
u[i__ + u_dim1] = -u2[i__ + u2_dim1];
}
}
return;
}
F77_FUNC(dcopy,DCOPY)(k, &z__[1], &c__1, &q[q_offset], &c__1);
rho = F77_FUNC(dnrm2,DNRM2)(k, &z__[1], &c__1);
F77_FUNC(dlascl,DLASCL)("G", &c__0, &c__0, &rho, &one, k, &c__1, &z__[1], k, info);
rho *= rho;
i__1 = *k;
for (j = 1; j <= i__1; ++j) {
F77_FUNC(dlasd4,DLASD4)(k, &j, &dsigma[1], &z__[1], &u[j * u_dim1 + 1], &rho, &d__[j],
&vt[j * vt_dim1 + 1], info);
if (*info != 0) {
return;
}
}
i__1 = *k;
for (i__ = 1; i__ <= i__1; ++i__) {
z__[i__] = u[i__ + *k * u_dim1] * vt[i__ + *k * vt_dim1];
i__2 = i__ - 1;
for (j = 1; j <= i__2; ++j) {
z__[i__] *= u[i__ + j * u_dim1] * vt[i__ + j * vt_dim1] / (dsigma[
i__] - dsigma[j]) / (dsigma[i__] + dsigma[j]);
}
i__2 = *k - 1;
for (j = i__; j <= i__2; ++j) {
z__[i__] *= u[i__ + j * u_dim1] * vt[i__ + j * vt_dim1] / (dsigma[
i__] - dsigma[j + 1]) / (dsigma[i__] + dsigma[j + 1]);
}
d__2 = std::sqrt(std::abs(z__[i__]));
z__[i__] = (q[i__ + q_dim1] > 0) ? d__2 : -d__2;
}
i__1 = *k;
for (i__ = 1; i__ <= i__1; ++i__) {
vt[i__ * vt_dim1 + 1] = z__[1] / u[i__ * u_dim1 + 1] / vt[i__ *
vt_dim1 + 1];
u[i__ * u_dim1 + 1] = -1.;
i__2 = *k;
for (j = 2; j <= i__2; ++j) {
vt[j + i__ * vt_dim1] = z__[j] / u[j + i__ * u_dim1] / vt[j + i__
* vt_dim1];
u[j + i__ * u_dim1] = dsigma[j] * vt[j + i__ * vt_dim1];
}
temp = F77_FUNC(dnrm2,DNRM2)(k, &u[i__ * u_dim1 + 1], &c__1);
q[i__ * q_dim1 + 1] = u[i__ * u_dim1 + 1] / temp;
i__2 = *k;
for (j = 2; j <= i__2; ++j) {
jc = idxc[j];
q[j + i__ * q_dim1] = u[jc + i__ * u_dim1] / temp;
}
}
if (*k == 2) {
F77_FUNC(dgemm,DGEMM)("N", "N", &n, k, k, &one, &u2[u2_offset], ldu2, &q[q_offset],
ldq, &zero, &u[u_offset], ldu);
goto L100;
}
if (ctot[1] > 0) {
F77_FUNC(dgemm,DGEMM)("N", "N", nl, k, &ctot[1], &one, &u2[(u2_dim1 << 1) + 1],
ldu2, &q[q_dim1 + 2], ldq, &zero, &u[u_dim1 + 1], ldu);
if (ctot[3] > 0) {
ktemp = ctot[1] + 2 + ctot[2];
F77_FUNC(dgemm,DGEMM)("N", "N", nl, k, &ctot[3], &one, &u2[ktemp * u2_dim1 + 1]
, ldu2, &q[ktemp + q_dim1], ldq, &one, &u[u_dim1 + 1],
ldu);
}
} else if (ctot[3] > 0) {
ktemp = ctot[1] + 2 + ctot[2];
F77_FUNC(dgemm,DGEMM)("N", "N", nl, k, &ctot[3], &one, &u2[ktemp * u2_dim1 + 1],
ldu2, &q[ktemp + q_dim1], ldq, &zero, &u[u_dim1 + 1], ldu);
} else {
F77_FUNC(dlacpy,DLACPY)("F", nl, k, &u2[u2_offset], ldu2, &u[u_offset], ldu);
}
F77_FUNC(dcopy,DCOPY)(k, &q[q_dim1 + 1], ldq, &u[nlp1 + u_dim1], ldu);
ktemp = ctot[1] + 2;
ctemp = ctot[2] + ctot[3];
F77_FUNC(dgemm,DGEMM)("N", "N", nr, k, &ctemp, &one, &u2[nlp2 + ktemp * u2_dim1], ldu2,
&q[ktemp + q_dim1], ldq, &zero, &u[nlp2 + u_dim1], ldu);
L100:
i__1 = *k;
for (i__ = 1; i__ <= i__1; ++i__) {
temp = F77_FUNC(dnrm2,DNRM2)(k, &vt[i__ * vt_dim1 + 1], &c__1);
q[i__ + q_dim1] = vt[i__ * vt_dim1 + 1] / temp;
i__2 = *k;
for (j = 2; j <= i__2; ++j) {
jc = idxc[j];
q[i__ + j * q_dim1] = vt[jc + i__ * vt_dim1] / temp;
}
}
if (*k == 2) {
F77_FUNC(dgemm,DGEMM)("N", "N", k, &m, k, &one, &q[q_offset], ldq, &vt2[vt2_offset]
, ldvt2, &zero, &vt[vt_offset], ldvt);
return;
}
ktemp = ctot[1] + 1;
F77_FUNC(dgemm,DGEMM)("N", "N", k, &nlp1, &ktemp, &one, &q[q_dim1 + 1], ldq, &vt2[
vt2_dim1 + 1], ldvt2, &zero, &vt[vt_dim1 + 1], ldvt);
ktemp = ctot[1] + 2 + ctot[2];
if (ktemp <= *ldvt2) {
F77_FUNC(dgemm,DGEMM)("N", "N", k, &nlp1, &ctot[3], &one, &q[ktemp * q_dim1 + 1],
ldq, &vt2[ktemp + vt2_dim1], ldvt2, &one, &vt[vt_dim1 + 1],
ldvt);
}
ktemp = ctot[1] + 1;
nrp1 = *nr + *sqre;
if (ktemp > 1) {
i__1 = *k;
for (i__ = 1; i__ <= i__1; ++i__) {
q[i__ + ktemp * q_dim1] = q[i__ + q_dim1];
}
i__1 = m;
for (i__ = nlp2; i__ <= i__1; ++i__) {
vt2[ktemp + i__ * vt2_dim1] = vt2[i__ * vt2_dim1 + 1];
}
}
ctemp = ctot[2] + 1 + ctot[3];
F77_FUNC(dgemm,DGEMM)("N", "N", k, &nrp1, &ctemp, &one, &q[ktemp * q_dim1 + 1], ldq, &
vt2[ktemp + nlp2 * vt2_dim1], ldvt2, &zero, &vt[nlp2 * vt_dim1 +
1], ldvt);
return;
}
| 26.142857 | 91 | 0.49778 | hejamu |
6f286efdc6e1e2d2be3a13cdaedfd17cb69dd2a7 | 921 | cpp | C++ | src/prod/src/Reliability/Failover/fm/FailoverThrottle.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/Reliability/Failover/fm/FailoverThrottle.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/Reliability/Failover/fm/FailoverThrottle.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "stdafx.h"
using namespace std;
using namespace Common;
using namespace Reliability;
using namespace Reliability::FailoverManagerComponent;
FailoverThrottle::FailoverThrottle(Common::ConfigEntry<Common::TimeSpan> & throttleTime)
: stopwatch_()
, throttleTime_(throttleTime)
, isFirstCall_(true)
{
}
bool FailoverThrottle::IsThrottling()
{
if (!isFirstCall_)
{
if (stopwatch_.Elapsed > throttleTime_.GetValue())
{
stopwatch_.Restart();
return true;
}
return false;
}
isFirstCall_ = false;
stopwatch_.Start();
return true;
}
| 24.236842 | 98 | 0.586319 | gridgentoo |
6f28a56faffce29d051ebb6660b1053b3aafd8b5 | 14,156 | cpp | C++ | src/gaussian/toplevelgauss.cpp | meelgroup/RoundXOR | c35d7316a46deed7cca0ab7eb314b5aa2ff7d7f7 | [
"MIT"
] | 5 | 2021-10-29T18:39:10.000Z | 2022-03-23T11:53:46.000Z | src/gaussian/toplevelgauss.cpp | meelgroup/RoundXOR | c35d7316a46deed7cca0ab7eb314b5aa2ff7d7f7 | [
"MIT"
] | 1 | 2022-02-09T10:56:21.000Z | 2022-02-09T10:56:30.000Z | src/gaussian/toplevelgauss.cpp | meelgroup/linpb | c35d7316a46deed7cca0ab7eb314b5aa2ff7d7f7 | [
"MIT"
] | null | null | null | /******************************************
Copyright (c) 2016, Mate Soos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
***********************************************/
#include "toplevelgauss.h"
#include "time_mem.h"
// #include "solver.h"
#include "solverwrapper.h"
// #include "occsimplifier.h"
// #include "clauseallocator.h"
#include <m4ri/m4ri.h>
#include <limits>
#include <cstddef>
// #include "sqlstats.h"
using namespace CMSat;
using std::cout;
using std::endl;
TopLevelGauss::TopLevelGauss(Solver* _solver) :
solver(_solver)
{
//NOT THREAD SAFE BUG
m4ri_build_all_codes();
}
bool TopLevelGauss::toplevelgauss(const vector<Xor>& _xors, vector<Lit>* _out_changed_occur)
{
out_changed_occur = _out_changed_occur;
runStats.clear();
runStats.numCalls = 1;
xors = _xors;
size_t origTrailSize = solver->trail_size();
extractInfo();
if (solver->conf.verbosity) {
runStats.print_short(solver);
}
runStats.zeroDepthAssigns = solver->trail_size() - origTrailSize;
/*
if (solver->sqlStats) {
solver->sqlStats->time_passed_min(
solver
, "toplevelgauss"
, runStats.total_time()
);
}*/
globalStats += runStats;
return solver->okay();
}
struct XorSorter{
bool operator()(const Xor& a, const Xor& b) const
{
return a.size() > b.size();
}
};
bool TopLevelGauss::extractInfo()
{
double myTime = cpuTime();
//Order XORs so that larger are first. this way, putting them into blocks
//will be faster
std::sort(xors.begin(), xors.end(), XorSorter());
//Pre-filter XORs -- don't use any XOR which is not connected to ANY
//other XOR. These cannot be XOR-ed with anything anyway
vector<uint32_t> varsIn(solver->nVars(), 0);
for(const Xor& x: xors) {
for(const uint32_t v: x) {
varsIn[v]++;
}
}
size_t i = 0;
vector<size_t> xorsToUse;
for(vector<Xor>::const_iterator
it = xors.begin(), end = xors.end()
; it != end
; ++it, i++
) {
const Xor& thisXor = *it;
bool makeItIn = false;
for(uint32_t v: thisXor) {
if (varsIn[v] > 1) {
makeItIn = true;
break;
}
}
//If this clause is not connected to ANY other, skip
if (!makeItIn)
continue;
xorsToUse.push_back(i);
}
//Cut above-filtered XORs into blocks
cutIntoBlocks(xorsToUse);
move_xors_into_blocks();
runStats.blockCutTime += cpuTime() -myTime;
myTime = cpuTime();
//These mappings will be needed for the matrices, which will have far less
//variables than solver->nVars()
outerToInterVarMap.clear();
outerToInterVarMap.resize(solver->nVars(), std::numeric_limits<uint32_t>::max());
interToOUterVarMap.clear();
interToOUterVarMap.resize(solver->nVars(), std::numeric_limits<uint32_t>::max());
//Go through all blocks, and extract info
i = 0;
for(vector<vector<uint32_t> >::const_iterator
it = blocks.begin(), end = blocks.end()
; it != end
; ++it, i++
) {
//If block is already merged, skip
if (it->empty())
continue;
double t = cpuTime();
const uint64_t oldNewUnits = runStats.newUnits;
const uint64_t oldNewBins = runStats.newBins;
if (!extractInfoFromBlock(*it, i))
goto end;
if (solver->conf.verbosity >= 2) {
cout << "c [toplevel-xor] Block size: " << it->size() << endl;
cout << "c [toplevel-xor] New units this round: " << (runStats.newUnits - oldNewUnits) << endl;
cout << "c [toplevel-xor] New bins this round: " << (runStats.newBins - oldNewBins) << endl;
cout << "c [toplevel-xor] Time: " << std::setprecision(3) << std::fixed << (cpuTime() - t) << endl;
}
}
end:
runStats.extractTime += cpuTime() - myTime;
return solver->okay();
}
bool TopLevelGauss::extractInfoFromBlock(
const vector<uint32_t>& block
, const size_t blockNum
) {
assert(solver->okay());
if (block.empty()) {
return solver->okay();
}
//Outer-inner var mapping is needed because not all vars are in the matrix
size_t num = 0;
for(vector<uint32_t>::const_iterator
it2 = block.begin(), end2 = block.end()
; it2 != end2
; it2++, num++
) {
//Used to put XOR into matrix
outerToInterVarMap[*it2] = num;
//Used to transform new data in matrix to solver
interToOUterVarMap[num] = *it2;
}
//Get corresponding XORs
const vector<uint32_t>& thisXors = xors_in_blocks[blockNum];
assert(thisXors.size() > 1 && "We pre-filter the set such that *every* block contains at least 2 xors");
//Set up matrix
uint64_t numCols = block.size()+1; //we need augmented column
uint64_t matSize = numCols*thisXors.size();
matSize /= 1000ULL*1000ULL;
if (matSize > solver->conf.maxXORMatrix) {
//this matrix is way too large, skip :(
if (solver->conf.verbosity) {
cout << "c skipping matrix " << thisXors.size() << " x " << numCols << " size:" << matSize << endl;
}
return solver->okay();
}
mzd_t *mat = mzd_init(thisXors.size(), numCols);
assert(mzd_is_zero(mat));
//Fill row-by-row
size_t row = 0;
for(vector<uint32_t>::const_iterator
it = thisXors.begin(), end2 = thisXors.end()
; it != end2
; ++it, row++
) {
const Xor& thisXor = xors[*it];
assert(thisXor.size() > 2 && "All XORs must be larger than 2-long");
//Put XOR into the matrix
for(uint32_t v: thisXor) {
const uint32_t var = outerToInterVarMap[v];
assert(var < numCols-1);
mzd_write_bit(mat, row, var, 1);
}
//Add RHS to the augmented columns
if (thisXor.rhs)
mzd_write_bit(mat, row, numCols-1, 1);
}
//Fully echelonize
mzd_echelonize_pluq(mat, true);
//Examine every row if it gives some new short truth
vector<Lit> lits;
for(size_t i = 0; i < row; i++) {
//Extract places where it's '1'
lits.clear();
for(size_t c = 0; c < numCols-1; c++) {
if (mzd_read_bit(mat, i, c))
lits.push_back(Lit(interToOUterVarMap[c], false));
//No point in going on, we cannot do anything with >2-long XORs
if (lits.size() > 2)
break;
}
//Extract RHS
const bool rhs = mzd_read_bit(mat, i, numCols-1);
switch(lits.size()) {
case 0:
//0-long XOR clause is equal to 1? If so, it's UNSAT
if (rhs) {
solver->add_xor_clause_inter(lits, 1, false);
assert(!solver->okay());
goto end;
}
break;
case 1: {
runStats.newUnits++;
solver->add_xor_clause_inter(lits, rhs, false);
if (!solver->okay())
goto end;
break;
}
case 2: {
runStats.newBins++;
out_changed_occur->insert(out_changed_occur->end(), lits.begin(), lits.end());
solver->add_xor_clause_inter(lits, rhs, false);
if (!solver->okay())
goto end;
break;
}
default:
//if resulting xor is larger than 2-long, we cannot extract anything.
break;
}
}
//Free mat, and return what need to be returned
end:
mzd_free(mat);
return solver->okay();
}
void TopLevelGauss::move_xors_into_blocks()
{
xors_in_blocks.clear();
xors_in_blocks.resize(blocks.size());
for(size_t i = 0; i < xors.size(); i++) {
const Xor& thisXor = xors[i];
assert(thisXor.size() > 2 && "XORs are always at least 3-long!");
uint32_t block = varToBlock[thisXor[0]];
if (block != std::numeric_limits<uint32_t>::max()) {
assert(block < xors_in_blocks.size());
xors_in_blocks[block].push_back(i);
}
}
}
void TopLevelGauss::cutIntoBlocks(const vector<size_t>& xorsToUse)
{
//Clearing data we will fill below
varToBlock.clear();
varToBlock.resize(solver->nVars(), std::numeric_limits<uint32_t>::max());
blocks.clear();
//Go through each XOR, and either make a new block for it
//or merge it into an existing block
//or merge it into an existing block AND merge blocks it joins together
for(size_t i: xorsToUse) {
const Xor& thisXor = xors[i];
//Calc blocks for this XOR
set<size_t> blocksBelongTo;
for(uint32_t v: thisXor) {
assert(solver->varData[v].removed == Removed::none);
if (varToBlock[v] != std::numeric_limits<uint32_t>::max())
blocksBelongTo.insert(varToBlock[v]);
}
switch(blocksBelongTo.size()) {
case 0: {
//Create new block
vector<uint32_t> block;
for(uint32_t v: thisXor) {
varToBlock[v] = blocks.size();
block.push_back(v);
}
blocks.push_back(block);
runStats.numBlocks++;
continue;
}
case 1: {
//Add to existing block
const size_t blockNum = *blocksBelongTo.begin();
vector<uint32_t>& block = blocks[blockNum];
for(uint32_t v :thisXor) {
if (varToBlock[v] == std::numeric_limits<uint32_t>::max()) {
block.push_back(v);
varToBlock[v] = blockNum;
}
}
continue;
}
default: {
//Merge blocks into first block
const size_t blockNum = *blocksBelongTo.begin();
set<size_t>::const_iterator it2 = blocksBelongTo.begin();
vector<uint32_t>& finalBlock = blocks[blockNum];
it2++; //don't merge the first into the first
for(set<size_t>::const_iterator end2 = blocksBelongTo.end(); it2 != end2; it2++) {
for(vector<uint32_t>::const_iterator
it3 = blocks[*it2].begin(), end3 = blocks[*it2].end()
; it3 != end3
; it3++
) {
finalBlock.push_back(*it3);
varToBlock[*it3] = blockNum;
}
blocks[*it2].clear();
runStats.numBlocks--;
}
//add remaining vars
for(uint32_t v: thisXor) {
if (varToBlock[v] == std::numeric_limits<uint32_t>::max()) {
finalBlock.push_back(v);
varToBlock[v] = blockNum;
}
}
}
}
}
//caclulate stats
vector<uint32_t> new_block_num;
uint32_t i = 0;
for(vector<vector<uint32_t> >::const_iterator
it = blocks.begin(), end = blocks.end()
; it != end
; ++it, i++
) {
//this set has been merged into another set. Skip
if (it->empty())
continue;
//cout << "Block vars: " << it->size() << endl;
runStats.numVarsInBlocks += it->size();
}
if (solver->conf.verbosity) {
cout << "c [xor-m4ri] Sum vars in blocks: " << runStats.numVarsInBlocks << endl;
}
}
size_t TopLevelGauss::mem_used() const
{
size_t mem = 0;
mem += xors.capacity()*sizeof(Xor);
mem += blocks.capacity()*sizeof(vector<uint32_t>);
for(size_t i = 0; i< blocks.size(); i++) {
mem += blocks[i].capacity()*sizeof(uint32_t);
}
mem += varToBlock.capacity()*sizeof(size_t);
//Temporaries for putting xors into matrix, and extracting info from matrix
mem += outerToInterVarMap.capacity()*sizeof(size_t);
mem += interToOUterVarMap.capacity()*sizeof(size_t);
return mem;
}
void TopLevelGauss::Stats::print_short(const Solver* solver) const
{
cout
<< "c [xor-m4ri] cut into " << numBlocks << " blcks. "
<< " Vars in blcks: " << numVarsInBlocks
<< solver->conf.print_times(blockCutTime)
<< endl;
cout
<< "c [xor-m4ri] extr info. "
<< " unit: " << newUnits
<< " bin: " << newBins
<< " 0-depth-ass: " << zeroDepthAssigns
<< solver->conf.print_times(extractTime)
<< endl;
}
TopLevelGauss::Stats& TopLevelGauss::Stats::operator+=(const TopLevelGauss::Stats& other)
{
numCalls += other.numCalls;
extractTime += other.numCalls;
blockCutTime += other.numCalls;
numVarsInBlocks += other.numCalls;
numBlocks += other.numCalls;
time_outs += other.numCalls;
newUnits += other.numCalls;
newBins += other.numCalls;
zeroDepthAssigns += other.zeroDepthAssigns;
return *this;
}
| 31.388027 | 111 | 0.5628 | meelgroup |
6f2bd87de10eeeb166a68241bfc5ff16358dd56b | 1,848 | cpp | C++ | Source/GIS/LevelSet.cpp | hustztz/Urho3D | 90abf7d8f176da9f9b828bb7ea9f46d1058ed009 | [
"MIT"
] | null | null | null | Source/GIS/LevelSet.cpp | hustztz/Urho3D | 90abf7d8f176da9f9b828bb7ea9f46d1058ed009 | [
"MIT"
] | null | null | null | Source/GIS/LevelSet.cpp | hustztz/Urho3D | 90abf7d8f176da9f9b828bb7ea9f46d1058ed009 | [
"MIT"
] | null | null | null | #include "LevelSet.h"
GIS::LevelSet::LevelSet( GIS::ElevationConfig & config )
{
config.GetValue(ConfigKey::TILE_ORIGIN, &tileOrigin_);
int numLevels = 0;
if ( config.GetValue(ConfigKey::NUM_LEVELS, &numLevels))
{
levels_.reserve(numLevels);
config.GetValue(ConfigKey::LEVEL_ZERO_TILE_DELTA, &levelZeroTileDelta_ );
auto lat = levelZeroTileDelta_.GetLatitude();
auto lon = levelZeroTileDelta_.GetLongitude();
for (int i = 0; i < numLevels; ++i)
{
config.SetValue(ConfigKey::LEVEL_NAME, std::to_string(i));
config.SetValue(ConfigKey::LEVEL_NUMBER, i);
config.SetValue(ConfigKey::TILE_DELTA, LatLon{ lat, lon });
levels_.push_back(Level{ config });
lat = Angle::FromDegrees(lat.GetDegrees() / 2);
lon = Angle::FromDegrees(lon.GetDegrees() / 2);
}
}
config.GetValue(ConfigKey::SECTOR, §or_);
}
const GIS::Sector & GIS::LevelSet::GetSector() const noexcept
{
return sector_;
}
const GIS::Level & GIS::LevelSet::GetLevel(int index) const
{
if (index >= 0 && index < levels_.size())
return levels_[index];
else
throw std::out_of_range{ "LevelSet::GetLevel" };
}
GIS::Level & GIS::LevelSet::GetLevel(int index)
{
return levels_[index];
}
const GIS::LatLon & GIS::LevelSet::GetTileOrigin() const noexcept
{
return tileOrigin_;
}
GIS::Level & GIS::LevelSet::GetTargetLevel(double targetSize)
{
auto & lastLevel = levels_[levels_.size() - 1];
if( lastLevel.GetTexelSize() >= targetSize )
return lastLevel;
for (auto & level : levels_)
{
if (level.GetTexelSize() <= targetSize)
return level;
}
return lastLevel;
}
uint32_t GIS::LevelSet::GetLevelCount() const noexcept
{
return static_cast<uint32_t>( levels_.size() );
}
auto GIS::LevelSet::GetLastLevel() const -> const Level &
{
return levels_.back();
}
auto GIS::LevelSet::GetLastLevel() -> Level &
{
return levels_.back();
}
| 24.315789 | 75 | 0.70184 | hustztz |
6f2d2ed8548721a77cd722b4a369e52296c19b3c | 2,148 | cpp | C++ | framework/src/Core/Network/Udp/UdpSocketServer.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | framework/src/Core/Network/Udp/UdpSocketServer.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | 3 | 2015-12-21T09:04:49.000Z | 2015-12-21T19:22:47.000Z | framework/src/Core/Network/Udp/UdpSocketServer.cpp | gautier-lefebvre/cppframework | bc1c3405913343274d79240b17ab75ae3f2adf56 | [
"MIT"
] | null | null | null | #include "Core/Network/Udp/UdpSocketServer.hh"
#include "Core/Network/Udp/UdpSocketClient.hh"
#include "Core/Network/Exception.hh"
using namespace fwk;
UdpSocketServer::UdpSocketServer(void):
AUdpSocket(),
APooled<UdpSocketServer>()
{}
UdpSocketServer::~UdpSocketServer(void) {
this->reinit();
}
void UdpSocketServer::reinit(void) {
this->AUdpSocket::reinit();
}
void UdpSocketServer::bind(uint16_t port) {
if (port == 80) {
throw NetworkException("bind: cannot bind port 80");
}
sockaddr_in sin;
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = htons(port);
sin.sin_family = AF_INET;
if (::bind(this->_fd, reinterpret_cast<sockaddr*>(&sin), sizeof(sin)) == -1) {
throw NetworkException(std::string("bind: ") + strerror(errno));
}
}
ssize_t UdpSocketServer::sendto(UdpSocketClient* client) {
SCOPELOCK(this);
ByteArray* datagram = client->nextDatagram();
if (datagram == nullptr) {
return 0;
}
ssize_t ret = ::sendto(this->_fd, datagram->getBytes(), datagram->getSize(), MSG_NOSIGNAL, reinterpret_cast<const sockaddr*>(&(client->socketAddress())), sizeof(sockaddr_in));
ByteArray::returnToPool(datagram);
if (ret < 0) {
throw NetworkException(std::string("sendto: ") + strerror(errno));
}
return ret;
}
ByteArray* UdpSocketServer::recvfrom(struct sockaddr_in& addr) {
SCOPELOCK(this);
ByteArray* datagram = nullptr;
socklen_t addrlen = sizeof(sockaddr_in);
// read data in buffer
ssize_t ret = ::recvfrom(this->_fd, this->_buffer->atStart(), this->_buffer->getSizeMax(), 0, reinterpret_cast<sockaddr*>(&(addr)), &addrlen);
if (ret < 0) {
throw NetworkException(std::string("recvfrom: ") + strerror(errno));
} else if (static_cast<size_t>(ret) > AUdpSocketIO::BUFFER_SIZE) {
throw NetworkException(std::string("recvfrom: received a datagram bigger than the buffer size (discarded)"));
}
// copy buffer to datagram resized to the number of bytes read.
size_t size = static_cast<size_t>(ret);
datagram = ByteArray::getFromPool(size, true);
datagram->push(this->_buffer->atStart(), size, false);
return datagram;
}
| 27.538462 | 177 | 0.695065 | gautier-lefebvre |
6f2d4d7ec9d1bc1a22bcc0300ec98488607e3c66 | 65 | hpp | C++ | clove/components/core/platform/include/Clove/Platform/Windows/CloveWindows.hpp | mondoo/Clove | 3989dc3fea0d886a69005c1e0bb4396501f336f2 | [
"MIT"
] | 33 | 2020-01-09T04:57:29.000Z | 2021-08-14T08:02:43.000Z | clove/components/core/platform/include/Clove/Platform/Windows/CloveWindows.hpp | mondoo/Clove | 3989dc3fea0d886a69005c1e0bb4396501f336f2 | [
"MIT"
] | 234 | 2019-10-25T06:04:35.000Z | 2021-08-18T05:47:41.000Z | clove/components/core/platform/include/Clove/Platform/Windows/CloveWindows.hpp | mondoo/Clove | 3989dc3fea0d886a69005c1e0bb4396501f336f2 | [
"MIT"
] | 4 | 2020-02-11T15:28:42.000Z | 2020-09-07T16:22:58.000Z | #define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h> | 21.666667 | 27 | 0.830769 | mondoo |
6f2daeb28f5468d7c69a6a4bee7a48ccfa47aad9 | 13,202 | cpp | C++ | library/src/level2/rocsparse_csrmv.cpp | akilaMD/rocSPARSE | 2694e68938cefa711a50b286fd9fd0baff712099 | [
"MIT"
] | null | null | null | library/src/level2/rocsparse_csrmv.cpp | akilaMD/rocSPARSE | 2694e68938cefa711a50b286fd9fd0baff712099 | [
"MIT"
] | null | null | null | library/src/level2/rocsparse_csrmv.cpp | akilaMD/rocSPARSE | 2694e68938cefa711a50b286fd9fd0baff712099 | [
"MIT"
] | null | null | null | /* ************************************************************************
* Copyright (c) 2018 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* ************************************************************************ */
#include "definitions.h"
#include "rocsparse.h"
#include "rocsparse_csrmv.hpp"
/*
* ===========================================================================
* C wrapper
* ===========================================================================
*/
extern "C" rocsparse_status rocsparse_scsrmv_analysis(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_mat_descr descr,
const float* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info)
{
return rocsparse_csrmv_analysis_template(
handle, trans, m, n, nnz, descr, csr_val, csr_row_ptr, csr_col_ind, info);
}
extern "C" rocsparse_status rocsparse_dcsrmv_analysis(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_mat_descr descr,
const double* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info)
{
return rocsparse_csrmv_analysis_template(
handle, trans, m, n, nnz, descr, csr_val, csr_row_ptr, csr_col_ind, info);
}
extern "C" rocsparse_status rocsparse_ccsrmv_analysis(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_mat_descr descr,
const rocsparse_float_complex* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info)
{
return rocsparse_csrmv_analysis_template(
handle, trans, m, n, nnz, descr, csr_val, csr_row_ptr, csr_col_ind, info);
}
extern "C" rocsparse_status rocsparse_zcsrmv_analysis(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_mat_descr descr,
const rocsparse_double_complex* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info)
{
return rocsparse_csrmv_analysis_template(
handle, trans, m, n, nnz, descr, csr_val, csr_row_ptr, csr_col_ind, info);
}
extern "C" rocsparse_status rocsparse_csrmv_clear(rocsparse_handle handle, rocsparse_mat_info info)
{
// Check for valid handle and matrix descriptor
if(handle == nullptr)
{
return rocsparse_status_invalid_handle;
}
else if(info == nullptr)
{
return rocsparse_status_invalid_pointer;
}
// Logging
log_trace(handle, "rocsparse_csrmv_clear", (const void*&)info);
// Destroy csrmv info struct
RETURN_IF_ROCSPARSE_ERROR(rocsparse_destroy_csrmv_info(info->csrmv_info));
info->csrmv_info = nullptr;
return rocsparse_status_success;
}
extern "C" rocsparse_status rocsparse_scsrmv(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const float* alpha,
const rocsparse_mat_descr descr,
const float* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info,
const float* x,
const float* beta,
float* y)
{
return rocsparse_csrmv_template(handle,
trans,
m,
n,
nnz,
alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
beta,
y);
}
extern "C" rocsparse_status rocsparse_dcsrmv(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const double* alpha,
const rocsparse_mat_descr descr,
const double* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info,
const double* x,
const double* beta,
double* y)
{
return rocsparse_csrmv_template(handle,
trans,
m,
n,
nnz,
alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
beta,
y);
}
extern "C" rocsparse_status rocsparse_ccsrmv(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_float_complex* alpha,
const rocsparse_mat_descr descr,
const rocsparse_float_complex* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info,
const rocsparse_float_complex* x,
const rocsparse_float_complex* beta,
rocsparse_float_complex* y)
{
return rocsparse_csrmv_template(handle,
trans,
m,
n,
nnz,
alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
beta,
y);
}
extern "C" rocsparse_status rocsparse_zcsrmv(rocsparse_handle handle,
rocsparse_operation trans,
rocsparse_int m,
rocsparse_int n,
rocsparse_int nnz,
const rocsparse_double_complex* alpha,
const rocsparse_mat_descr descr,
const rocsparse_double_complex* csr_val,
const rocsparse_int* csr_row_ptr,
const rocsparse_int* csr_col_ind,
rocsparse_mat_info info,
const rocsparse_double_complex* x,
const rocsparse_double_complex* beta,
rocsparse_double_complex* y)
{
return rocsparse_csrmv_template(handle,
trans,
m,
n,
nnz,
alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
beta,
y);
}
| 55.238494 | 99 | 0.348508 | akilaMD |
6f2dd7391271a58e42e6224d45259aeb32dc9474 | 482 | cpp | C++ | TERefiner/StrOperation.cpp | simoncchu/REPdenovo | 708f2f8efc40f6df0a64c1e4049f16e79f65f471 | [
"MIT"
] | 6 | 2019-11-11T19:33:21.000Z | 2020-03-26T23:41:22.000Z | TERefiner/StrOperation.cpp | simoncchu/REPdenovo | 708f2f8efc40f6df0a64c1e4049f16e79f65f471 | [
"MIT"
] | 3 | 2019-08-19T14:14:55.000Z | 2020-05-10T23:47:23.000Z | TERefiner/StrOperation.cpp | simoncchu/REPdenovo | 708f2f8efc40f6df0a64c1e4049f16e79f65f471 | [
"MIT"
] | 1 | 2020-02-13T15:18:53.000Z | 2020-02-13T15:18:53.000Z | #include"StrOperation.h"
/*
Get reverse supplementary.
*/
void StrOperation::getReverseSupplementary(std::string& sin, std::string& sout)
{
sout="";
int slen=sin.length();
for(int i=slen-1;i>=0;i--)
{
sout+=getSupplementary(sin[i]);
}
}
char StrOperation::getSupplementary(char ci)
{
if(ci=='A' || ci=='a')
return 'T';
else if(ci=='T' || ci=='t')
return 'A';
else if(ci=='C' || ci=='c')
return 'G';
else if(ci=='G' || ci=='g')
return 'C';
else
return 'N';
} | 17.214286 | 79 | 0.595436 | simoncchu |
6f2e459b1555628e9f17111de92544156c04247a | 1,923 | hpp | C++ | include/sphere.hpp | lebarsfa/vpython-wx | 38df062e5532b79f632f4f2a1abae86754c264a9 | [
"BSL-1.0"
] | 68 | 2015-01-17T05:41:58.000Z | 2021-04-24T08:35:24.000Z | include/sphere.hpp | lebarsfa/vpython-wx | 38df062e5532b79f632f4f2a1abae86754c264a9 | [
"BSL-1.0"
] | 16 | 2015-01-02T19:36:06.000Z | 2018-09-09T21:01:25.000Z | include/sphere.hpp | lebarsfa/vpython-wx | 38df062e5532b79f632f4f2a1abae86754c264a9 | [
"BSL-1.0"
] | 37 | 2015-02-04T04:23:00.000Z | 2020-06-07T03:24:41.000Z | #ifndef VPYTHON_SPHERE_HPP
#define VPYTHON_SPHERE_HPP
// Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others.
// Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others.
// See the file license.txt for complete license terms.
// See the file authors.txt for a complete list of contributors.
#include "axial.hpp"
#include "util/displaylist.hpp"
namespace cvisual {
/** A simple monochrome sphere.
*/
class sphere : public axial
{
private:
/** The level-of-detail cache. It is stored for the life of the program, and
initialized when the first sphere is rendered. At one time there were
going to be additional entries for the textured case, but that was
not implemented.
*/
//static displaylist lod_cache[6];
/// True until the first sphere is rendered, then false.
static void init_model(view& scene);
public:
/** Construct a unit sphere at the origin. */
sphere();
sphere( const sphere& other);
virtual ~sphere();
protected:
/** Renders a simple sphere with the #2 level of detail. */
virtual void gl_pick_render( view&);
/** Renders the sphere. All of the spheres share the same basic set of
* models, and then use matrix transforms to shape and position them.
*/
virtual void gl_render( view&);
/** Extent reported using extent::add_sphere(). */
virtual void grow_extent( extent&);
/** Exposed for the benefit of the ellipsoid object, which overrides it.
* The default is to use <radius, radius, radius> for the scale.
*/
virtual vector get_scale();
/** Returns true if this object should not be drawn. Conditions are:
* zero radius, or visible is false. (overridden by the ellipsoid class).
*/
virtual bool degenerate();
virtual void get_material_matrix( const view&, tmatrix& out );
PRIMITIVE_TYPEINFO_DECL;
};
} // !namespace cvisual
#endif // !defined VPYTHON_SPHERE_HPP
| 31.52459 | 79 | 0.699428 | lebarsfa |
6f2f82b3c151cb8abcdddae80f9d6f0f95cdeaaa | 3,511 | cc | C++ | database/src/desktop/view/child_change_accumulator.cc | crazyhappygame/firebase-cpp-sdk | e8aeb120d2a2e9fa314d7965391d841ebf1c3915 | [
"Apache-2.0"
] | 1 | 2021-02-14T19:09:51.000Z | 2021-02-14T19:09:51.000Z | database/src/desktop/view/child_change_accumulator.cc | crazyhappygame/firebase-cpp-sdk | e8aeb120d2a2e9fa314d7965391d841ebf1c3915 | [
"Apache-2.0"
] | null | null | null | database/src/desktop/view/child_change_accumulator.cc | crazyhappygame/firebase-cpp-sdk | e8aeb120d2a2e9fa314d7965391d841ebf1c3915 | [
"Apache-2.0"
] | 1 | 2020-08-16T11:53:44.000Z | 2020-08-16T11:53:44.000Z | // Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "database/src/desktop/view/child_change_accumulator.h"
#include <cassert>
#include <map>
#include <string>
#include "app/src/assert.h"
#include "database/src/desktop/view/change.h"
#include "database/src/desktop/view/event.h"
namespace firebase {
namespace database {
namespace internal {
void TrackChildChange(const Change& change,
ChildChangeAccumulator* accumulator) {
EventType type = change.event_type;
// This function should only be used for ChildAdd, ChildChange and ChildRemove
// changes.
FIREBASE_DEV_ASSERT_MESSAGE(type == kEventTypeChildAdded ||
type == kEventTypeChildChanged ||
type == kEventTypeChildRemoved,
"Only child changes supported for tracking");
const std::string& child_key = change.child_key;
// Sanity check
FIREBASE_DEV_ASSERT(change.child_key != ".priority");
auto iter = accumulator->find(child_key);
if (iter != accumulator->end()) {
// If the change data exists for the given child, try to merge the existing
// change data and the new one.
const Change& old_change = iter->second;
EventType old_type = old_change.event_type;
if (type == kEventTypeChildAdded && old_type == kEventTypeChildRemoved) {
// Change from kTypeChildRemoved to kTypeChildAdded => kTypeChildChanged
iter->second = ChildChangedChange(child_key, change.indexed_variant,
old_change.indexed_variant);
} else if (type == kEventTypeChildRemoved &&
old_type == kEventTypeChildAdded) {
// Change from kTypeChildAdded to kTypeChildRemoved => delete data
accumulator->erase(iter);
} else if (type == kEventTypeChildRemoved &&
old_type == kEventTypeChildChanged) {
// Change from kTypeChildChanged to kTypeChildRemoved => kTypeChildRemoved
iter->second = ChildRemovedChange(child_key, old_change.indexed_variant);
} else if (type == kEventTypeChildChanged &&
old_type == kEventTypeChildAdded) {
// Change from kTypeChildAdded to kTypeChildChanged => kTypeChildAdded
iter->second = ChildAddedChange(child_key, change.indexed_variant);
} else if (type == kEventTypeChildChanged &&
old_type == kEventTypeChildChanged) {
// Change from kTypeChildChanged to kTypeChildChanged => kTypeChildChanged
iter->second = ChildChangedChange(child_key, change.indexed_variant,
old_change.old_indexed_variant);
} else {
// Assert for the other cases
FIREBASE_DEV_ASSERT_MESSAGE(false, "Illegal combination of changes");
}
} else {
// Insert the change data if it is a new change to the given child
(*accumulator)[change.child_key] = change;
}
}
} // namespace internal
} // namespace database
} // namespace firebase
| 41.797619 | 80 | 0.683851 | crazyhappygame |
6f3a5ec123a79ff128b9824f2d70b379f023af64 | 6,711 | cpp | C++ | kernel/devices/pci/PciCapabilities.cpp | DeanoBurrito/northport | 6da490b02bfe7d0a12a25316db879ecc249be1c7 | [
"MIT"
] | 19 | 2021-12-10T12:48:44.000Z | 2022-03-30T09:17:14.000Z | kernel/devices/pci/PciCapabilities.cpp | DeanoBurrito/northport | 6da490b02bfe7d0a12a25316db879ecc249be1c7 | [
"MIT"
] | 24 | 2021-11-30T10:00:05.000Z | 2022-03-29T10:19:21.000Z | kernel/devices/pci/PciCapabilities.cpp | DeanoBurrito/northport | 6da490b02bfe7d0a12a25316db879ecc249be1c7 | [
"MIT"
] | 2 | 2021-11-24T00:52:10.000Z | 2021-12-27T23:47:32.000Z | #include <devices/pci/PciCapabilities.h>
#include <devices/PciBridge.h>
namespace Kernel::Devices::Pci
{
sl::Opt<PciCap*> FindPciCap(PciAddress addr, uint8_t withId, PciCap* start)
{
uint16_t statusReg = addr.ReadReg(1) >> 16;
if ((statusReg & (1 << 4)) == 0)
return {}; //capabilities list not available
PciCap* cap = EnsureHigherHalfAddr(sl::NativePtr(addr.addr).As<PciCap>(addr.ReadReg(0xD) & 0xFF));
bool returnNextMatch = (start == nullptr);
while ((uint64_t)cap != EnsureHigherHalfAddr(addr.addr))
{
if (cap->capabilityId == withId && returnNextMatch)
return cap;
if (cap == start)
returnNextMatch = true;
cap = EnsureHigherHalfAddr(sl::NativePtr(addr.addr).As<PciCap>(cap->nextOffset));
}
return {};
}
bool PciCapMsi::Enabled() const
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
return control & 0b1;
}
void PciCapMsi::Enable(bool yes)
{
uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
control &= ~0b1;
if (yes)
control |= 0b1;
sl::MemWrite<uint16_t>((uintptr_t)this + 2, control);
}
size_t PciCapMsi::VectorsRequested() const
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
return 1 << ((control >> 1) & 0b111);
}
void PciCapMsi::SetVectorsEnabled(size_t count)
{
uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
control &= 0xFF8F;
switch (count)
{
case 1: control |= (0b000) << 4; break;
case 2: control |= (0b001) << 4; break;
case 4: control |= (0b010) << 4; break;
case 8: control |= (0b011) << 4; break;
case 16: control |= (0b100) << 4; break;
case 32: control |= (0b101) << 4; break;
default:
return;
}
sl::MemWrite<uint16_t>((uintptr_t)this + 2, control);
}
bool PciCapMsi::Has64BitAddress() const
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
return control & (1 << 7);
}
void PciCapMsi::SetAddress(sl::NativePtr ptr)
{
sl::MemWrite<uint32_t>((uintptr_t)this + 4, ptr.raw & 0xFFFF'FFFF);
if (Has64BitAddress())
sl::MemWrite<uint32_t>((uintptr_t)this + 8, ptr.raw >> 32);
}
void PciCapMsi::SetData(uint16_t data)
{
if (Has64BitAddress())
sl::MemWrite((uintptr_t)this + 0xC, data);
else
sl::MemWrite((uintptr_t)this + 8, data);
}
bool PciCapMsi::Masked(size_t index) const
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
if ((control & (1 << 8)) == 0)
return false;
if (index >= 32)
return false;
if (Has64BitAddress())
return sl::MemRead<uint32_t>((uintptr_t)this + 0x10) & (1 << index);
else
return sl::MemRead<uint32_t>((uintptr_t)this + 0xC) & (1 << index);
}
void PciCapMsi::Mask(size_t index, bool masked)
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
if ((control & (1 << 8)) == 0)
return;
if (index >= 32)
return;
const uintptr_t addr = (uintptr_t)this + (Has64BitAddress() ? 0x10 : 0xC);
uint32_t value = sl::MemRead<uint32_t>(addr) & ~(1 << index);
if (masked)
value |= 1 << index;
sl::MemWrite<uint32_t>(addr, value);
}
bool PciCapMsi::Pending(size_t index) const
{
const uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
if ((control & (1 << 8)) == 0)
return false;
if (index >= 32)
return false;
if (Has64BitAddress())
return sl::MemRead<uint32_t>((uintptr_t)this + 0x14) & (1 << index);
else
return sl::MemRead<uint32_t>((uintptr_t)this + 0x10) & (1 << index);
}
sl::NativePtr PciCapMsiX::GetTableEntry(size_t index, PciBar* bars) const
{
const size_t count = (sl::MemRead<uint32_t>((uintptr_t)this + 2) & 0x3FF) + 1;
if (index >= count)
return nullptr;
const size_t bir = sl::MemRead<uint32_t>((uintptr_t)this + 4) & 0b111;
const uintptr_t tableOffset = sl::MemRead<uint32_t>((uintptr_t)this + 4) & ~0b111;
return bars[bir].address + tableOffset + index * 16;
}
bool PciCapMsiX::Enabled() const
{
return sl::MemRead<uint32_t>((uintptr_t)this + 2) & (1 << 15);
}
void PciCapMsiX::Enable(bool yes)
{
uint16_t control = sl::MemRead<uint16_t>((uintptr_t)this + 2);
control &= 0x7F;
if (yes)
control |= 1 << 15;
sl::MemWrite((uintptr_t)this + 2, control);
}
size_t PciCapMsiX::Vectors() const
{
return (sl::MemRead<uint32_t>((uintptr_t)this + 2) & 0x3FF) + 1;
}
void PciCapMsiX::SetVector(size_t index, uint64_t address, uint16_t data, PciBar* bars)
{
sl::NativePtr entryAddr = GetTableEntry(index, bars);
if (entryAddr.ptr == nullptr)
return;
sl::MemWrite<uint64_t>(entryAddr, address);
sl::MemWrite<uint32_t>(entryAddr.raw + 8, data);
}
bool PciCapMsiX::Masked(size_t index, PciBar* bars) const
{
sl::NativePtr entryAddr = GetTableEntry(index, bars);
if (entryAddr.ptr == nullptr)
return false;
return sl::MemRead<uint16_t>(entryAddr.raw + 12) & 0b1;
}
void PciCapMsiX::Mask(size_t index, bool masked, PciBar* bars)
{
sl::NativePtr entryAddr = GetTableEntry(index, bars);
if (entryAddr.ptr == nullptr)
return;
uint16_t value = sl::MemRead<uint16_t>(entryAddr.raw + 12);
value &= 0b1;
if (masked)
value |= 0b1;
sl::MemWrite(entryAddr.raw + 12, value);
}
bool PciCapMsiX::Pending(size_t index, PciBar* bars) const
{
const size_t count = (sl::MemRead<uint32_t>((uintptr_t)this + 2) & 0x3FF) + 1;
if (index >= count)
return false;
const size_t bir = sl::MemRead<uint32_t>((uintptr_t)this + 4) & 0b111;
const uintptr_t arrayOffset = sl::MemRead<uint32_t>((uintptr_t)this + 4) & ~0b111;
const sl::NativePtr arrayAddr = bars[bir].address + arrayOffset;
return (sl::MemRead<uint64_t>(arrayAddr) + index / 64) & (1 << index % 64);
}
}
| 31.805687 | 106 | 0.554016 | DeanoBurrito |
6f3aea3d609f974af22956e4abd4741a2a30a069 | 1,324 | cpp | C++ | Siv3D/src/Siv3D-Platform/WindowsDesktop/Graphics/SivGraphics_Platform.cpp | yumetodo/OpenSiv3D | ea191438ecbc64185f5df3d9f79dffc6757e4192 | [
"MIT"
] | 7 | 2020-04-26T11:06:02.000Z | 2021-09-05T16:42:31.000Z | Siv3D/src/Siv3D-Platform/WindowsDesktop/Graphics/SivGraphics_Platform.cpp | yumetodo/OpenSiv3D | ea191438ecbc64185f5df3d9f79dffc6757e4192 | [
"MIT"
] | 10 | 2020-04-26T13:25:36.000Z | 2022-03-01T12:34:44.000Z | Siv3D/src/Siv3D-Platform/WindowsDesktop/Graphics/SivGraphics_Platform.cpp | yumetodo/OpenSiv3D | ea191438ecbc64185f5df3d9f79dffc6757e4192 | [
"MIT"
] | 2 | 2020-05-11T08:23:23.000Z | 2020-08-08T12:33:30.000Z | //-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2019 Ryo Suzuki
// Copyright (c) 2016-2019 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# include <Siv3D/Windows.hpp>
# include <Siv3D/Graphics.hpp>
# include <Siv3D/Monitor.hpp>
namespace s3d
{
namespace Graphics
{
Array<DisplayOutput> EnumOutputs()
{
Array<DisplayOutput> outputs;
for (const auto& monitor : System::EnumerateActiveMonitors())
{
DisplayOutput output;
output.name = monitor.name;
output.displayRect = monitor.displayRect;
DEVMODEW devMode = {};
uint32 index = 0;
Array<std::tuple<int32, int32, double>> modes;
while (::EnumDisplaySettingsW(monitor.displayDeviceName.toWstr().c_str(), index++, &devMode))
{
std::tuple<int32, int32, double> mode;
std::get<0>(mode) = devMode.dmPelsWidth;
std::get<1>(mode) = devMode.dmPelsHeight;
std::get<2>(mode) = devMode.dmDisplayFrequency;
modes << mode;
}
output.displayModes = modes.unique().map([](const std::tuple<int32, int32, double> & t)
{
return DisplayMode{ Size(std::get<0>(t), std::get<1>(t)), std::get<2>(t) };
});
outputs << output;
}
return outputs;
}
}
}
| 24.518519 | 97 | 0.595166 | yumetodo |
6f3af705b55c3031ed30415d9cdc082a79933f14 | 564,756 | cpp | C++ | interfaces/matlab/interface/helicsMEX.cpp | GMLC-TDC/HELICS-src | 5e37168bca0ea9e16b939e052e257182ca6e24bd | [
"BSD-3-Clause"
] | 31 | 2017-06-29T19:50:25.000Z | 2019-05-17T14:10:14.000Z | interfaces/matlab/interface/helicsMEX.cpp | GMLC-TDC/HELICS-src | 5e37168bca0ea9e16b939e052e257182ca6e24bd | [
"BSD-3-Clause"
] | 511 | 2017-08-18T02:14:00.000Z | 2019-06-18T20:11:02.000Z | interfaces/matlab/interface/helicsMEX.cpp | GMLC-TDC/HELICS-src | 5e37168bca0ea9e16b939e052e257182ca6e24bd | [
"BSD-3-Clause"
] | 11 | 2017-10-27T15:03:37.000Z | 2019-05-03T19:35:14.000Z | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.11
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#define SWIGMATLAB
#define SWIG_name_d "helics"
#define SWIG_name helics
#define SWIG_op_prefix "op_"
#define SWIG_pkg_name "helics"
#define SwigVar_mxArray mxArray*
#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
struct SwigMovePointer {
T *ptr;
SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointer() { delete ptr; }
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
SwigValueWrapper() : pointer(0) { }
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const { return *pointer.ptr; }
T *operator&() { return pointer.ptr; }
};
template <typename T> T SwigValueInit() {
return T();
}
#endif
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if defined(__GNUC__)
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif
/* Intel's compiler complains if a variable which was never initialised is
* cast to void, which is a common idiom which we use to indicate that we
* are aware a variable isn't used. So we just silence that warning.
* See: https://github.com/swig/swig/issues/192 for more discussion.
*/
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
/* Workaround, Octave's mex.h lacks uint64_t */
#include <stdint.h>
/* MATLAB's C-API */
#include <mex.h>
/* MISC C libraries */
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <limits.h>
/* -----------------------------------------------------------------------------
* swigrun.swg
*
* This file contains generic C API SWIG runtime support for pointer
* type checking.
* ----------------------------------------------------------------------------- */
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif
/*
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
creating a static or dynamic library from the SWIG runtime code.
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
But only do this if strictly necessary, ie, if you have problems
with your compiler or suchlike.
*/
#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif
#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif
/* Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
/*
Flags/methods for returning states.
The SWIG conversion methods, as ConvertPtr, return an integer
that tells if the conversion was successful or not. And if not,
an error code can be returned (see swigerrors.swg for the codes).
Use the following macros/flags to set or process the returning
states.
In old versions of SWIG, code such as the following was usually written:
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
// success code
} else {
//fail code
}
Now you can be more explicit:
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
if (SWIG_IsOK(res)) {
// success code
} else {
// fail code
}
which is the same really, but now you can also do
Type *ptr;
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
if (SWIG_IsOK(res)) {
// success code
if (SWIG_IsNewObj(res) {
...
delete *ptr;
} else {
...
}
} else {
// fail code
}
I.e., now SWIG_ConvertPtr can return new objects and you can
identify the case and take care of the deallocation. Of course that
also requires SWIG_ConvertPtr to return new result values, such as
int SWIG_ConvertPtr(obj, ptr,...) {
if (<obj is ok>) {
if (<need new object>) {
*ptr = <ptr to new allocated object>;
return SWIG_NEWOBJ;
} else {
*ptr = <ptr to old object>;
return SWIG_OLDOBJ;
}
} else {
return SWIG_BADOBJ;
}
}
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
SWIG errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
allows to return the 'cast rank', for example, if you have this
int food(double)
int fooi(int);
and you call
food(1) // cast rank '1' (1 -> 1.0)
fooi(1) // cast rank '0'
just use the SWIG_AddCast()/SWIG_CheckState()
*/
#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ (SWIG_ERROR)
#define SWIG_OLDOBJ (SWIG_OK)
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */
} swig_type_info;
/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
swig_type_info *type; /* pointer to type that is equivalent to this type */
swig_converter_func converter; /* function to cast the void pointers */
struct swig_cast_info *next; /* pointer to next cast in linked list */
struct swig_cast_info *prev; /* pointer to the previous cast */
} swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
size_t size; /* Number of types in this module */
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
swig_type_info **type_initial; /* Array of initially generated type structures */
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
void *clientdata; /* Language specific module data */
} swig_module_info;
/*
Compare two type names skipping the space characters, therefore
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
const char *f2, const char *l2) {
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
while ((*f1 == ' ') && (f1 != l1)) ++f1;
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
return (int)((l1 - f1) - (l2 - f2));
}
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 1;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne;
}
return equiv;
}
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}
/*
Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
if (ty) {
swig_cast_info *iter = ty->cast;
while (iter) {
if (strcmp(iter->type->name, c) == 0) {
if (iter == ty->cast)
return iter;
/* Move iter to the top of the linked list */
iter->prev->next = iter->next;
if (iter->next)
iter->next->prev = iter->prev;
iter->next = ty->cast;
iter->prev = 0;
if (ty->cast) ty->cast->prev = iter;
ty->cast = iter;
return iter;
}
iter = iter->next;
}
}
return 0;
}
/*
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
if (ty) {
swig_cast_info *iter = ty->cast;
while (iter) {
if (iter->type == from) {
if (iter == ty->cast)
return iter;
/* Move iter to the top of the linked list */
iter->prev->next = iter->next;
if (iter->next)
iter->next->prev = iter->prev;
iter->next = ty->cast;
iter->prev = 0;
if (ty->cast) ty->cast->prev = iter;
ty->cast = iter;
return iter;
}
iter = iter->next;
}
}
return 0;
}
/*
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
swig_type_info *lastty = ty;
if (!ty || !ty->dcast) return ty;
while (ty && (ty->dcast)) {
ty = (*ty->dcast)(ptr);
if (ty) lastty = ty;
}
return lastty;
}
/*
Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
return ty->name;
}
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
/* The "str" field contains the equivalent pretty names of the
type, separated by vertical-bar characters. We choose
to print the last name, as it is often (?) the most
specific. */
if (!type) return NULL;
if (type->str != NULL) {
const char *last_name = type->str;
const char *s;
for (s = type->str; *s; s++)
if (*s == '|') last_name = s+1;
return last_name;
}
else
return type->name;
}
/*
Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
swig_cast_info *cast = ti->cast;
/* if (ti->clientdata == clientdata) return; */
ti->clientdata = clientdata;
while (cast) {
if (!cast->converter) {
swig_type_info *tc = cast->type;
if (!tc->clientdata) {
SWIG_TypeClientData(tc, clientdata);
}
}
cast = cast->next;
}
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
SWIG_TypeClientData(ti, clientdata);
ti->owndata = 1;
}
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
swig_module_info *iter = start;
do {
if (iter->size) {
size_t l = 0;
size_t r = iter->size - 1;
do {
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
if (iname) {
int compare = strcmp(name, iname);
if (compare == 0) {
return iter->types[i];
} else if (compare < 0) {
if (i) {
r = i - 1;
} else {
break;
}
} else if (compare > 0) {
l = i + 1;
}
} else {
break; /* should never happen */
}
} while (l <= r);
}
iter = iter->next;
} while (iter != end);
return 0;
}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
It first searches the mangled names of the types, which is a O(log #types)
If a type is not found it then searches the human readable names, which is O(#types).
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
/* STEP 1: Search the name field using binary search */
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
if (ret) {
return ret;
} else {
/* STEP 2: If the type hasn't been found, do a complete search
of the str field (the human readable name) */
swig_module_info *iter = start;
do {
size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return iter->types[i];
}
iter = iter->next;
} while (iter != end);
}
/* neither found a match */
return 0;
}
/*
Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
const unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
return c;
}
/*
Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
char d = *(c++);
unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = (unsigned char)((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = (unsigned char)((d - ('a'-10)) << 4);
else
return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (unsigned char)(d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (unsigned char)(d - ('a'-10));
else
return (char *) 0;
*u = uu;
}
return c;
}
/*
Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
char *r = buff;
if ((2*sizeof(void *) + 2) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,&ptr,sizeof(void *));
if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
strcpy(r,name);
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
*ptr = (void *) 0;
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sizeof(void *));
}
SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
char *r = buff;
size_t lname = (name ? strlen(name) : 0);
if ((2*sz + 2 + lname) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,ptr,sz);
if (lname) {
strncpy(r,name,lname+1);
} else {
*r = 0;
}
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
memset(ptr,0,sz);
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sz);
}
#ifdef __cplusplus
}
#endif
/* Errors in SWIG */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
#define SWIG_IndexError -4
#define SWIG_TypeError -5
#define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7
#define SWIG_SyntaxError -8
#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
/* Last error */
static int SWIG_lasterror_code = 0;
static char SWIG_lasterror_msg[65536];
SWIGRUNTIME void SWIG_Error(int code, const char *format, ...) {
SWIG_lasterror_code = code;
va_list arg;
va_start(arg, format);
vsnprintf(SWIG_lasterror_msg, sizeof(SWIG_lasterror_msg), format, arg);
va_end(arg);
}
SWIGRUNTIME const char* SWIG_ErrorType(int code) {
switch (code) {
case SWIG_MemoryError:
return "SWIG:MemoryError";
case SWIG_IOError:
return "SWIG:IOError";
case SWIG_RuntimeError:
return "SWIG:RuntimeError";
case SWIG_IndexError:
return "SWIG:IndexError";
case SWIG_TypeError:
return "SWIG:TypeError";
case SWIG_DivisionByZero:
return "SWIG:DivisionByZero";
case SWIG_OverflowError:
return "SWIG:OverflowError";
case SWIG_SyntaxError:
return "SWIG:SyntaxError";
case SWIG_ValueError:
return "SWIG:ValueError";
case SWIG_SystemError:
return "SWIG:SystemError";
case SWIG_AttributeError:
return "SWIG:AttributeError";
}
return "SWIG:UnknownError";
}
SWIGRUNTIME int SWIG_check_num_args(const char *func_name, int num_args, int max_args, int min_args, int varargs) {
if (num_args > max_args && !varargs) {
SWIG_Error(SWIG_RuntimeError, "function %s takes at most %i arguments", func_name, max_args);
} else if (num_args < min_args) {
SWIG_Error(SWIG_RuntimeError, "function %s requires at least %i arguments", func_name, min_args);
} else {
return 1;
}
return 0;
}
#define SWIG_fail goto fail
#define SWIG_Matlab_ConvertPtr(obj, pptr, type, flags) SWIG_Matlab_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Matlab_ConvertPtr(obj, pptr, type, flags)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Matlab_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Matlab_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Matlab_NewPointerObj(ptr, type, flags)
#define swig_owntype int
#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Matlab_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Matlab_NewPackedObj(ptr, sz, type)
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Matlab_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Matlab_NewPackedObj(ptr, sz, type)
#define SWIG_GetModule(clientdata) SWIG_Matlab_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Matlab_SetModule(pointer);
#define SWIG_MODULE_CLIENTDATA_TYPE void*
#define Matlab_Error_Occurred() 0
#define SWIG_Matlab_AddErrorMsg(msg) {;}
SWIGRUNTIME swig_module_info *SWIG_Matlab_GetModule(void *clientdata);
SWIGRUNTIME void SWIG_Matlab_SetModule(swig_module_info *pointer);
/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION 0
#define SWIG_arg_fail(arg) 0
/* Pointer to C/C++ object, including type information and reference counters */
typedef struct SwigPtr {
void *ptr;
swig_type_info *type;
int own;
void *self;
struct SwigPtr* next;
} SwigPtr;
static swig_module_info *saved_swig_module = 0;
/* Add new pointer object to the memory allocator
Returns the location of the new element by reference and a return flag by value.
*/
int SWIG_Matlab_NewPointer(SwigPtr** swig_ptr, void *ptr, swig_type_info *type, int own) {
/* Check input arguments */
if (!swig_ptr || !type) return 1;
/* Allocate memory */
SwigPtr *obj=(SwigPtr *)malloc(sizeof(SwigPtr));
if (!obj) return 1;
/* Initialize object */
obj->ptr = ptr;
obj->type = type;
obj->own = own;
obj->self = obj;
obj->next = 0;
/* Return memory reference and successful return */
*swig_ptr = obj;
return 0;
}
/* Free pointer object
Returns a void* with the object to be freed (if any)
*/
void* SWIG_Matlab_DeletePointer(SwigPtr* p) {
/* Quick return if null pointer? */
if (p==0) return 0;
/* Clear and free */
void* ret = p->own ? p->ptr : 0;
p->ptr=0;
p->type=0;
p->own=0;
p->self=0;
p->next=0;
free(p);
return ret;
}
/* This should probably be moved somewhere else */
#ifdef __cplusplus
extern "C"
#endif /* cplusplus */
void SWIG_Matlab_ExitFcn(void) {
/* Unused at the moment */
}
SWIGRUNTIME int
SWIG_Matlab_CallInterp(int nlhs, mxArray *plhs[], int nrhs,
mxArray *prhs[], const char *functionName) {
#ifdef HAVE_OCTAVE
return mexCallMATLAB(nlhs, plhs, nrhs, prhs, functionName);
#else
mxArray* ex = mexCallMATLABWithTrap(nlhs, plhs, nrhs, prhs, functionName);
if (ex) {
mxDestroyArray(ex);
return 1;
} else {
return 0;
}
#endif
}
SWIGRUNTIME mxArray*
SWIG_Matlab_CallInterpEx(int nlhs, mxArray *plhs[], int nrhs,
mxArray *prhs[], const char *functionName) {
#ifdef HAVE_OCTAVE
int flag = mexCallMATLAB(nlhs, plhs, nrhs, prhs, functionName);
if (flag) {
mexErrMsgIdAndTxt("SWIG:CallInterpEx","Not implemented for Octave");
}
return 0;
#else
return mexCallMATLABWithTrap(nlhs, plhs, nrhs, prhs, functionName);
#endif
}
/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Matlab_ConvertPacked(mxArray* SWIGUNUSEDPARM(pm), void* SWIGUNUSEDPARM(ptr), size_t SWIGUNUSEDPARM(sz), swig_type_info* SWIGUNUSEDPARM(ty)) {
mexErrMsgIdAndTxt("SWIG:ConvertPacked","Not implemented");
return SWIG_ERROR;
}
/* Runtime API implementation */
SWIGRUNTIME mxArray* SWIG_Matlab_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
/* Ownership? */
int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
/* Allocate a pointer object */
SwigPtr* swig_ptr = 0;
if (SWIG_Matlab_NewPointer(&swig_ptr, ptr, type, own)) {
mexErrMsgIdAndTxt("SWIG:NewPointerObj","Cannot allocate pointer");
}
/* Create a SwigRef instance */
mxArray* pm = 0;
int ex = SWIG_Matlab_CallInterp(1, &pm, 0, 0, "SwigRef");
if (ex) mexErrMsgIdAndTxt("SWIG:NewPointerObj", "Cannot create SwigRef instance");
/* Set pointer property */
mxArray *pm_ptr = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
*(uint64_T *)mxGetData(pm_ptr) = (uint64_T)swig_ptr;
if(!pm_ptr) mexErrMsgIdAndTxt("SWIG:NewPointerObj", "mxCreateNumericMatrix failed");
mxArray *rhs[2] = {pm, pm_ptr};
mexCallMATLAB(0, 0, 2, rhs, "SwigSet");
mxDestroyArray(pm_ptr);
/* Create a proxy class of the desired type */
if (type->clientdata) {
const char* matlab_classname = (const char *)type->clientdata;
mxArray* pm_test = 0;
ex = SWIG_Matlab_CallInterp(1, &pm_test, 1, &pm, matlab_classname);
if (ex) {
mexWarnMsgIdAndTxt("SWIG:NewPointerObj",
"NewPointerObj problem. creating SwigRef as opposed to %s", matlab_classname);
} else {
mxDestroyArray(pm);
pm = pm_test;
}
}
return pm;
}
/* Create a new packed object */
SWIGRUNTIMEINLINE mxArray*
SWIG_Matlab_NewPackedObj(void* SWIGUNUSEDPARM(ptr), size_t SWIGUNUSEDPARM(sz), swig_type_info* SWIGUNUSEDPARM(type)) {
mexErrMsgIdAndTxt("SWIG:NewPackedOb","Not implemented");
return 0;
}
SWIGRUNTIME int SWIG_Matlab_isOwned(mxArray* pm) {
/* Get index, represented as a uint64_T scalar */
mxArray *pm_ptr;
mexCallMATLAB(1, &pm_ptr, 1, &pm, "SwigGet");
if(!pm_ptr || mxGetNumberOfElements(pm_ptr) != 1 ||
mxGetClassID(pm_ptr) != mxUINT64_CLASS || mxIsComplex(pm_ptr)) {
if(pm_ptr) mxDestroyArray(pm_ptr);
return SWIG_ERROR;
}
SwigPtr* p = (SwigPtr*)(*(uint64_T*)mxGetData(pm_ptr));
mxDestroyArray(pm_ptr);
return p ? p->own : 0;
}
SWIGRUNTIME SwigPtr* SWIG_Matlab_getSwigPtr(mxArray* pm) {
/* Get index, represented as a uint64_T scalar */
mxArray *pm_ptr;
mexCallMATLAB(1, &pm_ptr, 1, &pm, "SwigGet");
if(!pm_ptr || mxGetNumberOfElements(pm_ptr) != 1 ||
mxGetClassID(pm_ptr) != mxUINT64_CLASS || mxIsComplex(pm_ptr)) {
if(pm_ptr) mxDestroyArray(pm_ptr);
return 0;
}
SwigPtr* p = (SwigPtr*)(*(uint64_T*)mxGetData(pm_ptr));
mxDestroyArray(pm_ptr);
/* Consistency check */
if (p->self != p) return 0;
/* Get pointer object */
return p;
}
SWIGRUNTIME int SWIG_Matlab_ConvertPtrAndOwn(mxArray* pm, void **ptr, swig_type_info *type, int flags, int *own) {
/* Get index, represented as a uint64_T scalar */
mxArray *pm_ptr;
mexCallMATLAB(1, &pm_ptr, 1, &pm, "SwigGet");
if(!pm_ptr || mxGetNumberOfElements(pm_ptr) != 1 ||
mxGetClassID(pm_ptr) != mxUINT64_CLASS || mxIsComplex(pm_ptr)){
if(pm_ptr) mxDestroyArray(pm_ptr);
return SWIG_ERROR;
}
SwigPtr* swig_ptr = (SwigPtr*)(*(uint64_T*)mxGetData(pm_ptr));
mxDestroyArray(pm_ptr);
/* Get pointer object */
if (!swig_ptr) return SWIG_ERROR;
swig_cast_info *tc;
int same_type = 0;
SwigPtr* p=swig_ptr;
while (p) {
/* Loop over types */
swig_type_info *p_type = p->type;
/* No type cast needed */
if (p_type==type || !type) {
same_type = 1;
break;
}
/* Check if type conversion is possible */
tc = SWIG_TypeCheck(p_type->name, type);
if (tc) break;
/* Check next type */
p = p->next;
}
/* Conversion not possible */
if (!same_type && !tc) return SWIG_ERROR;
/* Get data */
if (ptr) *ptr = p->ptr;
if (own) *own = p->own;
/* Set ownership marker to false? */
if(flags & SWIG_POINTER_DISOWN){
SWIG_Matlab_DeletePointer(swig_ptr);
}
/* No type cast needed */
if (same_type || !ptr) {
return SWIG_OK;
}
/* Do type-cast */
int newmemory = 0;
*ptr = SWIG_TypeCast(tc, *ptr, &newmemory);
if (newmemory == SWIG_CAST_NEW_MEMORY) {
if (own) {
*own = *own | SWIG_CAST_NEW_MEMORY;
} else {
/* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
mexErrMsgIdAndTxt("SWIG:ConvertPointerObj","SWIG error in converting pointer for type %s. Bad typemap?",type->name);
return SWIG_ERROR;
}
}
return SWIG_OK;
}
SWIGRUNTIME swig_module_info *SWIG_Matlab_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
if (!saved_swig_module) {
/* First call for this module, fetch pointer from MATLAB */
mxArray* mem = 0;
int flag = mexCallMATLAB(1, &mem, 0, 0, "SwigMem");
if (flag || !mem) mexErrMsgIdAndTxt("SWIG:GetModule", "Cannot call SwigMem");
/* On first call, mem is an empty matrix */
if (mxGetNumberOfElements(mem)!= 0) {
if (!mxIsStruct(mem)) {
mexErrMsgIdAndTxt("SWIG:GetModule", "Corrupted memory");
}
mxArray *module = mxGetField(mem, 0,
"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
if (module && mxGetNumberOfElements(module) == 1 && mxGetClassID(module) == mxUINT64_CLASS && !mxIsComplex(module)) {
/* Cast memory as a pointer */
saved_swig_module = (swig_module_info*)(*(uint64_T*)mxGetData(module));
}
}
mxDestroyArray(mem);
}
return saved_swig_module;
}
SWIGRUNTIME void SWIG_Matlab_SetModule(swig_module_info *pointer) {
mxArray* mem = 0;
const char *fields[1] = {"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME};
int flag = mexCallMATLAB(1, &mem, 0, 0, "SwigMem");
if (flag || !mem) mexErrMsgIdAndTxt("SWIG:SetModule", "Cannot call SwigMem");
/* Under normal circumstances, swigMem is an empty matrix */
/* but is not required to be for a valid call to SWIG_Matlab_SetModule() */
if (mxGetNumberOfElements(mem) == 0) {
mxDestroyArray(mem);
mem = mxCreateStructMatrix(1,1,1,fields);
if(!mem) mexErrMsgIdAndTxt("SWIG:SetModule","mxCreateStructMatrix failed");
mxArray *module = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
if(!module) mexErrMsgIdAndTxt("SWIG:SetModule","mxCreateNumericMatrix failed");
*(uint64_T *)mxGetData(module) = (uint64_T)pointer;
mxSetField(mem, 0, fields[0], module);
} else {
int nfields = 0;
int fieldNum = 0;
/* Add to existing mem if not the same */
if (!mxIsStruct(mem)) {
mexErrMsgIdAndTxt("SWIG:SetModule", "Corrupted memory");
}
nfields = mxGetNumberOfFields(mem);
/* Check if same type table */
int ii;
for (ii=0; ii<nfields; ++ii){
if(strcmp(mxGetFieldNameByNumber(mem, ii), fields[0]) == 0) {
mxDestroyArray(mem);
return;
}
}
fieldNum = mxAddField(mem, fields[0]);
if (fieldNum < 0) mexErrMsgIdAndTxt("SWIG:SetModule", "Error adding field to SwigMem");
mxArray *module = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
if(!module) mexErrMsgIdAndTxt("SWIG:SetModule","mxCreateNumericMatrix failed");
*(uint64_T *)mxGetData(module) = (uint64_T)pointer;
mxSetFieldByNumber(mem, 0, fieldNum, module);
}
/* Set variable in SwigMem */
flag = mexCallMATLAB(0, 0, 1, &mem, "SwigMem");
mxDestroyArray(mem);
if (flag) {
mexErrMsgIdAndTxt("SWIG:SetModule", "Could not set variable in SwigMem.\n");
}
saved_swig_module = pointer;
}
/* HACK HACK */
#define SWIG_Matlab_SetConstant(dummy1,dummy2,pm) (pm)
#ifdef __cplusplus
#include <streambuf>
#include <iostream>
namespace swig {
// Stream buffer to allow redirecting output to MATLAB
class SWIG_Matlab_streambuf : public std::streambuf {
public:
SWIG_Matlab_streambuf() {}
protected:
virtual int_type overflow(int_type ch) {
if(ch != traits_type::eof()) {
mexPrintf("%c", static_cast<char>(ch));
}
return ch;
}
virtual std::streamsize xsputn(const char* s, std::streamsize num) {
// Pass straight to mexPrintf without buffering
mexPrintf("%.*s", static_cast<int>(num), s);
return num;
}
};
// Instantiation
static SWIG_Matlab_streambuf SWIG_Matlab_buf;
} // namespace swig
#endif /* cplusplus */
#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_HelicsComplex swig_types[0]
#define SWIGTYPE_p_HelicsCoreFlags swig_types[1]
#define SWIGTYPE_p_HelicsCoreTypes swig_types[2]
#define SWIGTYPE_p_HelicsDataTypes swig_types[3]
#define SWIGTYPE_p_HelicsError swig_types[4]
#define SWIGTYPE_p_HelicsErrorTypes swig_types[5]
#define SWIGTYPE_p_HelicsFederateFlags swig_types[6]
#define SWIGTYPE_p_HelicsFederateState swig_types[7]
#define SWIGTYPE_p_HelicsFilterTypes swig_types[8]
#define SWIGTYPE_p_HelicsFlags swig_types[9]
#define SWIGTYPE_p_HelicsHandleOptions swig_types[10]
#define SWIGTYPE_p_HelicsIterationRequest swig_types[11]
#define SWIGTYPE_p_HelicsIterationResult swig_types[12]
#define SWIGTYPE_p_HelicsLogLevels swig_types[13]
#define SWIGTYPE_p_HelicsMultiInputModes swig_types[14]
#define SWIGTYPE_p_HelicsProperties swig_types[15]
#define SWIGTYPE_p_HelicsSequencingModes swig_types[16]
#define SWIGTYPE_p_char swig_types[17]
#define SWIGTYPE_p_double swig_types[18]
#define SWIGTYPE_p_f_double_int_p_void__void swig_types[19]
#define SWIGTYPE_p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void swig_types[20]
#define SWIGTYPE_p_f_int__int swig_types[21]
#define SWIGTYPE_p_int swig_types[22]
#define SWIGTYPE_p_int32_t swig_types[23]
#define SWIGTYPE_p_p_char swig_types[24]
#define SWIGTYPE_p_void swig_types[25]
static swig_type_info *swig_types[27];
static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
/* -------- TYPES TABLE (END) -------- */
#define SWIGVERSION 0x030011
#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
#include <stdexcept>
#include "helics/helics.h"
/* throw a helics error */
static void throwHelicsMatlabError(HelicsError *err) {
switch (err->error_code)
{
case HELICS_OK:
return;
case HELICS_ERROR_REGISTRATION_FAILURE:
mexErrMsgIdAndTxt( "helics:registration_failure", err->message);
break;
case HELICS_ERROR_CONNECTION_FAILURE:
mexErrMsgIdAndTxt( "helics:connection_failure", err->message);
break;
case HELICS_ERROR_INVALID_OBJECT:
mexErrMsgIdAndTxt( "helics:invalid_object", err->message);
break;
case HELICS_ERROR_INVALID_ARGUMENT:
mexErrMsgIdAndTxt( "helics:invalid_argument", err->message);
break;
case HELICS_ERROR_DISCARD:
mexErrMsgIdAndTxt( "helics:discard", err->message);
break;
case HELICS_ERROR_SYSTEM_FAILURE:
mexErrMsgIdAndTxt( "helics:system_failure", err->message);
break;
case HELICS_ERROR_INVALID_STATE_TRANSITION:
mexErrMsgIdAndTxt( "helics:invalid_state_transition", err->message);
break;
case HELICS_ERROR_INVALID_FUNCTION_CALL:
mexErrMsgIdAndTxt( "helics:invalid_function_call", err->message);
break;
case HELICS_ERROR_EXECUTION_FAILURE:
mexErrMsgIdAndTxt( "helics:execution_failure", err->message);
break;
case HELICS_ERROR_INSUFFICIENT_SPACE:
mexErrMsgIdAndTxt( "helics:insufficient_space", err->message);
break;
case HELICS_ERROR_OTHER:
case HELICS_ERROR_EXTERNAL_TYPE:
default:
mexErrMsgIdAndTxt( "helics:error", err->message);
break;
}
}
#include "helics/helics.h"
SWIGINTERNINLINE mxArray* SWIG_From_long (long value)
{
mxArray* out = mxCreateNumericMatrix(1,1,mxINT64_CLASS,mxREAL);
*((int64_T*)mxGetData(out)) = (int64_T)value;
return out;
}
SWIGINTERNINLINE mxArray*
SWIG_From_int (int value)
{
return SWIG_From_long (value);
}
SWIGINTERNINLINE mxArray* SWIG_From_double (double value)
{
return mxCreateDoubleScalar(value);
}
SWIGINTERN int SWIG_AsVal_double (mxArray* pm, double* val)
{
if(!mxIsDouble(pm) || mxGetNumberOfElements(pm)!=1) return SWIG_TypeError;
if (val) *val = mxGetScalar(pm);
return SWIG_OK;
}
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
if (!init) {
info = SWIG_TypeQuery("_p_char");
init = 1;
}
return info;
}
SWIGINTERNINLINE mxArray*
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
mwSize dims[2] = {1,(mwSize)size};
mxArray* ret = mxCreateCharArray((mwSize)2,dims);
if(!ret) mexErrMsgIdAndTxt("SWIG:FromCharPtrAndSize","mxCreateCharArray failed");
mxChar *ret_data = (mxChar *)mxGetData(ret);
size_t i;
for(i=0; i<size; ++i) ret_data[i] = carray[i];
return ret;
}
SWIGINTERNINLINE mxArray*
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
#include <limits.h>
#if !defined(SWIG_NO_LLONG_MAX)
# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
# define LLONG_MAX __LONG_LONG_MAX__
# define LLONG_MIN (-LLONG_MAX - 1LL)
# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
# endif
#endif
SWIGINTERN int SWIG_AsVal_long (mxArray* pm, long* val)
{
if(mxGetNumberOfElements(pm)!=1) return SWIG_TypeError;
switch(mxGetClassID(pm)){
case mxINT8_CLASS:
if(val) *val = (long)(*(int8_T*)mxGetData(pm)); break;
case mxUINT8_CLASS:
if(val) *val = (long)(*(uint8_T*)mxGetData(pm)); break;
case mxINT16_CLASS:
if(val) *val = (long)(*(int16_T*)mxGetData(pm)); break;
case mxUINT16_CLASS:
if(val) *val = (long)(*(uint16_T*)mxGetData(pm)); break;
case mxINT32_CLASS:
if(val) *val = (long)(*(int32_T*)mxGetData(pm)); break;
case mxUINT32_CLASS:
if(val) *val = (long)(*(uint32_T*)mxGetData(pm)); break;
case mxINT64_CLASS:
if(val) *val = (long)(*(int64_T*)mxGetData(pm)); break;
case mxUINT64_CLASS:
if(val) *val = (long)(*(uint64_T*)mxGetData(pm)); break;
case mxDOUBLE_CLASS:
{
double v=mxGetScalar(pm);
if(v!=floor(v)) return SWIG_TypeError;
if(val) *val = (long)v;
break;
}
default: return SWIG_TypeError;
}
return SWIG_OK;
}
SWIGINTERN int
SWIG_AsVal_int (mxArray* obj, int *val)
{
long v;
int res = SWIG_AsVal_long (obj, &v);
if (SWIG_IsOK(res)) {
if ((v < INT_MIN || v > INT_MAX)) {
return SWIG_OverflowError;
} else {
if (val) *val = static_cast< int >(v);
}
}
return res;
}
SWIGINTERN int
SWIG_AsCharPtrAndSize(mxArray* pm, char** cptr, size_t* psize, int *alloc)
{
if(!mxIsChar(pm) || (mxGetNumberOfElements(pm) != 0 && mxGetM(pm)!=1)) return SWIG_TypeError;
size_t len=mxGetN(pm);
static char buf[256];
int flag = mxGetString(pm,buf,(mwSize)sizeof(buf));
if(flag) return SWIG_TypeError;
if (alloc) {
*cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), buf, sizeof(char)*(len + 1)));
*alloc = SWIG_NEWOBJ;
} else if (cptr)
*cptr = buf;
if (psize)
*psize = len + 1;
return SWIG_OK;
}
SWIGINTERN int
SWIG_AsCharArray(mxArray* obj, char *val, size_t size)
{
char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
if (SWIG_IsOK(res)) {
/* special case of single char conversion when we don't need space for NUL */
if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize;
if (csize <= size) {
if (val) {
if (csize) memcpy(val, cptr, csize*sizeof(char));
if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
}
if (alloc == SWIG_NEWOBJ) {
delete[] cptr;
res = SWIG_DelNewMask(res);
}
return res;
}
if (alloc == SWIG_NEWOBJ) delete[] cptr;
}
return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_char (mxArray* obj, char *val)
{
int res = SWIG_AsCharArray(obj, val, 1);
if (!SWIG_IsOK(res)) {
long v;
res = SWIG_AddCast(SWIG_AsVal_long (obj, &v));
if (SWIG_IsOK(res)) {
if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
if (val) *val = static_cast< char >(v);
} else {
res = SWIG_OverflowError;
}
}
}
return res;
}
SWIGINTERN int SWIG_AsVal_long_SS_long (mxArray* pm, long long* val)
{
if(mxGetNumberOfElements(pm)!=1) return SWIG_TypeError;
switch(mxGetClassID(pm)){
case mxINT8_CLASS:
if(val) *val = (long long)(*(int8_T*)mxGetData(pm)); break;
case mxUINT8_CLASS:
if(val) *val = (long long)(*(uint8_T*)mxGetData(pm)); break;
case mxINT16_CLASS:
if(val) *val = (long long)(*(int16_T*)mxGetData(pm)); break;
case mxUINT16_CLASS:
if(val) *val = (long long)(*(uint16_T*)mxGetData(pm)); break;
case mxINT32_CLASS:
if(val) *val = (long long)(*(int32_T*)mxGetData(pm)); break;
case mxUINT32_CLASS:
if(val) *val = (long long)(*(uint32_T*)mxGetData(pm)); break;
case mxINT64_CLASS:
if(val) *val = (long long)(*(int64_T*)mxGetData(pm)); break;
case mxUINT64_CLASS:
if(val) *val = (long long)(*(uint64_T*)mxGetData(pm)); break;
case mxDOUBLE_CLASS:
{
double v=mxGetScalar(pm);
if(v!=floor(v)) return SWIG_TypeError;
if(val) *val = (long long)v;
break;
}
default: return SWIG_TypeError;
}
return SWIG_OK;
}
SWIGINTERNINLINE mxArray* SWIG_From_long_SS_long (long long value)
{
mxArray* out = mxCreateNumericMatrix(1,1,mxINT64_CLASS,mxREAL);
*((int64_T*)mxGetData(out)) = (int64_T)value;
return out;
}
SWIGINTERNINLINE mxArray*
SWIG_From_char (char c)
{
return SWIG_FromCharPtrAndSize(&c,1);
}
SWIGINTERN int _wrap_HELICS_INVALID_OPTION_INDEX_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_int(static_cast< int >(HELICS_INVALID_OPTION_INDEX));
return 0;
}
SWIGINTERN int _wrap_HELICS_INVALID_PROPERTY_VALUE_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_int(static_cast< int >(HELICS_INVALID_PROPERTY_VALUE));
return 0;
}
SWIGINTERN int _wrap_cHelicsBigNumber_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_double(static_cast< double >(cHelicsBigNumber));
return 0;
}
SWIGINTERN int _wrap_HELICS_TIME_ZERO_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_double(static_cast< double >(HELICS_TIME_ZERO));
return 0;
}
SWIGINTERN int _wrap_HELICS_TIME_EPSILON_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_double(static_cast< double >(HELICS_TIME_EPSILON));
return 0;
}
SWIGINTERN int _wrap_HELICS_TIME_INVALID_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_double(static_cast< double >(HELICS_TIME_INVALID));
return 0;
}
SWIGINTERN int _wrap_HELICS_TIME_MAXTIME_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_double(static_cast< double >(HELICS_TIME_MAXTIME));
return 0;
}
SWIGINTERN int _wrap_HELICS_TRUE_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_int(static_cast< int >(HELICS_TRUE));
return 0;
}
SWIGINTERN int _wrap_HELICS_FALSE_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
resv[0] = SWIG_From_int(static_cast< int >(HELICS_FALSE));
return 0;
}
int _wrap_HelicsComplex_real_set(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsComplex *arg1 = (HelicsComplex *) 0 ;
double arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
double val2 ;
int ecode2 = 0 ;
mxArray * _out;
if (!SWIG_check_num_args("HelicsComplex_real_set",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_HelicsComplex, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HelicsComplex_real_set" "', argument " "1"" of type '" "HelicsComplex *""'");
}
arg1 = reinterpret_cast< HelicsComplex * >(argp1);
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "HelicsComplex_real_set" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
if (arg1) (arg1)->real = arg2;
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_HelicsComplex_real_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsComplex *arg1 = (HelicsComplex *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
mxArray * _out;
double result;
if (!SWIG_check_num_args("HelicsComplex_real_get",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_HelicsComplex, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HelicsComplex_real_get" "', argument " "1"" of type '" "HelicsComplex *""'");
}
arg1 = reinterpret_cast< HelicsComplex * >(argp1);
result = (double) ((arg1)->real);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_HelicsComplex_imag_set(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsComplex *arg1 = (HelicsComplex *) 0 ;
double arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
double val2 ;
int ecode2 = 0 ;
mxArray * _out;
if (!SWIG_check_num_args("HelicsComplex_imag_set",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_HelicsComplex, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HelicsComplex_imag_set" "', argument " "1"" of type '" "HelicsComplex *""'");
}
arg1 = reinterpret_cast< HelicsComplex * >(argp1);
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "HelicsComplex_imag_set" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
if (arg1) (arg1)->imag = arg2;
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_HelicsComplex_imag_get(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsComplex *arg1 = (HelicsComplex *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
mxArray * _out;
double result;
if (!SWIG_check_num_args("HelicsComplex_imag_get",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_HelicsComplex, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "HelicsComplex_imag_get" "', argument " "1"" of type '" "HelicsComplex *""'");
}
arg1 = reinterpret_cast< HelicsComplex * >(argp1);
result = (double) ((arg1)->imag);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_new_HelicsComplex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
HelicsComplex *result = 0 ;
if (!SWIG_check_num_args("new_HelicsComplex",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (HelicsComplex *)new HelicsComplex();
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_HelicsComplex, 1 | 0 );
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_delete_HelicsComplex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsComplex *arg1 = (HelicsComplex *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
mxArray * _out;
int is_owned;
if (!SWIG_check_num_args("delete_HelicsComplex",argc,1,1,0)) {
SWIG_fail;
}
is_owned = SWIG_Matlab_isOwned(argv[0]);
res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_HelicsComplex, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_HelicsComplex" "', argument " "1"" of type '" "HelicsComplex *""'");
}
arg1 = reinterpret_cast< HelicsComplex * >(argp1);
if (is_owned) {
delete arg1;
}
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsGetVersion(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsGetVersion",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (char *)helicsGetVersion();
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsGetBuildFlags(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsGetBuildFlags",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (char *)helicsGetBuildFlags();
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsGetCompilerVersion(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsGetCompilerVersion",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (char *)helicsGetCompilerVersion();
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsGetSystemInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsGetSystemInfo",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (char *)helicsGetSystemInfo();
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsLoadSignalHandler(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
if (!SWIG_check_num_args("helicsLoadSignalHandler",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
helicsLoadSignalHandler();
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsLoadThreadedSignalHandler(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
if (!SWIG_check_num_args("helicsLoadThreadedSignalHandler",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
helicsLoadThreadedSignalHandler();
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsClearSignalHandler(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
if (!SWIG_check_num_args("helicsClearSignalHandler",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
helicsClearSignalHandler();
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsLoadSignalHandlerCallbackNoExit(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBool (*arg1)(int) = (HelicsBool (*)(int)) 0 ;
HelicsBool arg2 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsLoadSignalHandlerCallbackNoExit",argc,2,2,0)) {
SWIG_fail;
}
{
int res = SWIG_ConvertFunctionPtr(argv[0], (void**)(&arg1), SWIGTYPE_p_f_int__int);
if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ArgError(res), "in method '" "helicsLoadSignalHandlerCallbackNoExit" "', argument " "1"" of type '" "HelicsBool (*)(int)""'");
}
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsLoadSignalHandlerCallbackNoExit" "', argument " "2"" of type '" "HelicsBool""'");
}
arg2 = static_cast< HelicsBool >(val2);
helicsLoadSignalHandlerCallbackNoExit(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsAbort(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
int arg1 ;
char *arg2 = (char *) 0 ;
int val1 ;
int ecode1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsAbort",argc,2,2,0)) {
SWIG_fail;
}
ecode1 = SWIG_AsVal_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "helicsAbort" "', argument " "1"" of type '" "int""'");
}
arg1 = static_cast< int >(val1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsAbort" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsAbort(arg1,(char const *)arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsIsCoreTypeAvailable(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsIsCoreTypeAvailable",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsIsCoreTypeAvailable" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (HelicsBool)helicsIsCoreTypeAvailable((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsCreateCore(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsCore result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCreateCore",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateCore" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateCore" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCreateCore" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsCore)helicsCreateCore((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCreateCoreFromArgs(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
char **arg4 = (char **) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsCore result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsCreateCoreFromArgs",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateCoreFromArgs" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateCoreFromArgs" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
{
/* Check if is a list */
if (mxIsCell(argv[2])) {
int ii;
int allocation2=0;
char *buffer_cell=NULL;
int cellSize=static_cast<int>(mxGetNumberOfElements(argv[2]));
arg4 = (char **) malloc((cellSize+1)*sizeof(char *));
for (ii=0;ii<cellSize;++ii)
{
mxArray *cellElement=mxGetCell(argv[2], ii);
int resCode = SWIG_AsCharPtrAndSize(cellElement, &buffer_cell, NULL, &allocation2);
if (!SWIG_IsOK(resCode)) {
SWIG_exception_fail(SWIG_ArgError(resCode), "cell elements must be a string");
}
arg4[ii+1]=buffer_cell;
}
}
else if (mxIsChar(argv[2]))
{
int retval=0;
char *buffer=NULL;
int allocation=0;
arg3=2;
arg4 = (char **) malloc(2*sizeof(char *));
retval = SWIG_AsCharPtrAndSize(argv[2], &buffer, NULL, &allocation);
if (!SWIG_IsOK(retval)) {
SWIG_exception_fail(SWIG_ArgError(retval), "conversion to string failed");
}
arg4[0]=buffer;
arg4[1]=buffer;
}
else
{
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a cell array or string");
return NULL;
}
}
result = (HelicsCore)helicsCreateCoreFromArgs((char const *)arg1,(char const *)arg2,arg3,(char const *const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
free((char **) arg4);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
free((char **) arg4);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsCoreClone(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsCore result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCoreClone",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreClone" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (HelicsCore)helicsCoreClone(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCoreIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsCoreIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreIsValid" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (HelicsBool)helicsCoreIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCreateBroker(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsBroker result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCreateBroker",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateBroker" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateBroker" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCreateBroker" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsBroker)helicsCreateBroker((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCreateBrokerFromArgs(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
char **arg4 = (char **) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsBroker result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsCreateBrokerFromArgs",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateBrokerFromArgs" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateBrokerFromArgs" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
{
/* Check if is a list */
if (mxIsCell(argv[2])) {
int ii;
int allocation2=0;
char *buffer_cell=NULL;
int cellSize=static_cast<int>(mxGetNumberOfElements(argv[2]));
arg4 = (char **) malloc((cellSize+1)*sizeof(char *));
for (ii=0;ii<cellSize;++ii)
{
mxArray *cellElement=mxGetCell(argv[2], ii);
int resCode = SWIG_AsCharPtrAndSize(cellElement, &buffer_cell, NULL, &allocation2);
if (!SWIG_IsOK(resCode)) {
SWIG_exception_fail(SWIG_ArgError(resCode), "cell elements must be a string");
}
arg4[ii+1]=buffer_cell;
}
}
else if (mxIsChar(argv[2]))
{
int retval=0;
char *buffer=NULL;
int allocation=0;
arg3=2;
arg4 = (char **) malloc(2*sizeof(char *));
retval = SWIG_AsCharPtrAndSize(argv[2], &buffer, NULL, &allocation);
if (!SWIG_IsOK(retval)) {
SWIG_exception_fail(SWIG_ArgError(retval), "conversion to string failed");
}
arg4[0]=buffer;
arg4[1]=buffer;
}
else
{
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a cell array or string");
return NULL;
}
}
result = (HelicsBroker)helicsCreateBrokerFromArgs((char const *)arg1,(char const *)arg2,arg3,(char const *const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
free((char **) arg4);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
free((char **) arg4);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsBrokerClone(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsBroker result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsBrokerClone",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerClone" "', argument " "1"" of type '" "HelicsBroker""'");
}
result = (HelicsBroker)helicsBrokerClone(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsBrokerIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsBrokerIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerIsValid" "', argument " "1"" of type '" "HelicsBroker""'");
}
result = (HelicsBool)helicsBrokerIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerIsConnected(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsBrokerIsConnected",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerIsConnected" "', argument " "1"" of type '" "HelicsBroker""'");
}
result = (HelicsBool)helicsBrokerIsConnected(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerDataLink(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerDataLink",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerDataLink" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerDataLink" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerDataLink" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerDataLink(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsBrokerAddSourceFilterToEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerAddSourceFilterToEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerAddSourceFilterToEndpoint" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerAddSourceFilterToEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerAddSourceFilterToEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerAddSourceFilterToEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsBrokerAddDestinationFilterToEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerAddDestinationFilterToEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerAddDestinationFilterToEndpoint" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerAddDestinationFilterToEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerAddDestinationFilterToEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerAddDestinationFilterToEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsBrokerMakeConnections(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsBrokerMakeConnections",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerMakeConnections" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerMakeConnections" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsBrokerMakeConnections(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCoreWaitForDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsBool result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCoreWaitForDisconnect",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreWaitForDisconnect" "', argument " "1"" of type '" "HelicsCore""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsCoreWaitForDisconnect" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsBool)helicsCoreWaitForDisconnect(arg1,arg2,arg3);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsBrokerWaitForDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsBool result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsBrokerWaitForDisconnect",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "1"" of type '" "HelicsBroker""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsBrokerWaitForDisconnect" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsBool)helicsBrokerWaitForDisconnect(arg1,arg2,arg3);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCoreIsConnected(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsCoreIsConnected",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreIsConnected" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (HelicsBool)helicsCoreIsConnected(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreDataLink(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreDataLink",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreDataLink" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreDataLink" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreDataLink" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreDataLink(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreAddSourceFilterToEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreAddSourceFilterToEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreAddSourceFilterToEndpoint" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreAddSourceFilterToEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreAddSourceFilterToEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreAddSourceFilterToEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreAddDestinationFilterToEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreAddDestinationFilterToEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreAddDestinationFilterToEndpoint" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreAddDestinationFilterToEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreAddDestinationFilterToEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreAddDestinationFilterToEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreMakeConnections(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCoreMakeConnections",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreMakeConnections" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreMakeConnections" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsCoreMakeConnections(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsBrokerGetIdentifier(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsBrokerGetIdentifier",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerGetIdentifier" "', argument " "1"" of type '" "HelicsBroker""'");
}
result = (char *)helicsBrokerGetIdentifier(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreGetIdentifier(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsCoreGetIdentifier",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreGetIdentifier" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (char *)helicsCoreGetIdentifier(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerGetAddress(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsBrokerGetAddress",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerGetAddress" "', argument " "1"" of type '" "HelicsBroker""'");
}
result = (char *)helicsBrokerGetAddress(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreGetAddress(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsCoreGetAddress",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreGetAddress" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (char *)helicsCoreGetAddress(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreSetReadyToInit(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCoreSetReadyToInit",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreSetReadyToInit" "', argument " "1"" of type '" "HelicsCore""'");
}
helicsCoreSetReadyToInit(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCoreConnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsBool result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCoreConnect",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreConnect" "', argument " "1"" of type '" "HelicsCore""'");
}
result = (HelicsBool)helicsCoreConnect(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCoreDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCoreDisconnect",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreDisconnect" "', argument " "1"" of type '" "HelicsCore""'");
}
helicsCoreDisconnect(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsGetFederateByName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederate result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsGetFederateByName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetFederateByName" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (HelicsFederate)helicsGetFederateByName((char const *)arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsBrokerDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsBrokerDisconnect",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerDisconnect" "', argument " "1"" of type '" "HelicsBroker""'");
}
helicsBrokerDisconnect(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateDestroy(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsFederateDestroy",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateDestroy" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateDestroy(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerDestroy(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsBrokerDestroy",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerDestroy" "', argument " "1"" of type '" "HelicsBroker""'");
}
helicsBrokerDestroy(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreDestroy(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsCoreDestroy",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreDestroy" "', argument " "1"" of type '" "HelicsCore""'");
}
helicsCoreDestroy(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCoreFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsCoreFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreFree" "', argument " "1"" of type '" "HelicsCore""'");
}
helicsCoreFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsBrokerFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerFree" "', argument " "1"" of type '" "HelicsBroker""'");
}
helicsBrokerFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCreateValueFederate(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsFederateInfo arg2 = (HelicsFederateInfo) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFederate result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCreateValueFederate",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateValueFederate" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateValueFederate" "', argument " "2"" of type '" "HelicsFederateInfo""'");
}
result = (HelicsFederate)helicsCreateValueFederate((char const *)arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCreateValueFederateFromConfig(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederate result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCreateValueFederateFromConfig",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateValueFederateFromConfig" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (HelicsFederate)helicsCreateValueFederateFromConfig((char const *)arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCreateMessageFederate(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsFederateInfo arg2 = (HelicsFederateInfo) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFederate result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCreateMessageFederate",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateMessageFederate" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateMessageFederate" "', argument " "2"" of type '" "HelicsFederateInfo""'");
}
result = (HelicsFederate)helicsCreateMessageFederate((char const *)arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCreateMessageFederateFromConfig(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederate result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCreateMessageFederateFromConfig",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateMessageFederateFromConfig" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (HelicsFederate)helicsCreateMessageFederateFromConfig((char const *)arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCreateCombinationFederate(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsFederateInfo arg2 = (HelicsFederateInfo) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFederate result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCreateCombinationFederate",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateCombinationFederate" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateCombinationFederate" "', argument " "2"" of type '" "HelicsFederateInfo""'");
}
result = (HelicsFederate)helicsCreateCombinationFederate((char const *)arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCreateCombinationFederateFromConfig(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederate result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsCreateCombinationFederateFromConfig",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateCombinationFederateFromConfig" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (HelicsFederate)helicsCreateCombinationFederateFromConfig((char const *)arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateClone(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederate result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateClone",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateClone" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsFederate)helicsFederateClone(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCreateFederateInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
HelicsFederateInfo result;
if (!SWIG_check_num_args("helicsCreateFederateInfo",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
result = (HelicsFederateInfo)helicsCreateFederateInfo();
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateInfoClone(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederateInfo result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateInfoClone",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoClone" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
result = (HelicsFederateInfo)helicsFederateInfoClone(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateInfoLoadFromArgs(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
char **arg3 = (char **) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateInfoLoadFromArgs",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoLoadFromArgs" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
{
/* Check if is a list */
if (mxIsCell(argv[1])) {
int ii;
int allocation2=0;
char *buffer_cell=NULL;
int cellSize=static_cast<int>(mxGetNumberOfElements(argv[1]));
arg3 = (char **) malloc((cellSize+1)*sizeof(char *));
for (ii=0;ii<cellSize;++ii)
{
mxArray *cellElement=mxGetCell(argv[1], ii);
int resCode = SWIG_AsCharPtrAndSize(cellElement, &buffer_cell, NULL, &allocation2);
if (!SWIG_IsOK(resCode)) {
SWIG_exception_fail(SWIG_ArgError(resCode), "cell elements must be a string");
}
arg3[ii+1]=buffer_cell;
}
}
else if (mxIsChar(argv[1]))
{
int retval=0;
char *buffer=NULL;
int allocation=0;
arg2=2;
arg3 = (char **) malloc(2*sizeof(char *));
retval = SWIG_AsCharPtrAndSize(argv[1], &buffer, NULL, &allocation);
if (!SWIG_IsOK(retval)) {
SWIG_exception_fail(SWIG_ArgError(retval), "conversion to string failed");
}
arg3[0]=buffer;
arg3[1]=buffer;
}
else
{
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a cell array or string");
return NULL;
}
}
helicsFederateInfoLoadFromArgs(arg1,arg2,(char const *const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
free((char **) arg3);
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
free((char **) arg3);
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateInfoLoadFromString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoLoadFromString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoLoadFromString" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoLoadFromString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoLoadFromString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsFederateInfoFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoFree" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
helicsFederateInfoFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsFederateIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateIsValid" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsBool)helicsFederateIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateInfoSetCoreName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetCoreName",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetCoreName" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetCoreName" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetCoreName(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetCoreInitString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetCoreInitString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetCoreInitString" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetCoreInitString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetCoreInitString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetBrokerInitString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetBrokerInitString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetBrokerInitString" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetBrokerInitString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetBrokerInitString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetCoreType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetCoreType",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetCoreType" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetCoreType" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
helicsFederateInfoSetCoreType(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetCoreTypeFromString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetCoreTypeFromString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetCoreTypeFromString" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetCoreTypeFromString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetCoreTypeFromString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetBroker(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetBroker",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetBroker" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetBroker" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetBroker(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetBrokerKey(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetBrokerKey",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetBrokerKey" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetBrokerKey" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetBrokerKey(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetBrokerPort(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetBrokerPort",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetBrokerPort" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetBrokerPort" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
helicsFederateInfoSetBrokerPort(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetLocalPort(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetLocalPort",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetLocalPort" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateInfoSetLocalPort" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateInfoSetLocalPort(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsGetPropertyIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsGetPropertyIndex",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetPropertyIndex" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (int)helicsGetPropertyIndex((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsGetFlagIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsGetFlagIndex",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetFlagIndex" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (int)helicsGetFlagIndex((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsGetOptionIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsGetOptionIndex",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetOptionIndex" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (int)helicsGetOptionIndex((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsGetOptionValue(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsGetOptionValue",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetOptionValue" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (int)helicsGetOptionValue((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsGetDataType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsGetDataType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsGetDataType" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
result = (int)helicsGetDataType((char const *)arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return 1;
}
int _wrap_helicsFederateInfoSetFlagOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
HelicsBool arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateInfoSetFlagOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetFlagOption" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetFlagOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateInfoSetFlagOption" "', argument " "3"" of type '" "HelicsBool""'");
}
arg3 = static_cast< HelicsBool >(val3);
helicsFederateInfoSetFlagOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetSeparator(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
char arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateInfoSetSeparator",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetSeparator" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_char(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetSeparator" "', argument " "2"" of type '" "char""'");
}
arg2 = static_cast< char >(val2);
helicsFederateInfoSetSeparator(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetTimeProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
HelicsTime arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
double val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateInfoSetTimeProperty",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetTimeProperty" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetTimeProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_double(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateInfoSetTimeProperty" "', argument " "3"" of type '" "HelicsTime""'");
}
arg3 = static_cast< HelicsTime >(val3);
helicsFederateInfoSetTimeProperty(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateInfoSetIntegerProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederateInfo arg1 = (HelicsFederateInfo) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateInfoSetIntegerProperty",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateInfoSetIntegerProperty" "', argument " "1"" of type '" "HelicsFederateInfo""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateInfoSetIntegerProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateInfoSetIntegerProperty" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsFederateInfoSetIntegerProperty(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterInterfaces(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRegisterInterfaces",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterInterfaces" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterInterfaces" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateRegisterInterfaces(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGlobalError(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateGlobalError",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGlobalError" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGlobalError" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateGlobalError" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateGlobalError(arg1,arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateLocalError(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateLocalError",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLocalError" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateLocalError" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateLocalError" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateLocalError(arg1,arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateFinalize(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateFinalize",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateFinalize" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateFinalize(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateFinalizeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateFinalizeAsync",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateFinalizeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateFinalizeAsync(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateFinalizeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateFinalizeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateFinalizeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateFinalizeComplete(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateDisconnect(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateDisconnect",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateDisconnect" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateDisconnect(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateDisconnectAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateDisconnectAsync",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateDisconnectAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateDisconnectAsync(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateDisconnectComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateDisconnectComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateDisconnectComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateDisconnectComplete(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsFederateFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateFree" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCloseLibrary(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
if (!SWIG_check_num_args("helicsCloseLibrary",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
helicsCloseLibrary();
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateEnterInitializingMode(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterInitializingMode",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterInitializingMode" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterInitializingMode(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterInitializingModeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterInitializingModeAsync",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterInitializingModeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterInitializingModeAsync(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateIsAsyncOperationCompleted(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsBool result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateIsAsyncOperationCompleted",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateIsAsyncOperationCompleted" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsBool)helicsFederateIsAsyncOperationCompleted(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterInitializingModeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterInitializingModeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterInitializingModeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterInitializingModeComplete(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingMode(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingMode",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingMode" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterExecutingMode(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingModeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingModeAsync",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingModeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterExecutingModeAsync(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingModeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingModeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingModeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateEnterExecutingModeComplete(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingModeIterative(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsIterationRequest arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsIterationResult result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingModeIterative",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingModeIterative" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateEnterExecutingModeIterative" "', argument " "2"" of type '" "HelicsIterationRequest""'");
}
arg2 = static_cast< HelicsIterationRequest >(val2);
result = (HelicsIterationResult)helicsFederateEnterExecutingModeIterative(arg1,arg2,arg3);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingModeIterativeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsIterationRequest arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingModeIterativeAsync",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingModeIterativeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateEnterExecutingModeIterativeAsync" "', argument " "2"" of type '" "HelicsIterationRequest""'");
}
arg2 = static_cast< HelicsIterationRequest >(val2);
helicsFederateEnterExecutingModeIterativeAsync(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateEnterExecutingModeIterativeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsIterationResult result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateEnterExecutingModeIterativeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateEnterExecutingModeIterativeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsIterationResult)helicsFederateEnterExecutingModeIterativeComplete(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateGetState(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsFederateState result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateGetState",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetState" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsFederateState)helicsFederateGetState(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateGetCore(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsCore result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateGetCore",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetCore" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsCore)helicsFederateGetCore(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateRequestTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsTime result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRequestTime",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTime" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRequestTime" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
result = (HelicsTime)helicsFederateRequestTime(arg1,arg2,arg3);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeAdvance(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsTime result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeAdvance",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeAdvance" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRequestTimeAdvance" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
result = (HelicsTime)helicsFederateRequestTimeAdvance(arg1,arg2,arg3);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateRequestNextStep(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsTime result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateRequestNextStep",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestNextStep" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsTime)helicsFederateRequestNextStep(arg1,arg2);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeIterative(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsIterationRequest arg3 ;
HelicsIterationResult *arg4 = (HelicsIterationResult *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsIterationResult temp4 ;
int res4 = SWIG_TMPOBJ ;
HelicsError etemp5 ;
mxArray * _out;
HelicsTime result;
arg4 = &temp4;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeIterative",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeIterative" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRequestTimeIterative" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRequestTimeIterative" "', argument " "3"" of type '" "HelicsIterationRequest""'");
}
arg3 = static_cast< HelicsIterationRequest >(val3);
result = (HelicsTime)helicsFederateRequestTimeIterative(arg1,arg2,arg3,arg4,arg5);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
if (SWIG_IsTmpObj(res4)) {
if (--resc>=0) *resv++ = SWIG_From_int((*arg4));
} else {
int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
if (--resc>=0) *resv++ = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_HelicsIterationResult, new_flags);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeAsync",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRequestTimeAsync" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsFederateRequestTimeAsync(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsTime result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsTime)helicsFederateRequestTimeComplete(arg1,arg2);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeIterativeAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsIterationRequest arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeIterativeAsync",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeIterativeAsync" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRequestTimeIterativeAsync" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRequestTimeIterativeAsync" "', argument " "3"" of type '" "HelicsIterationRequest""'");
}
arg3 = static_cast< HelicsIterationRequest >(val3);
helicsFederateRequestTimeIterativeAsync(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRequestTimeIterativeComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsIterationResult *arg2 = (HelicsIterationResult *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
HelicsIterationResult temp2 ;
int res2 = SWIG_TMPOBJ ;
HelicsError etemp3 ;
mxArray * _out;
HelicsTime result;
arg2 = &temp2;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRequestTimeIterativeComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRequestTimeIterativeComplete" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsTime)helicsFederateRequestTimeIterativeComplete(arg1,arg2,arg3);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
if (SWIG_IsTmpObj(res2)) {
if (--resc>=0) *resv++ = SWIG_From_int((*arg2));
} else {
int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
if (--resc>=0) *resv++ = SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_HelicsIterationResult, new_flags);
}
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateProcessCommunications(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateProcessCommunications",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateProcessCommunications" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateProcessCommunications" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsFederateProcessCommunications(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsFederateGetName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetName" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (char *)helicsFederateGetName(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateSetTimeProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsTime arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
double val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetTimeProperty",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetTimeProperty" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateSetTimeProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_double(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateSetTimeProperty" "', argument " "3"" of type '" "HelicsTime""'");
}
arg3 = static_cast< HelicsTime >(val3);
helicsFederateSetTimeProperty(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateSetFlagOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsBool arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetFlagOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetFlagOption" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateSetFlagOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateSetFlagOption" "', argument " "3"" of type '" "HelicsBool""'");
}
arg3 = static_cast< HelicsBool >(val3);
helicsFederateSetFlagOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateSetSeparator(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateSetSeparator",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetSeparator" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_char(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateSetSeparator" "', argument " "2"" of type '" "char""'");
}
arg2 = static_cast< char >(val2);
helicsFederateSetSeparator(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateSetIntegerProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetIntegerProperty",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetIntegerProperty" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateSetIntegerProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateSetIntegerProperty" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsFederateSetIntegerProperty(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateGetTimeProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsTime result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetTimeProperty",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetTimeProperty" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetTimeProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsTime)helicsFederateGetTimeProperty(arg1,arg2,arg3);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetFlagOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsBool result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetFlagOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetFlagOption" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetFlagOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsBool)helicsFederateGetFlagOption(arg1,arg2,arg3);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetIntegerProperty(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
int result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetIntegerProperty",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetIntegerProperty" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetIntegerProperty" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (int)helicsFederateGetIntegerProperty(arg1,arg2,arg3);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetCurrentTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsTime result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateGetCurrentTime",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetCurrentTime" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsTime)helicsFederateGetCurrentTime(arg1,arg2);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateSetGlobal(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetGlobal",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetGlobal" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateSetGlobal" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateSetGlobal" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateSetGlobal(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateSetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetTag",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetTag" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateSetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateSetTag" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateSetTag(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateGetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
char *result = 0 ;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetTag",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetTag" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)helicsFederateGetTag(arg1,(char const *)arg2,arg3);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateAddDependency(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateAddDependency",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateAddDependency" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateAddDependency" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateAddDependency(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateSetLogFile(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateSetLogFile",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetLogFile" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateSetLogFile" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateSetLogFile(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateLogErrorMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateLogErrorMessage",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLogErrorMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateLogErrorMessage" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateLogErrorMessage(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateLogWarningMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateLogWarningMessage",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLogWarningMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateLogWarningMessage" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateLogWarningMessage(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateLogInfoMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateLogInfoMessage",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLogInfoMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateLogInfoMessage" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateLogInfoMessage(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateLogDebugMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateLogDebugMessage",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLogDebugMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateLogDebugMessage" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateLogDebugMessage(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateLogLevelMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateLogLevelMessage",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateLogLevelMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateLogLevelMessage" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateLogLevelMessage" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateLogLevelMessage(arg1,arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateSendCommand(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSendCommand",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSendCommand" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateSendCommand" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateSendCommand" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFederateSendCommand(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateGetCommand(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
char *result = 0 ;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateGetCommand",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetCommand" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (char *)helicsFederateGetCommand(arg1,arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateGetCommandSource(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
char *result = 0 ;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateGetCommandSource",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetCommandSource" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (char *)helicsFederateGetCommandSource(arg1,arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateWaitCommand(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
char *result = 0 ;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateWaitCommand",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateWaitCommand" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (char *)helicsFederateWaitCommand(arg1,arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsCoreSetGlobal(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreSetGlobal",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreSetGlobal" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreSetGlobal" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreSetGlobal" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreSetGlobal(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsBrokerSetGlobal(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerSetGlobal",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerSetGlobal" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerSetGlobal" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerSetGlobal" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerSetGlobal(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreSendCommand(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreSendCommand",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreSendCommand" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreSendCommand" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreSendCommand" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreSendCommand(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsBrokerSendCommand(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerSendCommand",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerSendCommand" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerSendCommand" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerSendCommand" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerSendCommand(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreSetLogFile(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCoreSetLogFile",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreSetLogFile" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreSetLogFile" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsCoreSetLogFile(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsBrokerSetLogFile(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsBrokerSetLogFile",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerSetLogFile" "', argument " "1"" of type '" "HelicsBroker""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsBrokerSetLogFile" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsBrokerSetLogFile(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsBrokerSetTimeBarrier(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsBrokerSetTimeBarrier",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerSetTimeBarrier" "', argument " "1"" of type '" "HelicsBroker""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsBrokerSetTimeBarrier" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsBrokerSetTimeBarrier(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsBrokerClearTimeBarrier(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsBrokerClearTimeBarrier",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerClearTimeBarrier" "', argument " "1"" of type '" "HelicsBroker""'");
}
helicsBrokerClearTimeBarrier(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsBrokerGlobalError(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsBroker arg1 = (HelicsBroker) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsBrokerGlobalError",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsBrokerGlobalError" "', argument " "1"" of type '" "HelicsBroker""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsBrokerGlobalError" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsBrokerGlobalError" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsBrokerGlobalError(arg1,arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreGlobalError(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreGlobalError",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreGlobalError" "', argument " "1"" of type '" "HelicsCore""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsCoreGlobalError" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreGlobalError" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsCoreGlobalError(arg1,arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCreateQuery(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
char *arg1 = (char *) 0 ;
char *arg2 = (char *) 0 ;
int res1 ;
char *buf1 = 0 ;
int alloc1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
HelicsQuery result;
if (!SWIG_check_num_args("helicsCreateQuery",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCreateQuery" "', argument " "1"" of type '" "char const *""'");
}
arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCreateQuery" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsQuery)helicsCreateQuery((char const *)arg1,(char const *)arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsQueryExecute(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
HelicsFederate arg2 = (HelicsFederate) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
char *result = 0 ;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQueryExecute",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryExecute" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQueryExecute" "', argument " "2"" of type '" "HelicsFederate""'");
}
result = (char *)helicsQueryExecute(arg1,arg2,arg3);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQueryCoreExecute(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
HelicsCore arg2 = (HelicsCore) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
char *result = 0 ;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQueryCoreExecute",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryCoreExecute" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQueryCoreExecute" "', argument " "2"" of type '" "HelicsCore""'");
}
result = (char *)helicsQueryCoreExecute(arg1,arg2,arg3);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQueryBrokerExecute(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
HelicsBroker arg2 = (HelicsBroker) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
char *result = 0 ;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQueryBrokerExecute",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryBrokerExecute" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQueryBrokerExecute" "', argument " "2"" of type '" "HelicsBroker""'");
}
result = (char *)helicsQueryBrokerExecute(arg1,arg2,arg3);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQueryExecuteAsync(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
HelicsFederate arg2 = (HelicsFederate) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQueryExecuteAsync",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryExecuteAsync" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQueryExecuteAsync" "', argument " "2"" of type '" "HelicsFederate""'");
}
helicsQueryExecuteAsync(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQueryExecuteComplete(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
char *result = 0 ;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsQueryExecuteComplete",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryExecuteComplete" "', argument " "1"" of type '" "HelicsQuery""'");
}
result = (char *)helicsQueryExecuteComplete(arg1,arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsQueryIsCompleted(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsQueryIsCompleted",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryIsCompleted" "', argument " "1"" of type '" "HelicsQuery""'");
}
result = (HelicsBool)helicsQueryIsCompleted(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsQuerySetTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQuerySetTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQuerySetTarget" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQuerySetTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsQuerySetTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQuerySetQueryString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQuerySetQueryString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQuerySetQueryString" "', argument " "1"" of type '" "HelicsQuery""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQuerySetQueryString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsQuerySetQueryString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQuerySetOrdering(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
int32_t arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
void *argp2 ;
int res2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsQuerySetOrdering",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQuerySetOrdering" "', argument " "1"" of type '" "HelicsQuery""'");
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_int32_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsQuerySetOrdering" "', argument " "2"" of type '" "int32_t""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "helicsQuerySetOrdering" "', argument " "2"" of type '" "int32_t""'");
} else {
arg2 = *(reinterpret_cast< int32_t * >(argp2));
}
}
helicsQuerySetOrdering(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsQueryFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsQuery arg1 = (HelicsQuery) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsQueryFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsQueryFree" "', argument " "1"" of type '" "HelicsQuery""'");
}
helicsQueryFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsCleanupLibrary(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
mxArray * _out;
if (!SWIG_check_num_args("helicsCleanupLibrary",argc,0,0,0)) {
SWIG_fail;
}
(void)argv;
helicsCleanupLibrary();
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateRegisterSubscription(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsInput result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterSubscription",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterSubscription" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterSubscription" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterSubscription" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsInput)helicsFederateRegisterSubscription(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterPublication(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsDataTypes arg3 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterPublication",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterPublication" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterPublication" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRegisterPublication" "', argument " "3"" of type '" "HelicsDataTypes""'");
}
arg3 = static_cast< HelicsDataTypes >(val3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterPublication" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterPublication(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterTypePublication(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterTypePublication",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterTypePublication" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterTypePublication" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterTypePublication" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterTypePublication" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterTypePublication(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalPublication(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsDataTypes arg3 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalPublication",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalPublication" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalPublication" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRegisterGlobalPublication" "', argument " "3"" of type '" "HelicsDataTypes""'");
}
arg3 = static_cast< HelicsDataTypes >(val3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterGlobalPublication" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterGlobalPublication(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalTypePublication(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalTypePublication",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalTypePublication" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalTypePublication" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterGlobalTypePublication" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterGlobalTypePublication" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterGlobalTypePublication(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterInput(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsDataTypes arg3 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsInput result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterInput",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterInput" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterInput" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRegisterInput" "', argument " "3"" of type '" "HelicsDataTypes""'");
}
arg3 = static_cast< HelicsDataTypes >(val3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterInput" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsInput)helicsFederateRegisterInput(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterTypeInput(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsInput result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterTypeInput",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterTypeInput" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterTypeInput" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterTypeInput" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterTypeInput" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsInput)helicsFederateRegisterTypeInput(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalInput(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsDataTypes arg3 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalInput",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalInput" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalInput" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFederateRegisterGlobalInput" "', argument " "3"" of type '" "HelicsDataTypes""'");
}
arg3 = static_cast< HelicsDataTypes >(val3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterGlobalInput" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterGlobalInput(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalTypeInput(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
HelicsPublication result;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalTypeInput",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalTypeInput" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalTypeInput" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterGlobalTypeInput" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsFederateRegisterGlobalTypeInput" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
result = (HelicsPublication)helicsFederateRegisterGlobalTypeInput(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsFederateGetPublication(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsPublication result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetPublication",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetPublication" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetPublication" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsPublication)helicsFederateGetPublication(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetPublicationByIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsPublication result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetPublicationByIndex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetPublicationByIndex" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetPublicationByIndex" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsPublication)helicsFederateGetPublicationByIndex(arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetInput(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsInput result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetInput",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetInput" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetInput" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsInput)helicsFederateGetInput(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetInputByIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsInput result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetInputByIndex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetInputByIndex" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetInputByIndex" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsInput)helicsFederateGetInputByIndex(arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetSubscription(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsInput result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetSubscription",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetSubscription" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetSubscription" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsInput)helicsFederateGetSubscription(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateClearUpdates(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsFederateClearUpdates",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateClearUpdates" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateClearUpdates(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateRegisterFromPublicationJSON(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRegisterFromPublicationJSON",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterFromPublicationJSON" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterFromPublicationJSON" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederateRegisterFromPublicationJSON(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederatePublishJSON(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederatePublishJSON",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederatePublishJSON" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederatePublishJSON" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFederatePublishJSON(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsPublicationIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationIsValid" "', argument " "1"" of type '" "HelicsPublication""'");
}
result = (HelicsBool)helicsPublicationIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationPublishBytes(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationPublishBytes",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishBytes" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationPublishBytes" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
helicsPublicationPublishBytes(arg1,(void const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationPublishString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishString" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationPublishString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsPublicationPublishString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishInteger(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int64_t arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
long long val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishInteger",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishInteger" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_long_SS_long(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationPublishInteger" "', argument " "2"" of type '" "int64_t""'");
}
arg2 = static_cast< int64_t >(val2);
helicsPublicationPublishInteger(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishBoolean(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
HelicsBool arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishBoolean",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishBoolean" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationPublishBoolean" "', argument " "2"" of type '" "HelicsBool""'");
}
arg2 = static_cast< HelicsBool >(val2);
helicsPublicationPublishBoolean(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishDouble(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
double arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishDouble",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishDouble" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationPublishDouble" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
helicsPublicationPublishDouble(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishTime",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishTime" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationPublishTime" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsPublicationPublishTime(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishChar(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationPublishChar",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishChar" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_char(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationPublishChar" "', argument " "2"" of type '" "char""'");
}
arg2 = static_cast< char >(val2);
helicsPublicationPublishChar(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationPublishComplex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
double arg2 ;
double arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationPublishComplex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishComplex" "', argument " "1"" of type '" "HelicsPublication""'");
}
{
if(mxIsComplex(argv[1]))
{
arg2=mxGetPr(argv[1])[0];
arg3=mxGetPi(argv[1])[0];
}
else if (mxIsDouble(argv[1]))
{
arg3=0.0;
arg2=mxGetPr(argv[1])[0];
}
else
{
arg2=0.0;
arg3 = 0.0;
}
}
helicsPublicationPublishComplex(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationPublishVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
double *arg2 = (double *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationPublishVector",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishVector" "', argument " "1"" of type '" "HelicsPublication""'");
}
{
if (!mxIsDouble(argv[1])) {
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a double array");
return NULL;
}
arg3=static_cast<int>(mxGetNumberOfElements(argv[1]));
arg2=mxGetPr(argv[1]);
}
helicsPublicationPublishVector(arg1,(double const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationPublishComplexVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
double *arg2 = (double *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationPublishComplexVector",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishComplexVector" "', argument " "1"" of type '" "HelicsPublication""'");
}
{
if (!mxIsDouble(argv[1])) {
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a double array");
return NULL;
}
arg3=static_cast<int>(mxGetNumberOfElements(argv[1]));
arg2=mxGetPr(argv[1]);
}
helicsPublicationPublishComplexVector(arg1,(double const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationPublishNamedPoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
double arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
double val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationPublishNamedPoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationPublishNamedPoint" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationPublishNamedPoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_double(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsPublicationPublishNamedPoint" "', argument " "3"" of type '" "double""'");
}
arg3 = static_cast< double >(val3);
helicsPublicationPublishNamedPoint(arg1,(char const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationAddTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationAddTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationAddTarget" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationAddTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsPublicationAddTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsInputIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputIsValid" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (HelicsBool)helicsInputIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputAddTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputAddTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputAddTarget" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputAddTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsInputAddTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputGetByteCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsInputGetByteCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetByteCount" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (int)helicsInputGetByteCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetBytes(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
int *arg4 = (int *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp5 ;
mxArray * _out;
{
arg4=&(arg3);
}
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsInputGetBytes",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetBytes" "', argument " "1"" of type '" "HelicsInput""'");
}
{
arg3 = helicsInputGetByteCount(arg1) + 2;
arg2 = malloc(arg3);
}
helicsInputGetBytes(arg1,arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (--resc>=0) *resv++ = SWIG_FromCharPtrAndSize((char*)arg2,*arg4);
}
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsInputGetStringSize(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsInputGetStringSize",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetStringSize" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (int)helicsInputGetStringSize(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
int *arg4 = (int *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp5 ;
mxArray * _out;
{
arg4=&(arg3);
}
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsInputGetString",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetString" "', argument " "1"" of type '" "HelicsInput""'");
}
{
arg3=helicsInputGetStringSize(arg1)+2;
arg2 = (char *) malloc(arg3);
}
helicsInputGetString(arg1,arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (--resc>=0) *resv++ = SWIG_FromCharPtrAndSize(arg2,*arg4-1);
}
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsInputGetInteger(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
int64_t result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsInputGetInteger",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetInteger" "', argument " "1"" of type '" "HelicsInput""'");
}
result = helicsInputGetInteger(arg1,arg2);
_out = SWIG_From_long_SS_long(static_cast< long long >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsInputGetBoolean(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsBool result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsInputGetBoolean",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetBoolean" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (HelicsBool)helicsInputGetBoolean(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsInputGetDouble(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
double result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsInputGetDouble",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetDouble" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (double)helicsInputGetDouble(arg1,arg2);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsInputGetTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsTime result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsInputGetTime",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetTime" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (HelicsTime)helicsInputGetTime(arg1,arg2);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsInputGetChar(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
char result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsInputGetChar",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetChar" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char)helicsInputGetChar(arg1,arg2);
_out = SWIG_From_char(static_cast< char >(result));
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsInputGetComplex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double *arg2 = (double *) 0 ;
double *arg3 = (double *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
double vals2[2] ;
HelicsError etemp4 ;
mxArray * _out;
{
arg2=&(vals2[0]);
arg3=&(vals2[1]);
}
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputGetComplex",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetComplex" "', argument " "1"" of type '" "HelicsInput""'");
}
helicsInputGetComplex(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
mxArray *out=mxCreateDoubleMatrix(1, 1, mxCOMPLEX);
double *r=mxGetPr(out);
double *i=mxGetPi(out);
*r=*arg2;
*i=*arg3;
if (--resc>=0) *resv++ =out;
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputGetVectorSize(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsInputGetVectorSize",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetVectorSize" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (int)helicsInputGetVectorSize(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double *arg2 ;
int arg3 ;
int *arg4 = (int *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp5 ;
mxArray * _out;
{
arg2=(double *)(NULL);
}
{
arg4=&(arg3);
}
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsInputGetVector",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetVector" "', argument " "1"" of type '" "HelicsInput""'");
}
{
arg3=helicsInputGetVectorSize(arg1);
arg2 = (double *) mxCalloc(arg3,sizeof(double));
}
helicsInputGetVector(arg1,arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
mxArray *mat=mxCreateDoubleMatrix(*arg4,1,mxREAL);
mxSetPr(mat,arg2);
if (--resc>=0) *resv++ = mat;
}
{
//if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
//if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsInputGetComplexVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double *arg2 ;
int arg3 ;
int *arg4 = (int *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp5 ;
mxArray * _out;
{
arg2=(double *)(NULL);
}
{
arg4=&(arg3);
}
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsInputGetComplexVector",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetComplexVector" "', argument " "1"" of type '" "HelicsInput""'");
}
{
arg3=helicsInputGetVectorSize(arg1);
arg2 = (double *) mxCalloc(arg3,sizeof(double));
}
helicsInputGetComplexVector(arg1,arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
mxArray *mat=mxCreateDoubleMatrix(*arg4,1,mxREAL);
mxSetPr(mat,arg2);
if (--resc>=0) *resv++ = mat;
}
{
//if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
//if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsInputGetNamedPoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
int arg3 ;
int *arg4 = (int *) 0 ;
double *arg5 = (double *) 0 ;
HelicsError *arg6 = (HelicsError *) 0 ;
int res1 ;
double temp5 ;
int res5 = SWIG_TMPOBJ ;
HelicsError etemp6 ;
mxArray * _out;
{
arg4=&(arg3);
}
arg5 = &temp5;
{
etemp6=helicsErrorInitialize();
arg6=&etemp6;
}
if (!SWIG_check_num_args("helicsInputGetNamedPoint",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetNamedPoint" "', argument " "1"" of type '" "HelicsInput""'");
}
{
arg3=helicsInputGetStringSize(arg1)+2;
arg2 = (char *) malloc(arg3);
}
helicsInputGetNamedPoint(arg1,arg2,arg3,arg4,arg5,arg6);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (--resc>=0) *resv++ = SWIG_FromCharPtrAndSize(arg2,*arg4-1);
}
if (SWIG_IsTmpObj(res5)) {
if (--resc>=0) *resv++ = SWIG_From_double((*arg5));
} else {
int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
if (--resc>=0) *resv++ = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags);
}
{
if (arg2) free(arg2);
}
{
if (arg6->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg6);
}
}
return 0;
fail:
{
if (arg2) free(arg2);
}
{
if (arg6->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg6);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultBytes(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetDefaultBytes",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultBytes" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputSetDefaultBytes" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
helicsInputSetDefaultBytes(arg1,(void const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultString" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputSetDefaultString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsInputSetDefaultString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultInteger(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int64_t arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
long long val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultInteger",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultInteger" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_long_SS_long(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetDefaultInteger" "', argument " "2"" of type '" "int64_t""'");
}
arg2 = static_cast< int64_t >(val2);
helicsInputSetDefaultInteger(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultBoolean(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsBool arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultBoolean",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultBoolean" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetDefaultBoolean" "', argument " "2"" of type '" "HelicsBool""'");
}
arg2 = static_cast< HelicsBool >(val2);
helicsInputSetDefaultBoolean(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultTime",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultTime" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetDefaultTime" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsInputSetDefaultTime(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultChar(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
char val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultChar",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultChar" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_char(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetDefaultChar" "', argument " "2"" of type '" "char""'");
}
arg2 = static_cast< char >(val2);
helicsInputSetDefaultChar(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultDouble(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetDefaultDouble",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultDouble" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetDefaultDouble" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
helicsInputSetDefaultDouble(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultComplex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double arg2 ;
double arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetDefaultComplex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultComplex" "', argument " "1"" of type '" "HelicsInput""'");
}
{
if(mxIsComplex(argv[1]))
{
arg2=mxGetPr(argv[1])[0];
arg3=mxGetPi(argv[1])[0];
}
else if (mxIsDouble(argv[1]))
{
arg3=0.0;
arg2=mxGetPr(argv[1])[0];
}
else
{
arg2=0.0;
arg3 = 0.0;
}
}
helicsInputSetDefaultComplex(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double *arg2 = (double *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetDefaultVector",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultVector" "', argument " "1"" of type '" "HelicsInput""'");
}
{
if (!mxIsDouble(argv[1])) {
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a double array");
return NULL;
}
arg3=static_cast<int>(mxGetNumberOfElements(argv[1]));
arg2=mxGetPr(argv[1]);
}
helicsInputSetDefaultVector(arg1,(double const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultComplexVector(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double *arg2 = (double *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetDefaultComplexVector",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultComplexVector" "', argument " "1"" of type '" "HelicsInput""'");
}
{
if (!mxIsDouble(argv[1])) {
SWIG_exception_fail(SWIG_ArgError(3), "argument must be a double array");
return NULL;
}
arg3=static_cast<int>(mxGetNumberOfElements(argv[1]));
arg2=mxGetPr(argv[1]);
}
helicsInputSetDefaultComplexVector(arg1,(double const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
}
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputSetDefaultNamedPoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
double arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
double val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetDefaultNamedPoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetDefaultNamedPoint" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputSetDefaultNamedPoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_double(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsInputSetDefaultNamedPoint" "', argument " "3"" of type '" "double""'");
}
arg3 = static_cast< double >(val3);
helicsInputSetDefaultNamedPoint(arg1,(char const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputGetType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetType" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetType(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetPublicationType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetPublicationType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetPublicationType" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetPublicationType(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetPublicationDataType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsInputGetPublicationDataType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetPublicationDataType" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (int)helicsInputGetPublicationDataType(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationGetType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsPublicationGetType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetType" "', argument " "1"" of type '" "HelicsPublication""'");
}
result = (char *)helicsPublicationGetType(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetName" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetName(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsSubscriptionGetTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsSubscriptionGetTarget",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsSubscriptionGetTarget" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsSubscriptionGetTarget(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationGetName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsPublicationGetName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetName" "', argument " "1"" of type '" "HelicsPublication""'");
}
result = (char *)helicsPublicationGetName(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetUnits(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetUnits",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetUnits" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetUnits(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetInjectionUnits(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetInjectionUnits",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetInjectionUnits" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetInjectionUnits(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetExtractionUnits(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetExtractionUnits",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetExtractionUnits" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetExtractionUnits(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationGetUnits(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsPublicationGetUnits",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetUnits" "', argument " "1"" of type '" "HelicsPublication""'");
}
result = (char *)helicsPublicationGetUnits(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputGetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetInfo",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetInfo" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (char *)helicsInputGetInfo(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputSetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetInfo",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetInfo" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputSetInfo" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsInputSetInfo(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputGetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsInputGetTag",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetTag" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputGetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)helicsInputGetTag(arg1,(char const *)arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsInputSetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetTag",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetTag" "', argument " "1"" of type '" "HelicsInput""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsInputSetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsInputSetTag" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsInputSetTag(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationGetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsPublicationGetInfo",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetInfo" "', argument " "1"" of type '" "HelicsPublication""'");
}
result = (char *)helicsPublicationGetInfo(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationSetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationSetInfo",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationSetInfo" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationSetInfo" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsPublicationSetInfo(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsPublicationGetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsPublicationGetTag",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetTag" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationGetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)helicsPublicationGetTag(arg1,(char const *)arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsPublicationSetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationSetTag",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationSetTag" "', argument " "1"" of type '" "HelicsPublication""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsPublicationSetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsPublicationSetTag" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsPublicationSetTag(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsInputGetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int arg2 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsInputGetOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputGetOption" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputGetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (int)helicsInputGetOption(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputSetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsInputSetOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetOption" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsInputSetOption" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsInputSetOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationGetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int arg2 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsPublicationGetOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationGetOption" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationGetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (int)helicsPublicationGetOption(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsPublicationSetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsPublicationSetOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationSetOption" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationSetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsPublicationSetOption" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsPublicationSetOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsPublicationSetMinimumChange(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsPublication arg1 = (HelicsPublication) 0 ;
double arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsPublicationSetMinimumChange",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsPublicationSetMinimumChange" "', argument " "1"" of type '" "HelicsPublication""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsPublicationSetMinimumChange" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
helicsPublicationSetMinimumChange(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputSetMinimumChange(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
double arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsInputSetMinimumChange",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputSetMinimumChange" "', argument " "1"" of type '" "HelicsInput""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsInputSetMinimumChange" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
helicsInputSetMinimumChange(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsInputIsUpdated(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsInputIsUpdated",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputIsUpdated" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (HelicsBool)helicsInputIsUpdated(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputLastUpdateTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
HelicsTime result;
if (!SWIG_check_num_args("helicsInputLastUpdateTime",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputLastUpdateTime" "', argument " "1"" of type '" "HelicsInput""'");
}
result = (HelicsTime)helicsInputLastUpdateTime(arg1);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsInputClearUpdate(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsInput arg1 = (HelicsInput) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsInputClearUpdate",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsInputClearUpdate" "', argument " "1"" of type '" "HelicsInput""'");
}
helicsInputClearUpdate(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateGetPublicationCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFederateGetPublicationCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetPublicationCount" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (int)helicsFederateGetPublicationCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateGetInputCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFederateGetInputCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetInputCount" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (int)helicsFederateGetInputCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateRegisterEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterEndpoint" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsEndpoint)helicsFederateRegisterEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalEndpoint" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterGlobalEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsEndpoint)helicsFederateRegisterGlobalEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterTargetedEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterTargetedEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterTargetedEndpoint" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterTargetedEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterTargetedEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsEndpoint)helicsFederateRegisterTargetedEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalTargetedEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalTargetedEndpoint",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalTargetedEndpoint" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalTargetedEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterGlobalTargetedEndpoint" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsEndpoint)helicsFederateRegisterGlobalTargetedEndpoint(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateGetEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetEndpoint",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetEndpoint" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsEndpoint)helicsFederateGetEndpoint(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetEndpointByIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsEndpoint result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetEndpointByIndex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetEndpointByIndex" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetEndpointByIndex" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsEndpoint)helicsFederateGetEndpointByIndex(arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsEndpointIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointIsValid" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (HelicsBool)helicsEndpointIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointSetDefaultDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointSetDefaultDestination",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSetDefaultDestination" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSetDefaultDestination" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointSetDefaultDestination(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointGetDefaultDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsEndpointGetDefaultDestination",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetDefaultDestination" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (char *)helicsEndpointGetDefaultDestination(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointSendBytes(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsEndpointSendBytes",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendBytes" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendBytes" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
helicsEndpointSendBytes(arg1,(void const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsEndpointSendBytesTo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
char *arg4 = (char *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsEndpointSendBytesTo",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendBytesTo" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendBytesTo" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsEndpointSendBytesTo" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
helicsEndpointSendBytesTo(arg1,(void const *)arg2,arg3,(char const *)arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsEndpointSendBytesToAt(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
char *arg4 = (char *) 0 ;
HelicsTime arg5 ;
HelicsError *arg6 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
double val5 ;
int ecode5 = 0 ;
HelicsError etemp6 ;
mxArray * _out;
{
etemp6=helicsErrorInitialize();
arg6=&etemp6;
}
if (!SWIG_check_num_args("helicsEndpointSendBytesToAt",argc,4,4,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendBytesToAt" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendBytesToAt" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "helicsEndpointSendBytesToAt" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
ecode5 = SWIG_AsVal_double(argv[3], &val5);
if (!SWIG_IsOK(ecode5)) {
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "helicsEndpointSendBytesToAt" "', argument " "5"" of type '" "HelicsTime""'");
}
arg5 = static_cast< HelicsTime >(val5);
helicsEndpointSendBytesToAt(arg1,(void const *)arg2,arg3,(char const *)arg4,arg5,arg6);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg6->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg6);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
{
if (arg6->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg6);
}
}
return 1;
}
int _wrap_helicsEndpointSendBytesAt(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsTime arg4 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
double val4 ;
int ecode4 = 0 ;
HelicsError etemp5 ;
mxArray * _out;
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsEndpointSendBytesAt",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendBytesAt" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendBytesAt" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
ecode4 = SWIG_AsVal_double(argv[2], &val4);
if (!SWIG_IsOK(ecode4)) {
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "helicsEndpointSendBytesAt" "', argument " "4"" of type '" "HelicsTime""'");
}
arg4 = static_cast< HelicsTime >(val4);
helicsEndpointSendBytesAt(arg1,(void const *)arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsEndpointSendMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
HelicsMessage arg2 = (HelicsMessage) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointSendMessage",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendMessage" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendMessage" "', argument " "2"" of type '" "HelicsMessage""'");
}
helicsEndpointSendMessage(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointSendMessageZeroCopy(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
HelicsMessage arg2 = (HelicsMessage) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointSendMessageZeroCopy",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSendMessageZeroCopy" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSendMessageZeroCopy" "', argument " "2"" of type '" "HelicsMessage""'");
}
helicsEndpointSendMessageZeroCopy(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointSubscribe(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointSubscribe",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSubscribe" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSubscribe" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointSubscribe(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateHasMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsFederateHasMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateHasMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsBool)helicsFederateHasMessage(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointHasMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsEndpointHasMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointHasMessage" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (HelicsBool)helicsEndpointHasMessage(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederatePendingMessageCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFederatePendingMessageCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederatePendingMessageCount" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (int)helicsFederatePendingMessageCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointPendingMessageCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsEndpointPendingMessageCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointPendingMessageCount" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (int)helicsEndpointPendingMessageCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointGetMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
HelicsMessage result;
if (!SWIG_check_num_args("helicsEndpointGetMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetMessage" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (HelicsMessage)helicsEndpointGetMessage(arg1);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointCreateMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsMessage result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsEndpointCreateMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointCreateMessage" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (HelicsMessage)helicsEndpointCreateMessage(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateGetMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
HelicsMessage result;
if (!SWIG_check_num_args("helicsFederateGetMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsMessage)helicsFederateGetMessage(arg1);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateCreateMessage(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsMessage result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsFederateCreateMessage",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateCreateMessage" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (HelicsMessage)helicsFederateCreateMessage(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateClearMessages(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsFederateClearMessages",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateClearMessages" "', argument " "1"" of type '" "HelicsFederate""'");
}
helicsFederateClearMessages(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointGetType(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsEndpointGetType",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetType" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (char *)helicsEndpointGetType(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointGetName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsEndpointGetName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetName" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (char *)helicsEndpointGetName(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateGetEndpointCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFederateGetEndpointCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetEndpointCount" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (int)helicsFederateGetEndpointCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointGetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsEndpointGetInfo",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetInfo" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
result = (char *)helicsEndpointGetInfo(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointSetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointSetInfo",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSetInfo" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSetInfo" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointSetInfo(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointGetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsEndpointGetTag",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetTag" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointGetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)helicsEndpointGetTag(arg1,(char const *)arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsEndpointSetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsEndpointSetTag",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSetTag" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointSetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsEndpointSetTag" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsEndpointSetTag(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsEndpointSetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsEndpointSetOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointSetOption" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsEndpointSetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsEndpointSetOption" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsEndpointSetOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsEndpointGetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
int arg2 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsEndpointGetOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointGetOption" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsEndpointGetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (int)helicsEndpointGetOption(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsEndpointAddSourceTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointAddSourceTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointAddSourceTarget" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointAddSourceTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointAddSourceTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointAddDestinationTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointAddDestinationTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointAddDestinationTarget" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointAddDestinationTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointAddDestinationTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointRemoveTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointRemoveTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointRemoveTarget" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointRemoveTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointRemoveTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointAddSourceFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointAddSourceFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointAddSourceFilter" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointAddSourceFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointAddSourceFilter(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsEndpointAddDestinationFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsEndpoint arg1 = (HelicsEndpoint) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsEndpointAddDestinationFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsEndpointAddDestinationFilter" "', argument " "1"" of type '" "HelicsEndpoint""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsEndpointAddDestinationFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsEndpointAddDestinationFilter(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageGetSource(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetSource",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetSource" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (char *)helicsMessageGetSource(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetDestination",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetDestination" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (char *)helicsMessageGetDestination(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetOriginalSource(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetOriginalSource",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetOriginalSource" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (char *)helicsMessageGetOriginalSource(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetOriginalDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetOriginalDestination",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetOriginalDestination" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (char *)helicsMessageGetOriginalDestination(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
HelicsTime result;
if (!SWIG_check_num_args("helicsMessageGetTime",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetTime" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (HelicsTime)helicsMessageGetTime(arg1);
_out = SWIG_From_double(static_cast< double >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetString",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetString" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (char *)helicsMessageGetString(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetMessageID(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsMessageGetMessageID",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetMessageID" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (int)helicsMessageGetMessageID(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetFlagOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int arg2 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsMessageGetFlagOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetFlagOption" "', argument " "1"" of type '" "HelicsMessage""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsMessageGetFlagOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsBool)helicsMessageGetFlagOption(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetByteCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsMessageGetByteCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetByteCount" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (int)helicsMessageGetByteCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageGetBytes(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
int *arg4 = (int *) 0 ;
HelicsError *arg5 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp5 ;
mxArray * _out;
{
arg4=&(arg3);
}
{
etemp5=helicsErrorInitialize();
arg5=&etemp5;
}
if (!SWIG_check_num_args("helicsMessageGetBytes",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetBytes" "', argument " "1"" of type '" "HelicsMessage""'");
}
{
arg3=helicsMessageGetByteCount(arg1)+2;
arg2 = malloc(arg3);
}
helicsMessageGetBytes(arg1,arg2,arg3,arg4,arg5);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (--resc>=0) *resv++ = SWIG_FromCharPtrAndSize((char*)arg2,*arg4);
}
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 0;
fail:
{
if (arg2) free(arg2);
}
{
if (arg5->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg5);
}
}
return 1;
}
int _wrap_helicsMessageGetBytesPointer(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
void *result = 0 ;
if (!SWIG_check_num_args("helicsMessageGetBytesPointer",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageGetBytesPointer" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (void *)helicsMessageGetBytesPointer(arg1);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsMessageIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageIsValid" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (HelicsBool)helicsMessageIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageSetSource(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetSource",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetSource" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetSource" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsMessageSetSource(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetDestination",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetDestination" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetDestination" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsMessageSetDestination(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetOriginalSource(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetOriginalSource",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetOriginalSource" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetOriginalSource" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsMessageSetOriginalSource(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetOriginalDestination(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetOriginalDestination",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetOriginalDestination" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetOriginalDestination" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsMessageSetOriginalDestination(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetTime(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
HelicsTime arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
double val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetTime",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetTime" "', argument " "1"" of type '" "HelicsMessage""'");
}
ecode2 = SWIG_AsVal_double(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsMessageSetTime" "', argument " "2"" of type '" "HelicsTime""'");
}
arg2 = static_cast< HelicsTime >(val2);
helicsMessageSetTime(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageReserve(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageReserve",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageReserve" "', argument " "1"" of type '" "HelicsMessage""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsMessageReserve" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
helicsMessageReserve(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetMessageID(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int32_t arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
void *argp2 ;
int res2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetMessageID",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetMessageID" "', argument " "1"" of type '" "HelicsMessage""'");
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_int32_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetMessageID" "', argument " "2"" of type '" "int32_t""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "helicsMessageSetMessageID" "', argument " "2"" of type '" "int32_t""'");
} else {
arg2 = *(reinterpret_cast< int32_t * >(argp2));
}
}
helicsMessageSetMessageID(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageClearFlags(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsMessageClearFlags",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageClearFlags" "', argument " "1"" of type '" "HelicsMessage""'");
}
helicsMessageClearFlags(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageSetFlagOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int arg2 ;
HelicsBool arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsMessageSetFlagOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetFlagOption" "', argument " "1"" of type '" "HelicsMessage""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsMessageSetFlagOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsMessageSetFlagOption" "', argument " "3"" of type '" "HelicsBool""'");
}
arg3 = static_cast< HelicsBool >(val3);
helicsMessageSetFlagOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsMessageSetString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageSetString",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetString" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsMessageSetString(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageSetData(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsMessageSetData",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageSetData" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageSetData" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
helicsMessageSetData(arg1,(void const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsMessageAppendData(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
void *arg2 = (void *) 0 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
size_t size2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsMessageAppendData",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageAppendData" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageAppendData" "', argument " "2"" of type '" "void const *""'");
}
arg2 = reinterpret_cast< void * >(buf2);
arg3 = static_cast< int >(size2 - 1);
helicsMessageAppendData(arg1,(void const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsMessageCopy(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
HelicsMessage arg2 = (HelicsMessage) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsMessageCopy",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageCopy" "', argument " "1"" of type '" "HelicsMessage""'");
}
res2 = SWIG_ConvertPtr(argv[1],SWIG_as_voidptrptr(&arg2), 0, 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsMessageCopy" "', argument " "2"" of type '" "HelicsMessage""'");
}
helicsMessageCopy(arg1,arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsMessageClone(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
HelicsMessage result;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsMessageClone",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageClone" "', argument " "1"" of type '" "HelicsMessage""'");
}
result = (HelicsMessage)helicsMessageClone(arg1,arg2);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsMessageFree(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
int res1 ;
mxArray * _out;
if (!SWIG_check_num_args("helicsMessageFree",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageFree" "', argument " "1"" of type '" "HelicsMessage""'");
}
helicsMessageFree(arg1);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsMessageClear(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsMessage arg1 = (HelicsMessage) 0 ;
HelicsError *arg2 = (HelicsError *) 0 ;
int res1 ;
HelicsError etemp2 ;
mxArray * _out;
{
etemp2=helicsErrorInitialize();
arg2=&etemp2;
}
if (!SWIG_check_num_args("helicsMessageClear",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsMessageClear" "', argument " "1"" of type '" "HelicsMessage""'");
}
helicsMessageClear(arg1,arg2);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 0;
fail:
{
if (arg2->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg2);
}
}
return 1;
}
int _wrap_helicsFederateRegisterFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsFilterTypes arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsFilter result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterFilter",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterFilter" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRegisterFilter" "', argument " "2"" of type '" "HelicsFilterTypes""'");
}
arg2 = static_cast< HelicsFilterTypes >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterFilter" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsFilter)helicsFederateRegisterFilter(arg1,arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
HelicsFilterTypes arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsFilter result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalFilter",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalFilter" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateRegisterGlobalFilter" "', argument " "2"" of type '" "HelicsFilterTypes""'");
}
arg2 = static_cast< HelicsFilterTypes >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateRegisterGlobalFilter" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsFilter)helicsFederateRegisterGlobalFilter(arg1,arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateRegisterCloningFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFilter result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRegisterCloningFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterCloningFilter" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterCloningFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsFilter)helicsFederateRegisterCloningFilter(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateRegisterGlobalCloningFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFilter result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateRegisterGlobalCloningFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateRegisterGlobalCloningFilter" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateRegisterGlobalCloningFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsFilter)helicsFederateRegisterGlobalCloningFilter(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsCoreRegisterFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
HelicsFilterTypes arg2 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
HelicsFilter result;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsCoreRegisterFilter",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreRegisterFilter" "', argument " "1"" of type '" "HelicsCore""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsCoreRegisterFilter" "', argument " "2"" of type '" "HelicsFilterTypes""'");
}
arg2 = static_cast< HelicsFilterTypes >(val2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsCoreRegisterFilter" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
result = (HelicsFilter)helicsCoreRegisterFilter(arg1,arg2,(char const *)arg3,arg4);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsCoreRegisterCloningFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsCore arg1 = (HelicsCore) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFilter result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsCoreRegisterCloningFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsCoreRegisterCloningFilter" "', argument " "1"" of type '" "HelicsCore""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsCoreRegisterCloningFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsFilter)helicsCoreRegisterCloningFilter(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetFilterCount(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int res1 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFederateGetFilterCount",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetFilterCount" "', argument " "1"" of type '" "HelicsFederate""'");
}
result = (int)helicsFederateGetFilterCount(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateGetFilter(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFilter result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetFilter",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetFilter" "', argument " "1"" of type '" "HelicsFederate""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFederateGetFilter" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (HelicsFilter)helicsFederateGetFilter(arg1,(char const *)arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFederateGetFilterByIndex(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
int arg2 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
HelicsFilter result;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFederateGetFilterByIndex",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateGetFilterByIndex" "', argument " "1"" of type '" "HelicsFederate""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFederateGetFilterByIndex" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (HelicsFilter)helicsFederateGetFilterByIndex(arg1,arg2,arg3);
_out = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (_out) --resc, *resv++ = _out;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterIsValid(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
int res1 ;
mxArray * _out;
HelicsBool result;
if (!SWIG_check_num_args("helicsFilterIsValid",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterIsValid" "', argument " "1"" of type '" "HelicsFilter""'");
}
result = (HelicsBool)helicsFilterIsValid(arg1);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFilterGetName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsFilterGetName",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterGetName" "', argument " "1"" of type '" "HelicsFilter""'");
}
result = (char *)helicsFilterGetName(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFilterSet(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
double arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
double val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFilterSet",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterSet" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterSet" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_double(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFilterSet" "', argument " "3"" of type '" "double""'");
}
arg3 = static_cast< double >(val3);
helicsFilterSet(arg1,(char const *)arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFilterSetString(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFilterSetString",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterSetString" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterSetString" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFilterSetString" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFilterSetString(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFilterAddDestinationTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterAddDestinationTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterAddDestinationTarget" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterAddDestinationTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterAddDestinationTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterAddSourceTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterAddSourceTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterAddSourceTarget" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterAddSourceTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterAddSourceTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterAddDeliveryEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterAddDeliveryEndpoint",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterAddDeliveryEndpoint" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterAddDeliveryEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterAddDeliveryEndpoint(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterRemoveTarget(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterRemoveTarget",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterRemoveTarget" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterRemoveTarget" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterRemoveTarget(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterRemoveDeliveryEndpoint(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterRemoveDeliveryEndpoint",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterRemoveDeliveryEndpoint" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterRemoveDeliveryEndpoint" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterRemoveDeliveryEndpoint(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterGetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
int res1 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsFilterGetInfo",argc,1,1,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterGetInfo" "', argument " "1"" of type '" "HelicsFilter""'");
}
result = (char *)helicsFilterGetInfo(arg1);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFilterSetInfo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
HelicsError *arg3 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
HelicsError etemp3 ;
mxArray * _out;
{
etemp3=helicsErrorInitialize();
arg3=&etemp3;
}
if (!SWIG_check_num_args("helicsFilterSetInfo",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterSetInfo" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterSetInfo" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
helicsFilterSetInfo(arg1,(char const *)arg2,arg3);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
{
if (arg3->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg3);
}
}
return 1;
}
int _wrap_helicsFilterGetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
mxArray * _out;
char *result = 0 ;
if (!SWIG_check_num_args("helicsFilterGetTag",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterGetTag" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterGetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (char *)helicsFilterGetTag(arg1,(char const *)arg2);
_out = SWIG_FromCharPtr((const char *)result);
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return 1;
}
int _wrap_helicsFilterSetTag(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFilterSetTag",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterSetTag" "', argument " "1"" of type '" "HelicsFilter""'");
}
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "helicsFilterSetTag" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFilterSetTag" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
helicsFilterSetTag(arg1,(char const *)arg2,(char const *)arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFilterSetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
int arg2 ;
int arg3 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
int val3 ;
int ecode3 = 0 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFilterSetOption",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterSetOption" "', argument " "1"" of type '" "HelicsFilter""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFilterSetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
ecode3 = SWIG_AsVal_int(argv[2], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "helicsFilterSetOption" "', argument " "3"" of type '" "int""'");
}
arg3 = static_cast< int >(val3);
helicsFilterSetOption(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFilterGetOption(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFilter arg1 = (HelicsFilter) 0 ;
int arg2 ;
int res1 ;
int val2 ;
int ecode2 = 0 ;
mxArray * _out;
int result;
if (!SWIG_check_num_args("helicsFilterGetOption",argc,2,2,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFilterGetOption" "', argument " "1"" of type '" "HelicsFilter""'");
}
ecode2 = SWIG_AsVal_int(argv[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "helicsFilterGetOption" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
result = (int)helicsFilterGetOption(arg1,arg2);
_out = SWIG_From_int(static_cast< int >(result));
if (_out) --resc, *resv++ = _out;
return 0;
fail:
return 1;
}
int _wrap_helicsFederateSetTimeUpdateCallback(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
void (*arg2)(HelicsTime,HelicsBool,void *) = (void (*)(HelicsTime,HelicsBool,void *)) 0 ;
void *arg3 = (void *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res3 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetTimeUpdateCallback",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetTimeUpdateCallback" "', argument " "1"" of type '" "HelicsFederate""'");
}
{
int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_double_int_p_void__void);
if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ArgError(res), "in method '" "helicsFederateSetTimeUpdateCallback" "', argument " "2"" of type '" "void (*)(HelicsTime,HelicsBool,void *)""'");
}
}
res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateSetTimeUpdateCallback" "', argument " "3"" of type '" "void *""'");
}
helicsFederateSetTimeUpdateCallback(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
int _wrap_helicsFederateSetStateChangeCallback(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
HelicsFederate arg1 = (HelicsFederate) 0 ;
void (*arg2)(HelicsFederateState,HelicsFederateState,void *) = (void (*)(HelicsFederateState,HelicsFederateState,void *)) 0 ;
void *arg3 = (void *) 0 ;
HelicsError *arg4 = (HelicsError *) 0 ;
int res1 ;
int res3 ;
HelicsError etemp4 ;
mxArray * _out;
{
etemp4=helicsErrorInitialize();
arg4=&etemp4;
}
if (!SWIG_check_num_args("helicsFederateSetStateChangeCallback",argc,3,3,0)) {
SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0],SWIG_as_voidptrptr(&arg1), 0, 0);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "helicsFederateSetStateChangeCallback" "', argument " "1"" of type '" "HelicsFederate""'");
}
{
int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void);
if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ArgError(res), "in method '" "helicsFederateSetStateChangeCallback" "', argument " "2"" of type '" "void (*)(HelicsFederateState,HelicsFederateState,void *)""'");
}
}
res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "helicsFederateSetStateChangeCallback" "', argument " "3"" of type '" "void *""'");
}
helicsFederateSetStateChangeCallback(arg1,arg2,arg3,arg4);
_out = (mxArray*)0;
if (_out) --resc, *resv++ = _out;
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 0;
fail:
{
if (arg4->error_code!=HELICS_OK)
{
throwHelicsMatlabError(arg4);
}
}
return 1;
}
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
static swig_type_info _swigt__p_HelicsComplex = {"_p_HelicsComplex", "HelicsComplex *", 0, 0, (void*)"helics.HelicsComplex", 0};
static swig_type_info _swigt__p_HelicsCoreFlags = {"_p_HelicsCoreFlags", "enum HelicsCoreFlags *|HelicsCoreFlags *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsCoreTypes = {"_p_HelicsCoreTypes", "enum HelicsCoreTypes *|HelicsCoreTypes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsDataTypes = {"_p_HelicsDataTypes", "enum HelicsDataTypes *|HelicsDataTypes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsError = {"_p_HelicsError", "HelicsError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsErrorTypes = {"_p_HelicsErrorTypes", "enum HelicsErrorTypes *|HelicsErrorTypes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsFederateFlags = {"_p_HelicsFederateFlags", "enum HelicsFederateFlags *|HelicsFederateFlags *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsFederateState = {"_p_HelicsFederateState", "enum HelicsFederateState *|HelicsFederateState *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsFilterTypes = {"_p_HelicsFilterTypes", "enum HelicsFilterTypes *|HelicsFilterTypes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsFlags = {"_p_HelicsFlags", "enum HelicsFlags *|HelicsFlags *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsHandleOptions = {"_p_HelicsHandleOptions", "enum HelicsHandleOptions *|HelicsHandleOptions *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsIterationRequest = {"_p_HelicsIterationRequest", "enum HelicsIterationRequest *|HelicsIterationRequest *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsIterationResult = {"_p_HelicsIterationResult", "enum HelicsIterationResult *|HelicsIterationResult *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsLogLevels = {"_p_HelicsLogLevels", "enum HelicsLogLevels *|HelicsLogLevels *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsMultiInputModes = {"_p_HelicsMultiInputModes", "enum HelicsMultiInputModes *|HelicsMultiInputModes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsProperties = {"_p_HelicsProperties", "enum HelicsProperties *|HelicsProperties *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_HelicsSequencingModes = {"_p_HelicsSequencingModes", "enum HelicsSequencingModes *|HelicsSequencingModes *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_double = {"_p_double", "double *|HelicsTime *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_double_int_p_void__void = {"_p_f_double_int_p_void__void", "void (*)(double,int,void *)|void (*)(HelicsTime,HelicsBool,void *)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void = {"_p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void", "void (*)(enum HelicsFederateState,enum HelicsFederateState,void *)|void (*)(HelicsFederateState,HelicsFederateState,void *)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_int__int = {"_p_f_int__int", "int (*)(int)|HelicsBool (*)(int)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|HelicsBool *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int32_t = {"_p_int32_t", "int32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_void = {"_p_void", "HelicsPublication|HelicsBroker|HelicsInput|HelicsCore|HelicsFederateInfo|HelicsFilter|HelicsFederate|HelicsEndpoint|HelicsMessage|void *|HelicsQuery", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_HelicsComplex,
&_swigt__p_HelicsCoreFlags,
&_swigt__p_HelicsCoreTypes,
&_swigt__p_HelicsDataTypes,
&_swigt__p_HelicsError,
&_swigt__p_HelicsErrorTypes,
&_swigt__p_HelicsFederateFlags,
&_swigt__p_HelicsFederateState,
&_swigt__p_HelicsFilterTypes,
&_swigt__p_HelicsFlags,
&_swigt__p_HelicsHandleOptions,
&_swigt__p_HelicsIterationRequest,
&_swigt__p_HelicsIterationResult,
&_swigt__p_HelicsLogLevels,
&_swigt__p_HelicsMultiInputModes,
&_swigt__p_HelicsProperties,
&_swigt__p_HelicsSequencingModes,
&_swigt__p_char,
&_swigt__p_double,
&_swigt__p_f_double_int_p_void__void,
&_swigt__p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void,
&_swigt__p_f_int__int,
&_swigt__p_int,
&_swigt__p_int32_t,
&_swigt__p_p_char,
&_swigt__p_void,
};
static swig_cast_info _swigc__p_HelicsComplex[] = { {&_swigt__p_HelicsComplex, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsCoreFlags[] = { {&_swigt__p_HelicsCoreFlags, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsCoreTypes[] = { {&_swigt__p_HelicsCoreTypes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsDataTypes[] = { {&_swigt__p_HelicsDataTypes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsError[] = { {&_swigt__p_HelicsError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsErrorTypes[] = { {&_swigt__p_HelicsErrorTypes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsFederateFlags[] = { {&_swigt__p_HelicsFederateFlags, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsFederateState[] = { {&_swigt__p_HelicsFederateState, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsFilterTypes[] = { {&_swigt__p_HelicsFilterTypes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsFlags[] = { {&_swigt__p_HelicsFlags, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsHandleOptions[] = { {&_swigt__p_HelicsHandleOptions, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsIterationRequest[] = { {&_swigt__p_HelicsIterationRequest, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsIterationResult[] = { {&_swigt__p_HelicsIterationResult, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsLogLevels[] = { {&_swigt__p_HelicsLogLevels, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsMultiInputModes[] = { {&_swigt__p_HelicsMultiInputModes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsProperties[] = { {&_swigt__p_HelicsProperties, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_HelicsSequencingModes[] = { {&_swigt__p_HelicsSequencingModes, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_double_int_p_void__void[] = { {&_swigt__p_f_double_int_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void[] = { {&_swigt__p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_int__int[] = { {&_swigt__p_f_int__int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int32_t[] = { {&_swigt__p_int32_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_HelicsComplex,
_swigc__p_HelicsCoreFlags,
_swigc__p_HelicsCoreTypes,
_swigc__p_HelicsDataTypes,
_swigc__p_HelicsError,
_swigc__p_HelicsErrorTypes,
_swigc__p_HelicsFederateFlags,
_swigc__p_HelicsFederateState,
_swigc__p_HelicsFilterTypes,
_swigc__p_HelicsFlags,
_swigc__p_HelicsHandleOptions,
_swigc__p_HelicsIterationRequest,
_swigc__p_HelicsIterationResult,
_swigc__p_HelicsLogLevels,
_swigc__p_HelicsMultiInputModes,
_swigc__p_HelicsProperties,
_swigc__p_HelicsSequencingModes,
_swigc__p_char,
_swigc__p_double,
_swigc__p_f_double_int_p_void__void,
_swigc__p_f_enum_HelicsFederateState_enum_HelicsFederateState_p_void__void,
_swigc__p_f_int__int,
_swigc__p_int,
_swigc__p_int32_t,
_swigc__p_p_char,
_swigc__p_void,
};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
/* -----------------------------------------------------------------------------
* Type initialization:
* This problem is tough by the requirement that no dynamic
* memory is used. Also, since swig_type_info structures store pointers to
* swig_cast_info structures and swig_cast_info structures store pointers back
* to swig_type_info structures, we need some lookup code at initialization.
* The idea is that swig generates all the structures that are needed.
* The runtime then collects these partially filled structures.
* The SWIG_InitializeModule function takes these initial arrays out of
* swig_module, and does all the lookup, filling in the swig_module.types
* array with the correct data and linking the correct swig_cast_info
* structures together.
*
* The generated swig_type_info structures are assigned statically to an initial
* array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
* two-dimensional array. Each row corresponds to a type (there are the same
* number of rows as there are in the swig_type_initial array). Each entry in
* a column is one of the swig_cast_info structures for that type.
* The cast_initial array is actually an array of arrays, because each row has
* a variable number of columns. So to actually build the cast linked list,
* we find the array of casts associated with the type, and loop through it
* adding the casts to the list. The one last trick we need to do is making
* sure the type pointer in the swig_cast_info struct is correct.
*
* First off, we lookup the cast->type name to see if it is already loaded.
* There are three cases to handle:
* 1) If the cast->type has already been loaded AND the type we are adding
* casting info to has not been loaded (it is in this module), THEN we
* replace the cast->type pointer with the type pointer that has already
* been loaded.
* 2) If BOTH types (the one we are adding casting info to, and the
* cast->type) are loaded, THEN the cast info has already been loaded by
* the previous module so we just ignore it.
* 3) Finally, if cast->type has not already been loaded, then we add that
* swig_cast_info to the linked list (because the cast->type) pointer will
* be correct.
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif
#if 0
#define SWIGRUNTIME_DEBUG
#endif
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int init;
/* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) {
/* Initialize the swig_module */
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
init = 1;
} else {
init = 0;
}
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
if (!module_head) {
/* This is the first module loaded for this interpreter */
/* so set the swig module into the interpreter */
SWIG_SetModule(clientdata, &swig_module);
} else {
/* the interpreter has loaded a SWIG module, but has it loaded this one? */
iter=module_head;
do {
if (iter==&swig_module) {
/* Our module is already in the list, so there's nothing more to do. */
return;
}
iter=iter->next;
} while (iter!= module_head);
/* otherwise we must add our module into the list */
swig_module.next = module_head->next;
module_head->next = &swig_module;
}
/* When multiple interpreters are used, a module could have already been initialized in
a different interpreter, but not yet have a pointer in this interpreter.
In this case, we do not want to continue adding types... everything should be
set up already */
if (init == 0) return;
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
for (i = 0; i < swig_module.size; ++i) {
swig_type_info *type = 0;
swig_type_info *ret;
swig_cast_info *cast;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
/* if there is another module already loaded */
if (swig_module.next != &swig_module) {
type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
}
if (type) {
/* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
if (swig_module.type_initial[i]->clientdata) {
type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
}
} else {
type = swig_module.type_initial[i];
}
/* Insert casting types */
cast = swig_module.cast_initial[i];
while (cast->type) {
/* Don't need to add information already in the list */
ret = 0;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
if (swig_module.next != &swig_module) {
ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
}
if (ret) {
if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
cast->type = ret;
ret = 0;
} else {
/* Check for casting already in the list */
swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
if (!ocast) ret = 0;
}
}
if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
if (type->cast) {
type->cast->prev = cast;
cast->next = type->cast;
}
type->cast = cast;
}
cast++;
}
/* Set entry in modules->types array equal to the type */
swig_module.types[i] = type;
}
swig_module.types[i] = 0;
#ifdef SWIGRUNTIME_DEBUG
printf("**** SWIG_InitializeModule: Cast List ******\n");
for (i = 0; i < swig_module.size; ++i) {
int j = 0;
swig_cast_info *cast = swig_module.cast_initial[i];
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
while (cast->type) {
printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
cast++;
++j;
}
printf("---- Total casts: %d\n",j);
}
printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}
/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types. It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
size_t i;
swig_cast_info *equiv;
static int init_run = 0;
if (init_run) return;
init_run = 1;
for (i = 0; i < swig_module.size; i++) {
if (swig_module.types[i]->clientdata) {
equiv = swig_module.types[i]->cast;
while (equiv) {
if (!equiv->converter) {
if (equiv->type && !equiv->type->clientdata)
SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
}
equiv = equiv->next;
}
}
}
}
#ifdef __cplusplus
#if 0
{ /* c-mode */
#endif
}
#endif
void SWIG_Matlab_LoadModule() {
/* Only call once */
static int moduleIsLoaded = 0;
if (moduleIsLoaded) return;
moduleIsLoaded = 1;
/* Prevent unloading this file until MATLAB exits */
mexLock();
/* Exit function (called when unloaded) */
mexAtExit(SWIG_Matlab_ExitFcn);
/* Load dependent modules and initialize */
SWIG_InitializeModule(0);
}
SWIGINTERN const char* SwigConstantName(int con_id) {
switch (con_id) {
case 0: return "HELICS_CORE_TYPE_DEFAULT";
case 1: return "HELICS_CORE_TYPE_ZMQ";
case 2: return "HELICS_CORE_TYPE_MPI";
case 3: return "HELICS_CORE_TYPE_TEST";
case 4: return "HELICS_CORE_TYPE_INTERPROCESS";
case 5: return "HELICS_CORE_TYPE_IPC";
case 6: return "HELICS_CORE_TYPE_TCP";
case 7: return "HELICS_CORE_TYPE_UDP";
case 8: return "HELICS_CORE_TYPE_ZMQ_SS";
case 9: return "HELICS_CORE_TYPE_NNG";
case 10: return "HELICS_CORE_TYPE_TCP_SS";
case 11: return "HELICS_CORE_TYPE_HTTP";
case 12: return "HELICS_CORE_TYPE_WEBSOCKET";
case 13: return "HELICS_CORE_TYPE_INPROC";
case 14: return "HELICS_CORE_TYPE_NULL";
case 15: return "HELICS_CORE_TYPE_EMPTY";
case 16: return "HELICS_DATA_TYPE_UNKNOWN";
case 17: return "HELICS_DATA_TYPE_STRING";
case 18: return "HELICS_DATA_TYPE_DOUBLE";
case 19: return "HELICS_DATA_TYPE_INT";
case 20: return "HELICS_DATA_TYPE_COMPLEX";
case 21: return "HELICS_DATA_TYPE_VECTOR";
case 22: return "HELICS_DATA_TYPE_COMPLEX_VECTOR";
case 23: return "HELICS_DATA_TYPE_NAMED_POINT";
case 24: return "HELICS_DATA_TYPE_BOOLEAN";
case 25: return "HELICS_DATA_TYPE_TIME";
case 26: return "HELICS_DATA_TYPE_RAW";
case 27: return "HELICS_DATA_TYPE_JSON";
case 28: return "HELICS_DATA_TYPE_MULTI";
case 29: return "HELICS_DATA_TYPE_ANY";
case 30: return "HELICS_FLAG_OBSERVER";
case 31: return "HELICS_FLAG_UNINTERRUPTIBLE";
case 32: return "HELICS_FLAG_INTERRUPTIBLE";
case 33: return "HELICS_FLAG_SOURCE_ONLY";
case 34: return "HELICS_FLAG_ONLY_TRANSMIT_ON_CHANGE";
case 35: return "HELICS_FLAG_ONLY_UPDATE_ON_CHANGE";
case 36: return "HELICS_FLAG_WAIT_FOR_CURRENT_TIME_UPDATE";
case 37: return "HELICS_FLAG_RESTRICTIVE_TIME_POLICY";
case 38: return "HELICS_FLAG_ROLLBACK";
case 39: return "HELICS_FLAG_FORWARD_COMPUTE";
case 40: return "HELICS_FLAG_REALTIME";
case 41: return "HELICS_FLAG_SINGLE_THREAD_FEDERATE";
case 42: return "HELICS_FLAG_IGNORE_TIME_MISMATCH_WARNINGS";
case 43: return "HELICS_FLAG_STRICT_CONFIG_CHECKING";
case 44: return "HELICS_FLAG_USE_JSON_SERIALIZATION";
case 45: return "HELICS_FLAG_EVENT_TRIGGERED";
case 46: return "HELICS_FLAG_LOCAL_PROFILING_CAPTURE";
case 47: return "HELICS_FLAG_DELAY_INIT_ENTRY";
case 48: return "HELICS_FLAG_ENABLE_INIT_ENTRY";
case 49: return "HELICS_FLAG_IGNORE";
case 50: return "HELICS_FLAG_SLOW_RESPONDING";
case 51: return "HELICS_FLAG_DEBUGGING";
case 52: return "HELICS_FLAG_TERMINATE_ON_ERROR";
case 53: return "HELICS_FLAG_FORCE_LOGGING_FLUSH";
case 54: return "HELICS_FLAG_DUMPLOG";
case 55: return "HELICS_FLAG_PROFILING";
case 56: return "HELICS_FLAG_PROFILING_MARKER";
case 57: return "HELICS_LOG_LEVEL_DUMPLOG";
case 58: return "HELICS_LOG_LEVEL_NO_PRINT";
case 59: return "HELICS_LOG_LEVEL_ERROR";
case 60: return "HELICS_LOG_LEVEL_PROFILING";
case 61: return "HELICS_LOG_LEVEL_WARNING";
case 62: return "HELICS_LOG_LEVEL_SUMMARY";
case 63: return "HELICS_LOG_LEVEL_CONNECTIONS";
case 64: return "HELICS_LOG_LEVEL_INTERFACES";
case 65: return "HELICS_LOG_LEVEL_TIMING";
case 66: return "HELICS_LOG_LEVEL_DATA";
case 67: return "HELICS_LOG_LEVEL_DEBUG";
case 68: return "HELICS_LOG_LEVEL_TRACE";
case 69: return "HELICS_ERROR_FATAL";
case 70: return "HELICS_ERROR_EXTERNAL_TYPE";
case 71: return "HELICS_ERROR_OTHER";
case 72: return "HELICS_USER_EXCEPTION";
case 73: return "HELICS_ERROR_USER_ABORT";
case 74: return "HELICS_ERROR_INSUFFICIENT_SPACE";
case 75: return "HELICS_ERROR_EXECUTION_FAILURE";
case 76: return "HELICS_ERROR_INVALID_FUNCTION_CALL";
case 77: return "HELICS_ERROR_INVALID_STATE_TRANSITION";
case 78: return "HELICS_WARNING";
case 79: return "HELICS_ERROR_SYSTEM_FAILURE";
case 80: return "HELICS_ERROR_DISCARD";
case 81: return "HELICS_ERROR_INVALID_ARGUMENT";
case 82: return "HELICS_ERROR_INVALID_OBJECT";
case 83: return "HELICS_ERROR_CONNECTION_FAILURE";
case 84: return "HELICS_ERROR_REGISTRATION_FAILURE";
case 85: return "HELICS_OK";
case 86: return "HELICS_PROPERTY_TIME_DELTA";
case 87: return "HELICS_PROPERTY_TIME_PERIOD";
case 88: return "HELICS_PROPERTY_TIME_OFFSET";
case 89: return "HELICS_PROPERTY_TIME_RT_LAG";
case 90: return "HELICS_PROPERTY_TIME_RT_LEAD";
case 91: return "HELICS_PROPERTY_TIME_RT_TOLERANCE";
case 92: return "HELICS_PROPERTY_TIME_INPUT_DELAY";
case 93: return "HELICS_PROPERTY_TIME_OUTPUT_DELAY";
case 94: return "HELICS_PROPERTY_TIME_GRANT_TIMEOUT";
case 95: return "HELICS_PROPERTY_INT_MAX_ITERATIONS";
case 96: return "HELICS_PROPERTY_INT_LOG_LEVEL";
case 97: return "HELICS_PROPERTY_INT_FILE_LOG_LEVEL";
case 98: return "HELICS_PROPERTY_INT_CONSOLE_LOG_LEVEL";
case 99: return "HELICS_PROPERTY_INT_LOG_BUFFER";
case 100: return "HELICS_MULTI_INPUT_NO_OP";
case 101: return "HELICS_MULTI_INPUT_VECTORIZE_OPERATION";
case 102: return "HELICS_MULTI_INPUT_AND_OPERATION";
case 103: return "HELICS_MULTI_INPUT_OR_OPERATION";
case 104: return "HELICS_MULTI_INPUT_SUM_OPERATION";
case 105: return "HELICS_MULTI_INPUT_DIFF_OPERATION";
case 106: return "HELICS_MULTI_INPUT_MAX_OPERATION";
case 107: return "HELICS_MULTI_INPUT_MIN_OPERATION";
case 108: return "HELICS_MULTI_INPUT_AVERAGE_OPERATION";
case 109: return "HELICS_HANDLE_OPTION_CONNECTION_REQUIRED";
case 110: return "HELICS_HANDLE_OPTION_CONNECTION_OPTIONAL";
case 111: return "HELICS_HANDLE_OPTION_SINGLE_CONNECTION_ONLY";
case 112: return "HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED";
case 113: return "HELICS_HANDLE_OPTION_BUFFER_DATA";
case 114: return "HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING";
case 115: return "HELICS_HANDLE_OPTION_IGNORE_UNIT_MISMATCH";
case 116: return "HELICS_HANDLE_OPTION_ONLY_TRANSMIT_ON_CHANGE";
case 117: return "HELICS_HANDLE_OPTION_ONLY_UPDATE_ON_CHANGE";
case 118: return "HELICS_HANDLE_OPTION_IGNORE_INTERRUPTS";
case 119: return "HELICS_HANDLE_OPTION_MULTI_INPUT_HANDLING_METHOD";
case 120: return "HELICS_HANDLE_OPTION_INPUT_PRIORITY_LOCATION";
case 121: return "HELICS_HANDLE_OPTION_CLEAR_PRIORITY_LIST";
case 122: return "HELICS_HANDLE_OPTION_CONNECTIONS";
case 123: return "HELICS_FILTER_TYPE_CUSTOM";
case 124: return "HELICS_FILTER_TYPE_DELAY";
case 125: return "HELICS_FILTER_TYPE_RANDOM_DELAY";
case 126: return "HELICS_FILTER_TYPE_RANDOM_DROP";
case 127: return "HELICS_FILTER_TYPE_REROUTE";
case 128: return "HELICS_FILTER_TYPE_CLONE";
case 129: return "HELICS_FILTER_TYPE_FIREWALL";
case 130: return "HELICS_SEQUENCING_MODE_FAST";
case 131: return "HELICS_SEQUENCING_MODE_ORDERED";
case 132: return "HELICS_SEQUENCING_MODE_DEFAULT";
case 133: return "HELICS_BIG_NUMBER";
case 134: return "HELICS_ITERATION_REQUEST_NO_ITERATION";
case 135: return "HELICS_ITERATION_REQUEST_FORCE_ITERATION";
case 136: return "HELICS_ITERATION_REQUEST_ITERATE_IF_NEEDED";
case 137: return "HELICS_ITERATION_RESULT_NEXT_STEP";
case 138: return "HELICS_ITERATION_RESULT_ERROR";
case 139: return "HELICS_ITERATION_RESULT_HALTED";
case 140: return "HELICS_ITERATION_RESULT_ITERATING";
case 141: return "HELICS_STATE_STARTUP";
case 142: return "HELICS_STATE_INITIALIZATION";
case 143: return "HELICS_STATE_EXECUTION";
case 144: return "HELICS_STATE_FINALIZE";
case 145: return "HELICS_STATE_ERROR";
case 146: return "HELICS_STATE_PENDING_INIT";
case 147: return "HELICS_STATE_PENDING_EXEC";
case 148: return "HELICS_STATE_PENDING_TIME";
case 149: return "HELICS_STATE_PENDING_ITERATIVE_TIME";
case 150: return "HELICS_STATE_PENDING_FINALIZE";
case 151: return "HELICS_STATE_FINISHED";
default: return 0;
}
}
SWIGINTERN int swigConstantName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
if (argc!=1 || !mxIsDouble(*argv) || mxGetNumberOfElements(*argv)!=1) {
SWIG_Error(SWIG_RuntimeError, "This mex file should only be called from inside the .m files generated by SWIG. The input should be the constant ID.");
return 1;
}
if (resc!=1) {
SWIG_Error(SWIG_RuntimeError, "The function should have one output.");
return 1;
}
int con_id = (int)mxGetScalar(*argv);
const char* s = SwigConstantName(con_id);
if (s==0) {
SWIG_Error(SWIG_RuntimeError, "No such constant ID.");
return 1;
}
*resv = mxCreateString(s);
return 0;
}
SWIGINTERN int swigConstant(int SWIGUNUSEDPARM(resc), mxArray *resv[], int argc, mxArray *argv[]) {
if (--argc < 0 || !mxIsDouble(*argv) || mxGetNumberOfElements(*argv)!=1) {
SWIG_Error(SWIG_RuntimeError, "This function should only be called from inside the .m files generated by SWIG. First input should be the constant ID .");
return 1;
}
int con_id = (int)mxGetScalar(*argv++);
switch (con_id) {
case 0: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_DEFAULT",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_DEFAULT)));; break;
case 1: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_ZMQ)));; break;
case 2: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_MPI",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_MPI)));; break;
case 3: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TEST",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_TEST)));; break;
case 4: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INTERPROCESS",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_INTERPROCESS)));; break;
case 5: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_IPC",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_IPC)));; break;
case 6: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_TCP)));; break;
case 7: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_UDP",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_UDP)));; break;
case 8: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_ZMQ_SS",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_ZMQ_SS)));; break;
case 9: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_NNG",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_NNG)));; break;
case 10: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_TCP_SS",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_TCP_SS)));; break;
case 11: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_HTTP",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_HTTP)));; break;
case 12: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_WEBSOCKET",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_WEBSOCKET)));; break;
case 13: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_INPROC",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_INPROC)));; break;
case 14: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_NULL",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_NULL)));; break;
case 15: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_CORE_TYPE_EMPTY",SWIG_From_int(static_cast< int >(HELICS_CORE_TYPE_EMPTY)));; break;
case 16: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_UNKNOWN",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_UNKNOWN)));; break;
case 17: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_STRING",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_STRING)));; break;
case 18: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_DOUBLE",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_DOUBLE)));; break;
case 19: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_INT",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_INT)));; break;
case 20: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_COMPLEX)));; break;
case 21: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_VECTOR",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_VECTOR)));; break;
case 22: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_COMPLEX_VECTOR",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_COMPLEX_VECTOR)));; break;
case 23: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_NAMED_POINT",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_NAMED_POINT)));; break;
case 24: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_BOOLEAN",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_BOOLEAN)));; break;
case 25: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_TIME",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_TIME)));; break;
case 26: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_RAW",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_RAW)));; break;
case 27: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_JSON",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_JSON)));; break;
case 28: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_MULTI",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_MULTI)));; break;
case 29: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_DATA_TYPE_ANY",SWIG_From_int(static_cast< int >(HELICS_DATA_TYPE_ANY)));; break;
case 30: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_OBSERVER",SWIG_From_int(static_cast< int >(HELICS_FLAG_OBSERVER)));; break;
case 31: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_UNINTERRUPTIBLE",SWIG_From_int(static_cast< int >(HELICS_FLAG_UNINTERRUPTIBLE)));; break;
case 32: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_INTERRUPTIBLE",SWIG_From_int(static_cast< int >(HELICS_FLAG_INTERRUPTIBLE)));; break;
case 33: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_SOURCE_ONLY",SWIG_From_int(static_cast< int >(HELICS_FLAG_SOURCE_ONLY)));; break;
case 34: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_ONLY_TRANSMIT_ON_CHANGE",SWIG_From_int(static_cast< int >(HELICS_FLAG_ONLY_TRANSMIT_ON_CHANGE)));; break;
case 35: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_ONLY_UPDATE_ON_CHANGE",SWIG_From_int(static_cast< int >(HELICS_FLAG_ONLY_UPDATE_ON_CHANGE)));; break;
case 36: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_WAIT_FOR_CURRENT_TIME_UPDATE",SWIG_From_int(static_cast< int >(HELICS_FLAG_WAIT_FOR_CURRENT_TIME_UPDATE)));; break;
case 37: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_RESTRICTIVE_TIME_POLICY",SWIG_From_int(static_cast< int >(HELICS_FLAG_RESTRICTIVE_TIME_POLICY)));; break;
case 38: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_ROLLBACK",SWIG_From_int(static_cast< int >(HELICS_FLAG_ROLLBACK)));; break;
case 39: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_FORWARD_COMPUTE",SWIG_From_int(static_cast< int >(HELICS_FLAG_FORWARD_COMPUTE)));; break;
case 40: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_REALTIME",SWIG_From_int(static_cast< int >(HELICS_FLAG_REALTIME)));; break;
case 41: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_SINGLE_THREAD_FEDERATE",SWIG_From_int(static_cast< int >(HELICS_FLAG_SINGLE_THREAD_FEDERATE)));; break;
case 42: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_IGNORE_TIME_MISMATCH_WARNINGS",SWIG_From_int(static_cast< int >(HELICS_FLAG_IGNORE_TIME_MISMATCH_WARNINGS)));; break;
case 43: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_STRICT_CONFIG_CHECKING",SWIG_From_int(static_cast< int >(HELICS_FLAG_STRICT_CONFIG_CHECKING)));; break;
case 44: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_USE_JSON_SERIALIZATION",SWIG_From_int(static_cast< int >(HELICS_FLAG_USE_JSON_SERIALIZATION)));; break;
case 45: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_EVENT_TRIGGERED",SWIG_From_int(static_cast< int >(HELICS_FLAG_EVENT_TRIGGERED)));; break;
case 46: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_LOCAL_PROFILING_CAPTURE",SWIG_From_int(static_cast< int >(HELICS_FLAG_LOCAL_PROFILING_CAPTURE)));; break;
case 47: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_DELAY_INIT_ENTRY",SWIG_From_int(static_cast< int >(HELICS_FLAG_DELAY_INIT_ENTRY)));; break;
case 48: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_ENABLE_INIT_ENTRY",SWIG_From_int(static_cast< int >(HELICS_FLAG_ENABLE_INIT_ENTRY)));; break;
case 49: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_IGNORE",SWIG_From_int(static_cast< int >(HELICS_FLAG_IGNORE)));; break;
case 50: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_SLOW_RESPONDING",SWIG_From_int(static_cast< int >(HELICS_FLAG_SLOW_RESPONDING)));; break;
case 51: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_DEBUGGING",SWIG_From_int(static_cast< int >(HELICS_FLAG_DEBUGGING)));; break;
case 52: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_TERMINATE_ON_ERROR",SWIG_From_int(static_cast< int >(HELICS_FLAG_TERMINATE_ON_ERROR)));; break;
case 53: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_FORCE_LOGGING_FLUSH",SWIG_From_int(static_cast< int >(HELICS_FLAG_FORCE_LOGGING_FLUSH)));; break;
case 54: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_DUMPLOG",SWIG_From_int(static_cast< int >(HELICS_FLAG_DUMPLOG)));; break;
case 55: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_PROFILING",SWIG_From_int(static_cast< int >(HELICS_FLAG_PROFILING)));; break;
case 56: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FLAG_PROFILING_MARKER",SWIG_From_int(static_cast< int >(HELICS_FLAG_PROFILING_MARKER)));; break;
case 57: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_DUMPLOG",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_DUMPLOG)));; break;
case 58: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_NO_PRINT",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_NO_PRINT)));; break;
case 59: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_ERROR",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_ERROR)));; break;
case 60: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_PROFILING",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_PROFILING)));; break;
case 61: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_WARNING",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_WARNING)));; break;
case 62: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_SUMMARY",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_SUMMARY)));; break;
case 63: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_CONNECTIONS",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_CONNECTIONS)));; break;
case 64: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_INTERFACES",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_INTERFACES)));; break;
case 65: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_TIMING",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_TIMING)));; break;
case 66: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_DATA",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_DATA)));; break;
case 67: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_DEBUG",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_DEBUG)));; break;
case 68: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_LOG_LEVEL_TRACE",SWIG_From_int(static_cast< int >(HELICS_LOG_LEVEL_TRACE)));; break;
case 69: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_FATAL",SWIG_From_int(static_cast< int >(HELICS_ERROR_FATAL)));; break;
case 70: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_EXTERNAL_TYPE",SWIG_From_int(static_cast< int >(HELICS_ERROR_EXTERNAL_TYPE)));; break;
case 71: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_OTHER",SWIG_From_int(static_cast< int >(HELICS_ERROR_OTHER)));; break;
case 72: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_USER_EXCEPTION",SWIG_From_int(static_cast< int >(HELICS_USER_EXCEPTION)));; break;
case 73: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_USER_ABORT",SWIG_From_int(static_cast< int >(HELICS_ERROR_USER_ABORT)));; break;
case 74: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_INSUFFICIENT_SPACE",SWIG_From_int(static_cast< int >(HELICS_ERROR_INSUFFICIENT_SPACE)));; break;
case 75: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_EXECUTION_FAILURE",SWIG_From_int(static_cast< int >(HELICS_ERROR_EXECUTION_FAILURE)));; break;
case 76: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_INVALID_FUNCTION_CALL",SWIG_From_int(static_cast< int >(HELICS_ERROR_INVALID_FUNCTION_CALL)));; break;
case 77: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_INVALID_STATE_TRANSITION",SWIG_From_int(static_cast< int >(HELICS_ERROR_INVALID_STATE_TRANSITION)));; break;
case 78: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_WARNING",SWIG_From_int(static_cast< int >(HELICS_WARNING)));; break;
case 79: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_SYSTEM_FAILURE",SWIG_From_int(static_cast< int >(HELICS_ERROR_SYSTEM_FAILURE)));; break;
case 80: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_DISCARD",SWIG_From_int(static_cast< int >(HELICS_ERROR_DISCARD)));; break;
case 81: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_INVALID_ARGUMENT",SWIG_From_int(static_cast< int >(HELICS_ERROR_INVALID_ARGUMENT)));; break;
case 82: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_INVALID_OBJECT",SWIG_From_int(static_cast< int >(HELICS_ERROR_INVALID_OBJECT)));; break;
case 83: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_CONNECTION_FAILURE",SWIG_From_int(static_cast< int >(HELICS_ERROR_CONNECTION_FAILURE)));; break;
case 84: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ERROR_REGISTRATION_FAILURE",SWIG_From_int(static_cast< int >(HELICS_ERROR_REGISTRATION_FAILURE)));; break;
case 85: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_OK",SWIG_From_int(static_cast< int >(HELICS_OK)));; break;
case 86: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_DELTA",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_DELTA)));; break;
case 87: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_PERIOD",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_PERIOD)));; break;
case 88: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_OFFSET",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_OFFSET)));; break;
case 89: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_RT_LAG",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_RT_LAG)));; break;
case 90: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_RT_LEAD",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_RT_LEAD)));; break;
case 91: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_RT_TOLERANCE",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_RT_TOLERANCE)));; break;
case 92: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_INPUT_DELAY",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_INPUT_DELAY)));; break;
case 93: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_OUTPUT_DELAY",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_OUTPUT_DELAY)));; break;
case 94: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_TIME_GRANT_TIMEOUT",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_TIME_GRANT_TIMEOUT)));; break;
case 95: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_INT_MAX_ITERATIONS",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_INT_MAX_ITERATIONS)));; break;
case 96: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_INT_LOG_LEVEL",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_INT_LOG_LEVEL)));; break;
case 97: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_INT_FILE_LOG_LEVEL",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_INT_FILE_LOG_LEVEL)));; break;
case 98: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_INT_CONSOLE_LOG_LEVEL",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_INT_CONSOLE_LOG_LEVEL)));; break;
case 99: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_PROPERTY_INT_LOG_BUFFER",SWIG_From_int(static_cast< int >(HELICS_PROPERTY_INT_LOG_BUFFER)));; break;
case 100: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_NO_OP",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_NO_OP)));; break;
case 101: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_VECTORIZE_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_VECTORIZE_OPERATION)));; break;
case 102: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_AND_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_AND_OPERATION)));; break;
case 103: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_OR_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_OR_OPERATION)));; break;
case 104: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_SUM_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_SUM_OPERATION)));; break;
case 105: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_DIFF_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_DIFF_OPERATION)));; break;
case 106: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_MAX_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_MAX_OPERATION)));; break;
case 107: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_MIN_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_MIN_OPERATION)));; break;
case 108: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_MULTI_INPUT_AVERAGE_OPERATION",SWIG_From_int(static_cast< int >(HELICS_MULTI_INPUT_AVERAGE_OPERATION)));; break;
case 109: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_CONNECTION_REQUIRED",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_CONNECTION_REQUIRED)));; break;
case 110: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_CONNECTION_OPTIONAL",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_CONNECTION_OPTIONAL)));; break;
case 111: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_SINGLE_CONNECTION_ONLY",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_SINGLE_CONNECTION_ONLY)));; break;
case 112: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_MULTIPLE_CONNECTIONS_ALLOWED)));; break;
case 113: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_BUFFER_DATA",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_BUFFER_DATA)));; break;
case 114: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_STRICT_TYPE_CHECKING)));; break;
case 115: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_IGNORE_UNIT_MISMATCH",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_IGNORE_UNIT_MISMATCH)));; break;
case 116: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_ONLY_TRANSMIT_ON_CHANGE",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_ONLY_TRANSMIT_ON_CHANGE)));; break;
case 117: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_ONLY_UPDATE_ON_CHANGE",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_ONLY_UPDATE_ON_CHANGE)));; break;
case 118: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_IGNORE_INTERRUPTS",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_IGNORE_INTERRUPTS)));; break;
case 119: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_MULTI_INPUT_HANDLING_METHOD",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_MULTI_INPUT_HANDLING_METHOD)));; break;
case 120: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_INPUT_PRIORITY_LOCATION",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_INPUT_PRIORITY_LOCATION)));; break;
case 121: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_CLEAR_PRIORITY_LIST",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_CLEAR_PRIORITY_LIST)));; break;
case 122: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_HANDLE_OPTION_CONNECTIONS",SWIG_From_int(static_cast< int >(HELICS_HANDLE_OPTION_CONNECTIONS)));; break;
case 123: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_CUSTOM",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_CUSTOM)));; break;
case 124: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_DELAY",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_DELAY)));; break;
case 125: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_RANDOM_DELAY",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_RANDOM_DELAY)));; break;
case 126: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_RANDOM_DROP",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_RANDOM_DROP)));; break;
case 127: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_REROUTE",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_REROUTE)));; break;
case 128: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_CLONE",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_CLONE)));; break;
case 129: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_FILTER_TYPE_FIREWALL",SWIG_From_int(static_cast< int >(HELICS_FILTER_TYPE_FIREWALL)));; break;
case 130: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_SEQUENCING_MODE_FAST",SWIG_From_int(static_cast< int >(HELICS_SEQUENCING_MODE_FAST)));; break;
case 131: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_SEQUENCING_MODE_ORDERED",SWIG_From_int(static_cast< int >(HELICS_SEQUENCING_MODE_ORDERED)));; break;
case 132: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_SEQUENCING_MODE_DEFAULT",SWIG_From_int(static_cast< int >(HELICS_SEQUENCING_MODE_DEFAULT)));; break;
case 133: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_BIG_NUMBER",SWIG_From_double(static_cast< double >(9223372036.854774)));; break;
case 134: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_REQUEST_NO_ITERATION",SWIG_From_int(static_cast< int >(HELICS_ITERATION_REQUEST_NO_ITERATION)));; break;
case 135: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_REQUEST_FORCE_ITERATION",SWIG_From_int(static_cast< int >(HELICS_ITERATION_REQUEST_FORCE_ITERATION)));; break;
case 136: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_REQUEST_ITERATE_IF_NEEDED",SWIG_From_int(static_cast< int >(HELICS_ITERATION_REQUEST_ITERATE_IF_NEEDED)));; break;
case 137: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_RESULT_NEXT_STEP",SWIG_From_int(static_cast< int >(HELICS_ITERATION_RESULT_NEXT_STEP)));; break;
case 138: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_RESULT_ERROR",SWIG_From_int(static_cast< int >(HELICS_ITERATION_RESULT_ERROR)));; break;
case 139: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_RESULT_HALTED",SWIG_From_int(static_cast< int >(HELICS_ITERATION_RESULT_HALTED)));; break;
case 140: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_ITERATION_RESULT_ITERATING",SWIG_From_int(static_cast< int >(HELICS_ITERATION_RESULT_ITERATING)));; break;
case 141: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_STARTUP",SWIG_From_int(static_cast< int >(HELICS_STATE_STARTUP)));; break;
case 142: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_INITIALIZATION",SWIG_From_int(static_cast< int >(HELICS_STATE_INITIALIZATION)));; break;
case 143: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_EXECUTION",SWIG_From_int(static_cast< int >(HELICS_STATE_EXECUTION)));; break;
case 144: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_FINALIZE",SWIG_From_int(static_cast< int >(HELICS_STATE_FINALIZE)));; break;
case 145: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_ERROR",SWIG_From_int(static_cast< int >(HELICS_STATE_ERROR)));; break;
case 146: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_PENDING_INIT",SWIG_From_int(static_cast< int >(HELICS_STATE_PENDING_INIT)));; break;
case 147: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_PENDING_EXEC",SWIG_From_int(static_cast< int >(HELICS_STATE_PENDING_EXEC)));; break;
case 148: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_PENDING_TIME",SWIG_From_int(static_cast< int >(HELICS_STATE_PENDING_TIME)));; break;
case 149: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_PENDING_ITERATIVE_TIME",SWIG_From_int(static_cast< int >(HELICS_STATE_PENDING_ITERATIVE_TIME)));; break;
case 150: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_PENDING_FINALIZE",SWIG_From_int(static_cast< int >(HELICS_STATE_PENDING_FINALIZE)));; break;
case 151: *resv = SWIG_Matlab_SetConstant(module_ns,"HELICS_STATE_FINISHED",SWIG_From_int(static_cast< int >(HELICS_STATE_FINISHED)));; break;
default:
SWIG_Error(SWIG_RuntimeError, "No such constant.");
return 1;
}
return 0;
}
SWIGINTERN const char* SwigFunctionName(int fcn_id) {
switch(fcn_id) {
case 0: return "swigConstant";
case 1: return "swigFunctionName";
case 2: return "swigConstantName";
case 3: return "swigThis";
case 4: return "swigTouch";
case 5: return "HELICS_INVALID_OPTION_INDEX_get";
case 6: return "HELICS_INVALID_PROPERTY_VALUE_get";
case 7: return "cHelicsBigNumber_get";
case 8: return "HELICS_TIME_ZERO_get";
case 9: return "HELICS_TIME_EPSILON_get";
case 10: return "HELICS_TIME_INVALID_get";
case 11: return "HELICS_TIME_MAXTIME_get";
case 12: return "HELICS_TRUE_get";
case 13: return "HELICS_FALSE_get";
case 14: return "HelicsComplex_real_get";
case 15: return "HelicsComplex_real_set";
case 16: return "HelicsComplex_imag_get";
case 17: return "HelicsComplex_imag_set";
case 18: return "new_HelicsComplex";
case 19: return "delete_HelicsComplex";
case 20: return "_wrap_helicsGetVersion";
case 21: return "_wrap_helicsGetBuildFlags";
case 22: return "_wrap_helicsGetCompilerVersion";
case 23: return "_wrap_helicsGetSystemInfo";
case 24: return "_wrap_helicsLoadSignalHandler";
case 25: return "_wrap_helicsLoadThreadedSignalHandler";
case 26: return "_wrap_helicsClearSignalHandler";
case 27: return "_wrap_helicsLoadSignalHandlerCallbackNoExit";
case 28: return "_wrap_helicsAbort";
case 29: return "_wrap_helicsIsCoreTypeAvailable";
case 30: return "_wrap_helicsCreateCore";
case 31: return "_wrap_helicsCreateCoreFromArgs";
case 32: return "_wrap_helicsCoreClone";
case 33: return "_wrap_helicsCoreIsValid";
case 34: return "_wrap_helicsCreateBroker";
case 35: return "_wrap_helicsCreateBrokerFromArgs";
case 36: return "_wrap_helicsBrokerClone";
case 37: return "_wrap_helicsBrokerIsValid";
case 38: return "_wrap_helicsBrokerIsConnected";
case 39: return "_wrap_helicsBrokerDataLink";
case 40: return "_wrap_helicsBrokerAddSourceFilterToEndpoint";
case 41: return "_wrap_helicsBrokerAddDestinationFilterToEndpoint";
case 42: return "_wrap_helicsBrokerMakeConnections";
case 43: return "_wrap_helicsCoreWaitForDisconnect";
case 44: return "_wrap_helicsBrokerWaitForDisconnect";
case 45: return "_wrap_helicsCoreIsConnected";
case 46: return "_wrap_helicsCoreDataLink";
case 47: return "_wrap_helicsCoreAddSourceFilterToEndpoint";
case 48: return "_wrap_helicsCoreAddDestinationFilterToEndpoint";
case 49: return "_wrap_helicsCoreMakeConnections";
case 50: return "_wrap_helicsBrokerGetIdentifier";
case 51: return "_wrap_helicsCoreGetIdentifier";
case 52: return "_wrap_helicsBrokerGetAddress";
case 53: return "_wrap_helicsCoreGetAddress";
case 54: return "_wrap_helicsCoreSetReadyToInit";
case 55: return "_wrap_helicsCoreConnect";
case 56: return "_wrap_helicsCoreDisconnect";
case 57: return "_wrap_helicsGetFederateByName";
case 58: return "_wrap_helicsBrokerDisconnect";
case 59: return "_wrap_helicsFederateDestroy";
case 60: return "_wrap_helicsBrokerDestroy";
case 61: return "_wrap_helicsCoreDestroy";
case 62: return "_wrap_helicsCoreFree";
case 63: return "_wrap_helicsBrokerFree";
case 64: return "_wrap_helicsCreateValueFederate";
case 65: return "_wrap_helicsCreateValueFederateFromConfig";
case 66: return "_wrap_helicsCreateMessageFederate";
case 67: return "_wrap_helicsCreateMessageFederateFromConfig";
case 68: return "_wrap_helicsCreateCombinationFederate";
case 69: return "_wrap_helicsCreateCombinationFederateFromConfig";
case 70: return "_wrap_helicsFederateClone";
case 71: return "_wrap_helicsCreateFederateInfo";
case 72: return "_wrap_helicsFederateInfoClone";
case 73: return "_wrap_helicsFederateInfoLoadFromArgs";
case 74: return "_wrap_helicsFederateInfoLoadFromString";
case 75: return "_wrap_helicsFederateInfoFree";
case 76: return "_wrap_helicsFederateIsValid";
case 77: return "_wrap_helicsFederateInfoSetCoreName";
case 78: return "_wrap_helicsFederateInfoSetCoreInitString";
case 79: return "_wrap_helicsFederateInfoSetBrokerInitString";
case 80: return "_wrap_helicsFederateInfoSetCoreType";
case 81: return "_wrap_helicsFederateInfoSetCoreTypeFromString";
case 82: return "_wrap_helicsFederateInfoSetBroker";
case 83: return "_wrap_helicsFederateInfoSetBrokerKey";
case 84: return "_wrap_helicsFederateInfoSetBrokerPort";
case 85: return "_wrap_helicsFederateInfoSetLocalPort";
case 86: return "_wrap_helicsGetPropertyIndex";
case 87: return "_wrap_helicsGetFlagIndex";
case 88: return "_wrap_helicsGetOptionIndex";
case 89: return "_wrap_helicsGetOptionValue";
case 90: return "_wrap_helicsGetDataType";
case 91: return "_wrap_helicsFederateInfoSetFlagOption";
case 92: return "_wrap_helicsFederateInfoSetSeparator";
case 93: return "_wrap_helicsFederateInfoSetTimeProperty";
case 94: return "_wrap_helicsFederateInfoSetIntegerProperty";
case 95: return "_wrap_helicsFederateRegisterInterfaces";
case 96: return "_wrap_helicsFederateGlobalError";
case 97: return "_wrap_helicsFederateLocalError";
case 98: return "_wrap_helicsFederateFinalize";
case 99: return "_wrap_helicsFederateFinalizeAsync";
case 100: return "_wrap_helicsFederateFinalizeComplete";
case 101: return "_wrap_helicsFederateDisconnect";
case 102: return "_wrap_helicsFederateDisconnectAsync";
case 103: return "_wrap_helicsFederateDisconnectComplete";
case 104: return "_wrap_helicsFederateFree";
case 105: return "_wrap_helicsCloseLibrary";
case 106: return "_wrap_helicsFederateEnterInitializingMode";
case 107: return "_wrap_helicsFederateEnterInitializingModeAsync";
case 108: return "_wrap_helicsFederateIsAsyncOperationCompleted";
case 109: return "_wrap_helicsFederateEnterInitializingModeComplete";
case 110: return "_wrap_helicsFederateEnterExecutingMode";
case 111: return "_wrap_helicsFederateEnterExecutingModeAsync";
case 112: return "_wrap_helicsFederateEnterExecutingModeComplete";
case 113: return "_wrap_helicsFederateEnterExecutingModeIterative";
case 114: return "_wrap_helicsFederateEnterExecutingModeIterativeAsync";
case 115: return "_wrap_helicsFederateEnterExecutingModeIterativeComplete";
case 116: return "_wrap_helicsFederateGetState";
case 117: return "_wrap_helicsFederateGetCore";
case 118: return "_wrap_helicsFederateRequestTime";
case 119: return "_wrap_helicsFederateRequestTimeAdvance";
case 120: return "_wrap_helicsFederateRequestNextStep";
case 121: return "_wrap_helicsFederateRequestTimeIterative";
case 122: return "_wrap_helicsFederateRequestTimeAsync";
case 123: return "_wrap_helicsFederateRequestTimeComplete";
case 124: return "_wrap_helicsFederateRequestTimeIterativeAsync";
case 125: return "_wrap_helicsFederateRequestTimeIterativeComplete";
case 126: return "_wrap_helicsFederateProcessCommunications";
case 127: return "_wrap_helicsFederateGetName";
case 128: return "_wrap_helicsFederateSetTimeProperty";
case 129: return "_wrap_helicsFederateSetFlagOption";
case 130: return "_wrap_helicsFederateSetSeparator";
case 131: return "_wrap_helicsFederateSetIntegerProperty";
case 132: return "_wrap_helicsFederateGetTimeProperty";
case 133: return "_wrap_helicsFederateGetFlagOption";
case 134: return "_wrap_helicsFederateGetIntegerProperty";
case 135: return "_wrap_helicsFederateGetCurrentTime";
case 136: return "_wrap_helicsFederateSetGlobal";
case 137: return "_wrap_helicsFederateSetTag";
case 138: return "_wrap_helicsFederateGetTag";
case 139: return "_wrap_helicsFederateAddDependency";
case 140: return "_wrap_helicsFederateSetLogFile";
case 141: return "_wrap_helicsFederateLogErrorMessage";
case 142: return "_wrap_helicsFederateLogWarningMessage";
case 143: return "_wrap_helicsFederateLogInfoMessage";
case 144: return "_wrap_helicsFederateLogDebugMessage";
case 145: return "_wrap_helicsFederateLogLevelMessage";
case 146: return "_wrap_helicsFederateSendCommand";
case 147: return "_wrap_helicsFederateGetCommand";
case 148: return "_wrap_helicsFederateGetCommandSource";
case 149: return "_wrap_helicsFederateWaitCommand";
case 150: return "_wrap_helicsCoreSetGlobal";
case 151: return "_wrap_helicsBrokerSetGlobal";
case 152: return "_wrap_helicsCoreSendCommand";
case 153: return "_wrap_helicsBrokerSendCommand";
case 154: return "_wrap_helicsCoreSetLogFile";
case 155: return "_wrap_helicsBrokerSetLogFile";
case 156: return "_wrap_helicsBrokerSetTimeBarrier";
case 157: return "_wrap_helicsBrokerClearTimeBarrier";
case 158: return "_wrap_helicsBrokerGlobalError";
case 159: return "_wrap_helicsCoreGlobalError";
case 160: return "_wrap_helicsCreateQuery";
case 161: return "_wrap_helicsQueryExecute";
case 162: return "_wrap_helicsQueryCoreExecute";
case 163: return "_wrap_helicsQueryBrokerExecute";
case 164: return "_wrap_helicsQueryExecuteAsync";
case 165: return "_wrap_helicsQueryExecuteComplete";
case 166: return "_wrap_helicsQueryIsCompleted";
case 167: return "_wrap_helicsQuerySetTarget";
case 168: return "_wrap_helicsQuerySetQueryString";
case 169: return "_wrap_helicsQuerySetOrdering";
case 170: return "_wrap_helicsQueryFree";
case 171: return "_wrap_helicsCleanupLibrary";
case 172: return "_wrap_helicsFederateRegisterSubscription";
case 173: return "_wrap_helicsFederateRegisterPublication";
case 174: return "_wrap_helicsFederateRegisterTypePublication";
case 175: return "_wrap_helicsFederateRegisterGlobalPublication";
case 176: return "_wrap_helicsFederateRegisterGlobalTypePublication";
case 177: return "_wrap_helicsFederateRegisterInput";
case 178: return "_wrap_helicsFederateRegisterTypeInput";
case 179: return "_wrap_helicsFederateRegisterGlobalInput";
case 180: return "_wrap_helicsFederateRegisterGlobalTypeInput";
case 181: return "_wrap_helicsFederateGetPublication";
case 182: return "_wrap_helicsFederateGetPublicationByIndex";
case 183: return "_wrap_helicsFederateGetInput";
case 184: return "_wrap_helicsFederateGetInputByIndex";
case 185: return "_wrap_helicsFederateGetSubscription";
case 186: return "_wrap_helicsFederateClearUpdates";
case 187: return "_wrap_helicsFederateRegisterFromPublicationJSON";
case 188: return "_wrap_helicsFederatePublishJSON";
case 189: return "_wrap_helicsPublicationIsValid";
case 190: return "_wrap_helicsPublicationPublishBytes";
case 191: return "_wrap_helicsPublicationPublishString";
case 192: return "_wrap_helicsPublicationPublishInteger";
case 193: return "_wrap_helicsPublicationPublishBoolean";
case 194: return "_wrap_helicsPublicationPublishDouble";
case 195: return "_wrap_helicsPublicationPublishTime";
case 196: return "_wrap_helicsPublicationPublishChar";
case 197: return "_wrap_helicsPublicationPublishComplex";
case 198: return "_wrap_helicsPublicationPublishVector";
case 199: return "_wrap_helicsPublicationPublishComplexVector";
case 200: return "_wrap_helicsPublicationPublishNamedPoint";
case 201: return "_wrap_helicsPublicationAddTarget";
case 202: return "_wrap_helicsInputIsValid";
case 203: return "_wrap_helicsInputAddTarget";
case 204: return "_wrap_helicsInputGetByteCount";
case 205: return "_wrap_helicsInputGetBytes";
case 206: return "_wrap_helicsInputGetStringSize";
case 207: return "_wrap_helicsInputGetString";
case 208: return "_wrap_helicsInputGetInteger";
case 209: return "_wrap_helicsInputGetBoolean";
case 210: return "_wrap_helicsInputGetDouble";
case 211: return "_wrap_helicsInputGetTime";
case 212: return "_wrap_helicsInputGetChar";
case 213: return "_wrap_helicsInputGetComplex";
case 214: return "_wrap_helicsInputGetVectorSize";
case 215: return "_wrap_helicsInputGetVector";
case 216: return "_wrap_helicsInputGetComplexVector";
case 217: return "_wrap_helicsInputGetNamedPoint";
case 218: return "_wrap_helicsInputSetDefaultBytes";
case 219: return "_wrap_helicsInputSetDefaultString";
case 220: return "_wrap_helicsInputSetDefaultInteger";
case 221: return "_wrap_helicsInputSetDefaultBoolean";
case 222: return "_wrap_helicsInputSetDefaultTime";
case 223: return "_wrap_helicsInputSetDefaultChar";
case 224: return "_wrap_helicsInputSetDefaultDouble";
case 225: return "_wrap_helicsInputSetDefaultComplex";
case 226: return "_wrap_helicsInputSetDefaultVector";
case 227: return "_wrap_helicsInputSetDefaultComplexVector";
case 228: return "_wrap_helicsInputSetDefaultNamedPoint";
case 229: return "_wrap_helicsInputGetType";
case 230: return "_wrap_helicsInputGetPublicationType";
case 231: return "_wrap_helicsInputGetPublicationDataType";
case 232: return "_wrap_helicsPublicationGetType";
case 233: return "_wrap_helicsInputGetName";
case 234: return "_wrap_helicsSubscriptionGetTarget";
case 235: return "_wrap_helicsPublicationGetName";
case 236: return "_wrap_helicsInputGetUnits";
case 237: return "_wrap_helicsInputGetInjectionUnits";
case 238: return "_wrap_helicsInputGetExtractionUnits";
case 239: return "_wrap_helicsPublicationGetUnits";
case 240: return "_wrap_helicsInputGetInfo";
case 241: return "_wrap_helicsInputSetInfo";
case 242: return "_wrap_helicsInputGetTag";
case 243: return "_wrap_helicsInputSetTag";
case 244: return "_wrap_helicsPublicationGetInfo";
case 245: return "_wrap_helicsPublicationSetInfo";
case 246: return "_wrap_helicsPublicationGetTag";
case 247: return "_wrap_helicsPublicationSetTag";
case 248: return "_wrap_helicsInputGetOption";
case 249: return "_wrap_helicsInputSetOption";
case 250: return "_wrap_helicsPublicationGetOption";
case 251: return "_wrap_helicsPublicationSetOption";
case 252: return "_wrap_helicsPublicationSetMinimumChange";
case 253: return "_wrap_helicsInputSetMinimumChange";
case 254: return "_wrap_helicsInputIsUpdated";
case 255: return "_wrap_helicsInputLastUpdateTime";
case 256: return "_wrap_helicsInputClearUpdate";
case 257: return "_wrap_helicsFederateGetPublicationCount";
case 258: return "_wrap_helicsFederateGetInputCount";
case 259: return "_wrap_helicsFederateRegisterEndpoint";
case 260: return "_wrap_helicsFederateRegisterGlobalEndpoint";
case 261: return "_wrap_helicsFederateRegisterTargetedEndpoint";
case 262: return "_wrap_helicsFederateRegisterGlobalTargetedEndpoint";
case 263: return "_wrap_helicsFederateGetEndpoint";
case 264: return "_wrap_helicsFederateGetEndpointByIndex";
case 265: return "_wrap_helicsEndpointIsValid";
case 266: return "_wrap_helicsEndpointSetDefaultDestination";
case 267: return "_wrap_helicsEndpointGetDefaultDestination";
case 268: return "_wrap_helicsEndpointSendBytes";
case 269: return "_wrap_helicsEndpointSendBytesTo";
case 270: return "_wrap_helicsEndpointSendBytesToAt";
case 271: return "_wrap_helicsEndpointSendBytesAt";
case 272: return "_wrap_helicsEndpointSendMessage";
case 273: return "_wrap_helicsEndpointSendMessageZeroCopy";
case 274: return "_wrap_helicsEndpointSubscribe";
case 275: return "_wrap_helicsFederateHasMessage";
case 276: return "_wrap_helicsEndpointHasMessage";
case 277: return "_wrap_helicsFederatePendingMessageCount";
case 278: return "_wrap_helicsEndpointPendingMessageCount";
case 279: return "_wrap_helicsEndpointGetMessage";
case 280: return "_wrap_helicsEndpointCreateMessage";
case 281: return "_wrap_helicsFederateGetMessage";
case 282: return "_wrap_helicsFederateCreateMessage";
case 283: return "_wrap_helicsFederateClearMessages";
case 284: return "_wrap_helicsEndpointGetType";
case 285: return "_wrap_helicsEndpointGetName";
case 286: return "_wrap_helicsFederateGetEndpointCount";
case 287: return "_wrap_helicsEndpointGetInfo";
case 288: return "_wrap_helicsEndpointSetInfo";
case 289: return "_wrap_helicsEndpointGetTag";
case 290: return "_wrap_helicsEndpointSetTag";
case 291: return "_wrap_helicsEndpointSetOption";
case 292: return "_wrap_helicsEndpointGetOption";
case 293: return "_wrap_helicsEndpointAddSourceTarget";
case 294: return "_wrap_helicsEndpointAddDestinationTarget";
case 295: return "_wrap_helicsEndpointRemoveTarget";
case 296: return "_wrap_helicsEndpointAddSourceFilter";
case 297: return "_wrap_helicsEndpointAddDestinationFilter";
case 298: return "_wrap_helicsMessageGetSource";
case 299: return "_wrap_helicsMessageGetDestination";
case 300: return "_wrap_helicsMessageGetOriginalSource";
case 301: return "_wrap_helicsMessageGetOriginalDestination";
case 302: return "_wrap_helicsMessageGetTime";
case 303: return "_wrap_helicsMessageGetString";
case 304: return "_wrap_helicsMessageGetMessageID";
case 305: return "_wrap_helicsMessageGetFlagOption";
case 306: return "_wrap_helicsMessageGetByteCount";
case 307: return "_wrap_helicsMessageGetBytes";
case 308: return "_wrap_helicsMessageGetBytesPointer";
case 309: return "_wrap_helicsMessageIsValid";
case 310: return "_wrap_helicsMessageSetSource";
case 311: return "_wrap_helicsMessageSetDestination";
case 312: return "_wrap_helicsMessageSetOriginalSource";
case 313: return "_wrap_helicsMessageSetOriginalDestination";
case 314: return "_wrap_helicsMessageSetTime";
case 315: return "_wrap_helicsMessageReserve";
case 316: return "_wrap_helicsMessageSetMessageID";
case 317: return "_wrap_helicsMessageClearFlags";
case 318: return "_wrap_helicsMessageSetFlagOption";
case 319: return "_wrap_helicsMessageSetString";
case 320: return "_wrap_helicsMessageSetData";
case 321: return "_wrap_helicsMessageAppendData";
case 322: return "_wrap_helicsMessageCopy";
case 323: return "_wrap_helicsMessageClone";
case 324: return "_wrap_helicsMessageFree";
case 325: return "_wrap_helicsMessageClear";
case 326: return "_wrap_helicsFederateRegisterFilter";
case 327: return "_wrap_helicsFederateRegisterGlobalFilter";
case 328: return "_wrap_helicsFederateRegisterCloningFilter";
case 329: return "_wrap_helicsFederateRegisterGlobalCloningFilter";
case 330: return "_wrap_helicsCoreRegisterFilter";
case 331: return "_wrap_helicsCoreRegisterCloningFilter";
case 332: return "_wrap_helicsFederateGetFilterCount";
case 333: return "_wrap_helicsFederateGetFilter";
case 334: return "_wrap_helicsFederateGetFilterByIndex";
case 335: return "_wrap_helicsFilterIsValid";
case 336: return "_wrap_helicsFilterGetName";
case 337: return "_wrap_helicsFilterSet";
case 338: return "_wrap_helicsFilterSetString";
case 339: return "_wrap_helicsFilterAddDestinationTarget";
case 340: return "_wrap_helicsFilterAddSourceTarget";
case 341: return "_wrap_helicsFilterAddDeliveryEndpoint";
case 342: return "_wrap_helicsFilterRemoveTarget";
case 343: return "_wrap_helicsFilterRemoveDeliveryEndpoint";
case 344: return "_wrap_helicsFilterGetInfo";
case 345: return "_wrap_helicsFilterSetInfo";
case 346: return "_wrap_helicsFilterGetTag";
case 347: return "_wrap_helicsFilterSetTag";
case 348: return "_wrap_helicsFilterSetOption";
case 349: return "_wrap_helicsFilterGetOption";
case 350: return "_wrap_helicsFederateSetTimeUpdateCallback";
case 351: return "_wrap_helicsFederateSetStateChangeCallback";
default: return 0;
}
}
SWIGINTERN int swigFunctionName(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
if (argc!=1 || !mxIsDouble(*argv) || mxGetNumberOfElements(*argv)!=1) {
SWIG_Error(SWIG_RuntimeError, "This mex file should only be called from inside the .m files generated by SWIG. The input should be the function ID.");
return 1;
}
if (resc!=1) {
SWIG_Error(SWIG_RuntimeError, "The function should have one output.");
return 1;
}
int fcn_id = (int)mxGetScalar(*argv);
const char* s = SwigFunctionName(fcn_id);
if (s==0) {
SWIG_Error(SWIG_RuntimeError, "No such function ID.");
return 1;
}
*resv = mxCreateString(s);
return 0;
}
SWIGINTERN int swigThis(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
if (argc!=1 || resc!=1) {
SWIG_Error(SWIG_RuntimeError, "swigThis should have one input and one output.");
return 1;
}
SwigPtr* swig_ptr = SWIG_Matlab_getSwigPtr(argv[0]);
if (!swig_ptr) {
SWIG_Error(SWIG_RuntimeError, "The argument should be a SWIG class.");
return 1;
}
resv[0] = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
*(uint64_T *)mxGetData(resv[0]) = (uint64_T)swig_ptr->ptr;
return 0;
}
SWIGINTERN int swigTouch(int resc, mxArray** SWIGUNUSEDPARM(resv), int argc, mxArray** SWIGUNUSEDPARM(argv)) {
if (argc!=0 || resc!=0) {
SWIG_Error(SWIG_RuntimeError, "swigTouch should have no inputs or outputs.");
return 1;
}
return 0;
}
extern "C"
void mexFunction(int resc, mxArray *resv[], int argc, const mxArray *argv[]) {
/* Initialize module if first call */
SWIG_Matlab_LoadModule();
if (--argc < 0 || !mxIsDouble(*argv) || mxGetNumberOfElements(*argv)!=1)
mexErrMsgTxt("This mex file should only be called from inside the .m files generated by SWIG. First input should be the function ID .");
int fcn_id = (int)mxGetScalar(*argv++);
int flag=0;
switch (fcn_id) {
case 0: flag=swigConstant(resc,resv,argc,(mxArray**)(argv)); break;
case 1: flag=swigFunctionName(resc,resv,argc,(mxArray**)(argv)); break;
case 2: flag=swigConstantName(resc,resv,argc,(mxArray**)(argv)); break;
case 3: flag=swigThis(resc,resv,argc,(mxArray**)(argv)); break;
case 4: flag=swigTouch(resc,resv,argc,(mxArray**)(argv)); break;
case 5: flag=_wrap_HELICS_INVALID_OPTION_INDEX_get(resc,resv,argc,(mxArray**)(argv)); break;
case 6: flag=_wrap_HELICS_INVALID_PROPERTY_VALUE_get(resc,resv,argc,(mxArray**)(argv)); break;
case 7: flag=_wrap_cHelicsBigNumber_get(resc,resv,argc,(mxArray**)(argv)); break;
case 8: flag=_wrap_HELICS_TIME_ZERO_get(resc,resv,argc,(mxArray**)(argv)); break;
case 9: flag=_wrap_HELICS_TIME_EPSILON_get(resc,resv,argc,(mxArray**)(argv)); break;
case 10: flag=_wrap_HELICS_TIME_INVALID_get(resc,resv,argc,(mxArray**)(argv)); break;
case 11: flag=_wrap_HELICS_TIME_MAXTIME_get(resc,resv,argc,(mxArray**)(argv)); break;
case 12: flag=_wrap_HELICS_TRUE_get(resc,resv,argc,(mxArray**)(argv)); break;
case 13: flag=_wrap_HELICS_FALSE_get(resc,resv,argc,(mxArray**)(argv)); break;
case 14: flag=_wrap_HelicsComplex_real_get(resc,resv,argc,(mxArray**)(argv)); break;
case 15: flag=_wrap_HelicsComplex_real_set(resc,resv,argc,(mxArray**)(argv)); break;
case 16: flag=_wrap_HelicsComplex_imag_get(resc,resv,argc,(mxArray**)(argv)); break;
case 17: flag=_wrap_HelicsComplex_imag_set(resc,resv,argc,(mxArray**)(argv)); break;
case 18: flag=_wrap_new_HelicsComplex(resc,resv,argc,(mxArray**)(argv)); break;
case 19: flag=_wrap_delete_HelicsComplex(resc,resv,argc,(mxArray**)(argv)); break;
case 20: flag=_wrap_helicsGetVersion(resc,resv,argc,(mxArray**)(argv)); break;
case 21: flag=_wrap_helicsGetBuildFlags(resc,resv,argc,(mxArray**)(argv)); break;
case 22: flag=_wrap_helicsGetCompilerVersion(resc,resv,argc,(mxArray**)(argv)); break;
case 23: flag=_wrap_helicsGetSystemInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 24: flag=_wrap_helicsLoadSignalHandler(resc,resv,argc,(mxArray**)(argv)); break;
case 25: flag=_wrap_helicsLoadThreadedSignalHandler(resc,resv,argc,(mxArray**)(argv)); break;
case 26: flag=_wrap_helicsClearSignalHandler(resc,resv,argc,(mxArray**)(argv)); break;
case 27: flag=_wrap_helicsLoadSignalHandlerCallbackNoExit(resc,resv,argc,(mxArray**)(argv)); break;
case 28: flag=_wrap_helicsAbort(resc,resv,argc,(mxArray**)(argv)); break;
case 29: flag=_wrap_helicsIsCoreTypeAvailable(resc,resv,argc,(mxArray**)(argv)); break;
case 30: flag=_wrap_helicsCreateCore(resc,resv,argc,(mxArray**)(argv)); break;
case 31: flag=_wrap_helicsCreateCoreFromArgs(resc,resv,argc,(mxArray**)(argv)); break;
case 32: flag=_wrap_helicsCoreClone(resc,resv,argc,(mxArray**)(argv)); break;
case 33: flag=_wrap_helicsCoreIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 34: flag=_wrap_helicsCreateBroker(resc,resv,argc,(mxArray**)(argv)); break;
case 35: flag=_wrap_helicsCreateBrokerFromArgs(resc,resv,argc,(mxArray**)(argv)); break;
case 36: flag=_wrap_helicsBrokerClone(resc,resv,argc,(mxArray**)(argv)); break;
case 37: flag=_wrap_helicsBrokerIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 38: flag=_wrap_helicsBrokerIsConnected(resc,resv,argc,(mxArray**)(argv)); break;
case 39: flag=_wrap_helicsBrokerDataLink(resc,resv,argc,(mxArray**)(argv)); break;
case 40: flag=_wrap_helicsBrokerAddSourceFilterToEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 41: flag=_wrap_helicsBrokerAddDestinationFilterToEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 42: flag=_wrap_helicsBrokerMakeConnections(resc,resv,argc,(mxArray**)(argv)); break;
case 43: flag=_wrap_helicsCoreWaitForDisconnect(resc,resv,argc,(mxArray**)(argv)); break;
case 44: flag=_wrap_helicsBrokerWaitForDisconnect(resc,resv,argc,(mxArray**)(argv)); break;
case 45: flag=_wrap_helicsCoreIsConnected(resc,resv,argc,(mxArray**)(argv)); break;
case 46: flag=_wrap_helicsCoreDataLink(resc,resv,argc,(mxArray**)(argv)); break;
case 47: flag=_wrap_helicsCoreAddSourceFilterToEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 48: flag=_wrap_helicsCoreAddDestinationFilterToEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 49: flag=_wrap_helicsCoreMakeConnections(resc,resv,argc,(mxArray**)(argv)); break;
case 50: flag=_wrap_helicsBrokerGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break;
case 51: flag=_wrap_helicsCoreGetIdentifier(resc,resv,argc,(mxArray**)(argv)); break;
case 52: flag=_wrap_helicsBrokerGetAddress(resc,resv,argc,(mxArray**)(argv)); break;
case 53: flag=_wrap_helicsCoreGetAddress(resc,resv,argc,(mxArray**)(argv)); break;
case 54: flag=_wrap_helicsCoreSetReadyToInit(resc,resv,argc,(mxArray**)(argv)); break;
case 55: flag=_wrap_helicsCoreConnect(resc,resv,argc,(mxArray**)(argv)); break;
case 56: flag=_wrap_helicsCoreDisconnect(resc,resv,argc,(mxArray**)(argv)); break;
case 57: flag=_wrap_helicsGetFederateByName(resc,resv,argc,(mxArray**)(argv)); break;
case 58: flag=_wrap_helicsBrokerDisconnect(resc,resv,argc,(mxArray**)(argv)); break;
case 59: flag=_wrap_helicsFederateDestroy(resc,resv,argc,(mxArray**)(argv)); break;
case 60: flag=_wrap_helicsBrokerDestroy(resc,resv,argc,(mxArray**)(argv)); break;
case 61: flag=_wrap_helicsCoreDestroy(resc,resv,argc,(mxArray**)(argv)); break;
case 62: flag=_wrap_helicsCoreFree(resc,resv,argc,(mxArray**)(argv)); break;
case 63: flag=_wrap_helicsBrokerFree(resc,resv,argc,(mxArray**)(argv)); break;
case 64: flag=_wrap_helicsCreateValueFederate(resc,resv,argc,(mxArray**)(argv)); break;
case 65: flag=_wrap_helicsCreateValueFederateFromConfig(resc,resv,argc,(mxArray**)(argv)); break;
case 66: flag=_wrap_helicsCreateMessageFederate(resc,resv,argc,(mxArray**)(argv)); break;
case 67: flag=_wrap_helicsCreateMessageFederateFromConfig(resc,resv,argc,(mxArray**)(argv)); break;
case 68: flag=_wrap_helicsCreateCombinationFederate(resc,resv,argc,(mxArray**)(argv)); break;
case 69: flag=_wrap_helicsCreateCombinationFederateFromConfig(resc,resv,argc,(mxArray**)(argv)); break;
case 70: flag=_wrap_helicsFederateClone(resc,resv,argc,(mxArray**)(argv)); break;
case 71: flag=_wrap_helicsCreateFederateInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 72: flag=_wrap_helicsFederateInfoClone(resc,resv,argc,(mxArray**)(argv)); break;
case 73: flag=_wrap_helicsFederateInfoLoadFromArgs(resc,resv,argc,(mxArray**)(argv)); break;
case 74: flag=_wrap_helicsFederateInfoLoadFromString(resc,resv,argc,(mxArray**)(argv)); break;
case 75: flag=_wrap_helicsFederateInfoFree(resc,resv,argc,(mxArray**)(argv)); break;
case 76: flag=_wrap_helicsFederateIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 77: flag=_wrap_helicsFederateInfoSetCoreName(resc,resv,argc,(mxArray**)(argv)); break;
case 78: flag=_wrap_helicsFederateInfoSetCoreInitString(resc,resv,argc,(mxArray**)(argv)); break;
case 79: flag=_wrap_helicsFederateInfoSetBrokerInitString(resc,resv,argc,(mxArray**)(argv)); break;
case 80: flag=_wrap_helicsFederateInfoSetCoreType(resc,resv,argc,(mxArray**)(argv)); break;
case 81: flag=_wrap_helicsFederateInfoSetCoreTypeFromString(resc,resv,argc,(mxArray**)(argv)); break;
case 82: flag=_wrap_helicsFederateInfoSetBroker(resc,resv,argc,(mxArray**)(argv)); break;
case 83: flag=_wrap_helicsFederateInfoSetBrokerKey(resc,resv,argc,(mxArray**)(argv)); break;
case 84: flag=_wrap_helicsFederateInfoSetBrokerPort(resc,resv,argc,(mxArray**)(argv)); break;
case 85: flag=_wrap_helicsFederateInfoSetLocalPort(resc,resv,argc,(mxArray**)(argv)); break;
case 86: flag=_wrap_helicsGetPropertyIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 87: flag=_wrap_helicsGetFlagIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 88: flag=_wrap_helicsGetOptionIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 89: flag=_wrap_helicsGetOptionValue(resc,resv,argc,(mxArray**)(argv)); break;
case 90: flag=_wrap_helicsGetDataType(resc,resv,argc,(mxArray**)(argv)); break;
case 91: flag=_wrap_helicsFederateInfoSetFlagOption(resc,resv,argc,(mxArray**)(argv)); break;
case 92: flag=_wrap_helicsFederateInfoSetSeparator(resc,resv,argc,(mxArray**)(argv)); break;
case 93: flag=_wrap_helicsFederateInfoSetTimeProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 94: flag=_wrap_helicsFederateInfoSetIntegerProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 95: flag=_wrap_helicsFederateRegisterInterfaces(resc,resv,argc,(mxArray**)(argv)); break;
case 96: flag=_wrap_helicsFederateGlobalError(resc,resv,argc,(mxArray**)(argv)); break;
case 97: flag=_wrap_helicsFederateLocalError(resc,resv,argc,(mxArray**)(argv)); break;
case 98: flag=_wrap_helicsFederateFinalize(resc,resv,argc,(mxArray**)(argv)); break;
case 99: flag=_wrap_helicsFederateFinalizeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 100: flag=_wrap_helicsFederateFinalizeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 101: flag=_wrap_helicsFederateDisconnect(resc,resv,argc,(mxArray**)(argv)); break;
case 102: flag=_wrap_helicsFederateDisconnectAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 103: flag=_wrap_helicsFederateDisconnectComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 104: flag=_wrap_helicsFederateFree(resc,resv,argc,(mxArray**)(argv)); break;
case 105: flag=_wrap_helicsCloseLibrary(resc,resv,argc,(mxArray**)(argv)); break;
case 106: flag=_wrap_helicsFederateEnterInitializingMode(resc,resv,argc,(mxArray**)(argv)); break;
case 107: flag=_wrap_helicsFederateEnterInitializingModeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 108: flag=_wrap_helicsFederateIsAsyncOperationCompleted(resc,resv,argc,(mxArray**)(argv)); break;
case 109: flag=_wrap_helicsFederateEnterInitializingModeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 110: flag=_wrap_helicsFederateEnterExecutingMode(resc,resv,argc,(mxArray**)(argv)); break;
case 111: flag=_wrap_helicsFederateEnterExecutingModeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 112: flag=_wrap_helicsFederateEnterExecutingModeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 113: flag=_wrap_helicsFederateEnterExecutingModeIterative(resc,resv,argc,(mxArray**)(argv)); break;
case 114: flag=_wrap_helicsFederateEnterExecutingModeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 115: flag=_wrap_helicsFederateEnterExecutingModeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 116: flag=_wrap_helicsFederateGetState(resc,resv,argc,(mxArray**)(argv)); break;
case 117: flag=_wrap_helicsFederateGetCore(resc,resv,argc,(mxArray**)(argv)); break;
case 118: flag=_wrap_helicsFederateRequestTime(resc,resv,argc,(mxArray**)(argv)); break;
case 119: flag=_wrap_helicsFederateRequestTimeAdvance(resc,resv,argc,(mxArray**)(argv)); break;
case 120: flag=_wrap_helicsFederateRequestNextStep(resc,resv,argc,(mxArray**)(argv)); break;
case 121: flag=_wrap_helicsFederateRequestTimeIterative(resc,resv,argc,(mxArray**)(argv)); break;
case 122: flag=_wrap_helicsFederateRequestTimeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 123: flag=_wrap_helicsFederateRequestTimeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 124: flag=_wrap_helicsFederateRequestTimeIterativeAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 125: flag=_wrap_helicsFederateRequestTimeIterativeComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 126: flag=_wrap_helicsFederateProcessCommunications(resc,resv,argc,(mxArray**)(argv)); break;
case 127: flag=_wrap_helicsFederateGetName(resc,resv,argc,(mxArray**)(argv)); break;
case 128: flag=_wrap_helicsFederateSetTimeProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 129: flag=_wrap_helicsFederateSetFlagOption(resc,resv,argc,(mxArray**)(argv)); break;
case 130: flag=_wrap_helicsFederateSetSeparator(resc,resv,argc,(mxArray**)(argv)); break;
case 131: flag=_wrap_helicsFederateSetIntegerProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 132: flag=_wrap_helicsFederateGetTimeProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 133: flag=_wrap_helicsFederateGetFlagOption(resc,resv,argc,(mxArray**)(argv)); break;
case 134: flag=_wrap_helicsFederateGetIntegerProperty(resc,resv,argc,(mxArray**)(argv)); break;
case 135: flag=_wrap_helicsFederateGetCurrentTime(resc,resv,argc,(mxArray**)(argv)); break;
case 136: flag=_wrap_helicsFederateSetGlobal(resc,resv,argc,(mxArray**)(argv)); break;
case 137: flag=_wrap_helicsFederateSetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 138: flag=_wrap_helicsFederateGetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 139: flag=_wrap_helicsFederateAddDependency(resc,resv,argc,(mxArray**)(argv)); break;
case 140: flag=_wrap_helicsFederateSetLogFile(resc,resv,argc,(mxArray**)(argv)); break;
case 141: flag=_wrap_helicsFederateLogErrorMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 142: flag=_wrap_helicsFederateLogWarningMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 143: flag=_wrap_helicsFederateLogInfoMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 144: flag=_wrap_helicsFederateLogDebugMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 145: flag=_wrap_helicsFederateLogLevelMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 146: flag=_wrap_helicsFederateSendCommand(resc,resv,argc,(mxArray**)(argv)); break;
case 147: flag=_wrap_helicsFederateGetCommand(resc,resv,argc,(mxArray**)(argv)); break;
case 148: flag=_wrap_helicsFederateGetCommandSource(resc,resv,argc,(mxArray**)(argv)); break;
case 149: flag=_wrap_helicsFederateWaitCommand(resc,resv,argc,(mxArray**)(argv)); break;
case 150: flag=_wrap_helicsCoreSetGlobal(resc,resv,argc,(mxArray**)(argv)); break;
case 151: flag=_wrap_helicsBrokerSetGlobal(resc,resv,argc,(mxArray**)(argv)); break;
case 152: flag=_wrap_helicsCoreSendCommand(resc,resv,argc,(mxArray**)(argv)); break;
case 153: flag=_wrap_helicsBrokerSendCommand(resc,resv,argc,(mxArray**)(argv)); break;
case 154: flag=_wrap_helicsCoreSetLogFile(resc,resv,argc,(mxArray**)(argv)); break;
case 155: flag=_wrap_helicsBrokerSetLogFile(resc,resv,argc,(mxArray**)(argv)); break;
case 156: flag=_wrap_helicsBrokerSetTimeBarrier(resc,resv,argc,(mxArray**)(argv)); break;
case 157: flag=_wrap_helicsBrokerClearTimeBarrier(resc,resv,argc,(mxArray**)(argv)); break;
case 158: flag=_wrap_helicsBrokerGlobalError(resc,resv,argc,(mxArray**)(argv)); break;
case 159: flag=_wrap_helicsCoreGlobalError(resc,resv,argc,(mxArray**)(argv)); break;
case 160: flag=_wrap_helicsCreateQuery(resc,resv,argc,(mxArray**)(argv)); break;
case 161: flag=_wrap_helicsQueryExecute(resc,resv,argc,(mxArray**)(argv)); break;
case 162: flag=_wrap_helicsQueryCoreExecute(resc,resv,argc,(mxArray**)(argv)); break;
case 163: flag=_wrap_helicsQueryBrokerExecute(resc,resv,argc,(mxArray**)(argv)); break;
case 164: flag=_wrap_helicsQueryExecuteAsync(resc,resv,argc,(mxArray**)(argv)); break;
case 165: flag=_wrap_helicsQueryExecuteComplete(resc,resv,argc,(mxArray**)(argv)); break;
case 166: flag=_wrap_helicsQueryIsCompleted(resc,resv,argc,(mxArray**)(argv)); break;
case 167: flag=_wrap_helicsQuerySetTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 168: flag=_wrap_helicsQuerySetQueryString(resc,resv,argc,(mxArray**)(argv)); break;
case 169: flag=_wrap_helicsQuerySetOrdering(resc,resv,argc,(mxArray**)(argv)); break;
case 170: flag=_wrap_helicsQueryFree(resc,resv,argc,(mxArray**)(argv)); break;
case 171: flag=_wrap_helicsCleanupLibrary(resc,resv,argc,(mxArray**)(argv)); break;
case 172: flag=_wrap_helicsFederateRegisterSubscription(resc,resv,argc,(mxArray**)(argv)); break;
case 173: flag=_wrap_helicsFederateRegisterPublication(resc,resv,argc,(mxArray**)(argv)); break;
case 174: flag=_wrap_helicsFederateRegisterTypePublication(resc,resv,argc,(mxArray**)(argv)); break;
case 175: flag=_wrap_helicsFederateRegisterGlobalPublication(resc,resv,argc,(mxArray**)(argv)); break;
case 176: flag=_wrap_helicsFederateRegisterGlobalTypePublication(resc,resv,argc,(mxArray**)(argv)); break;
case 177: flag=_wrap_helicsFederateRegisterInput(resc,resv,argc,(mxArray**)(argv)); break;
case 178: flag=_wrap_helicsFederateRegisterTypeInput(resc,resv,argc,(mxArray**)(argv)); break;
case 179: flag=_wrap_helicsFederateRegisterGlobalInput(resc,resv,argc,(mxArray**)(argv)); break;
case 180: flag=_wrap_helicsFederateRegisterGlobalTypeInput(resc,resv,argc,(mxArray**)(argv)); break;
case 181: flag=_wrap_helicsFederateGetPublication(resc,resv,argc,(mxArray**)(argv)); break;
case 182: flag=_wrap_helicsFederateGetPublicationByIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 183: flag=_wrap_helicsFederateGetInput(resc,resv,argc,(mxArray**)(argv)); break;
case 184: flag=_wrap_helicsFederateGetInputByIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 185: flag=_wrap_helicsFederateGetSubscription(resc,resv,argc,(mxArray**)(argv)); break;
case 186: flag=_wrap_helicsFederateClearUpdates(resc,resv,argc,(mxArray**)(argv)); break;
case 187: flag=_wrap_helicsFederateRegisterFromPublicationJSON(resc,resv,argc,(mxArray**)(argv)); break;
case 188: flag=_wrap_helicsFederatePublishJSON(resc,resv,argc,(mxArray**)(argv)); break;
case 189: flag=_wrap_helicsPublicationIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 190: flag=_wrap_helicsPublicationPublishBytes(resc,resv,argc,(mxArray**)(argv)); break;
case 191: flag=_wrap_helicsPublicationPublishString(resc,resv,argc,(mxArray**)(argv)); break;
case 192: flag=_wrap_helicsPublicationPublishInteger(resc,resv,argc,(mxArray**)(argv)); break;
case 193: flag=_wrap_helicsPublicationPublishBoolean(resc,resv,argc,(mxArray**)(argv)); break;
case 194: flag=_wrap_helicsPublicationPublishDouble(resc,resv,argc,(mxArray**)(argv)); break;
case 195: flag=_wrap_helicsPublicationPublishTime(resc,resv,argc,(mxArray**)(argv)); break;
case 196: flag=_wrap_helicsPublicationPublishChar(resc,resv,argc,(mxArray**)(argv)); break;
case 197: flag=_wrap_helicsPublicationPublishComplex(resc,resv,argc,(mxArray**)(argv)); break;
case 198: flag=_wrap_helicsPublicationPublishVector(resc,resv,argc,(mxArray**)(argv)); break;
case 199: flag=_wrap_helicsPublicationPublishComplexVector(resc,resv,argc,(mxArray**)(argv)); break;
case 200: flag=_wrap_helicsPublicationPublishNamedPoint(resc,resv,argc,(mxArray**)(argv)); break;
case 201: flag=_wrap_helicsPublicationAddTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 202: flag=_wrap_helicsInputIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 203: flag=_wrap_helicsInputAddTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 204: flag=_wrap_helicsInputGetByteCount(resc,resv,argc,(mxArray**)(argv)); break;
case 205: flag=_wrap_helicsInputGetBytes(resc,resv,argc,(mxArray**)(argv)); break;
case 206: flag=_wrap_helicsInputGetStringSize(resc,resv,argc,(mxArray**)(argv)); break;
case 207: flag=_wrap_helicsInputGetString(resc,resv,argc,(mxArray**)(argv)); break;
case 208: flag=_wrap_helicsInputGetInteger(resc,resv,argc,(mxArray**)(argv)); break;
case 209: flag=_wrap_helicsInputGetBoolean(resc,resv,argc,(mxArray**)(argv)); break;
case 210: flag=_wrap_helicsInputGetDouble(resc,resv,argc,(mxArray**)(argv)); break;
case 211: flag=_wrap_helicsInputGetTime(resc,resv,argc,(mxArray**)(argv)); break;
case 212: flag=_wrap_helicsInputGetChar(resc,resv,argc,(mxArray**)(argv)); break;
case 213: flag=_wrap_helicsInputGetComplex(resc,resv,argc,(mxArray**)(argv)); break;
case 214: flag=_wrap_helicsInputGetVectorSize(resc,resv,argc,(mxArray**)(argv)); break;
case 215: flag=_wrap_helicsInputGetVector(resc,resv,argc,(mxArray**)(argv)); break;
case 216: flag=_wrap_helicsInputGetComplexVector(resc,resv,argc,(mxArray**)(argv)); break;
case 217: flag=_wrap_helicsInputGetNamedPoint(resc,resv,argc,(mxArray**)(argv)); break;
case 218: flag=_wrap_helicsInputSetDefaultBytes(resc,resv,argc,(mxArray**)(argv)); break;
case 219: flag=_wrap_helicsInputSetDefaultString(resc,resv,argc,(mxArray**)(argv)); break;
case 220: flag=_wrap_helicsInputSetDefaultInteger(resc,resv,argc,(mxArray**)(argv)); break;
case 221: flag=_wrap_helicsInputSetDefaultBoolean(resc,resv,argc,(mxArray**)(argv)); break;
case 222: flag=_wrap_helicsInputSetDefaultTime(resc,resv,argc,(mxArray**)(argv)); break;
case 223: flag=_wrap_helicsInputSetDefaultChar(resc,resv,argc,(mxArray**)(argv)); break;
case 224: flag=_wrap_helicsInputSetDefaultDouble(resc,resv,argc,(mxArray**)(argv)); break;
case 225: flag=_wrap_helicsInputSetDefaultComplex(resc,resv,argc,(mxArray**)(argv)); break;
case 226: flag=_wrap_helicsInputSetDefaultVector(resc,resv,argc,(mxArray**)(argv)); break;
case 227: flag=_wrap_helicsInputSetDefaultComplexVector(resc,resv,argc,(mxArray**)(argv)); break;
case 228: flag=_wrap_helicsInputSetDefaultNamedPoint(resc,resv,argc,(mxArray**)(argv)); break;
case 229: flag=_wrap_helicsInputGetType(resc,resv,argc,(mxArray**)(argv)); break;
case 230: flag=_wrap_helicsInputGetPublicationType(resc,resv,argc,(mxArray**)(argv)); break;
case 231: flag=_wrap_helicsInputGetPublicationDataType(resc,resv,argc,(mxArray**)(argv)); break;
case 232: flag=_wrap_helicsPublicationGetType(resc,resv,argc,(mxArray**)(argv)); break;
case 233: flag=_wrap_helicsInputGetName(resc,resv,argc,(mxArray**)(argv)); break;
case 234: flag=_wrap_helicsSubscriptionGetTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 235: flag=_wrap_helicsPublicationGetName(resc,resv,argc,(mxArray**)(argv)); break;
case 236: flag=_wrap_helicsInputGetUnits(resc,resv,argc,(mxArray**)(argv)); break;
case 237: flag=_wrap_helicsInputGetInjectionUnits(resc,resv,argc,(mxArray**)(argv)); break;
case 238: flag=_wrap_helicsInputGetExtractionUnits(resc,resv,argc,(mxArray**)(argv)); break;
case 239: flag=_wrap_helicsPublicationGetUnits(resc,resv,argc,(mxArray**)(argv)); break;
case 240: flag=_wrap_helicsInputGetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 241: flag=_wrap_helicsInputSetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 242: flag=_wrap_helicsInputGetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 243: flag=_wrap_helicsInputSetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 244: flag=_wrap_helicsPublicationGetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 245: flag=_wrap_helicsPublicationSetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 246: flag=_wrap_helicsPublicationGetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 247: flag=_wrap_helicsPublicationSetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 248: flag=_wrap_helicsInputGetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 249: flag=_wrap_helicsInputSetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 250: flag=_wrap_helicsPublicationGetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 251: flag=_wrap_helicsPublicationSetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 252: flag=_wrap_helicsPublicationSetMinimumChange(resc,resv,argc,(mxArray**)(argv)); break;
case 253: flag=_wrap_helicsInputSetMinimumChange(resc,resv,argc,(mxArray**)(argv)); break;
case 254: flag=_wrap_helicsInputIsUpdated(resc,resv,argc,(mxArray**)(argv)); break;
case 255: flag=_wrap_helicsInputLastUpdateTime(resc,resv,argc,(mxArray**)(argv)); break;
case 256: flag=_wrap_helicsInputClearUpdate(resc,resv,argc,(mxArray**)(argv)); break;
case 257: flag=_wrap_helicsFederateGetPublicationCount(resc,resv,argc,(mxArray**)(argv)); break;
case 258: flag=_wrap_helicsFederateGetInputCount(resc,resv,argc,(mxArray**)(argv)); break;
case 259: flag=_wrap_helicsFederateRegisterEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 260: flag=_wrap_helicsFederateRegisterGlobalEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 261: flag=_wrap_helicsFederateRegisterTargetedEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 262: flag=_wrap_helicsFederateRegisterGlobalTargetedEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 263: flag=_wrap_helicsFederateGetEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 264: flag=_wrap_helicsFederateGetEndpointByIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 265: flag=_wrap_helicsEndpointIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 266: flag=_wrap_helicsEndpointSetDefaultDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 267: flag=_wrap_helicsEndpointGetDefaultDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 268: flag=_wrap_helicsEndpointSendBytes(resc,resv,argc,(mxArray**)(argv)); break;
case 269: flag=_wrap_helicsEndpointSendBytesTo(resc,resv,argc,(mxArray**)(argv)); break;
case 270: flag=_wrap_helicsEndpointSendBytesToAt(resc,resv,argc,(mxArray**)(argv)); break;
case 271: flag=_wrap_helicsEndpointSendBytesAt(resc,resv,argc,(mxArray**)(argv)); break;
case 272: flag=_wrap_helicsEndpointSendMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 273: flag=_wrap_helicsEndpointSendMessageZeroCopy(resc,resv,argc,(mxArray**)(argv)); break;
case 274: flag=_wrap_helicsEndpointSubscribe(resc,resv,argc,(mxArray**)(argv)); break;
case 275: flag=_wrap_helicsFederateHasMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 276: flag=_wrap_helicsEndpointHasMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 277: flag=_wrap_helicsFederatePendingMessageCount(resc,resv,argc,(mxArray**)(argv)); break;
case 278: flag=_wrap_helicsEndpointPendingMessageCount(resc,resv,argc,(mxArray**)(argv)); break;
case 279: flag=_wrap_helicsEndpointGetMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 280: flag=_wrap_helicsEndpointCreateMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 281: flag=_wrap_helicsFederateGetMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 282: flag=_wrap_helicsFederateCreateMessage(resc,resv,argc,(mxArray**)(argv)); break;
case 283: flag=_wrap_helicsFederateClearMessages(resc,resv,argc,(mxArray**)(argv)); break;
case 284: flag=_wrap_helicsEndpointGetType(resc,resv,argc,(mxArray**)(argv)); break;
case 285: flag=_wrap_helicsEndpointGetName(resc,resv,argc,(mxArray**)(argv)); break;
case 286: flag=_wrap_helicsFederateGetEndpointCount(resc,resv,argc,(mxArray**)(argv)); break;
case 287: flag=_wrap_helicsEndpointGetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 288: flag=_wrap_helicsEndpointSetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 289: flag=_wrap_helicsEndpointGetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 290: flag=_wrap_helicsEndpointSetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 291: flag=_wrap_helicsEndpointSetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 292: flag=_wrap_helicsEndpointGetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 293: flag=_wrap_helicsEndpointAddSourceTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 294: flag=_wrap_helicsEndpointAddDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 295: flag=_wrap_helicsEndpointRemoveTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 296: flag=_wrap_helicsEndpointAddSourceFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 297: flag=_wrap_helicsEndpointAddDestinationFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 298: flag=_wrap_helicsMessageGetSource(resc,resv,argc,(mxArray**)(argv)); break;
case 299: flag=_wrap_helicsMessageGetDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 300: flag=_wrap_helicsMessageGetOriginalSource(resc,resv,argc,(mxArray**)(argv)); break;
case 301: flag=_wrap_helicsMessageGetOriginalDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 302: flag=_wrap_helicsMessageGetTime(resc,resv,argc,(mxArray**)(argv)); break;
case 303: flag=_wrap_helicsMessageGetString(resc,resv,argc,(mxArray**)(argv)); break;
case 304: flag=_wrap_helicsMessageGetMessageID(resc,resv,argc,(mxArray**)(argv)); break;
case 305: flag=_wrap_helicsMessageGetFlagOption(resc,resv,argc,(mxArray**)(argv)); break;
case 306: flag=_wrap_helicsMessageGetByteCount(resc,resv,argc,(mxArray**)(argv)); break;
case 307: flag=_wrap_helicsMessageGetBytes(resc,resv,argc,(mxArray**)(argv)); break;
case 308: flag=_wrap_helicsMessageGetBytesPointer(resc,resv,argc,(mxArray**)(argv)); break;
case 309: flag=_wrap_helicsMessageIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 310: flag=_wrap_helicsMessageSetSource(resc,resv,argc,(mxArray**)(argv)); break;
case 311: flag=_wrap_helicsMessageSetDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 312: flag=_wrap_helicsMessageSetOriginalSource(resc,resv,argc,(mxArray**)(argv)); break;
case 313: flag=_wrap_helicsMessageSetOriginalDestination(resc,resv,argc,(mxArray**)(argv)); break;
case 314: flag=_wrap_helicsMessageSetTime(resc,resv,argc,(mxArray**)(argv)); break;
case 315: flag=_wrap_helicsMessageReserve(resc,resv,argc,(mxArray**)(argv)); break;
case 316: flag=_wrap_helicsMessageSetMessageID(resc,resv,argc,(mxArray**)(argv)); break;
case 317: flag=_wrap_helicsMessageClearFlags(resc,resv,argc,(mxArray**)(argv)); break;
case 318: flag=_wrap_helicsMessageSetFlagOption(resc,resv,argc,(mxArray**)(argv)); break;
case 319: flag=_wrap_helicsMessageSetString(resc,resv,argc,(mxArray**)(argv)); break;
case 320: flag=_wrap_helicsMessageSetData(resc,resv,argc,(mxArray**)(argv)); break;
case 321: flag=_wrap_helicsMessageAppendData(resc,resv,argc,(mxArray**)(argv)); break;
case 322: flag=_wrap_helicsMessageCopy(resc,resv,argc,(mxArray**)(argv)); break;
case 323: flag=_wrap_helicsMessageClone(resc,resv,argc,(mxArray**)(argv)); break;
case 324: flag=_wrap_helicsMessageFree(resc,resv,argc,(mxArray**)(argv)); break;
case 325: flag=_wrap_helicsMessageClear(resc,resv,argc,(mxArray**)(argv)); break;
case 326: flag=_wrap_helicsFederateRegisterFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 327: flag=_wrap_helicsFederateRegisterGlobalFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 328: flag=_wrap_helicsFederateRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 329: flag=_wrap_helicsFederateRegisterGlobalCloningFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 330: flag=_wrap_helicsCoreRegisterFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 331: flag=_wrap_helicsCoreRegisterCloningFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 332: flag=_wrap_helicsFederateGetFilterCount(resc,resv,argc,(mxArray**)(argv)); break;
case 333: flag=_wrap_helicsFederateGetFilter(resc,resv,argc,(mxArray**)(argv)); break;
case 334: flag=_wrap_helicsFederateGetFilterByIndex(resc,resv,argc,(mxArray**)(argv)); break;
case 335: flag=_wrap_helicsFilterIsValid(resc,resv,argc,(mxArray**)(argv)); break;
case 336: flag=_wrap_helicsFilterGetName(resc,resv,argc,(mxArray**)(argv)); break;
case 337: flag=_wrap_helicsFilterSet(resc,resv,argc,(mxArray**)(argv)); break;
case 338: flag=_wrap_helicsFilterSetString(resc,resv,argc,(mxArray**)(argv)); break;
case 339: flag=_wrap_helicsFilterAddDestinationTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 340: flag=_wrap_helicsFilterAddSourceTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 341: flag=_wrap_helicsFilterAddDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 342: flag=_wrap_helicsFilterRemoveTarget(resc,resv,argc,(mxArray**)(argv)); break;
case 343: flag=_wrap_helicsFilterRemoveDeliveryEndpoint(resc,resv,argc,(mxArray**)(argv)); break;
case 344: flag=_wrap_helicsFilterGetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 345: flag=_wrap_helicsFilterSetInfo(resc,resv,argc,(mxArray**)(argv)); break;
case 346: flag=_wrap_helicsFilterGetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 347: flag=_wrap_helicsFilterSetTag(resc,resv,argc,(mxArray**)(argv)); break;
case 348: flag=_wrap_helicsFilterSetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 349: flag=_wrap_helicsFilterGetOption(resc,resv,argc,(mxArray**)(argv)); break;
case 350: flag=_wrap_helicsFederateSetTimeUpdateCallback(resc,resv,argc,(mxArray**)(argv)); break;
case 351: flag=_wrap_helicsFederateSetStateChangeCallback(resc,resv,argc,(mxArray**)(argv)); break;
default: flag=1, SWIG_Error(SWIG_RuntimeError, "No function id %d.", fcn_id);
}
if (flag) {
mexErrMsgIdAndTxt(SWIG_ErrorType(SWIG_lasterror_code), SWIG_lasterror_msg);
}
}
| 32.31794 | 317 | 0.674792 | GMLC-TDC |
6f3b10fd913ba92540b381a7af8e05f4c197853b | 4,287 | cpp | C++ | tests/NEO/SignerTests.cpp | vladyslav-iosdev/wallet-core | 6f8f175a380bdf9756f38bfd82fedd9b73b67580 | [
"MIT"
] | 1,306 | 2019-08-08T13:25:24.000Z | 2022-03-31T23:32:28.000Z | tests/NEO/SignerTests.cpp | vladyslav-iosdev/wallet-core | 6f8f175a380bdf9756f38bfd82fedd9b73b67580 | [
"MIT"
] | 1,179 | 2019-08-08T07:06:10.000Z | 2022-03-31T12:33:47.000Z | tests/NEO/SignerTests.cpp | vladyslav-iosdev/wallet-core | 6f8f175a380bdf9756f38bfd82fedd9b73b67580 | [
"MIT"
] | 811 | 2019-08-08T13:27:44.000Z | 2022-03-31T21:22:53.000Z | // Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
#include "PublicKey.h"
#include "HexCoding.h"
#include "NEO/Address.h"
#include "NEO/Signer.h"
#include <gtest/gtest.h>
using namespace std;
using namespace TW;
using namespace TW::NEO;
TEST(NEOSigner, FromPublicPrivateKey) {
auto hexPrvKey = "4646464646464646464646464646464646464646464646464646464646464646";
auto hexPubKey = "031bec1250aa8f78275f99a6663688f31085848d0ed92f1203e447125f927b7486";
auto signer = Signer(PrivateKey(parse_hex(hexPrvKey)));
auto prvKey = signer.getPrivateKey();
auto pubKey = signer.getPublicKey();
EXPECT_EQ(hexPrvKey, hex(prvKey.bytes));
EXPECT_EQ(hexPubKey, hex(pubKey.bytes));
auto address = signer.getAddress();
EXPECT_TRUE(Address::isValid(address.string()));
EXPECT_EQ(Address(pubKey), address);
}
TEST(NEOSigner, SigningData) {
auto signer = Signer(PrivateKey(parse_hex("4646464646464646464646464646464646464646464646464646464646464646")));
auto verScript = "ba7908ddfe5a1177f2c9d3fa1d3dc71c9c289a3325b3bdd977e20c50136959ed02d1411efa5e8b897d970ef7e2325e6c0a3fdee4eb421223f0d86e455879a9ad";
auto invocationScript = string("401642b3d538e138f34b32330e381a7fe3f5151fcf958f2030991e72e2e25043143e4a1ebd239634efba279c96fa0ab04a15aa15179d73a7ef5a886ac8a06af484401642b3d538e138f34b32330e381a7fe3f5151fcf958f2030991e72e2e25043143e4a1ebd239634efba279c96fa0ab04a15aa15179d73a7ef5a886ac8a06af484401642b3d538e138f34b32330e381a7fe3f5151fcf958f2030991e72e2e25043143e4a1ebd239634efba279c96fa0ab04a15aa15179d73a7ef5a886ac8a06af484");
invocationScript = string(invocationScript.rbegin(), invocationScript.rend());
EXPECT_EQ(verScript, hex(signer.sign(parse_hex(invocationScript))));
}
TEST(NEOAccount, validity) {
auto hexPrvKey = "4646464646464646464646464646464646464646464646464646464646464646";
auto hexPubKey = "031bec1250aa8f78275f99a6663688f31085848d0ed92f1203e447125f927b7486";
auto signer = Signer(PrivateKey(parse_hex(hexPrvKey)));
auto prvKey = signer.getPrivateKey();
auto pubKey = signer.getPublicKey();
EXPECT_EQ(hexPrvKey, hex(prvKey.bytes));
EXPECT_EQ(hexPubKey, hex(pubKey.bytes));
}
TEST(NEOSigner, SigningTransaction) {
auto signer = Signer(PrivateKey(parse_hex("F18B2F726000E86B4950EBEA7BFF151F69635951BC4A31C44F28EE6AF7AEC128")));
auto transaction = Transaction();
transaction.type = TransactionType::TT_ContractTransaction;
transaction.version = 0x00;
CoinReference coin;
coin.prevHash = load(parse_hex("9c85b39cd5677e2bfd6bf8a711e8da93a2f1d172b2a52c6ca87757a4bccc24de")); //reverse hash
coin.prevIndex = (uint16_t) 1;
transaction.inInputs.push_back(coin);
{
TransactionOutput out;
out.assetId = load(parse_hex("9b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc5"));
out.value = (int64_t) 1 * 100000000;
auto scriptHash = TW::NEO::Address("Ad9A1xPbuA5YBFr1XPznDwBwQzdckAjCev").toScriptHash();
out.scriptHash = load(scriptHash);
transaction.outputs.push_back(out);
}
{
TransactionOutput out;
out.assetId = load(parse_hex("9b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc5"));
out.value = (int64_t) 892 * 100000000;
auto scriptHash = TW::NEO::Address("AdtSLMBqACP4jv8tRWwyweXGpyGG46eMXV").toScriptHash();
out.scriptHash = load(scriptHash);
transaction.outputs.push_back(out);
}
signer.sign(transaction);
auto signedTx = transaction.serialize();
EXPECT_EQ(hex(signedTx), "800000019c85b39cd5677e2bfd6bf8a711e8da93a2f1d172b2a52c6ca87757a4bccc24de0100029b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500e1f50500000000ea610aa6db39bd8c8556c9569d94b5e5a5d0ad199b7cffdaa674beae0f930ebe6085af9093e5fe56b34a5c220ccdcf6efc336fc500fcbbc414000000f2908c7efc0c9e43ffa7e79170ba37e501e1b4ac0141405046619c8e20e1fdeec92ce95f3019f6e7cc057294eb16b2d5e55c105bf32eb27e1fc01c1858576228f1fef8c0945a8ad69688e52a4ed19f5b85f5eff7e961d7232102a41c2aea8568864b106553729d32b1317ec463aa23e7a3521455d95992e17a7aac");
}
| 50.435294 | 557 | 0.804759 | vladyslav-iosdev |
6f3bb303fa102a3d1d56cb85f9716134248a368d | 7,012 | cc | C++ | avionics/common/novatel_serial_test.cc | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 1,178 | 2020-09-10T17:15:42.000Z | 2022-03-31T14:59:35.000Z | avionics/common/novatel_serial_test.cc | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 1 | 2020-05-22T05:22:35.000Z | 2020-05-22T05:22:35.000Z | avionics/common/novatel_serial_test.cc | leozz37/makani | c94d5c2b600b98002f932e80a313a06b9285cc1b | [
"Apache-2.0"
] | 107 | 2020-09-10T17:29:30.000Z | 2022-03-18T09:00:14.000Z | // Copyright 2020 Makani Technologies LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdint.h>
#include <string.h>
#include <gtest/gtest.h>
extern "C" {
#include "avionics/common/novatel_serial.h"
#include "avionics/common/novatel_types.h"
#include "avionics/common/serial_parse.h"
#include "common/macros.h"
} // extern "C"
namespace {
static const uint8_t kBestXyzBinaryData[] = {
0xAA, 0x44, 0x12, 0x1C, 0xF1, 0x00, 0x02, 0x40, 0x70, 0x00, 0x00, 0x00,
0xA6, 0x14, 0x00, 0x00, 0xD4, 0x32, 0x08, 0x00, 0x00, 0x00, 0x4C, 0x00,
0x21, 0xD8, 0x9E, 0x18, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xFD, 0x4D, 0xE6
};
static const uint8_t kBestXyzAsciiData[] = {
"#BESTXYZA,COM1,0,55.0,FINESTEERING,1419,340033.000,00000040,d821,2724;"
"SOL_COMPUTED,NARROW_INT,-1634531.5683,-3664618.0326,4942496.3270,"
"0.0099,0.0219,0.0115,SOL_COMPUTED,NARROW_INT,0.0011,-0.0049,-0.0001,"
"0.0199,0.0439,0.0230,\"AAAA\",0.250,1.000,0.000,12,11,11,11,0,01,0,33"
"*e9eafeca\r"
};
static const uint8_t kLogCommand[] = {
0xAA, 0x44, 0x12, 0x1C, 0x01, 0x00, 0x02, 0x40, 0x20, 0x00, 0x00, 0x00,
0x1D, 0x1D, 0x00, 0x00, 0x29, 0x16, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x00,
0x55, 0x52, 0x5A, 0x80, 0x20, 0x00, 0x00, 0x00, 0x2A, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x23, 0x04, 0xB3, 0xF1
};
void InitTest(SerialReceiveBuffer *buffer, NovAtelReceive *rx) {
memset(rx, 0, sizeof(*rx));
SerialParseInit(buffer);
}
void RunTest(int32_t length, const uint8_t *data, SerialReceiveBuffer *buffer,
NovAtelReceive *rx) {
for (int32_t i = 0; i < length; ++i) {
SerialReadData(1, &data[i], buffer);
bool expected = (i + 1 == length);
bool new_message = NovAtelParse(buffer, rx);
EXPECT_EQ(expected, new_message);
}
}
} // namespace
TEST(NovAtelParseMessage, Command) {
NovAtelReceive rx;
SerialReceiveBuffer buffer;
InitTest(&buffer, &rx);
RunTest(ARRAYSIZE(kLogCommand), kLogCommand, &buffer, &rx);
EXPECT_EQ(rx.binary.header.header_length, 28);
EXPECT_EQ(rx.binary.header.message_length, 32);
EXPECT_EQ(rx.binary.header.message_id, kNovAtelMessageIdLog);
EXPECT_EQ(rx.binary.header.format, kNovAtelFormatBinary);
EXPECT_EQ(rx.binary.header.port, kNovAtelPortCom2);
EXPECT_EQ(rx.binary.header.response, kNovAtelResponseNone);
EXPECT_EQ(rx.binary.header.timestamp.time_status, 29);
EXPECT_EQ(rx.binary.header.timestamp.week, 0);
EXPECT_EQ(rx.binary.header.timestamp.tow, 5673);
EXPECT_EQ(rx.binary.header.sequence, 0);
EXPECT_EQ(rx.binary.header.idle_time, 29);
EXPECT_EQ(rx.binary.header.receiver_status, 0x4C0000);
EXPECT_EQ(rx.binary.header.receiver_sw_version, 0x805A);
}
TEST(NovAtelReceive, Binary) {
NovAtelReceive rx;
SerialReceiveBuffer buffer;
InitTest(&buffer, &rx);
RunTest(ARRAYSIZE(kBestXyzBinaryData), kBestXyzBinaryData, &buffer, &rx);
EXPECT_EQ(kNovAtelProtoBinary, rx.proto);
EXPECT_EQ(kNovAtelMessageIdBestXyz, rx.binary.header.message_id);
EXPECT_EQ(kNovAtelFormatBinary, rx.binary.header.format);
EXPECT_EQ(rx.binary.header.header_length, 28);
EXPECT_EQ(rx.binary.header.message_length, 112);
EXPECT_EQ(rx.binary.header.message_id, kNovAtelMessageIdBestXyz);
EXPECT_EQ(rx.binary.header.format, kNovAtelFormatBinary);
EXPECT_EQ(rx.binary.header.port, kNovAtelPortCom2);
EXPECT_EQ(rx.binary.header.response, kNovAtelResponseNone);
EXPECT_EQ(rx.binary.header.timestamp.time_status, 20);
EXPECT_EQ(rx.binary.header.timestamp.week, 0);
EXPECT_EQ(rx.binary.header.timestamp.tow, 537300);
EXPECT_EQ(rx.binary.header.sequence, 0);
EXPECT_EQ(rx.binary.header.idle_time, 166);
EXPECT_EQ(rx.binary.header.receiver_status, 0x4C0000);
EXPECT_EQ(rx.binary.header.receiver_sw_version, 0x189E);
}
TEST(NovAtelReceive, Ascii) {
NovAtelReceive rx;
SerialReceiveBuffer buffer;
InitTest(&buffer, &rx);
RunTest(ARRAYSIZE(kBestXyzAsciiData) - 1, kBestXyzAsciiData, &buffer, &rx);
EXPECT_EQ(kNovAtelProtoAscii, rx.proto);
EXPECT_EQ(38, rx.ascii.fields);
EXPECT_EQ(10, rx.ascii.header_fields);
// Verify first field.
int32_t field_length, field_start;
NovAtelAsciiGetField(&rx, 0, &field_length, &field_start);
EXPECT_EQ(field_start, 0);
EXPECT_EQ(field_length, 9);
EXPECT_EQ(memcmp("#BESTXYZA", &rx.data[field_start], field_length), 0);
// Verify second field.
NovAtelAsciiGetField(&rx, 1, &field_length, &field_start);
EXPECT_EQ(field_start, 10);
EXPECT_EQ(field_length, 4);
EXPECT_EQ(memcmp("COM1", &rx.data[field_start], field_length), 0);
// Verify last field.
NovAtelAsciiGetField(&rx, rx.ascii.fields - 1, &field_length, &field_start);
EXPECT_EQ(field_start, 268);
EXPECT_EQ(field_length, 2);
EXPECT_EQ(memcmp("33", &rx.data[field_start], field_length), 0);
// Verify invalid field.
NovAtelAsciiGetField(&rx, rx.ascii.fields, &field_length, &field_start);
EXPECT_EQ(field_start, 0);
EXPECT_EQ(field_length, 0);
}
TEST(NovAtelReceive, MixedBinaryAndAscii) {
NovAtelReceive rx;
SerialReceiveBuffer buffer;
InitTest(&buffer, &rx);
// Ascii.
RunTest(ARRAYSIZE(kBestXyzAsciiData) - 1, kBestXyzAsciiData, &buffer, &rx);
// Ascii -> binary.
RunTest(ARRAYSIZE(kBestXyzBinaryData), kBestXyzBinaryData, &buffer, &rx);
// Binary -> ascii.
RunTest(ARRAYSIZE(kBestXyzAsciiData) - 1, kBestXyzAsciiData, &buffer, &rx);
// Ascii -> ascii.
RunTest(ARRAYSIZE(kBestXyzAsciiData) - 1, kBestXyzAsciiData, &buffer, &rx);
// Ascii -> binary.
RunTest(ARRAYSIZE(kBestXyzBinaryData), kBestXyzBinaryData, &buffer, &rx);
// Binary -> binary.
RunTest(ARRAYSIZE(kBestXyzBinaryData), kBestXyzBinaryData, &buffer, &rx);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 37.902703 | 78 | 0.723474 | leozz37 |
6f3fd83769469def7e39feeb43f9bec6bb6d4790 | 2,350 | cpp | C++ | lib/frame_window_filtering/disparity_morphology.cpp | itko/scanbox | 9a00c11eafb4cc2faa69bfcc76bdf0d8e295dcf3 | [
"BSD-3-Clause"
] | 1 | 2020-01-09T09:30:23.000Z | 2020-01-09T09:30:23.000Z | lib/frame_window_filtering/disparity_morphology.cpp | itko/scanbox | 9a00c11eafb4cc2faa69bfcc76bdf0d8e295dcf3 | [
"BSD-3-Clause"
] | 23 | 2018-03-19T20:54:52.000Z | 2018-05-16T12:36:59.000Z | lib/frame_window_filtering/disparity_morphology.cpp | itko/scanbox | 9a00c11eafb4cc2faa69bfcc76bdf0d8e295dcf3 | [
"BSD-3-Clause"
] | 1 | 2018-03-14T20:00:43.000Z | 2018-03-14T20:00:43.000Z | /// \file
/// Maintainer: Felice Serena
///
///
#include "disparity_morphology.h"
#include <boost/log/trivial.hpp>
#include <iostream>
#include <opencv2/core/eigen.hpp>
#include <opencv2/imgproc/imgproc.hpp>
namespace MouseTrack {
FrameWindow DisparityMorphology::operator()(const FrameWindow &window) const {
FrameWindow result = window;
int op = opencvOperation();
cv::Mat kernel = getStructuringElement(
opencvKernelShape(), cv::Size(2 * diameter() + 1, 2 * diameter() + 1),
cv::Point(diameter(), diameter()));
for (size_t i = 0; i < window.frames().size(); ++i) {
Frame &f = result.frames()[i];
auto &disp = f.normalizedDisparityMap;
cv::Mat raw, processed;
cv::eigen2cv(disp, raw);
cv::morphologyEx(raw, processed, op, kernel);
cv::cv2eigen(processed, f.normalizedDisparityMap);
}
return result;
}
int DisparityMorphology::diameter() const { return _diameter; }
void DisparityMorphology::diameter(int _new) { _diameter = _new; }
DisparityMorphology::Morph DisparityMorphology::operation() const {
return _operation;
}
void DisparityMorphology::operation(Morph _new) { _operation = _new; }
DisparityMorphology::KernelShape DisparityMorphology::kernelShape() const {
return _kernelShape;
}
void DisparityMorphology::kernelShape(KernelShape _new) { _kernelShape = _new; }
int DisparityMorphology::opencvOperation() const {
switch (operation()) {
case Morph::open:
return cv::MORPH_OPEN;
case Morph::close:
return cv::MORPH_CLOSE;
default:
BOOST_LOG_TRIVIAL(warning)
<< "Unexpected value for morphology operation encountered "
<< operation() << ". Please add to switch statement.";
throw "Unexpected morphology operation encountered, please add to switch "
"statement.";
}
}
int DisparityMorphology::opencvKernelShape() const {
switch (kernelShape()) {
case KernelShape::rect:
return cv::MORPH_RECT;
case KernelShape::ellipse:
return cv::MORPH_ELLIPSE;
case KernelShape::cross:
return cv::MORPH_CROSS;
default:
BOOST_LOG_TRIVIAL(warning)
<< "Unexpected value for morphology kernel shape encountered "
<< operation() << ". Please add to switch statement.";
throw "Unexpected morphology kernel shape encountered, please add to "
"switch statement.";
}
}
} // namespace MouseTrack
| 30.519481 | 80 | 0.701277 | itko |
6f4713c130917dcea35d3d2c842b4dc3b0f5e7a3 | 2,833 | cpp | C++ | src/services/svc-mdns.cpp | RDobrinov/espurna32 | b0bcf5bb80324e3c96a8a7f756014804b618730e | [
"NTP",
"Unlicense"
] | null | null | null | src/services/svc-mdns.cpp | RDobrinov/espurna32 | b0bcf5bb80324e3c96a8a7f756014804b618730e | [
"NTP",
"Unlicense"
] | null | null | null | src/services/svc-mdns.cpp | RDobrinov/espurna32 | b0bcf5bb80324e3c96a8a7f756014804b618730e | [
"NTP",
"Unlicense"
] | null | null | null | /*
MDNS MODULE
Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
*/
// -----------------------------------------------------------------------------
// mDNS Server
// -----------------------------------------------------------------------------
#include "config/hardware.h"
#if MDNS_SERVER_SUPPORT
#include <ESPmDNS.h>
#include "espurna32.hpp"
#include "config/version.h"
#if MQTT_SUPPORT
void _mdnsFindMQTT() {
int count = MDNS.queryService("mqtt", "tcp");
DEBUG_MSG_P(PSTR("[MQTT] MQTT brokers found: %d\n"), count);
for (int i=0; i<count; i++) {
DEBUG_MSG_P(PSTR("[MQTT] Broker at %s:%d\n"), MDNS.IP(i).toString().c_str(), MDNS.port(i));
mqttSetBrokerIfNone(MDNS.IP(i), MDNS.port(i));
}
}
#endif
void _mdnsServerStart() {
if (MDNS.begin((char *) getSetting("hostname").c_str())) {
DEBUG_MSG_P(PSTR("[MDNS] Service is ready\n"));
} else {
DEBUG_MSG_P(PSTR("[MDNS] Service FAIL\n"));
}
}
// -----------------------------------------------------------------------------
void _mdnsServerServices() {
#if WEB_SUPPORT
MDNS.addService("http", "tcp", getSetting("webPort", WEB_PORT).toInt());
#endif
#if TELNET_SUPPORT
MDNS.addService("telnet", "tcp", TELNET_PORT);
#endif
// Public ESPurna related txt for OTA discovery
MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME);
MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION);
MDNS.addServiceTxt("arduino", "tcp", "build_date", buildTime());
MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress());
MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName());
{
char buffer[6] = {0};
itoa(spi_flash_get_chip_size() / 1024, buffer, 10);
MDNS.addServiceTxt("arduino", "tcp", "mem_size", (const char *) buffer);
}
{
char buffer[6] = {0};
itoa(ESP.getFlashChipSize() / 1024, buffer, 10);
MDNS.addServiceTxt("arduino", "tcp", "sdk_size", (const char *) buffer);
}
{
char buffer[6] = {0};
itoa(ESP.getFreeSketchSpace(), buffer, 10);
MDNS.addServiceTxt("arduino", "tcp", "free_space", (const char *) buffer);
}
}
void mdnsServerSetup()
{
wifiRegister([](justwifi_messages_t code, char * parameter) {
if (code == MESSAGE_CONNECTED) {
_mdnsServerStart();
_mdnsServerServices();
#if MQTT_SUPPORT
_mdnsFindMQTT();
#endif // MQTT_SUPPORT
}
if (code == MESSAGE_ACCESSPOINT_CREATED) {
_mdnsServerStart();
_mdnsServerServices();
}
if ( (code == MESSAGE_ACCESSPOINT_DESTROYED) || (code == MESSAGE_DISCONNECTED) )
MDNS.end();
});
}
#endif // MDNS_SERVER_SUPPORT | 27.504854 | 99 | 0.549594 | RDobrinov |
6f4b12abd36a6e78d7c1c194358d03b9974b8ade | 1,085 | cpp | C++ | LeetCode/680.valid_palindrome_2.cpp | PieroNarciso/cprogramming | d3a53ce2afce6f853e0b7cc394190d5be6427902 | [
"MIT"
] | 2 | 2021-05-22T17:47:01.000Z | 2021-05-27T17:10:58.000Z | LeetCode/680.valid_palindrome_2.cpp | PieroNarciso/cprogramming | d3a53ce2afce6f853e0b7cc394190d5be6427902 | [
"MIT"
] | null | null | null | LeetCode/680.valid_palindrome_2.cpp | PieroNarciso/cprogramming | d3a53ce2afce6f853e0b7cc394190d5be6427902 | [
"MIT"
] | null | null | null | #include <iostream>
using namespace std;
bool validPalindrome(string s) {
if (s.size() <= 1) return true;
int start = 0;
int end = s.size() - 1;
int count = 0;
while (start < end && count <= 1) {
if (s[start] != s[end]) {
end--;
count++;
} else if (s[start] == s[end]) {
end--;
start++;
}
}
if (count <= 1) {
return true;
} else {
start = 0;
end = s.size() - 1;
count = 0;
while (start < end && count <= 1) {
if (s[start] != s[end]) {
start++;
count++;
} else if (s[start] == s[end]) {
end--;
start++;
}
}
if (count <= 1) return true;
return false;
}
}
int main(int argc, const char** argv) {
cout << validPalindrome("aba") << " " << true << endl;
cout << validPalindrome("abca") << " " << true << endl;
cout << validPalindrome("abc") << " " << false << endl;
cout << validPalindrome("a") << " " << true << endl;
cout << validPalindrome("racecar") << " " << true << endl;
cout << validPalindrome("rececab") << " " << false << endl;
cout << validPalindrome("deeeee") << " " << true << endl;
return 0;
}
| 21.7 | 60 | 0.517972 | PieroNarciso |
6f4d1b8a026c8333c161f9cfc4a43f3bfd437630 | 5,603 | hpp | C++ | src/core/Patchwork.hpp | tfwu/AOGDetector | 296bdeefa3e111596ea824396203d15c5c0c4577 | [
"MIT"
] | 33 | 2016-01-11T22:42:41.000Z | 2020-12-27T17:19:26.000Z | src/core/Patchwork.hpp | mrgloom/AOGDetector | 296bdeefa3e111596ea824396203d15c5c0c4577 | [
"MIT"
] | null | null | null | src/core/Patchwork.hpp | mrgloom/AOGDetector | 296bdeefa3e111596ea824396203d15c5c0c4577 | [
"MIT"
] | 16 | 2015-11-15T14:48:28.000Z | 2021-09-16T12:59:07.000Z | // This file is adapted from FFLDv2 (the Fast Fourier Linear Detector version 2)
// Copyright (c) 2013 Idiap Research Institute, <http://www.idiap.ch/>
// Written by Charles Dubout <charles.dubout@idiap.ch>
#ifndef RGM_PATCHWORK_HPP_
#define RGM_PATCHWORK_HPP_
#include <utility>
extern "C" {
#include <fftw3.h>
}
#include "FeaturePyramid.hpp"
#include "Rectangle.hpp"
namespace RGM
{
/// The Patchwork class computes full convolutions much faster using FFT
class Patchwork
{
public:
/// Type of a patchwork plane cell (fixed-size complex vector of size NbFeatures).
typedef Eigen::Array<CScalar, FeaturePyramid::NbFeatures, 1> Cell;
/// Type of a patchwork plane (matrix of cells).
typedef Eigen::Matrix<Cell, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Plane;
/// Type of a patchwork filter (plane + original filter size).
typedef std::pair<Plane, std::pair<int, int> > Filter;
#if RGM_USE_PCA_DIM
typedef Eigen::Array<CScalar, FeaturePyramid::NbPCAFeatures, 1> PCACell;
typedef Eigen::Matrix<PCACell, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> PCAPlane;
typedef std::pair<PCAPlane, std::pair<int, int> > PCAFilter;
#endif
/// Constructs an empty patchwork. An empty patchwork has no plane.
Patchwork();
/// Constructs a patchwork from a pyramid.
/// @param[in] pyramid The pyramid of features.
/// @param[in] withPCA The setting for applying PCA projected features: 0 - no pca, 1 - only pca, 2 - both
/// @note If the pyramid is larger than the last maxRows and maxCols passed to the Init method
/// the Patchwork will be empty.
/// @note Assumes that the features of the pyramid levels are zero in the padded regions but for
/// the last feature, which is assumed to be one.
Patchwork(const FeaturePyramid & pyramid, int withPCA=0);
/// Returns the amount of horizontal zero padding (in cells).
int padx() const;
/// Returns the amount of vertical zero padding (in cells).
int pady() const;
/// Returns the number of levels per octave in the pyramid.
int interval() const;
/// Returns whether the patchwork is empty. An empty patchwork has no plane.
bool empty() const;
/// Returns the convolutions of the patchwork with filters (useful to compute the SVM margins).
/// @param[in] filters The filters.
/// @param[out] convolutions The convolutions (filters x levels).
void convolve(const std::vector<Filter *> & filters,
std::vector<std::vector<Matrix> > & convolutions) const;
/// Initializes the FFTW library.
/// @param[in] maxRows Maximum number of rows of a pyramid level (including padding).
/// @param[in] maxCols Maximum number of columns of a pyramid level (including padding).
/// @param[in] withPCA The setting for applying PCA projected features: 0 - no pca, 1 - only pca, 2 - both
/// @returns Whether the initialization was successful.
/// @note Must be called before any other method (including constructors).
static bool InitFFTW(int maxRows, int maxCols, int withPCA=0);
/// Returns the current maximum number of rows of a pyramid level (including padding).
static int MaxRows();
/// Returns the current maximum number of columns of a pyramid level (including padding).
static int MaxCols();
/// Returns a transformed version of a filter to be used by the @c convolve method.
/// @param[in] filter Filter to transform.
/// @param[out] result Transformed filter.
/// @note If Init was not already called or if the filter is larger than the last maxRows and
/// maxCols passed to the Init method the result will be empty.
static void TransformFilter(const FeaturePyramid::Level & filter, Filter & result);
#if RGM_USE_PCA_DIM
bool emptyPCA() const;
void convolve(const std::vector<PCAFilter *> & filters,
std::vector<std::vector<Matrix> > & convolutions) const;
static void TransformPCAFilter(const FeaturePyramid::PCALevel & filter, PCAFilter & result);
#endif
private:
#if RGM_USE_PCA_DIM
static bool InitFFTWForPCA(int maxRows, int maxCols);
#endif
int padx_;
int pady_;
int interval_;
std::vector<std::pair<Rectangle2i, int> > rectangles_;
std::vector<Plane> planes_;
#if RGM_USE_PCA_DIM
std::vector<PCAPlane> PCAplanes_;
#endif
static int MaxRows_;
static int MaxCols_;
static int HalfCols_;
#ifndef RGM_USE_DOUBLE
static fftwf_plan Forwards_;
static fftwf_plan Inverse_;
#if RGM_USE_PCA_DIM
static fftwf_plan PCAForwards_;
static fftwf_plan PCAInverse_;
#endif
#else
static fftw_plan Forwards_;
static fftw_plan Inverse_;
#if RGM_USE_PCA_DIM
static fftw_plan PCAForwards_;
static fftw_plan PCAInverse_;
#endif
#endif
}; // class Patchwork
} // namespace RGM
// Some compilers complain about the lack of a NumTraits for Eigen::Array<CScalar, NbFeatures, 1>
namespace Eigen
{
template <>
struct NumTraits<Array<RGM::CScalar, RGM::FeaturePyramid::NbFeatures, 1> > :
GenericNumTraits<Array<RGM::CScalar, RGM::FeaturePyramid::NbFeatures, 1> > {
static inline RGM::Scalar dummy_precision()
{
return 0; // Never actually called
}
};
#if RGM_USE_PCA_DIM
template <>
struct NumTraits<Array<RGM::CScalar, RGM::FeaturePyramid::NbPCAFeatures, 1> > :
GenericNumTraits<Array<RGM::CScalar, RGM::FeaturePyramid::NbPCAFeatures, 1> > {
static inline RGM::Scalar dummy_precision()
{
return 0; // Never actually called
}
};
#endif
} // namespace Eigen
#endif // RGM_PATCHWORK_HPP_
| 33.957576 | 110 | 0.704087 | tfwu |
6f50be38d8770d3ad439f2ea51b41e2d8226c20f | 542 | cpp | C++ | Week06/smartPointer.cpp | Stoefff/Object-Oriented-Programming-FMI-2017 | d2f8083ff146fb3cc68425cbd9af50bc37581e19 | [
"MIT"
] | 3 | 2018-03-05T13:57:56.000Z | 2018-05-03T19:25:05.000Z | Week06/smartPointer.cpp | Stoefff/Object-Oriented-Programming-FMI-2017 | d2f8083ff146fb3cc68425cbd9af50bc37581e19 | [
"MIT"
] | null | null | null | Week06/smartPointer.cpp | Stoefff/Object-Oriented-Programming-FMI-2017 | d2f8083ff146fb3cc68425cbd9af50bc37581e19 | [
"MIT"
] | null | null | null | #include <iostream>
class SmartPointer {
private:
int *ptr;
int size;
public:
explicit SmartPointer(int *iPtr, int size = 0);
int* getPtr();
int getSize();
~SmartPointer();
};
SmartPointer::SmartPointer(int * iPtr, int size)
:ptr(iPtr),
size(size) {}
// For arrays
SmartPointer::~SmartPointer(){
delete[] ptr;
}
int* SmartPointer::getPtr (){
return ptr;
}
int SmartPointer::getSize(){
return size;
}
int main(){
if(1 == 1){
SmartPointer p(new int[20], 20);
}
return 0;
}
| 14.263158 | 51 | 0.594096 | Stoefff |
6f50dcb029533d6a5bb839531080442a5a15c2d8 | 1,627 | cpp | C++ | network/lib/config/peer/HbGeneralClientConfig.cpp | hasboeuf/hb | d812f2ef56d7c79983701f1f673ce666b189b638 | [
"MIT"
] | 1 | 2019-03-23T22:41:16.000Z | 2019-03-23T22:41:16.000Z | network/lib/config/peer/HbGeneralClientConfig.cpp | hasboeuf/hb | d812f2ef56d7c79983701f1f673ce666b189b638 | [
"MIT"
] | null | null | null | network/lib/config/peer/HbGeneralClientConfig.cpp | hasboeuf/hb | d812f2ef56d7c79983701f1f673ce666b189b638 | [
"MIT"
] | null | null | null | // Local
#include <config/peer/HbGeneralClientConfig.h>
using namespace hb::network;
HbGeneralClientConfig::HbGeneralClientConfig(const HbGeneralClientConfig& config) : HbGeneralConfig(config) {
if (this != &config) {
mAuthConfig = config.mAuthConfig;
mChannelConfig = config.mChannelConfig;
mPresenceConfig = config.mPresenceConfig;
}
}
HbGeneralClientConfig& HbGeneralClientConfig::operator=(const HbGeneralClientConfig& config) {
if (this != &config) {
HbGeneralConfig::operator=(config);
mAuthConfig = config.mAuthConfig;
mChannelConfig = config.mChannelConfig;
mPresenceConfig = config.mPresenceConfig;
}
return *this;
}
bool HbGeneralClientConfig::isValid() const {
if (HbGeneralConfig::isValid()) {
if (!mAuthConfig.isValid())
return false;
if (!mChannelConfig.isValid())
return false;
if (!mPresenceConfig.isValid())
return false;
return true;
}
return false;
}
HbServiceAuthClientConfig& HbGeneralClientConfig::auth() {
return mAuthConfig;
}
HbServiceChannelClientConfig& HbGeneralClientConfig::channel() {
return mChannelConfig;
}
HbServicePresenceClientConfig& HbGeneralClientConfig::presence() {
return mPresenceConfig;
}
const HbServiceAuthClientConfig& HbGeneralClientConfig::auth() const {
return mAuthConfig;
}
const HbServiceChannelClientConfig& HbGeneralClientConfig::channel() const {
return mChannelConfig;
}
const HbServicePresenceClientConfig& HbGeneralClientConfig::presence() const {
return mPresenceConfig;
}
| 25.825397 | 109 | 0.712354 | hasboeuf |
6f534a2bc172a3dc5c80a02a292e44e0f461e39b | 5,748 | cpp | C++ | RLSimion/Common/named-var-set.cpp | xcillero001/SimionZoo | b343b08f3356e1aa230d4132b0abb58aac4c5e98 | [
"MIT"
] | 1 | 2019-02-21T10:40:28.000Z | 2019-02-21T10:40:28.000Z | RLSimion/Common/named-var-set.cpp | JosuGom3z/SimionZoo | b343b08f3356e1aa230d4132b0abb58aac4c5e98 | [
"MIT"
] | null | null | null | RLSimion/Common/named-var-set.cpp | JosuGom3z/SimionZoo | b343b08f3356e1aa230d4132b0abb58aac4c5e98 | [
"MIT"
] | null | null | null | #include "named-var-set.h"
#include "wire.h"
#include "wire-handler.h"
#include <algorithm>
#include <stdexcept>
#include "../../tools/System/CrossPlatform.h"
using namespace std;
NamedVarProperties::NamedVarProperties()
{
CrossPlatform::Strcpy_s(m_name, VAR_NAME_MAX_LENGTH, "N/A");
CrossPlatform::Strcpy_s(m_units, VAR_NAME_MAX_LENGTH, "N/A");
m_min = std::numeric_limits<double>::lowest();
m_max = std::numeric_limits<double>::max();
}
NamedVarProperties::NamedVarProperties(const char* name, const char* units, double min, double max, bool bCircular)
{
CrossPlatform::Sprintf_s(m_name, VAR_NAME_MAX_LENGTH, name);
CrossPlatform::Sprintf_s(m_units, VAR_NAME_MAX_LENGTH, units);
m_min = min;
m_max = max;
m_bCircular = bCircular; //default value
}
void NamedVarProperties::setName(const char* name)
{
CrossPlatform::Strcpy_s(m_name, VAR_NAME_MAX_LENGTH, name);
}
NamedVarProperties* Descriptor::getProperties(const char* name)
{
for (size_t i = 0; i<m_descriptor.size(); i++)
{
if (strcmp(m_descriptor[i]->getName(), name) == 0)
return m_descriptor[i];
}
//check if a wire with that name exists
Wire* pWire = m_pWireHandler->wireGet(name);
if (pWire != nullptr)
{
NamedVarProperties* pProperties = pWire->getProperties();
if (pProperties==nullptr)
return &wireDummyProperties;
return pProperties;
}
else
throw std::runtime_error("Wrong variable name given to Descriptor::getVarIndex()");
}
size_t Descriptor::addVariable(const char* name, const char* units, double min, double max, bool bCircular)
{
size_t index = (int) m_descriptor.size();
m_descriptor.push_back(new NamedVarProperties(name, units, min, max, bCircular));
return index;
}
NamedVarSet* Descriptor::getInstance()
{
NamedVarSet* pNew = new NamedVarSet(*this);
return pNew;
}
NamedVarSet::NamedVarSet(Descriptor& descriptor): m_descriptor(descriptor)
{
//m_descriptor= new NamedVarProperties[numVars];
m_pValues= new double[descriptor.size()];
for (size_t i = 0; i < descriptor.size(); i++)
m_pValues[i] = 0.0;
m_numVars= (int)descriptor.size();
}
NamedVarSet::~NamedVarSet()
{
if (m_pValues) delete [] m_pValues;
}
NamedVarProperties* NamedVarSet::getProperties(const char* varName) const
{
return m_descriptor.getProperties(varName);
}
double NamedVarSet::normalize(const char* varName, double value) const
{
NamedVarProperties* pProperties = getProperties(varName);
double range = std::max(0.01, pProperties->getRangeWidth());
return (value - pProperties->getMin()) / range;
}
double NamedVarSet::denormalize(const char* varName, double value) const
{
NamedVarProperties* pProperties = getProperties(varName);
double range = pProperties->getRangeWidth();
return pProperties->getMin() + value * range;
}
void NamedVarSet::setNormalized(const char* varName, double value)
{
double denormalizedValue = denormalize(varName, value);
set(varName, denormalizedValue);
}
void NamedVarSet::set(const char* varName, double value)
{
for (size_t i = 0; i < m_descriptor.size(); i++)
{
if (!strcmp(m_descriptor[i].getName(), varName))
{
set(i, value);
return;
}
}
//check if a wire with that name exists
WireHandler* pWireHandler = m_descriptor.getWireHandler();
if (pWireHandler != nullptr)
{
Wire* pWire = pWireHandler->wireGet(varName);
if (pWire != nullptr)
pWire->setValue(value);
else
throw std::runtime_error("Incorrect variable name in NamedVarSet::set()");
}
else
throw std::runtime_error("Incorrect variable name in NamedVarSet::set()");
}
void NamedVarSet::set(size_t i, double value)
{
if (i >= 0 && i < m_numVars)
{
if (!m_descriptor[i].isCircular())
{
m_pValues[i] = std::min(m_descriptor[i].getMax()
, std::max(m_descriptor[i].getMin(), value));
}
else
{
if (value > m_descriptor[i].getMax())
value -= m_descriptor[i].getRangeWidth();
else if (value < m_descriptor[i].getMin())
value += m_descriptor[i].getRangeWidth();
m_pValues[i] = value;
}
}
else throw std::runtime_error("Incorrect variable index in NamedVarSet::set()");
}
double NamedVarSet::getNormalized(const char* varName) const
{
return normalize(varName, get(varName));
}
double NamedVarSet::get(size_t i) const
{
if (i >= 0 && i<m_numVars)
return m_pValues[i];
throw std::runtime_error("Incorrect variable index in NamedVarSet::get()");
}
double NamedVarSet::get(const char* varName) const
{
for (size_t i = 0; i < m_descriptor.size(); i++)
{
if (!strcmp(m_descriptor[i].getName(), varName))
return m_pValues[i];
}
WireHandler* pWireHandler = m_descriptor.getWireHandler();
if (pWireHandler != nullptr)
{
Wire* pWire= pWireHandler->wireGet(varName);
if (pWire != nullptr)
return pWire->getValue();
else
throw std::runtime_error("Incorrect variable name in NamedVarSet::get()");
}
else
throw std::runtime_error("Incorrect variable name in NamedVarSet::get()");
}
double* NamedVarSet::getValuePtr(size_t i)
{
if (i >= 0 && i<m_numVars)
return &m_pValues[i];
throw std::runtime_error("Incorrect variable index in NamedVarSet::getValuePtr()");
}
double& NamedVarSet::getRef(size_t i)
{
if (i >= 0 && i<m_numVars)
return m_pValues[i];
throw std::runtime_error("Incorrect variable index in NamedVarSet::getRef()");
}
double NamedVarSet::getSumValue() const
{
double sum = 0.0;
for (size_t i = 0; i < m_numVars; i++)
sum += m_pValues[i];
return sum;
}
void NamedVarSet::copy(const NamedVarSet* nvs)
{
if(m_numVars != nvs->getNumVars())
throw std::runtime_error("Missmatched array lenghts in NamedVarSet::copy()");
for (size_t i = 0; i<m_numVars; i++)
{
set(i, nvs->get(i));
}
}
void NamedVarSet::addOffset(double offset)
{
for (size_t i = 0; i<m_numVars; i++)
{
set(i, this->get(i) + offset);
}
} | 24.991304 | 115 | 0.709986 | xcillero001 |
6f53f478c54127fe674d24559593dc5fb5dd7e83 | 129 | cc | C++ | tensorflow-yolo-ios/dependencies/tensorflow/core/platform/posix/net.cc | initialz/tensorflow-yolo-face-ios | ba74cf39168d0128e91318e65a1b88ce4d65a167 | [
"MIT"
] | 27 | 2017-06-07T19:07:32.000Z | 2020-10-15T10:09:12.000Z | tensorflow-yolo-ios/dependencies/tensorflow/core/platform/posix/net.cc | initialz/tensorflow-yolo-face-ios | ba74cf39168d0128e91318e65a1b88ce4d65a167 | [
"MIT"
] | 3 | 2017-08-25T17:39:46.000Z | 2017-11-18T03:40:55.000Z | tensorflow-yolo-ios/dependencies/tensorflow/core/platform/posix/net.cc | initialz/tensorflow-yolo-face-ios | ba74cf39168d0128e91318e65a1b88ce4d65a167 | [
"MIT"
] | 10 | 2017-06-16T18:04:45.000Z | 2018-07-05T17:33:01.000Z | version https://git-lfs.github.com/spec/v1
oid sha256:3cc7fcb7f8a9a1e665dce3cb98580bd376e1c6dfd73287c5c623743400561d9b
size 3402
| 32.25 | 75 | 0.883721 | initialz |
6f547ad130111112210b243c95ec816c8ce6c908 | 774 | cpp | C++ | breeze/testing/brz/test_descriptor.cpp | gennaroprota/breeze | 7afe88a30dc8ac8b97a76a192dc9b189d9752e8b | [
"BSD-3-Clause"
] | 1 | 2021-04-03T22:35:52.000Z | 2021-04-03T22:35:52.000Z | breeze/testing/brz/test_descriptor.cpp | gennaroprota/breeze | f1dfd7154222ae358f5ece936c2897a3ae110003 | [
"BSD-3-Clause"
] | null | null | null | breeze/testing/brz/test_descriptor.cpp | gennaroprota/breeze | f1dfd7154222ae358f5ece936c2897a3ae110003 | [
"BSD-3-Clause"
] | 1 | 2021-10-01T04:26:48.000Z | 2021-10-01T04:26:48.000Z | // ===========================================================================
// Copyright 2016 Gennaro Prota
//
// Licensed under the 3-Clause BSD License.
// (See accompanying file 3_CLAUSE_BSD_LICENSE.txt or
// <https://opensource.org/licenses/BSD-3-Clause>.)
// ___________________________________________________________________________
#include "breeze/testing/test_descriptor.hpp"
namespace breeze_ns {
test_descriptor::test_descriptor( test_function f, char const * name )
: m_function( f ),
m_name( name )
{
}
test_descriptor::test_function
test_descriptor::function() const noexcept
{
return m_function ;
}
std::string
test_descriptor::name() const
{
return m_name ;
}
}
| 24.967742 | 78 | 0.609819 | gennaroprota |
6f57312f3537aadb073f47a64267fcc275297804 | 4,403 | cpp | C++ | Homework202001-master/Homework202001-master/4-13/ex2.cpp | smurf-1119/Cplusplus-homework | eff845e7d8018fc0db647ce642e68e2a230dae58 | [
"MIT"
] | null | null | null | Homework202001-master/Homework202001-master/4-13/ex2.cpp | smurf-1119/Cplusplus-homework | eff845e7d8018fc0db647ce642e68e2a230dae58 | [
"MIT"
] | null | null | null | Homework202001-master/Homework202001-master/4-13/ex2.cpp | smurf-1119/Cplusplus-homework | eff845e7d8018fc0db647ce642e68e2a230dae58 | [
"MIT"
] | null | null | null | #include <iostream>
using namespace std;
class HugeInteger
{
public:
HugeInteger();
HugeInteger(long long a);
HugeInteger add( HugeInteger a );
friend ostream &operator<<(ostream& ,HugeInteger a);
bool isEqualTo( HugeInteger a );
bool isNotEqualTo( HugeInteger a );
bool isGreaterThan(HugeInteger a );
bool isLessThan( HugeInteger a );
bool isGreaterThanOrEqualTo( HugeInteger a );
bool isLessThanOrEqualTo( HugeInteger a );
// addition operator; HugeInt + HugeInt
HugeInteger operator+( HugeInteger ) ;
// addition operator; HugeInteger + int
HugeInteger operator+( int ) ;
// addition operator;
// HugeInteger + string that represents large integer value
bool operator==( HugeInteger ) ; // equality operator
bool operator!=( HugeInteger ) ; // inequality operator
bool operator<( HugeInteger ) ; // less than operator
// less than or equal to operator
bool operator<=( HugeInteger ) ;
bool operator>( HugeInteger ) ; // greater than operator
// greater than or equal to operator
bool operator>=( HugeInteger ) ;
private:
int integer[ 40 ];
};
HugeInteger::HugeInteger(){
for(int i = 0; i < 40; i++){
integer[i] = 0;
}
};
HugeInteger::HugeInteger(long long a){
for(int i = 0; i < 40; i++){
integer[40-i-1] = a % 10;
a = (a - a % 10)/10;
}
};
HugeInteger HugeInteger::add( HugeInteger a ){
HugeInteger c;
for(int i = 0; i < 40; i++){
c.integer[i] = integer[i] + a.integer[i];
}
int up = 0;
for(int i = 39; i >= 0; i--){
c.integer[i] += up;
if (c.integer[i] > 9){
up = c.integer[i] / 10;
c.integer[i] %= 10;
}
else{
up = 0;
}
}
return c;
};
bool HugeInteger::isEqualTo( HugeInteger a ){
for(int i = 0; i < 40; i++){
if(integer[i] != a.integer[i]){
return 0;
}
}
return 1;
};
bool HugeInteger::isNotEqualTo( HugeInteger a ){
for(int i = 0; i < 40; i++){
if(integer[i] != a.integer[i]){
return 1;
}
}
return 0;
};
bool HugeInteger::isGreaterThan(HugeInteger a ){
if (isEqualTo(a) == 1){
return 0;
}
else{
for(int i = 0; i < 40; i++){
if(integer[i] > a.integer[i]){
return 1;
}
}
return 0;
}
};
bool HugeInteger::isLessThan( HugeInteger a ){
if (isEqualTo(a) == 1){
return 0;
}
else{
for(int i = 0; i < 40; i++){
if(integer[i] < a.integer[i]){
return 1;
}
}
return 0;
}
};
bool HugeInteger::isGreaterThanOrEqualTo( HugeInteger a ){
for(int i = 0; i < 40; i++){
if(integer[i] > a.integer[i]){
return 1;
}
}
return 0;
};
bool HugeInteger::isLessThanOrEqualTo( HugeInteger a ){
for(int i = 0; i < 40; i++){
if(integer[i] < a.integer[i]){
return 1;
}
}
return 0;
};
ostream &operator<<(ostream& output,HugeInteger a){
int k = 0;
for(int i = 0; i < 40; i++){
if (a.integer[i] != 0){
k = i;
break;
}
}
for(int j = k; j < 40; j++){
output << a.integer[j];
}
return output;
};
HugeInteger HugeInteger::operator+(HugeInteger a){
return add(a);
};
HugeInteger HugeInteger::operator+(int a){
long long b = (long long) a;
HugeInteger k(b);
return add(k);
};
bool HugeInteger::operator==(HugeInteger a){
return isEqualTo(a);
};
bool HugeInteger::operator!=(HugeInteger a){
return isNotEqualTo(a);
};
bool HugeInteger::operator<(HugeInteger a){
return isLessThan(a);
};
bool HugeInteger::operator<=(HugeInteger a){
return isLessThanOrEqualTo(a);
};
bool HugeInteger::operator>(HugeInteger a ){
return isGreaterThan(a);
};
bool HugeInteger::operator>=(HugeInteger a){
return isGreaterThanOrEqualTo(a);
};
int main(){
HugeInteger n1(7654321);
HugeInteger n2(7891234);
HugeInteger n3(99999999999999999);
HugeInteger n4(1);
HugeInteger n5(12341234);
HugeInteger n6(7888);
cout << "n1 is " << n1 <<endl;
cout << "n2 is " << n2 <<endl;
cout << "n3 is " << n3 <<endl;
cout << "n4 is " << n4 <<endl;
cout << "n5 is " << n5 <<endl;
cout << "n6 is " << n6 <<endl;
cout << "n1 is";
n1==n2?cout<<" ":cout <<" not ";
cout << "equal to n2" << endl;
cout << "n1 is";
n1<n2?cout<<" ":cout <<" not ";
cout << "less than n2" << endl;
cout << "n1 is";
n1<=n2?cout<<" ":cout <<" not ";
cout << "less than or equal to n2" << endl;
cout << n3 << " + " << n4 << " = " << n3 + n4 <<endl;
cout << n1 << " + " << "9" << " = " << n1 + 9 <<endl;
cout << n2 << " + " << "10000" << " = " << n2 + 10000 <<endl;
}
| 21.168269 | 65 | 0.590506 | smurf-1119 |
6f57428bf0bd4411a6145330befe70801d249d7a | 1,652 | cpp | C++ | DynamicProgramming/StrategicApproach/nth_tribonacci_number.cpp | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | DynamicProgramming/StrategicApproach/nth_tribonacci_number.cpp | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | DynamicProgramming/StrategicApproach/nth_tribonacci_number.cpp | mamoudmatook/Leetcode | 59fb1612ee648a9b99ff7cc779ada5656c01ecd2 | [
"MIT"
] | null | null | null | /*
* Created on Sun Dec 05 2021
*
* The MIT License (MIT)
* Copyright (c) 2021 Maatuq
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <vector>
#include <unordered_map>
using namespace std;
class Solution
{
private:
unordered_map<int, int> hmap_;
public:
int dp(int i)
{
if (i == 0)
{
return i;
}
if (i < 3)
{
return 1;
}
if (hmap_.find(i) == hmap_.end())
{
hmap_[i] = dp(i - 1) + dp(i - 2) + dp(i - 3);
}
return hmap_[i];
}
int tribonacci(int n)
{
return dp(n);
}
}; | 32.392157 | 123 | 0.659806 | mamoudmatook |
6f59ce012956abb6322c028101f43206f4ec15a5 | 2,671 | cpp | C++ | products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp | GravisZro/MuditaOS | 4230da15e69350c3ef9e742ec587e5f70154fabd | [
"BSL-1.0"
] | 369 | 2021-11-10T09:20:29.000Z | 2022-03-30T06:36:58.000Z | products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp | GravisZro/MuditaOS | 4230da15e69350c3ef9e742ec587e5f70154fabd | [
"BSL-1.0"
] | 149 | 2021-11-10T08:38:35.000Z | 2022-03-31T23:01:52.000Z | products/BellHybrid/apps/application-bell-settings/presenter/TimeUnitsPresenter.cpp | GravisZro/MuditaOS | 4230da15e69350c3ef9e742ec587e5f70154fabd | [
"BSL-1.0"
] | 41 | 2021-11-10T08:30:37.000Z | 2022-03-29T08:12:46.000Z | // Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "models/TemperatureUnitModel.hpp"
#include "presenter/TimeUnitsPresenter.hpp"
#include <common/layouts/HomeScreenLayouts.hpp>
#include <common/models/LayoutModel.hpp>
#include <appmgr/messages/ChangeHomescreenLayoutMessage.hpp>
#include <service-appmgr/Constants.hpp>
namespace app::bell_settings
{
TimeUnitsWindowPresenter::TimeUnitsWindowPresenter(
app::ApplicationCommon *app,
std::shared_ptr<TimeUnitsModel> pagesProvider,
std::unique_ptr<AbstractTemperatureUnitModel> temperatureUnitModel,
std::unique_ptr<AbstractLayoutModel> layoutModel)
: app{app}, pagesProvider(std::move(pagesProvider)), temperatureUnitModel{std::move(temperatureUnitModel)},
layoutModel{std::move(layoutModel)}
{}
auto TimeUnitsWindowPresenter::getPagesProvider() const -> std::shared_ptr<gui::ListItemProvider>
{
return pagesProvider;
}
auto TimeUnitsWindowPresenter::clearData() -> void
{
pagesProvider->clearData();
}
auto TimeUnitsWindowPresenter::saveData() -> void
{
pagesProvider->saveData();
temperatureUnitModel->set(pagesProvider->getTemperatureUnit());
auto timeFormat = pagesProvider->getTimeFormat();
auto currentLayout = layoutModel->getValue();
auto isCurrentLayout12h = true;
if (timeFormat == utils::time::Locale::TimeFormat::FormatTime24H) {
for (const auto &layout : gui::factory::getLayoutsFormat24h()) {
if (layout.first == currentLayout) {
isCurrentLayout12h = false;
break;
}
}
if (isCurrentLayout12h) {
std::string fallbackLayout;
if (currentLayout->rfind("Classic", 0) == 0) {
fallbackLayout = "Classic";
}
else if (currentLayout->rfind("Vertical", 0) == 0) {
fallbackLayout = "VerticalSimple";
}
auto layoutChangeRequest = std::make_shared<ChangeHomescreenLayoutMessage>(fallbackLayout);
app->bus.sendUnicast(layoutChangeRequest, service::name::appmgr);
}
}
}
auto TimeUnitsWindowPresenter::loadData() -> void
{
pagesProvider->loadData();
pagesProvider->setTemperatureUnit(temperatureUnitModel->get());
}
auto TimeUnitsWindowPresenter::createData() -> void
{
pagesProvider->createData();
}
} // namespace app::bell_settings
| 36.094595 | 115 | 0.639461 | GravisZro |
6f5a7dcf0f2218a5b0fa5cbde81e46d3a0d43f48 | 1,403 | cpp | C++ | test/postconditions.cpp | jdgarciauc3m/min-contracts | 184b0c2f9f131fb802596d7fd7d6f9d954552a5e | [
"Apache-2.0"
] | null | null | null | test/postconditions.cpp | jdgarciauc3m/min-contracts | 184b0c2f9f131fb802596d7fd7d6f9d954552a5e | [
"Apache-2.0"
] | null | null | null | test/postconditions.cpp | jdgarciauc3m/min-contracts | 184b0c2f9f131fb802596d7fd7d6f9d954552a5e | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 J. Daniel Garcia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "mincontracts/mincontracts.hpp"
#include <cmath>
#include <gtest/gtest.h>
double mysqrt_2(double x) {
CONTRACT_PRE(x >= 0);
auto result = std::sqrt(x);
CONTRACT_POST(result > 0);// Wrong on purpose
CONTRACT_POST(result <= x);
return result;
}
double mysqrt_3(double x) {
CONTRACT_PRE(x >= 0);
auto post = CONTRACT_POST_RESULT(r, r > 0 && r <= x);
return post(std::sqrt(x));
}
TEST(postconditions, ok) {// NOLINT
auto r = mysqrt_2(1);
ASSERT_EQ(1, r);
}
TEST(postconditions, fail) {// NOLINT
ASSERT_DEATH(mysqrt_2(0), "Postcondition"); // NOLINT
}
TEST(postconditions_result, ok) {// NOLINT
auto r = mysqrt_3(1);
ASSERT_EQ(1, r);
}
TEST(postconditions_result, fail) {// NOLINT
ASSERT_DEATH(mysqrt_3(0), "Postcondition"); // NOLINT
} | 26.980769 | 78 | 0.686386 | jdgarciauc3m |
6f5acec3eb86ab29356830c499e089dbf22e7986 | 10,688 | cpp | C++ | src/xalanc/PlatformSupport/XalanParsedURI.cpp | ulisesten/xalanc | a722de08e61ce66965c4a828242f7d1250950621 | [
"Apache-2.0"
] | 24 | 2015-07-29T22:49:17.000Z | 2022-03-25T10:14:17.000Z | src/xalanc/PlatformSupport/XalanParsedURI.cpp | ulisesten/xalanc | a722de08e61ce66965c4a828242f7d1250950621 | [
"Apache-2.0"
] | 14 | 2019-05-10T16:25:50.000Z | 2021-11-24T18:04:47.000Z | src/xalanc/PlatformSupport/XalanParsedURI.cpp | ulisesten/xalanc | a722de08e61ce66965c4a828242f7d1250950621 | [
"Apache-2.0"
] | 28 | 2015-04-20T15:50:51.000Z | 2022-01-26T14:56:55.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "XalanParsedURI.hpp"
#include "DOMStringHelper.hpp"
#include "XalanUnicode.hpp"
namespace XALAN_CPP_NAMESPACE {
/* Merge the components back into a complete URI string */
XalanDOMString& XalanParsedURI::make(XalanDOMString& uri) const
{
uri.erase();
if (m_defined & d_scheme)
{
uri += m_scheme;
uri += XalanUnicode::charColon;
}
if (m_defined & d_authority)
{
uri += XalanUnicode::charSolidus;
uri += XalanUnicode::charSolidus;
uri += m_authority;
}
uri += m_path;
if (m_defined & d_query)
{
uri += XalanUnicode::charQuestionMark;
uri += m_query;
}
if (m_defined & d_fragment)
{
uri += XalanUnicode::charNumberSign;
uri += m_fragment;
}
return uri;
}
/* Parse a URI into component parts.
Essentially implements the regex ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
*/
void XalanParsedURI::parse(
const XalanDOMChar* uriString,
XalanDOMString::size_type uriStringLen
)
{
XalanDOMString::size_type index = 0;
// Clear the components present mask
m_defined = 0;
// Scheme portion
while (index < uriStringLen &&
uriString[index] != XalanUnicode::charColon &&
uriString[index] != XalanUnicode::charSolidus &&
uriString[index] != XalanUnicode::charQuestionMark &&
uriString[index] != XalanUnicode::charNumberSign)
{
++index;
}
if (index > 0 && uriString[index] == XalanUnicode::charColon)
{
m_scheme = XalanDOMString(uriString, getMemoryManager(), index);
++index;
m_defined |= d_scheme;
}
else
{
index = 0;
m_scheme.clear();
}
// Authority portion
if (index < uriStringLen - 1 &&
uriString[index] == XalanUnicode::charSolidus &&
uriString[index+1] == XalanUnicode::charSolidus)
{
index += 2;
XalanDOMString::size_type authority = index;
while (index < uriStringLen &&
uriString[index] != XalanUnicode::charSolidus &&
uriString[index] != XalanUnicode::charQuestionMark &&
uriString[index] != XalanUnicode::charNumberSign)
{
++index;
}
if (index != authority)
{
m_authority = XalanDOMString(uriString + authority, getMemoryManager(), index - authority);
m_defined |= d_authority;
}
else
m_authority.clear();
}
else
{
m_authority.clear();
}
// Path portion
XalanDOMString::size_type path = index;
while (index < uriStringLen &&
uriString[index] != XalanUnicode::charQuestionMark &&
uriString[index] != XalanUnicode::charNumberSign)
{
++index;
}
m_path = XalanDOMString(uriString + path,getMemoryManager(), index - path);
// Query portion
if (index < uriStringLen && uriString[index] == XalanUnicode::charQuestionMark)
{
++index;
XalanDOMString::size_type query = index;
while (index < uriStringLen &&
uriString[index] != XalanUnicode::charNumberSign)
{
++index;
}
m_query = XalanDOMString(uriString + query,getMemoryManager(), index - query);
m_defined |= d_query;
}
else
{
m_query.clear();
}
// Fragment portion
if (index < uriStringLen && uriString[index] == XalanUnicode::charNumberSign)
{
++index;
m_fragment = XalanDOMString(uriString + index, getMemoryManager(), uriStringLen - index);
m_defined |= d_fragment;
}
else
{
m_fragment.clear();
}
}
/* Resolve this URI relative to another according to RFC2396, section 5.2 */
void XalanParsedURI::resolve(
const XalanParsedURI &base
)
{
if (base.isSchemeDefined() == false)
{
// Protect against a base URI that is relative...
// This might become an assert or an exception.
}
// Handle references to the current document (step 2)
else if ((m_defined & (d_scheme | d_authority | d_query)) == 0 &&
m_path.empty())
{
m_defined = base.m_defined;
if (base.m_defined & d_scheme)
m_scheme = base.m_scheme;
if (base.m_defined & d_authority)
m_authority = base.m_authority;
m_path = base.m_path;
if (base.m_defined & d_query)
m_query = base.m_query;
// There is an error/unclarity in the specification in step 2 in that
// it doesn't state that the fragment should be inherited; however
// it is clear from the examples that it should be
if (!(m_defined & d_fragment))
{
m_fragment = base.m_fragment;
}
m_defined |= base.m_defined;
}
// A defined scheme component implies that this is an absolute URI (step 3)
// Also allow a scheme without authority that matches the base scheme to be
// interpreted as a relative URI
else if (!(m_defined & d_scheme) || (
(base.m_defined & d_scheme) && !(m_defined & d_authority)
&& equalsIgnoreCaseASCII(m_scheme, base.m_scheme)))
{
// Inherit the base scheme
if (base.m_defined & d_scheme)
{
m_scheme = base.m_scheme;
m_defined |= d_scheme;
}
// Step 4: If the authority is unm_defined then inherit it, otherwise skip to step 7
if (!(m_defined & d_authority))
{
// Inherit the base authority
if (base.m_defined & d_authority)
{
m_authority = base.m_authority;
m_defined |= d_authority;
}
// Step 5: if the path starts with a / then it is absolute
if (!(m_path.length() > 0 && m_path[0] == XalanUnicode::charSolidus))
{
// Step 6: merge relative path components
// a) strip off characters after the right most slash in the base path
XalanDOMString::size_type pathEnd = base.m_path.length();
while (pathEnd > 0 && base.m_path[pathEnd - 1] != XalanUnicode::charSolidus)
{
--pathEnd;
}
if (pathEnd > 0)
{
// b) append relative path
// This inserts the path portion from base...
m_path.insert(0, base.m_path, 0, pathEnd);
}
else
{
// TODO, maybe raise an error here as this
// is a severely wonky looking URI
}
// c)->g remove various "./" and "../" segments
for (XalanDOMString::size_type index = 0; index < m_path.length(); )
{
// remove '<segment>/../' and ./
if (m_path[index] == XalanUnicode::charFullStop)
{
if (index < m_path.length()-1 &&
m_path[index+1] == XalanUnicode::charSolidus) // ./
{
m_path.erase(index,2);
continue;
}
else if (index == m_path.length()-1) // trailing /.
{
m_path.erase(index,1);
continue;
}
// Note: also strips leading ../ in an attempt to get
// something out of a bad m_path
else if (index < m_path.length()-2 &&
m_path[index+1] == XalanUnicode::charFullStop &&
m_path[index+2] == XalanUnicode::charSolidus) // ../
{
const XalanDOMString::size_type end = index + 2;
if (index > 0) --index;
for ( ; index > 0 && m_path[index-1] != XalanUnicode::charSolidus; index--)
;
if (index > 0) --index;
m_path.erase(index, end - index);
continue;
}
else if (index == m_path.length()-2 &&
m_path[index+1] == XalanUnicode::charFullStop) // trailing /..
{
const XalanDOMString::size_type end = index + 2;
if (index > 0) --index;
for ( ; index > 0 && m_path[index-1] != XalanUnicode::charSolidus; index--)
;
m_path.erase(index, end - index);
continue;
}
}
for ( ; index < m_path.length() && m_path[index] != XalanUnicode::charSolidus ; ++index)
{
}
++index;
}
}
}
}
}
/* Static helper function to perform a resolve without mucking about with this class */
XalanDOMString& XalanParsedURI::resolve(
const XalanDOMChar *relative,
XalanDOMString::size_type relativeLen,
const XalanDOMChar *base,
XalanDOMString::size_type baseLen,
XalanDOMString& theResult
)
{
XalanParsedURI relativeURI(relative, relativeLen, theResult.getMemoryManager());
XalanParsedURI baseURI(base, baseLen, theResult.getMemoryManager());
relativeURI.resolve(baseURI);
return relativeURI.make(theResult);
}
}
| 33.4 | 108 | 0.526291 | ulisesten |
6f5fbb060c343fe5a95180c160f3811c98f07afd | 5,716 | cpp | C++ | fizz/crypto/openssl/OpenSSLKeyUtils.cpp | dgrnbrg-meta/fizz | a69c69f413b1441d6b98cb7a8deb173325780980 | [
"BSD-3-Clause"
] | 995 | 2018-08-06T10:41:15.000Z | 2022-03-16T19:49:14.000Z | fizz/crypto/openssl/OpenSSLKeyUtils.cpp | dgrnbrg-meta/fizz | a69c69f413b1441d6b98cb7a8deb173325780980 | [
"BSD-3-Clause"
] | 68 | 2018-08-06T16:29:06.000Z | 2022-03-11T21:20:10.000Z | fizz/crypto/openssl/OpenSSLKeyUtils.cpp | dgrnbrg-meta/fizz | a69c69f413b1441d6b98cb7a8deb173325780980 | [
"BSD-3-Clause"
] | 147 | 2018-08-06T16:52:49.000Z | 2022-03-14T21:25:35.000Z | /*
* Copyright (c) 2018-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <fizz/crypto/openssl/OpenSSLKeyUtils.h>
#include <openssl/err.h>
namespace fizz {
/*static*/ folly::ssl::EvpPkeyUniquePtr OpenSSLKeyUtils::generateECKeyPair(
int curveNid) {
return detail::generateECKeyPair(curveNid);
}
namespace detail {
void validateECKey(const folly::ssl::EvpPkeyUniquePtr& key, int curveNid) {
folly::ssl::EcKeyUniquePtr ecKey(EVP_PKEY_get1_EC_KEY(key.get()));
if (!ecKey) {
throw std::runtime_error("Wrong key type");
}
if (EC_KEY_check_key(ecKey.get()) != 1) {
throw std::runtime_error("Private key not valid");
}
folly::ssl::EcGroupUniquePtr curve(EC_GROUP_new_by_curve_name(curveNid));
if (!curve) {
throw std::runtime_error("Failed to create curve");
}
auto keyGroup = EC_KEY_get0_group(ecKey.get());
if (EC_GROUP_cmp(keyGroup, curve.get(), nullptr) != 0) {
throw std::runtime_error("Invalid group");
}
}
#if FIZZ_OPENSSL_HAS_ED25519
void validateEdKey(const folly::ssl::EvpPkeyUniquePtr& key, int curveNid) {
int pkeyNid = EVP_PKEY_base_id(key.get());
if (pkeyNid != NID_ED25519 && pkeyNid != NID_ED448) {
throw std::runtime_error("Wrong key type");
}
if (pkeyNid != curveNid) {
throw std::runtime_error("Invalid group");
}
}
#endif
std::unique_ptr<folly::IOBuf> generateEvpSharedSecret(
const folly::ssl::EvpPkeyUniquePtr& key,
const folly::ssl::EvpPkeyUniquePtr& peerKey) {
folly::ssl::EvpPkeyCtxUniquePtr ctx(EVP_PKEY_CTX_new(key.get(), nullptr));
if (EVP_PKEY_derive_init(ctx.get()) != 1) {
throw std::runtime_error("Initializing derive context failed");
}
// Start deriving the key.
if (EVP_PKEY_derive_set_peer(ctx.get(), peerKey.get()) != 1) {
throw std::runtime_error("Error setting peer key");
}
size_t secretLen = 0;
if (EVP_PKEY_derive(ctx.get(), nullptr, &secretLen) != 1) {
throw std::runtime_error("Error deriving key");
}
// secretLen is now the maximum secret length.
auto buf = folly::IOBuf::create(secretLen);
if (EVP_PKEY_derive(ctx.get(), buf->writableData(), &secretLen) != 1) {
throw std::runtime_error("Error deriving key");
}
buf->append(secretLen);
return buf;
}
folly::ssl::EvpPkeyUniquePtr generateECKeyPair(int curveNid) {
folly::ssl::EcKeyUniquePtr ecParamKey(EC_KEY_new_by_curve_name(curveNid));
folly::ssl::EvpPkeyUniquePtr params(EVP_PKEY_new());
if (!ecParamKey || !params) {
throw std::runtime_error("Error initializing params");
}
if (EVP_PKEY_set1_EC_KEY(params.get(), ecParamKey.get()) != 1) {
throw std::runtime_error("Error setting ec key for params");
}
folly::ssl::EvpPkeyCtxUniquePtr kctx(EVP_PKEY_CTX_new(params.get(), nullptr));
if (!kctx) {
throw std::runtime_error("Error creating kctx");
}
if (EVP_PKEY_keygen_init(kctx.get()) != 1) {
throw std::runtime_error("Error initializing ctx");
}
EVP_PKEY* pkey = nullptr;
if (EVP_PKEY_keygen(kctx.get(), &pkey) != 1) {
throw std::runtime_error("Error generating key");
}
folly::ssl::EvpPkeyUniquePtr evpKey(pkey);
folly::ssl::EcKeyUniquePtr ecKey(EVP_PKEY_get1_EC_KEY(evpKey.get()));
validateECKey(evpKey, curveNid);
return evpKey;
}
folly::ssl::EvpPkeyUniquePtr decodeECPublicKey(
folly::ByteRange range,
int curveNid) {
// Get the peer key.
folly::ssl::EcGroupUniquePtr curve(EC_GROUP_new_by_curve_name(curveNid));
folly::ssl::EcKeyUniquePtr peerKey(EC_KEY_new_by_curve_name(curveNid));
if (!curve || !peerKey) {
throw std::runtime_error("Error initializing peer key");
}
folly::ssl::EcPointUniquePtr point(EC_POINT_new(curve.get()));
if (!point) {
throw std::runtime_error("Error initializing point");
}
if (EC_POINT_oct2point(
curve.get(), point.get(), range.data(), range.size(), nullptr) != 1) {
throw std::runtime_error("Error decoding peer key");
}
if (EC_POINT_is_on_curve(curve.get(), point.get(), nullptr) != 1) {
throw std::runtime_error("Peer key is not on curve");
}
if (!EC_KEY_set_public_key(peerKey.get(), point.get())) {
throw std::runtime_error("Error setting public key");
}
folly::ssl::EvpPkeyUniquePtr peerPkey(EVP_PKEY_new());
if (EVP_PKEY_assign_EC_KEY(peerPkey.get(), peerKey.release()) != 1) {
throw std::runtime_error("Error assigning EC key");
}
return peerPkey;
}
std::unique_ptr<folly::IOBuf> encodeECPublicKey(
const folly::ssl::EvpPkeyUniquePtr& key) {
folly::ssl::EcKeyUniquePtr ecKey(EVP_PKEY_get1_EC_KEY(key.get()));
if (!ecKey) {
throw std::runtime_error("Wrong key type");
}
return encodeECPublicKey(ecKey);
}
std::unique_ptr<folly::IOBuf> encodeECPublicKey(
const folly::ssl::EcKeyUniquePtr& ecKey) {
auto point = EC_KEY_get0_public_key(ecKey.get());
auto group = EC_KEY_get0_group(ecKey.get());
size_t len = EC_POINT_point2oct(
group, point, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr);
auto buf = folly::IOBuf::create(len);
// TLS 1.3 only allows uncompressed point formats, so we only support that
// for now.
len = EC_POINT_point2oct(
group,
point,
POINT_CONVERSION_UNCOMPRESSED,
buf->writableData(),
len,
nullptr);
if (len == 0) {
throw std::runtime_error("Failed to encode key");
}
buf->append(len);
return buf;
}
std::string getOpenSSLError() {
auto err = ERR_get_error();
if (err == 0) {
return "";
}
char errMsg[256];
ERR_error_string_n(ERR_get_error(), errMsg, sizeof(errMsg));
return std::string(errMsg);
}
} // namespace detail
} // namespace fizz
| 32.477273 | 80 | 0.695066 | dgrnbrg-meta |
6f6569c14777b2a50bdefdf706f35109e4657df6 | 6,177 | cpp | C++ | src/lapack_like/props/Norm.cpp | jeffhammond/Elemental | a9e6236ce9d92dd56c7d3cd5ffd52f796a35cd0c | [
"Apache-2.0"
] | null | null | null | src/lapack_like/props/Norm.cpp | jeffhammond/Elemental | a9e6236ce9d92dd56c7d3cd5ffd52f796a35cd0c | [
"Apache-2.0"
] | null | null | null | src/lapack_like/props/Norm.cpp | jeffhammond/Elemental | a9e6236ce9d92dd56c7d3cd5ffd52f796a35cd0c | [
"Apache-2.0"
] | null | null | null | /*
Copyright (c) 2009-2016, Jack Poulson
All rights reserved.
This file is part of Elemental and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
*/
#include <El.hpp>
namespace El {
template<typename F>
Base<F> Norm( const Matrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case ENTRYWISE_ONE_NORM:
norm = EntrywiseNorm( A, Base<F>(1) );
break;
case FROBENIUS_NORM:
norm = FrobeniusNorm( A );
break;
case INFINITY_NORM:
norm = InfinityNorm( A );
break;
case MAX_NORM:
norm = MaxNorm( A );
break;
case ONE_NORM:
norm = OneNorm( A );
break;
// The following two norms make use of an SVD
case NUCLEAR_NORM:
norm = NuclearNorm( A );
break;
case TWO_NORM:
norm = TwoNorm( A );
break;
}
return norm;
}
template<typename F>
Base<F> SymmetricNorm( UpperOrLower uplo, const Matrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case FROBENIUS_NORM:
norm = SymmetricFrobeniusNorm( uplo, A );
break;
case ENTRYWISE_ONE_NORM:
norm = SymmetricEntrywiseNorm( uplo, A, Base<F>(1) );
break;
case INFINITY_NORM:
norm = SymmetricInfinityNorm( uplo, A );
break;
case MAX_NORM:
norm = SymmetricMaxNorm( uplo, A );
break;
case ONE_NORM:
norm = SymmetricOneNorm( uplo, A );
break;
// The following norms make use of an SVD
case NUCLEAR_NORM:
norm = SymmetricNuclearNorm( uplo, A );
break;
case TWO_NORM:
norm = SymmetricTwoNorm( uplo, A );
break;
}
return norm;
}
template<typename F>
Base<F> HermitianNorm( UpperOrLower uplo, const Matrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case FROBENIUS_NORM:
norm = HermitianFrobeniusNorm( uplo, A );
break;
case ENTRYWISE_ONE_NORM:
norm = HermitianEntrywiseNorm( uplo, A, Base<F>(1) );
break;
case INFINITY_NORM:
norm = HermitianInfinityNorm( uplo, A );
break;
case MAX_NORM:
norm = HermitianMaxNorm( uplo, A );
break;
case ONE_NORM:
norm = HermitianOneNorm( uplo, A );
break;
// The following norms make use of an SVD
case NUCLEAR_NORM:
norm = HermitianNuclearNorm( uplo, A );
break;
case TWO_NORM:
norm = HermitianTwoNorm( uplo, A );
break;
}
return norm;
}
template<typename F>
Base<F> Norm( const ElementalMatrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case FROBENIUS_NORM:
norm = FrobeniusNorm( A );
break;
case ENTRYWISE_ONE_NORM:
norm = EntrywiseNorm( A, Base<F>(1) );
break;
case INFINITY_NORM:
norm = InfinityNorm( A );
break;
case MAX_NORM:
norm = MaxNorm( A );
break;
case ONE_NORM:
norm = OneNorm( A );
break;
// The following norms make use of an SVD
case NUCLEAR_NORM:
norm = NuclearNorm( A );
break;
case TWO_NORM:
norm = TwoNorm( A );
break;
}
return norm;
}
template<typename F>
Base<F> SymmetricNorm
( UpperOrLower uplo, const ElementalMatrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case FROBENIUS_NORM:
norm = SymmetricFrobeniusNorm( uplo, A );
break;
case ENTRYWISE_ONE_NORM:
norm = SymmetricEntrywiseNorm( uplo, A, Base<F>(1) );
break;
case INFINITY_NORM:
norm = SymmetricInfinityNorm( uplo, A );
break;
case MAX_NORM:
norm = SymmetricMaxNorm( uplo, A );
break;
case ONE_NORM:
norm = SymmetricOneNorm( uplo, A );
break;
// The following norms make use of an SVD
case NUCLEAR_NORM:
norm = SymmetricNuclearNorm( uplo, A );
break;
case TWO_NORM:
norm = SymmetricTwoNorm( uplo, A );
break;
}
return norm;
}
template<typename F>
Base<F> HermitianNorm
( UpperOrLower uplo, const ElementalMatrix<F>& A, NormType type )
{
DEBUG_CSE
Base<F> norm = 0;
switch( type )
{
// The following norms are rather cheap to compute
case FROBENIUS_NORM:
norm = HermitianFrobeniusNorm( uplo, A );
break;
case ENTRYWISE_ONE_NORM:
norm = HermitianEntrywiseNorm( uplo, A, Base<F>(1) );
break;
case INFINITY_NORM:
norm = HermitianInfinityNorm( uplo, A );
break;
case MAX_NORM:
norm = HermitianMaxNorm( uplo, A );
break;
case ONE_NORM:
norm = HermitianOneNorm( uplo, A );
break;
// The following norms make use of an SVD
case NUCLEAR_NORM:
norm = HermitianNuclearNorm( uplo, A );
break;
case TWO_NORM:
norm = HermitianTwoNorm( uplo, A );
break;
}
return norm;
}
#define PROTO(F) \
template Base<F> Norm( const Matrix<F>& A, NormType type ); \
template Base<F> Norm( const ElementalMatrix<F>& A, NormType type ); \
template Base<F> HermitianNorm \
( UpperOrLower uplo, const Matrix<F>& A, NormType type ); \
template Base<F> HermitianNorm \
( UpperOrLower uplo, const ElementalMatrix<F>& A, NormType type ); \
template Base<F> SymmetricNorm \
( UpperOrLower uplo, const Matrix<F>& A, NormType type ); \
template Base<F> SymmetricNorm \
( UpperOrLower uplo, const ElementalMatrix<F>& A, NormType type );
#define EL_NO_INT_PROTO
#define EL_ENABLE_DOUBLEDOUBLE
#define EL_ENABLE_QUADDOUBLE
#define EL_ENABLE_QUAD
#define EL_ENABLE_BIGFLOAT
#include <El/macros/Instantiate.h>
} // namespace El
| 25.845188 | 77 | 0.607091 | jeffhammond |
6f68c2bdff802ed92cb84cbfeae1874e1cab2627 | 8,723 | cpp | C++ | libs/hwui/Properties.cpp | Keneral/aframeworksbase1 | 0287c3e3f6f763cd630290343cda11e15db1844f | [
"Unlicense"
] | null | null | null | libs/hwui/Properties.cpp | Keneral/aframeworksbase1 | 0287c3e3f6f763cd630290343cda11e15db1844f | [
"Unlicense"
] | null | null | null | libs/hwui/Properties.cpp | Keneral/aframeworksbase1 | 0287c3e3f6f763cd630290343cda11e15db1844f | [
"Unlicense"
] | null | null | null | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Properties.h"
#include "Debug.h"
#include <cutils/compiler.h>
#include <cutils/log.h>
#include <cutils/properties.h>
#include <algorithm>
#include <cstdlib>
namespace android {
namespace uirenderer {
bool Properties::drawDeferDisabled = false;
bool Properties::drawReorderDisabled = false;
bool Properties::debugLayersUpdates = false;
bool Properties::debugOverdraw = false;
bool Properties::showDirtyRegions = false;
bool Properties::skipEmptyFrames = true;
bool Properties::useBufferAge = true;
bool Properties::enablePartialUpdates = true;
float Properties::textGamma = DEFAULT_TEXT_GAMMA;
int Properties::fboCacheSize = DEFAULT_FBO_CACHE_SIZE;
int Properties::gradientCacheSize = MB(DEFAULT_GRADIENT_CACHE_SIZE);
int Properties::layerPoolSize = MB(DEFAULT_LAYER_CACHE_SIZE);
int Properties::patchCacheSize = KB(DEFAULT_PATCH_CACHE_SIZE);
int Properties::pathCacheSize = MB(DEFAULT_PATH_CACHE_SIZE);
int Properties::renderBufferCacheSize = MB(DEFAULT_RENDER_BUFFER_CACHE_SIZE);
int Properties::tessellationCacheSize = MB(DEFAULT_VERTEX_CACHE_SIZE);
int Properties::textDropShadowCacheSize = MB(DEFAULT_DROP_SHADOW_CACHE_SIZE);
int Properties::textureCacheSize = MB(DEFAULT_TEXTURE_CACHE_SIZE);
float Properties::textureCacheFlushRate = DEFAULT_TEXTURE_CACHE_FLUSH_RATE;
DebugLevel Properties::debugLevel = kDebugDisabled;
OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default;
StencilClipDebug Properties::debugStencilClip = StencilClipDebug::Hide;
float Properties::overrideLightRadius = -1.0f;
float Properties::overrideLightPosY = -1.0f;
float Properties::overrideLightPosZ = -1.0f;
float Properties::overrideAmbientRatio = -1.0f;
int Properties::overrideAmbientShadowStrength = -1;
int Properties::overrideSpotShadowStrength = -1;
ProfileType Properties::sProfileType = ProfileType::None;
bool Properties::sDisableProfileBars = false;
bool Properties::waitForGpuCompletion = false;
bool Properties::filterOutTestOverhead = false;
static int property_get_int(const char* key, int defaultValue) {
char buf[PROPERTY_VALUE_MAX] = {'\0',};
if (property_get(key, buf, "") > 0) {
return atoi(buf);
}
return defaultValue;
}
static float property_get_float(const char* key, float defaultValue) {
char buf[PROPERTY_VALUE_MAX] = {'\0',};
if (property_get(key, buf, "") > 0) {
return atof(buf);
}
return defaultValue;
}
bool Properties::load() {
char property[PROPERTY_VALUE_MAX];
bool prevDebugLayersUpdates = debugLayersUpdates;
bool prevDebugOverdraw = debugOverdraw;
StencilClipDebug prevDebugStencilClip = debugStencilClip;
debugOverdraw = false;
if (property_get(PROPERTY_DEBUG_OVERDRAW, property, nullptr) > 0) {
INIT_LOGD(" Overdraw debug enabled: %s", property);
if (!strcmp(property, "show")) {
debugOverdraw = true;
overdrawColorSet = OverdrawColorSet::Default;
} else if (!strcmp(property, "show_deuteranomaly")) {
debugOverdraw = true;
overdrawColorSet = OverdrawColorSet::Deuteranomaly;
}
}
// See Properties.h for valid values
if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, nullptr) > 0) {
INIT_LOGD(" Stencil clip debug enabled: %s", property);
if (!strcmp(property, "hide")) {
debugStencilClip = StencilClipDebug::Hide;
} else if (!strcmp(property, "highlight")) {
debugStencilClip = StencilClipDebug::ShowHighlight;
} else if (!strcmp(property, "region")) {
debugStencilClip = StencilClipDebug::ShowRegion;
}
} else {
debugStencilClip = StencilClipDebug::Hide;
}
sProfileType = ProfileType::None;
if (property_get(PROPERTY_PROFILE, property, "") > 0) {
if (!strcmp(property, PROPERTY_PROFILE_VISUALIZE_BARS)) {
sProfileType = ProfileType::Bars;
} else if (!strcmp(property, "true")) {
sProfileType = ProfileType::Console;
}
}
debugLayersUpdates = property_get_bool(PROPERTY_DEBUG_LAYERS_UPDATES, false);
INIT_LOGD(" Layers updates debug enabled: %d", debugLayersUpdates);
drawDeferDisabled = property_get_bool(PROPERTY_DISABLE_DRAW_DEFER, false);
INIT_LOGD(" Draw defer %s", drawDeferDisabled ? "disabled" : "enabled");
drawReorderDisabled = property_get_bool(PROPERTY_DISABLE_DRAW_REORDER, false);
INIT_LOGD(" Draw reorder %s", drawReorderDisabled ? "disabled" : "enabled");
showDirtyRegions = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false);
debugLevel = (DebugLevel) property_get_int(PROPERTY_DEBUG, kDebugDisabled);
skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true);
useBufferAge = property_get_bool(PROPERTY_USE_BUFFER_AGE, true);
enablePartialUpdates = property_get_bool(PROPERTY_ENABLE_PARTIAL_UPDATES, true);
textGamma = property_get_float(PROPERTY_TEXT_GAMMA, DEFAULT_TEXT_GAMMA);
fboCacheSize = property_get_int(PROPERTY_FBO_CACHE_SIZE, DEFAULT_FBO_CACHE_SIZE);
gradientCacheSize = MB(property_get_float(PROPERTY_GRADIENT_CACHE_SIZE, DEFAULT_GRADIENT_CACHE_SIZE));
layerPoolSize = MB(property_get_float(PROPERTY_LAYER_CACHE_SIZE, DEFAULT_LAYER_CACHE_SIZE));
patchCacheSize = KB(property_get_float(PROPERTY_PATCH_CACHE_SIZE, DEFAULT_PATCH_CACHE_SIZE));
pathCacheSize = MB(property_get_float(PROPERTY_PATH_CACHE_SIZE, DEFAULT_PATH_CACHE_SIZE));
renderBufferCacheSize = MB(property_get_float(PROPERTY_RENDER_BUFFER_CACHE_SIZE, DEFAULT_RENDER_BUFFER_CACHE_SIZE));
tessellationCacheSize = MB(property_get_float(PROPERTY_VERTEX_CACHE_SIZE, DEFAULT_VERTEX_CACHE_SIZE));
textDropShadowCacheSize = MB(property_get_float(PROPERTY_DROP_SHADOW_CACHE_SIZE, DEFAULT_DROP_SHADOW_CACHE_SIZE));
textureCacheSize = MB(property_get_float(PROPERTY_TEXTURE_CACHE_SIZE, DEFAULT_TEXTURE_CACHE_SIZE));
textureCacheFlushRate = std::max(0.0f, std::min(1.0f,
property_get_float(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, DEFAULT_TEXTURE_CACHE_FLUSH_RATE)));
filterOutTestOverhead = property_get_bool(PROPERTY_FILTER_TEST_OVERHEAD, false);
return (prevDebugLayersUpdates != debugLayersUpdates)
|| (prevDebugOverdraw != debugOverdraw)
|| (prevDebugStencilClip != debugStencilClip);
}
void Properties::overrideProperty(const char* name, const char* value) {
if (!strcmp(name, "disableProfileBars")) {
sDisableProfileBars = !strcmp(value, "true");
ALOGD("profile bars %s", sDisableProfileBars ? "disabled" : "enabled");
return;
} else if (!strcmp(name, "ambientRatio")) {
overrideAmbientRatio = std::min(std::max(atof(value), 0.0), 10.0);
ALOGD("ambientRatio = %.2f", overrideAmbientRatio);
return;
} else if (!strcmp(name, "lightRadius")) {
overrideLightRadius = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightRadius = %.2f", overrideLightRadius);
return;
} else if (!strcmp(name, "lightPosY")) {
overrideLightPosY = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightPos Y = %.2f", overrideLightPosY);
return;
} else if (!strcmp(name, "lightPosZ")) {
overrideLightPosZ = std::min(std::max(atof(value), 0.0), 3000.0);
ALOGD("lightPos Z = %.2f", overrideLightPosZ);
return;
} else if (!strcmp(name, "ambientShadowStrength")) {
overrideAmbientShadowStrength = atoi(value);
ALOGD("ambient shadow strength = 0x%x out of 0xff", overrideAmbientShadowStrength);
return;
} else if (!strcmp(name, "spotShadowStrength")) {
overrideSpotShadowStrength = atoi(value);
ALOGD("spot shadow strength = 0x%x out of 0xff", overrideSpotShadowStrength);
return;
}
ALOGD("failed overriding property %s to %s", name, value);
}
ProfileType Properties::getProfileType() {
if (CC_UNLIKELY(sDisableProfileBars && sProfileType == ProfileType::Bars))
return ProfileType::None;
return sProfileType;
}
}; // namespace uirenderer
}; // namespace android
| 41.736842 | 120 | 0.728878 | Keneral |
6f6923cc3eb6b2c13eac64e2b20d35c9446ff1b3 | 1,961 | cpp | C++ | tf2_bot_detector/Actions/ActionGenerators.cpp | fossabot/tf2_bot_detector | 475a11ba2305e33d9b93469e86537f7d2623b61e | [
"MIT"
] | null | null | null | tf2_bot_detector/Actions/ActionGenerators.cpp | fossabot/tf2_bot_detector | 475a11ba2305e33d9b93469e86537f7d2623b61e | [
"MIT"
] | null | null | null | tf2_bot_detector/Actions/ActionGenerators.cpp | fossabot/tf2_bot_detector | 475a11ba2305e33d9b93469e86537f7d2623b61e | [
"MIT"
] | null | null | null | #include "ActionGenerators.h"
#include "Actions.h"
#include "Log.h"
#include "RCONActionManager.h"
using namespace tf2_bot_detector;
using namespace std::chrono_literals;
duration_t StatusUpdateActionGenerator::GetInterval() const
{
return 3s;
}
bool StatusUpdateActionGenerator::ExecuteImpl(RCONActionManager& manager)
{
// 3 second interval, we want:
// 1. status
// 2. ping
// 3. status short
// 4. ping
// repeat
if (m_NextPing)
{
if (!manager.QueueAction<GenericCommandAction>("ping"))
return false;
}
else
{
//if (!manager.QueueAction<GenericCommandAction>("status", m_NextShort ? "short" : ""))
// return false;
//m_NextShort = !m_NextShort;
if (!manager.QueueAction<GenericCommandAction>("status"))
return false;
}
m_NextPing = !m_NextPing;
return true;
}
duration_t ConfigActionGenerator::GetInterval() const
{
return 10s;
}
bool ConfigActionGenerator::ExecuteImpl(RCONActionManager& manager)
{
if (!manager.QueueAction<GenericCommandAction>("con_logfile", "console.log"))
return false;
if (!manager.QueueAction<GenericCommandAction>("con_timestamp", "1"))
return false;
if (!manager.QueueAction<GenericCommandAction>("tf_mm_debug_level", "4"))
return false; // This is defaulted to 4, but mastercom's stupid config turns this off
// Need this for robust chat message detection
//manager.QueueAction<GenericCommandAction>("net_showmsg", "svc_UserMessage");
return true;
}
bool IPeriodicActionGenerator::Execute(RCONActionManager& manager)
{
const auto curTime = clock_t::now();
const auto interval = GetInterval();
if (m_LastRunTime == time_point_t{})
{
const auto delay = GetInitialDelay();
m_LastRunTime = curTime - interval + delay;
}
if ((curTime - m_LastRunTime) >= interval)
{
if (ExecuteImpl(manager))
{
m_LastRunTime = curTime;
return true;
}
else
{
LogWarning("Couldn't execute IPeriodicActionGenerator!");
return false;
}
}
return true;
}
| 22.033708 | 89 | 0.722081 | fossabot |
6f69f9d2c5e707b8b64d304648f4ac8cefa6f546 | 4,802 | cpp | C++ | runtime/containers/HashSet.cpp | rschleitzer/scaly | 7537cdf44f7a63ad1a560975017ee1c897c73787 | [
"MIT"
] | null | null | null | runtime/containers/HashSet.cpp | rschleitzer/scaly | 7537cdf44f7a63ad1a560975017ee1c897c73787 | [
"MIT"
] | null | null | null | runtime/containers/HashSet.cpp | rschleitzer/scaly | 7537cdf44f7a63ad1a560975017ee1c897c73787 | [
"MIT"
] | null | null | null | namespace scaly::containers {
using namespace scaly::memory;
// https://planetmath.org/goodhashtableprimes
static size_t HASH_PRIMES[] = {
3, 5, 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613,
393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611,
402653189, 805306457, 1610612741,
};
bool is_prime(size_t candidate) {
if ((candidate & 1) != 0) {
auto limit = (size_t)std::sqrt((double)candidate);
size_t divisor = 3;
while (divisor <= limit) {
divisor += 2;
if ((candidate % divisor) == 0) {
return false;
}
}
return true;
}
return candidate == 2;
}
size_t get_prime(size_t size) {
for (int i = 0; i < 30; i++) {
if (HASH_PRIMES[i] >= size) {
return HASH_PRIMES[i];
}
}
size_t i = size | 1;
while (i < std::numeric_limits<size_t>::max()) {
if (is_prime(i)) {
return i;
}
i += 2;
}
return size;
}
// FNV-1a hash
inline size_t hash(char* data, size_t length) {
size_t hash = 0xcbf29ce484222325;
size_t prime = 0x100000001b3;
for(int i = 0; i < length; ++i) {
char value = data[i];
hash = hash ^ value;
hash *= prime;
}
return hash;
}
// template<class T> struct List;
template<class T> struct Slot {
T value;
size_t hash_code;
};
template<class T>
struct HashSet : Object {
size_t length;
Vector<List<Slot<T>>>* slots;
Page* slots_page;
static HashSet<T>* create(Page* _rp) {
return new(alignof(HashSet<T>), _rp) HashSet<T> {
.length = 0,
.slots = nullptr,
};
}
static HashSet<T>* from_vector(Page* _rp, Vector<T>& vector) {
auto hash_set = create(_rp);
if (vector.length > 0)
{
hash_set->reallocate(vector.length);
for (size_t i = 0; i < vector.length; i++) {
hash_set->add_internal(*(vector[i]));
}
}
return hash_set;
}
void reallocate(size_t size)
{
auto hash_size = get_prime(size);
this->slots_page = Page::get(this)->allocate_exclusive_page();
if (hash_size < 97)
hash_size = 97;
Vector<List<Slot<T>>>* slots = Vector<List<Slot<T>>>::create(this->slots_page, hash_size);
if (this->slots != nullptr) {
auto vector_iterator = VectorIterator<List<Slot<T>>>::create(this->slots);
while (auto element = vector_iterator.next()) {
auto list_iterator = ListIterator<Slot<T>>::create(element->head);
while (auto item = list_iterator.next())
{
auto hash_code = item->hash_code;
auto slot_number = hash_code % slots->length;
auto slot_list = slots->get(slot_number);
if (slot_list == nullptr)
{
slot_list = List<Slot<T>>::create(Page::get(this->slots_page));
slots->set(slot_number, *slot_list);
}
slot_list->add(this->slots_page, *item);
}
}
Page::get(this)->deallocate_exclusive_page(Page::get(this->slots));
}
this->slots = slots;
}
bool add(T value) {
auto hash_size = get_prime(this->length + 1);
if (this->slots == nullptr || hash_size > this->slots->length)
reallocate(this->length + 1);
return add_internal(value);
}
bool add_internal(T value) {
auto hash_code = value.hash();
auto slot_number = hash_code % this->slots->length;
auto slot_list = this->slots->get(slot_number);
if (slot_list == nullptr)
this->slots->set(slot_number, *List<Slot<T>>::create(this->slots_page));
auto iterator = slot_list->get_iterator();
while (Slot<T>* item = iterator.next()) {
if (value.equals(item->value)) {
return false;
}
}
slot_list->add(this->slots_page, Slot<T> {
.value = value,
.hash_code = hash_code,
});
this->length++;
return true;
}
bool contains(T& value) {
if (this->slots == nullptr)
return false;
auto hash = value.hash();
auto slot_number = hash % this->slots->length;
auto slot = this->slots->get(slot_number);
auto iterator = slot->get_iterator();
while (Slot<T>* item = iterator.next()) {
if (value.equals(item->value)) {
return true;
}
}
return false;
}
};
} | 28.754491 | 98 | 0.526447 | rschleitzer |
6f6d5587e2e046708ccca2587b3dce6656d99f82 | 2,528 | cpp | C++ | operator.cpp | zhanghexie/design-patterns | ff8841dd555116f49da00876f0c68865c916a251 | [
"MIT"
] | null | null | null | operator.cpp | zhanghexie/design-patterns | ff8841dd555116f49da00876f0c68865c916a251 | [
"MIT"
] | null | null | null | operator.cpp | zhanghexie/design-patterns | ff8841dd555116f49da00876f0c68865c916a251 | [
"MIT"
] | null | null | null | #include<iostream>
using namespace std;
// 运算父类
class Operator {
private:
double _numberA;
double _numberB;
public:
double getA(){
return _numberA;
}
void setA(double number){
_numberA = number;
}
double getB(){
return _numberB;
}
void setB(double number){
_numberB = number;
}
virtual double getResult(double A, double B){
cout<<"wi"<<endl;
return 0;
}
};
// +运算具体实现
class OperatorAdd:public Operator{
public:
double getResult(double A,double B){
this->setA(A);
this->setB(B);
return this->getA()+this->getB();
}
};
// -运算具体实现
class OperatorSub:public Operator{
public:
double getResult(double A,double B){
this->setA(A);
this->setB(B);
return this->getA()-this->getB();
}
};
// ×运算具体实现
class OperatorMul:public Operator{
public:
double getResult(double A,double B){
this->setA(A);
this->setB(B);
return this->getA()*this->getB();
}
};
// /运算具体实现
class OperatorDev:public Operator{
public:
double getResult(double A,double B){
if(B==0){
throw"除数不能为零";
}
this->setA(A);
this->setB(B);
return this->getA()/this->getB();
}
};
// 操作符工厂类
class OperationFactory{
public:
static Operator* OperatorCreate (char c){
Operator* op;
switch (c)
{
case '+':
op = new OperatorAdd;
break;
case '-':
op = new OperatorSub;
break;
case '*':
op = new OperatorMul;
break;
case '/':
op = new OperatorDev;
break;
default:
throw"出现错误";
return NULL;
break;
}
return op;
}
};
// 客户端程序
int main(){
cout<<"+:"<<OperationFactory::OperatorCreate('+')->getResult(8,4)<<endl;
cout<<"-:"<<OperationFactory::OperatorCreate('-')->getResult(8,4)<<endl;
cout<<"*:"<<OperationFactory::OperatorCreate('*')->getResult(8,4)<<endl;
cout<<"/:"<<OperationFactory::OperatorCreate('/')->getResult(8,4)<<endl;
cout<<"a:"<<OperationFactory::OperatorCreate('a')->getResult(8,4)<<endl;
}
| 23.626168 | 76 | 0.474288 | zhanghexie |
6f6e7528dd300da390ef4e8d77cbe99c31053fe0 | 7,907 | hpp | C++ | nvmctrl.hpp | Skrywerbeer/SAMl21-Scoped-headers | 804affebc2f732aca80ff217f8672db52773217e | [
"MIT"
] | null | null | null | nvmctrl.hpp | Skrywerbeer/SAMl21-Scoped-headers | 804affebc2f732aca80ff217f8672db52773217e | [
"MIT"
] | null | null | null | nvmctrl.hpp | Skrywerbeer/SAMl21-Scoped-headers | 804affebc2f732aca80ff217f8672db52773217e | [
"MIT"
] | null | null | null | // ****************************************
// File: nvmctrl.hpp
// Written by: Johan Grobler
// Started: 13/9/2017
// Updated: 17/9/2017
// ****************************************
// Non-Voltile Memory Conrtoller special
// function registers of the ATSAML21J18
// MCU.
// ****************************************
#ifndef NVMCTRL_HPP_
#define NVMCTRL_HPP
#include "sfr.hpp"
// ****************************************
// Base addresses and offsets.
// ****************************************
namespace NVMCTRL {
// Base address.
const uint32_t NVMCTRL_BASE = 0x41004000;
// Control A Register offset.
const uint8_t CTRLA_OFFSET = 0x00;
// Control B Register offset.
const uint8_t CTRLB_OFFSET = 0x04;
// NVM Parameter Register offset.
const uint8_t PARAM_OFFSET = 0x08;
// Interrupt Enable Clear Register offset.
const uint8_t INTENCLR_OFFSET = 0x0c;
// Interrupt Enable Set Register offset.
const uint8_t INTENSET_OFFSET = 0x10;
// Interrupt Flag Status and Clear Register offset.
const uint8_t INTFLAG_OFFSET = 0x14;
// Status Register offset.
const uint8_t STATUS_OFFSET = 0x18;
// Address Register offset.
const uint8_t ADDR_OFFSET = 0x1c;
// Lock Section Register offset.
const uint8_t LOCK_OFFSET = 0x20;
}
// ****************************************
// Control A Register.
// ****************************************
namespace NVMCTRL {
rw_sfr16 CTRLA = __sfr16(NVMCTRL::NVMCTRL_BASE, NVMCTRL::CTRLA_OFFSET);
}
// ****************************************
// Control A bits.
// ****************************************
namespace NVMCTRL_CTRLA {
// Command Execution.
const uint8_t CMDEX_MASK = 0xa5;
const uint8_t CMDEX_SHIFT = 8;
// Commands.
const uint8_t ER = 0x02; // Erase Row.
const uint8_t WP = 0x04; // Write Page.
const uint8_t EAR = 0x05; // Erase Auxiliary Row.
const uint8_t WAP = 0x06; // Write Auxiliary Page.
const uint8_t WL = 0x0f; // Write Lockbits.
const uint8_t RWWEEWP = 0x1a; // RWWEE Erase Row.
const uint8_t RWWEEWP = 0x1c; // RWWEE Write Page.
const uint8_t LR = 0x40; // Lock Region.
const uint8_t UR = 0x41; // Unlock Region.
const uint8_t SPRM = 0x42; // Set Power Reduction Mode.
const uint8_t CPRM = 0x42; // Clear Power Reduction Mode.
const uint8_t PBC = 0x44; // Page Buffer Clear.
const uint8_t SSB = 0x45; // Set Security Bit.
const uint8_t INVALL = 0x46; // Invalidates all cache lines.
const uint8_t LDR = 0x47; // Lock Data Region.
const uint8_t UDR = 0x48; // Unlock Data Region.
}
// ****************************************
// Control B Register.
// ****************************************
namespace NVMCTRL {
rw_sfr32 CTRLB = __sfr32(NVMCTRL::NVMCTRL_BASE, NVMCTRL::CTRLB_OFFSET);
}
// ****************************************
// Control B bits.
// ****************************************
namespace NVMCTRL_CTRLB {
// Cache Disable.
const uint32_t CACHEDIS = (1 << 18);
// NVMCTRL Read Mode.
const uint32_t READMODE1 = (1 << 17);
const uint32_t READMODE0 = (1 << 16);
// Power Reduction Mode during Sleep.
const uint32_t SLEEPPRM1 = (1 << 9);
const uint32_t SLEEPPRM0 = (1 << 8);
// Manual Write.
const uint32_t MANW = (1 << 7);
// NVM Read Wait States.
const uint32_t RWS_MASK = 0x1e;
const uint8_t RWS_SHIFT = 1;
const uint32_t RWS3 = (1 << 4);
const uint32_t RWS2 = (1 << 3);
const uint32_t RWS1 = (1 << 2);
const uint32_t RWS0 = (1 << 1);
}
// ****************************************
// NVM Parameter Register.
// ****************************************
namespace NVMCTRL {
ro_sfr32 PARAM = __sfr32(NVMCTRL::NVMCTRL_BASE, NVMCTRL::PARAM_OFFSET);
}
// ****************************************
// NVM Parameter bits.
// ****************************************
namespace NVMCTRL_PARAM {
// Read While Write EEPROM emulation area Pages.
const uint32_t RWWEEP_MASK = 0xfff00000;
const uint32_t RWWEEP = 20;
const uint32_t RWWEEP11 = (1 << 31);
const uint32_t RWWEEP10 = (1 << 30);
const uint32_t RWWEEP9 = (1 << 29);
const uint32_t RWWEEP8 = (1 << 28);
const uint32_t RWWEEP7 = (1 << 27);
const uint32_t RWWEEP6 = (1 << 26);
const uint32_t RWWEEP5 = (1 << 25);
const uint32_t RWWEEP4 = (1 << 24);
const uint32_t RWWEEP3 = (1 << 23);
const uint32_t RWWEEP2 = (1 << 22);
const uint32_t RWWEEP1 = (1 << 21);
const uint32_t RWWEEP0 = (1 << 20);
// Page Size.
const uint32_t PSZ_MASK = 0x70000;
const uint32_t PSZ = 16;
const uint32_t PSZ2 = (1 << 18);
const uint32_t PSZ1 = (1 << 17);
const uint32_t PSZ0 = (1 << 16);
// NVM Pages.
const uint32_t NVMP_MASK = 0xffff;
}
// ****************************************
// Interrupt Enable Clear Register.
// ****************************************
namespace NVMCTRL {
rw_sfr8 INTENCLR = __sfr8(NVMCTRL::NVMCTRL_BASE, NVMCTRL::INTENCLR_OFFSET);
}
// ****************************************
// Interrupt Enable Clear bits.
// ****************************************
namespace NVMCTRL_INTENCLR {
// Error Interrupt Disable.
const uint8_t ERROR = (1 << 1);
}
// ****************************************
// Interrupt Enable Set Register.
// ****************************************
namespace NVMCTRL {
rw_sfr8 INTENSET = __sfr8(NVMCTRL::NVMCTRL_BASE, NVMCTRL::INTENSET_OFFSET);
}
// ****************************************
// Interrupt Enable Set bits.
// ****************************************
namespace NVMCTRL_INTENSET {
// Error Interrupt Enable.
const uint8_t ERROR = (1 << 1);
}
// ****************************************
// Interrupt Flag Status and Clear Register.
// ****************************************
namespace NVMCTRL {
rw_sfr8 INTFLAG = __sfr8(NVMCTRL::NVMCTRL_BASE, NVMCTRL::INTFLAG_OFFSET);
}
// ****************************************
// Interrupt Flag Status and Clear bits.
// ****************************************
namespace NVMCTRL_INTFLAG {
// Error Interrupt.
const uint8_t ERROR = (1 << 1);
}
// ****************************************
// Status Register.
// ****************************************
namespace NVMCTRL {
rw_sfr16 STATUS = __sfr16(NVMCTRL::NVMCTRL_BASE, NVMCTRL::STATUS_OFFSET);
}
// ****************************************
// Status bits.
// ****************************************
namespace NVMCTRL_STATUS {
// Security Bits Status.
const uint16_t SB = (1 << 8);
// NVM Error.
const uint16_t NVME = (1 << 4);
// Lock Error Status.
const uint16_t LOCKE = (1 << 3);
// Programming Error Status.
const uint16_t PROGE = (1 << 2);
// NVM Page Buffer Active Loading.
const uint16_t LOAD = (1 << 1);
// Power Reduction Mode.
const uint16_t PRM = (1 << 0);
}
// ****************************************
// Address Register.
// ****************************************
namespace NVMCTRL {
rw_sfr32 ADDR = __sfr32(NVMCTRL::NVMCTRL_BASE, NVMCTRL::ADDR_OFFSET);
}
// ****************************************
// Address bits.
// ****************************************
namespace NVMCTRL_ADDR {
// NVM Address.
const uint32_t ADDR = 0x003fffff;
// TODO: Add individual bits, maybe.
}
// ****************************************
// Lock Section Register.
// ****************************************
namespace NVMCTRL {
ro_sfr16 LOCK = __sfr16(NVMCTRL::NVMCTRL_BASE, NVMCTRL::LOCK_OFFSET);
}
// ****************************************
// Lock Section bits.
// ****************************************
namespace NVMCTRL_LOCK {
// Region Lock Bits.
const uint16_t LOCK15 = (1 << 15);
const uint16_t LOCK14 = (1 << 14);
const uint16_t LOCK13 = (1 << 13);
const uint16_t LOCK12 = (1 << 12);
const uint16_t LOCK11 = (1 << 11);
const uint16_t LOCK10 = (1 << 10);
const uint16_t LOCK9 = (1 << 9);
const uint16_t LOCK8 = (1 << 8);
const uint16_t LOCK7 = (1 << 7);
const uint16_t LOCK6 = (1 << 6);
const uint16_t LOCK5 = (1 << 5);
const uint16_t LOCK4 = (1 << 4);
const uint16_t LOCK3 = (1 << 3);
const uint16_t LOCK2 = (1 << 2);
const uint16_t LOCK1 = (1 << 1);
const uint16_t LOCK0 = (1 << 0);
}
#endif // NVMCTRL_HPP
| 30.528958 | 76 | 0.53636 | Skrywerbeer |
6f70187c36238201609e01528e354139b87a4e86 | 1,446 | cc | C++ | ui/views/animation/test/ink_drop_host_view_test_api.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | ui/views/animation/test/ink_drop_host_view_test_api.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2015-10-21T13:02:42.000Z | 2022-03-14T07:50:50.000Z | ui/views/animation/test/ink_drop_host_view_test_api.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/animation/test/ink_drop_host_view_test_api.h"
#include <utility>
namespace views {
namespace test {
InkDropHostTestApi::InkDropHostTestApi(InkDropHost* ink_drop_host)
: ink_drop_host_(ink_drop_host) {}
InkDropHostTestApi::~InkDropHostTestApi() = default;
void InkDropHostTestApi::SetInkDropMode(InkDropMode ink_drop_mode) {
ink_drop_host_->SetMode(ink_drop_mode);
}
void InkDropHostTestApi::SetInkDrop(std::unique_ptr<InkDrop> ink_drop,
bool handles_gesture_events) {
ink_drop_host_->SetMode(
handles_gesture_events
? views::InkDropHost::InkDropMode::ON
: views::InkDropHost::InkDropMode::ON_NO_GESTURE_HANDLER);
ink_drop_host_->ink_drop_ = std::move(ink_drop);
}
void InkDropHostTestApi::SetInkDrop(std::unique_ptr<InkDrop> ink_drop) {
SetInkDrop(std::move(ink_drop), true);
}
bool InkDropHostTestApi::HasInkDrop() const {
return ink_drop_host_->HasInkDrop();
}
InkDrop* InkDropHostTestApi::GetInkDrop() {
return ink_drop_host_->GetInkDrop();
}
void InkDropHostTestApi::AnimateToState(InkDropState state,
const ui::LocatedEvent* event) {
ink_drop_host_->AnimateToState(state, event);
}
} // namespace test
} // namespace views
| 29.510204 | 73 | 0.727524 | zealoussnow |
6f717d8d1475df34caffaea64cad207c70f71f85 | 1,914 | cpp | C++ | Codeforces/1436/d.cpp | eyangch/competitive-programming | 59839efcec72cb792e61b7d316f83ad54f16a166 | [
"MIT"
] | 14 | 2019-08-14T00:43:10.000Z | 2021-12-16T05:43:31.000Z | Codeforces/1436/d.cpp | eyangch/competitive-programming | 59839efcec72cb792e61b7d316f83ad54f16a166 | [
"MIT"
] | null | null | null | Codeforces/1436/d.cpp | eyangch/competitive-programming | 59839efcec72cb792e61b7d316f83ad54f16a166 | [
"MIT"
] | 6 | 2020-12-30T03:30:17.000Z | 2022-03-11T03:40:02.000Z | #include <bits/stdc++.h>
#define f first
#define s second
#define int long long
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <typename T1, typename T2>
ostream &operator <<(ostream &os, pair<T1, T2> p){os << p.first << " " << p.second; return os;}
template <typename T>
ostream &operator <<(ostream &os, vector<T> &v){for(T i : v)os << i << ", "; return os;}
template <typename T>
ostream &operator <<(ostream &os, set<T> s){for(T i : s) os << i << ", "; return os;}
template <typename T1, typename T2>
ostream &operator <<(ostream &os, map<T1, T2> m){for(pair<T1, T2> i : m) os << i << endl; return os;}
int N, a[200000];
vi graph[200000];
int leaves[200000], mx[200000], def[200000];
void dfs(int id){
for(int i : graph[id]){
dfs(i);
if(mx[id] == mx[i]){
def[id] += def[i];
}else if(mx[id] > mx[i]){
def[id] += def[i] + (mx[id] - mx[i]) * leaves[i];
}else{
def[id] += def[i] + (mx[i] - mx[id]) * leaves[id];
mx[id] = mx[i];
}
leaves[id] += leaves[i];
}
if((int)graph[id].size() == 0){
leaves[id] = 1;
mx[id] = a[id];
def[id] = 0;
}else{
if(def[id] >= a[id]){
def[id] -= a[id];
}else{
a[id] -= def[id];
def[id] = 0;
int aplus = a[id] / leaves[id];
mx[id] += aplus;
int ndef = a[id] % leaves[id];
if(ndef > 0){
mx[id]++;
def[id] = leaves[id] - ndef;
}
}
}
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
for(int i = 1; i < N; i++){
int p; cin >> p;
graph[p-1].push_back(i);
}
for(int i = 0; i < N; i++){
cin >> a[i];
}
dfs(0);
cout << mx[0] << endl;
return 0;
}
| 25.52 | 101 | 0.470742 | eyangch |
6f71d05d82f1f1b6e9dbfcaed69fc6f480c4a935 | 1,146 | cc | C++ | TestOutput/Subfolder/Windows.SharedLibrary.cc | hannes-harnisch/Snakify | 41254edddf2e0da0f4cc6d5e715b63701c7e17d1 | [
"MIT"
] | null | null | null | TestOutput/Subfolder/Windows.SharedLibrary.cc | hannes-harnisch/Snakify | 41254edddf2e0da0f4cc6d5e715b63701c7e17d1 | [
"MIT"
] | null | null | null | TestOutput/Subfolder/Windows.SharedLibrary.cc | hannes-harnisch/Snakify | 41254edddf2e0da0f4cc6d5e715b63701c7e17d1 | [
"MIT"
] | null | null | null | module;
#include "Core/Macros.hh"
#include "Windows.API.hh"
#include <string_view>
export module Vitro.Windows.SharedLibrary;
import Vitro.App.SharedLibraryBase;
import Vitro.Core.Unique;
import Vitro.Windows.Utils;
namespace vt::windows
{
export class SharedLibrary : public SharedLibraryBase
{
public:
[[nodiscard]] bool reload() final override
{
library = make_library();
return library.get() != nullptr;
}
void* handle() final override
{
return library.get();
}
protected:
SharedLibrary(std::string_view path) : path(widen_string(path)), library(make_library())
{}
void* load_symbol_address(std::string_view symbol) const final override
{
return ::GetProcAddress(library.get(), symbol.data());
}
private:
std::wstring path;
Unique<HMODULE, ::FreeLibrary> library;
decltype(library) make_library() const
{
auto raw_library = ::LoadLibraryW(path.data());
decltype(library) fresh_library(raw_library);
vt_ensure(raw_library, "Failed to find shared library '{}'.", narrow_string(path));
return fresh_library;
}
};
}
| 22.038462 | 91 | 0.67801 | hannes-harnisch |
4cf5ec8550895aa0236eeaa726717cc377a2c825 | 22,465 | cpp | C++ | hphp/runtime/ext/ext_error.ext_hhvm.cpp | larusx/hiphop-php | 65d2487ab7dbe5c06cb6dbb05e63e452ade52f7e | [
"PHP-3.01",
"Zend-2.0"
] | 1 | 2020-08-04T03:19:05.000Z | 2020-08-04T03:19:05.000Z | hphp/runtime/ext/ext_error.ext_hhvm.cpp | larusx/hiphop-php | 65d2487ab7dbe5c06cb6dbb05e63e452ade52f7e | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | hphp/runtime/ext/ext_error.ext_hhvm.cpp | larusx/hiphop-php | 65d2487ab7dbe5c06cb6dbb05e63e452ade52f7e | [
"PHP-3.01",
"Zend-2.0"
] | null | null | null | /*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include <runtime/ext_hhvm/ext_hhvm.h>
#include <runtime/base/builtin_functions.h>
#include <runtime/base/array/array_init.h>
#include <runtime/ext/ext.h>
#include <runtime/vm/class.h>
#include <runtime/vm/runtime.h>
#include <exception>
namespace HPHP {
/*
HPHP::Array HPHP::f_debug_backtrace(bool)
_ZN4HPHP17f_debug_backtraceEb
(return value) => rax
_rv => rdi
provide_object => rsi
*/
Value* fh_debug_backtrace(Value* _rv, bool provide_object) asm("_ZN4HPHP17f_debug_backtraceEb");
TypedValue * fg1_debug_backtrace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_debug_backtrace(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->_count = 0;
rv->m_type = KindOfArray;
tvCastToBooleanInPlace(args-0);
fh_debug_backtrace((Value*)(rv), (count > 0) ? (bool)(args[-0].m_data.num) : (bool)(true));
if (rv->m_data.num == 0LL) rv->m_type = KindOfNull;
return rv;
}
TypedValue* fg_debug_backtrace(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count <= 1LL) {
if ((count <= 0 || (args-0)->m_type == KindOfBoolean)) {
rv._count = 0;
rv.m_type = KindOfArray;
fh_debug_backtrace((Value*)(&(rv)), (count > 0) ? (bool)(args[-0].m_data.num) : (bool)(true));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_debug_backtrace(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_toomany_arguments_nr("debug_backtrace", 1, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
void HPHP::f_debug_print_backtrace()
_ZN4HPHP23f_debug_print_backtraceEv
*/
void fh_debug_print_backtrace() asm("_ZN4HPHP23f_debug_print_backtraceEv");
TypedValue* fg_debug_print_backtrace(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
fh_debug_print_backtrace();
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("debug_print_backtrace", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Array HPHP::f_error_get_last()
_ZN4HPHP16f_error_get_lastEv
(return value) => rax
_rv => rdi
*/
Value* fh_error_get_last(Value* _rv) asm("_ZN4HPHP16f_error_get_lastEv");
TypedValue* fg_error_get_last(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv._count = 0;
rv.m_type = KindOfArray;
fh_error_get_last((Value*)(&(rv)));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("error_get_last", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
bool HPHP::f_error_log(HPHP::String const&, int, HPHP::String const&, HPHP::String const&)
_ZN4HPHP11f_error_logERKNS_6StringEiS2_S2_
(return value) => rax
message => rdi
message_type => rsi
destination => rdx
extra_headers => rcx
*/
bool fh_error_log(Value* message, int message_type, Value* destination, Value* extra_headers) asm("_ZN4HPHP11f_error_logERKNS_6StringEiS2_S2_");
TypedValue * fg1_error_log(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_error_log(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->_count = 0;
rv->m_type = KindOfBoolean;
switch (count) {
default: // count >= 4
if (!IS_STRING_TYPE((args-3)->m_type)) {
tvCastToStringInPlace(args-3);
}
case 3:
if (!IS_STRING_TYPE((args-2)->m_type)) {
tvCastToStringInPlace(args-2);
}
case 2:
if ((args-1)->m_type != KindOfInt64) {
tvCastToInt64InPlace(args-1);
}
case 1:
break;
}
if (!IS_STRING_TYPE((args-0)->m_type)) {
tvCastToStringInPlace(args-0);
}
rv->m_data.num = (fh_error_log((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(0), (count > 2) ? (Value*)(args-2) : (Value*)(&null_string), (count > 3) ? (Value*)(args-3) : (Value*)(&null_string))) ? 1LL : 0LL;
return rv;
}
TypedValue* fg_error_log(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count >= 1LL && count <= 4LL) {
if ((count <= 3 || IS_STRING_TYPE((args-3)->m_type)) && (count <= 2 || IS_STRING_TYPE((args-2)->m_type)) && (count <= 1 || (args-1)->m_type == KindOfInt64) && IS_STRING_TYPE((args-0)->m_type)) {
rv._count = 0;
rv.m_type = KindOfBoolean;
rv.m_data.num = (fh_error_log((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(0), (count > 2) ? (Value*)(args-2) : (Value*)(&null_string), (count > 3) ? (Value*)(args-3) : (Value*)(&null_string))) ? 1LL : 0LL;
frame_free_locals_no_this_inl(ar, 4);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_error_log(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 4);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("error_log", count, 1, 4, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 4);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
long HPHP::f_error_reporting(HPHP::Variant const&)
_ZN4HPHP17f_error_reportingERKNS_7VariantE
(return value) => rax
level => rdi
*/
long fh_error_reporting(TypedValue* level) asm("_ZN4HPHP17f_error_reportingERKNS_7VariantE");
TypedValue* fg_error_reporting(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count <= 1LL) {
rv._count = 0;
rv.m_type = KindOfInt64;
Variant defVal0;
rv.m_data.num = (int64_t)fh_error_reporting((count > 0) ? (args-0) : (TypedValue*)(&defVal0));
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("error_reporting", 1, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
bool HPHP::f_restore_error_handler()
_ZN4HPHP23f_restore_error_handlerEv
(return value) => rax
*/
bool fh_restore_error_handler() asm("_ZN4HPHP23f_restore_error_handlerEv");
TypedValue* fg_restore_error_handler(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv._count = 0;
rv.m_type = KindOfBoolean;
rv.m_data.num = (fh_restore_error_handler()) ? 1LL : 0LL;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("restore_error_handler", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
bool HPHP::f_restore_exception_handler()
_ZN4HPHP27f_restore_exception_handlerEv
(return value) => rax
*/
bool fh_restore_exception_handler() asm("_ZN4HPHP27f_restore_exception_handlerEv");
TypedValue* fg_restore_exception_handler(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv._count = 0;
rv.m_type = KindOfBoolean;
rv.m_data.num = (fh_restore_exception_handler()) ? 1LL : 0LL;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("restore_exception_handler", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::f_set_error_handler(HPHP::Variant const&, int)
_ZN4HPHP19f_set_error_handlerERKNS_7VariantEi
(return value) => rax
_rv => rdi
error_handler => rsi
error_types => rdx
*/
TypedValue* fh_set_error_handler(TypedValue* _rv, TypedValue* error_handler, int error_types) asm("_ZN4HPHP19f_set_error_handlerERKNS_7VariantEi");
TypedValue * fg1_set_error_handler(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_set_error_handler(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
tvCastToInt64InPlace(args-1);
fh_set_error_handler((rv), (args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_ALL));
if (rv->m_type == KindOfUninit) rv->m_type = KindOfNull;
return rv;
}
TypedValue* fg_set_error_handler(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count >= 1LL && count <= 2LL) {
if ((count <= 1 || (args-1)->m_type == KindOfInt64)) {
fh_set_error_handler((&(rv)), (args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_ALL));
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_set_error_handler(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("set_error_handler", count, 1, 2, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Variant HPHP::f_set_exception_handler(HPHP::Variant const&)
_ZN4HPHP23f_set_exception_handlerERKNS_7VariantE
(return value) => rax
_rv => rdi
exception_handler => rsi
*/
TypedValue* fh_set_exception_handler(TypedValue* _rv, TypedValue* exception_handler) asm("_ZN4HPHP23f_set_exception_handlerERKNS_7VariantE");
TypedValue* fg_set_exception_handler(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
fh_set_exception_handler((&(rv)), (args-0));
if (rv.m_type == KindOfUninit) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_wrong_arguments_nr("set_exception_handler", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
void HPHP::f_hphp_set_error_page(HPHP::String const&)
_ZN4HPHP21f_hphp_set_error_pageERKNS_6StringE
page => rdi
*/
void fh_hphp_set_error_page(Value* page) asm("_ZN4HPHP21f_hphp_set_error_pageERKNS_6StringE");
TypedValue * fg1_hphp_set_error_page(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_hphp_set_error_page(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->m_data.num = 0LL;
rv->_count = 0;
rv->m_type = KindOfNull;
tvCastToStringInPlace(args-0);
fh_hphp_set_error_page((Value*)(args-0));
return rv;
}
TypedValue* fg_hphp_set_error_page(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
if (IS_STRING_TYPE((args-0)->m_type)) {
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
fh_hphp_set_error_page((Value*)(args-0));
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_hphp_set_error_page(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("hphp_set_error_page", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
void HPHP::f_hphp_throw_fatal_error(HPHP::String const&)
_ZN4HPHP24f_hphp_throw_fatal_errorERKNS_6StringE
error_msg => rdi
*/
void fh_hphp_throw_fatal_error(Value* error_msg) asm("_ZN4HPHP24f_hphp_throw_fatal_errorERKNS_6StringE");
TypedValue * fg1_hphp_throw_fatal_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_hphp_throw_fatal_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->m_data.num = 0LL;
rv->_count = 0;
rv->m_type = KindOfNull;
tvCastToStringInPlace(args-0);
fh_hphp_throw_fatal_error((Value*)(args-0));
return rv;
}
TypedValue* fg_hphp_throw_fatal_error(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 1LL) {
if (IS_STRING_TYPE((args-0)->m_type)) {
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
fh_hphp_throw_fatal_error((Value*)(args-0));
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_hphp_throw_fatal_error(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("hphp_throw_fatal_error", count, 1, 1, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 1);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
void HPHP::f_hphp_clear_unflushed()
_ZN4HPHP22f_hphp_clear_unflushedEv
*/
void fh_hphp_clear_unflushed() asm("_ZN4HPHP22f_hphp_clear_unflushedEv");
TypedValue* fg_hphp_clear_unflushed(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
fh_hphp_clear_unflushed();
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("hphp_clear_unflushed", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
HPHP::Array HPHP::f_hphp_debug_caller_info()
_ZN4HPHP24f_hphp_debug_caller_infoEv
(return value) => rax
_rv => rdi
*/
Value* fh_hphp_debug_caller_info(Value* _rv) asm("_ZN4HPHP24f_hphp_debug_caller_infoEv");
TypedValue* fg_hphp_debug_caller_info(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count == 0LL) {
rv._count = 0;
rv.m_type = KindOfArray;
fh_hphp_debug_caller_info((Value*)(&(rv)));
if (rv.m_data.num == 0LL) rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_toomany_arguments_nr("hphp_debug_caller_info", 0, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 0);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
bool HPHP::f_trigger_error(HPHP::String const&, int)
_ZN4HPHP15f_trigger_errorERKNS_6StringEi
(return value) => rax
error_msg => rdi
error_type => rsi
*/
bool fh_trigger_error(Value* error_msg, int error_type) asm("_ZN4HPHP15f_trigger_errorERKNS_6StringEi");
TypedValue * fg1_trigger_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_trigger_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->_count = 0;
rv->m_type = KindOfBoolean;
switch (count) {
default: // count >= 2
if ((args-1)->m_type != KindOfInt64) {
tvCastToInt64InPlace(args-1);
}
case 1:
break;
}
if (!IS_STRING_TYPE((args-0)->m_type)) {
tvCastToStringInPlace(args-0);
}
rv->m_data.num = (fh_trigger_error((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_USER_NOTICE))) ? 1LL : 0LL;
return rv;
}
TypedValue* fg_trigger_error(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count >= 1LL && count <= 2LL) {
if ((count <= 1 || (args-1)->m_type == KindOfInt64) && IS_STRING_TYPE((args-0)->m_type)) {
rv._count = 0;
rv.m_type = KindOfBoolean;
rv.m_data.num = (fh_trigger_error((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_USER_NOTICE))) ? 1LL : 0LL;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_trigger_error(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("trigger_error", count, 1, 2, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
/*
bool HPHP::f_user_error(HPHP::String const&, int)
_ZN4HPHP12f_user_errorERKNS_6StringEi
(return value) => rax
error_msg => rdi
error_type => rsi
*/
bool fh_user_error(Value* error_msg, int error_type) asm("_ZN4HPHP12f_user_errorERKNS_6StringEi");
TypedValue * fg1_user_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold));
TypedValue * fg1_user_error(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) {
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
rv->_count = 0;
rv->m_type = KindOfBoolean;
switch (count) {
default: // count >= 2
if ((args-1)->m_type != KindOfInt64) {
tvCastToInt64InPlace(args-1);
}
case 1:
break;
}
if (!IS_STRING_TYPE((args-0)->m_type)) {
tvCastToStringInPlace(args-0);
}
rv->m_data.num = (fh_user_error((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_USER_NOTICE))) ? 1LL : 0LL;
return rv;
}
TypedValue* fg_user_error(HPHP::VM::ActRec *ar) {
TypedValue rv;
int64_t count = ar->numArgs();
TypedValue* args UNUSED = ((TypedValue*)ar) - 1;
if (count >= 1LL && count <= 2LL) {
if ((count <= 1 || (args-1)->m_type == KindOfInt64) && IS_STRING_TYPE((args-0)->m_type)) {
rv._count = 0;
rv.m_type = KindOfBoolean;
rv.m_data.num = (fh_user_error((Value*)(args-0), (count > 1) ? (int)(args[-1].m_data.num) : (int)(k_E_USER_NOTICE))) ? 1LL : 0LL;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
fg1_user_error(&rv, ar, count);
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
}
} else {
throw_wrong_arguments_nr("user_error", count, 1, 2, 1);
}
rv.m_data.num = 0LL;
rv._count = 0;
rv.m_type = KindOfNull;
frame_free_locals_no_this_inl(ar, 2);
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
return &ar->m_r;
}
} // !HPHP
| 31.158114 | 236 | 0.635032 | larusx |
4cf84619d2c9ec81a411195e6fc9365c1b02ebc6 | 12,397 | cpp | C++ | thrift/lib/cpp2/async/GssSaslClient.cpp | senior7515/fbthrift | ebfa5458235632b88211cc01519bcd34b8a518e8 | [
"Apache-2.0"
] | null | null | null | thrift/lib/cpp2/async/GssSaslClient.cpp | senior7515/fbthrift | ebfa5458235632b88211cc01519bcd34b8a518e8 | [
"Apache-2.0"
] | null | null | null | thrift/lib/cpp2/async/GssSaslClient.cpp | senior7515/fbthrift | ebfa5458235632b88211cc01519bcd34b8a518e8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <thrift/lib/cpp2/async/GssSaslClient.h>
#include <folly/io/Cursor.h>
#include <folly/io/IOBuf.h>
#include <folly/io/IOBufQueue.h>
#include <folly/Memory.h>
#include <folly/MoveWrapper.h>
#include <thrift/lib/cpp/async/TEventBase.h>
#include <thrift/lib/cpp/concurrency/FunctionRunner.h>
#include <thrift/lib/cpp2/protocol/MessageSerializer.h>
#include <thrift/lib/cpp2/gen-cpp2/Sasl_types.h>
#include <thrift/lib/cpp2/gen-cpp2/SaslAuthService.h>
#include <thrift/lib/cpp2/security/KerberosSASLHandshakeClient.h>
#include <thrift/lib/cpp2/security/KerberosSASLHandshakeUtils.h>
#include <thrift/lib/cpp2/security/KerberosSASLThreadManager.h>
#include <thrift/lib/cpp2/security/SecurityLogger.h>
#include <thrift/lib/cpp/concurrency/Exception.h>
#include <memory>
using folly::IOBuf;
using folly::IOBufQueue;
using folly::MoveWrapper;
using apache::thrift::concurrency::Guard;
using apache::thrift::concurrency::Mutex;
using apache::thrift::concurrency::FunctionRunner;
using apache::thrift::concurrency::PosixThreadFactory;
using apache::thrift::concurrency::ThreadManager;
using apache::thrift::concurrency::TooManyPendingTasksException;
using apache::thrift::transport::TTransportException;
using namespace std;
using apache::thrift::sasl::SaslStart;
using apache::thrift::sasl::SaslRequest;
using apache::thrift::sasl::SaslReply;
using apache::thrift::sasl::SaslAuthService_authFirstRequest_pargs;
using apache::thrift::sasl::SaslAuthService_authFirstRequest_presult;
using apache::thrift::sasl::SaslAuthService_authNextRequest_pargs;
using apache::thrift::sasl::SaslAuthService_authNextRequest_presult;
namespace apache { namespace thrift {
static const char MECH[] = "krb5";
GssSaslClient::GssSaslClient(apache::thrift::async::TEventBase* evb,
const std::shared_ptr<SecurityLogger>& logger)
: SaslClient(logger)
, evb_(evb)
, clientHandshake_(new KerberosSASLHandshakeClient(logger))
, mutex_(new Mutex)
, saslThreadManager_(nullptr)
, seqId_(new int(0))
, protocol_(0xFFFF)
, inProgress_(std::make_shared<bool>(false)) {
}
void GssSaslClient::start(Callback *cb) {
auto channelCallbackUnavailable = channelCallbackUnavailable_;
auto clientHandshake = clientHandshake_;
auto mutex = mutex_;
auto logger = saslLogger_;
auto proto = protocol_;
auto seqId = seqId_;
auto threadManager = saslThreadManager_;
auto inProgress = inProgress_;
logger->logStart("prepare_first_request");
auto ew_tm = folly::try_and_catch<TooManyPendingTasksException>([&]() {
if (!saslThreadManager_) {
throw TApplicationException(
"saslThreadManager is not set in GssSaslClient");
}
logger->logStart("thread_manager_overhead");
*inProgress = true;
threadManager->start(std::make_shared<FunctionRunner>([=] {
logger->logEnd("thread_manager_overhead");
MoveWrapper<unique_ptr<IOBuf>> iobuf;
folly::exception_wrapper ex;
{
Guard guard(*mutex);
if (*channelCallbackUnavailable) {
return;
}
evb_->runInEventBaseThread([=] () mutable {
if (*channelCallbackUnavailable) {
return;
}
cb->saslStarted();
});
}
ex = folly::try_and_catch<std::exception, TTransportException,
TProtocolException, TApplicationException, TKerberosException>(
[&]() {
clientHandshake->startClientHandshake();
auto token = clientHandshake->getTokenToSend();
SaslStart start;
start.mechanism = MECH;
if (token != nullptr) {
start.request.response = *token;
start.request.__isset.response = true;
}
start.__isset.request = true;
SaslAuthService_authFirstRequest_pargs argsp;
argsp.saslStart = &start;
*iobuf = PargsPresultProtoSerialize(
proto, argsp, "authFirstRequest", T_CALL, (*seqId)++);
});
Guard guard(*mutex);
// Return if channel is unavailable. Ie. evb_ may not be good.
if (*channelCallbackUnavailable) {
return;
}
// Log the overhead around rescheduling the remainder of the
// handshake at the back of the evb queue.
logger->logStart("evb_overhead");
evb_->runInEventBaseThread([=]() mutable {
logger->logEnd("evb_overhead");
if (*channelCallbackUnavailable) {
return;
}
if (ex) {
cb->saslError(std::move(ex));
if (*inProgress) {
threadManager->end();
*inProgress = false;
}
return;
} else {
logger->logStart("first_rtt");
cb->saslSendServer(std::move(*iobuf));
}
});
}));
});
if (ew_tm) {
logger->log("too_many_pending_tasks_in_start");
cb->saslError(std::move(ew_tm));
// no end() here. If this happens, we never really started.
}
}
void GssSaslClient::consumeFromServer(
Callback *cb, std::unique_ptr<IOBuf>&& message) {
std::shared_ptr<IOBuf> smessage(std::move(message));
auto channelCallbackUnavailable = channelCallbackUnavailable_;
auto clientHandshake = clientHandshake_;
auto mutex = mutex_;
auto logger = saslLogger_;
auto proto = protocol_;
auto seqId = seqId_;
auto threadManager = saslThreadManager_;
auto inProgress = inProgress_;
auto ew_tm = folly::try_and_catch<TooManyPendingTasksException>([&]() {
threadManager->get()->add(std::make_shared<FunctionRunner>([=] {
std::string req_data;
MoveWrapper<unique_ptr<IOBuf>> iobuf;
folly::exception_wrapper ex;
{
Guard guard(*mutex);
if (*channelCallbackUnavailable) {
return;
}
evb_->runInEventBaseThread([=] () mutable {
if (*channelCallbackUnavailable) {
return;
}
cb->saslStarted();
});
}
// Get the input string or outcome status
std::string input = "";
bool finished = false;
// SaslAuthService_authFirstRequest_presult should be structurally
// identical to SaslAuthService_authNextRequest_presult
static_assert(sizeof(SaslAuthService_authFirstRequest_presult) ==
sizeof(SaslAuthService_authNextRequest_presult),
"Types should be structurally identical");
static_assert(std::is_same<
decltype(SaslAuthService_authFirstRequest_presult::success),
decltype(SaslAuthService_authNextRequest_presult::success)>::value,
"Types should be structurally identical");
ex = folly::try_and_catch<std::exception, TTransportException,
TProtocolException, TApplicationException, TKerberosException>(
[&]() {
SaslReply reply;
SaslAuthService_authFirstRequest_presult presult;
presult.success = &reply;
string methodName;
try {
methodName = PargsPresultProtoDeserialize(
proto, presult, smessage.get(), T_REPLY).first;
} catch (const TProtocolException& e) {
if (proto == protocol::T_BINARY_PROTOCOL &&
e.getType() == TProtocolException::BAD_VERSION) {
// We used to use compact always in security messages, even when
// the header said they should be binary. If we end up in this if,
// we're talking to an old version remote end, so try compact too.
methodName = PargsPresultProtoDeserialize(
protocol::T_COMPACT_PROTOCOL,
presult,
smessage.get(),
T_REPLY).first;
} else {
throw;
}
}
if (methodName != "authFirstRequest" &&
methodName != "authNextRequest") {
throw TApplicationException("Bad return method name: " + methodName);
}
if (reply.__isset.challenge) {
input = reply.challenge;
}
if (reply.__isset.outcome) {
finished = reply.outcome.success;
}
clientHandshake->handleResponse(input);
auto token = clientHandshake->getTokenToSend();
if (clientHandshake->getPhase() == COMPLETE) {
assert(token == nullptr);
if (finished != true) {
throw TKerberosException("Outcome of false returned from server");
}
}
if (token != nullptr) {
SaslRequest req;
req.response = *token;
req.__isset.response = true;
SaslAuthService_authNextRequest_pargs argsp;
argsp.saslRequest = &req;
*iobuf = PargsPresultProtoSerialize(proto, argsp, "authNextRequest",
T_CALL, (*seqId)++);
}
});
Guard guard(*mutex);
// Return if channel is unavailable. Ie. evb_ may not be good.
if (*channelCallbackUnavailable) {
return;
}
auto phase = clientHandshake->getPhase();
evb_->runInEventBaseThread([=]() mutable {
if (*channelCallbackUnavailable) {
return;
}
if (ex) {
cb->saslError(std::move(ex));
if (*inProgress) {
threadManager->end();
*inProgress = false;
}
return;
}
if (*iobuf && !(*iobuf)->empty()) {
if (phase == SELECT_SECURITY_LAYER) {
logger->logStart("third_rtt");
} else {
logger->logStart("second_rtt");
}
cb->saslSendServer(std::move(*iobuf));
}
if (clientHandshake_->isContextEstablished()) {
cb->saslComplete();
if (*inProgress) {
threadManager->end();
*inProgress = false;
}
}
});
}));
});
if (ew_tm) {
logger->log("too_many_pending_tasks_in_consume");
cb->saslError(std::move(ew_tm));
if (*inProgress) {
threadManager->end();
*inProgress = false;
}
}
}
std::unique_ptr<IOBuf> GssSaslClient::wrap(std::unique_ptr<IOBuf>&& buf) {
buf->coalesce();
std::unique_ptr<IOBuf> wrapped = clientHandshake_->wrapMessage(
std::move(buf));
uint32_t wraplen = wrapped->length();
std::unique_ptr<IOBuf> framing = IOBuf::create(sizeof(wraplen));
framing->append(sizeof(wraplen));
framing->appendChain(std::move(wrapped));
folly::io::RWPrivateCursor c(framing.get());
c.writeBE<uint32_t>(wraplen);
return framing;
}
std::unique_ptr<IOBuf> GssSaslClient::unwrap(
IOBufQueue* q,
size_t* remaining) {
folly::io::Cursor c(q->front());
size_t chainSize = q->front()->computeChainDataLength();
uint32_t wraplen = 0;
if (chainSize < sizeof(wraplen)) {
*remaining = sizeof(wraplen) - chainSize;
return nullptr;
}
wraplen = c.readBE<uint32_t>();
if (chainSize < sizeof(wraplen) + wraplen) {
*remaining = sizeof(wraplen) + wraplen - chainSize;
return nullptr;
}
// unwrap the data
q->trimStart(sizeof(wraplen));
std::unique_ptr<IOBuf> input = q->split(wraplen);
input->coalesce();
std::unique_ptr<IOBuf> output = clientHandshake_->unwrapMessage(
std::move(input));
*remaining = 0;
return output;
}
std::string GssSaslClient::getClientIdentity() const {
if (clientHandshake_->isContextEstablished()) {
return clientHandshake_->getEstablishedClientPrincipal();
} else {
return "";
}
}
std::string GssSaslClient::getServerIdentity() const {
if (clientHandshake_->isContextEstablished()) {
return clientHandshake_->getEstablishedServicePrincipal();
} else {
return "";
}
}
void GssSaslClient::markChannelCallbackUnavailable() {
apache::thrift::concurrency::Guard guard(*mutex_);
if (*inProgress_) {
saslThreadManager_->end();
*inProgress_ = false;
}
*channelCallbackUnavailable_ = true;
}
}}
| 32.11658 | 79 | 0.644027 | senior7515 |
4cfa63858fd2c35c81208f00ae7f292a0ea48f71 | 707 | cpp | C++ | src/chargemon.cpp | kimmoli/chargemon | c441bec10531de8ff13226df5c48236e3a58e04b | [
"MIT"
] | 2 | 2018-04-02T14:48:32.000Z | 2018-08-29T19:44:16.000Z | src/chargemon.cpp | kimmoli/chargemon | c441bec10531de8ff13226df5c48236e3a58e04b | [
"MIT"
] | 10 | 2016-03-15T11:13:42.000Z | 2021-11-14T13:00:36.000Z | src/chargemon.cpp | kimmoli/chargemon | c441bec10531de8ff13226df5c48236e3a58e04b | [
"MIT"
] | 4 | 2016-03-15T10:32:13.000Z | 2018-08-29T08:29:09.000Z | /*
* Charge monitor (C) 2014-2019 Kimmo Lindholm
* LICENSE MIT
*/
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <sailfishapp.h>
#include <QtQml>
#include <QScopedPointer>
#include <QQuickView>
#include <QQmlEngine>
#include <QGuiApplication>
#include <QQmlContext>
#include <QCoreApplication>
#include "cmon.h"
int main(int argc, char *argv[])
{
qmlRegisterType<Cmon>("harbour.chargemon", 1, 0, "Cmon");
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
view->setSource(SailfishApp::pathTo("qml/chargemon.qml"));
view->show();
return app->exec();
}
| 22.09375 | 79 | 0.681754 | kimmoli |
4cffff380a8068b1638ddbc355b7c1e132d489ff | 1,494 | cpp | C++ | testing/bench_ext_pushpull.cpp | arthurbiancarelli/liblsl | c217f93060e2ac1bde84dd3aa5bcfd9bc8460f1f | [
"MIT"
] | null | null | null | testing/bench_ext_pushpull.cpp | arthurbiancarelli/liblsl | c217f93060e2ac1bde84dd3aa5bcfd9bc8460f1f | [
"MIT"
] | null | null | null | testing/bench_ext_pushpull.cpp | arthurbiancarelli/liblsl | c217f93060e2ac1bde84dd3aa5bcfd9bc8460f1f | [
"MIT"
] | null | null | null | #include "catch.hpp"
#include "helper_type.hpp"
#include <atomic>
#include <list>
#include <lsl_cpp.h>
#include <string>
#include <thread>
TEMPLATE_TEST_CASE("pushpull", "[basic][throughput]", char, float, std::string) {
const std::size_t max_nchan = 128, chunk_size = 128;
const std::size_t param_nchan[] = {1, max_nchan};
const std::size_t param_inlets[] = {0, 1, 10};
const TestType data[max_nchan * chunk_size] = {TestType()};
//TestType data_out[max_n * chunk_size];
const char *name = SampleType<TestType>::fmt_string();
lsl::channel_format_t cf = (lsl::channel_format_t)SampleType<TestType>::chan_fmt;
for (auto nchan : param_nchan) {
lsl::stream_outlet out(
lsl::stream_info(name, "PushPull", (int) nchan, lsl::IRREGULAR_RATE, cf, "streamid"));
auto found_stream_info(lsl::resolve_stream("name", name, 1, 2.0));
REQUIRE(!found_stream_info.empty());
std::list<lsl::stream_inlet> inlet_list;
for (auto n_inlets : param_inlets) {
while (inlet_list.size() < n_inlets) {
inlet_list.emplace_front(found_stream_info[0], 1, false);
inlet_list.front().open_stream(.5);
}
BENCHMARK("push_sample_nchan_" + std::to_string(nchan)+"_inlets_"+std::to_string(n_inlets)) {
for (size_t s = 0; s < chunk_size; s++) out.push_sample(data);
};
BENCHMARK("push_chunk_nchan_" + std::to_string(nchan)+"_inlets_"+std::to_string(n_inlets)) {
out.push_chunk_multiplexed(data, chunk_size);
};
for(auto &inlet: inlet_list)
inlet.flush();
}
}
}
| 33.2 | 96 | 0.697456 | arthurbiancarelli |
98048a5af18a9553730de157db8aa33d687fe8e8 | 12,809 | cpp | C++ | src/matrix.cpp | tenglvjun/math | 6865d39512ff8836281fa00980fb5fa85ced2a35 | [
"MIT"
] | null | null | null | src/matrix.cpp | tenglvjun/math | 6865d39512ff8836281fa00980fb5fa85ced2a35 | [
"MIT"
] | null | null | null | src/matrix.cpp | tenglvjun/math | 6865d39512ff8836281fa00980fb5fa85ced2a35 | [
"MIT"
] | null | null | null | #include "matrix.h"
#include <memory.h>
#include <assert.h>
#include <cmath>
#include <iostream>
#include "math_tools.h"
#include "math_def.h"
GeoMatrix::GeoMatrix(const unsigned int row, const unsigned int col)
: m_data(nullptr), m_row(0), m_col(0)
{
Init(row, col);
}
GeoMatrix::GeoMatrix(const unsigned int row, const unsigned int col, const double *data)
: m_data(nullptr), m_row(0), m_col(0)
{
Init(row, col);
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m_col; j++)
{
m_data[i][j] = data[m_col * i + j];
}
}
}
GeoMatrix::GeoMatrix(const GeoMatrix &m)
{
Init(m.m_row, m.m_col);
for (unsigned int row = 0; row < m_row; row++)
{
for (unsigned int col = 0; col < m_col; col++)
{
m_data[row][col] = m[row][col];
}
}
}
GeoMatrix::~GeoMatrix()
{
Clear();
}
GeoMatrix &GeoMatrix::operator=(const GeoMatrix &m)
{
if (&m == this)
{
return *this;
}
Clear();
Init(m.m_row, m.m_col);
for (unsigned int row = 0; row < m_row; row++)
{
for (unsigned int col = 0; col < m_col; col++)
{
m_data[row][col] = m[row][col];
}
}
return *this;
}
double *GeoMatrix::operator[](const unsigned int idx) const
{
assert(m_data && (idx < m_row));
return m_data[idx];
}
double *GeoMatrix::operator[](const unsigned int idx)
{
assert(m_data && (idx < m_row));
return m_data[idx];
}
GeoVector3D GeoMatrix::operator*(const GeoVector3D &v) const
{
assert((GeoVector3D::Size() == m_col) && (m_col == m_row));
GeoVector3D ret;
ret[0] = m_data[0][0] * v[0] + m_data[0][1] * v[1] + m_data[0][2] * v[2];
ret[1] = m_data[1][0] * v[0] + m_data[1][1] * v[1] + m_data[1][2] * v[2];
ret[2] = m_data[2][0] * v[0] + m_data[2][1] * v[1] + m_data[2][2] * v[2];
return ret;
}
GeoVector2D GeoMatrix::operator*(const GeoVector2D &v) const
{
assert((GeoVector2D::Size() == m_col) && (m_col == m_row));
GeoVector2D ret;
ret[0] = m_data[0][0] * v[0] + m_data[0][1] * v[1];
ret[1] = m_data[1][0] * v[0] + m_data[1][1] * v[1];
return ret;
}
GeoVector4D GeoMatrix::operator*(const GeoVector4D &v) const
{
assert((GeoVector4D::Size() == m_col) && (m_col == m_row));
GeoVector4D ret;
ret[0] = m_data[0][0] * v[0] + m_data[0][1] * v[1] + m_data[0][2] * v[2] + m_data[0][3] * v[3];
ret[1] = m_data[1][0] * v[0] + m_data[1][1] * v[1] + m_data[1][2] * v[2] + m_data[1][3] * v[3];
ret[2] = m_data[2][0] * v[0] + m_data[2][1] * v[1] + m_data[2][2] * v[2] + m_data[2][3] * v[3];
ret[3] = m_data[3][0] * v[0] + m_data[3][1] * v[1] + m_data[3][2] * v[2] + m_data[3][3] * v[3];
return ret;
}
GeoMatrix GeoMatrix::operator*(const GeoMatrix &m) const
{
assert(m_col == m.Rows());
GeoMatrix ret(m_row, m.Cols());
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m.Cols(); j++)
{
for (unsigned int k = 0; k < m_col; k++)
{
ret[i][j] += (m_data[i][k] * m[k][j]);
}
}
}
return ret;
}
void GeoMatrix::operator*=(const double s)
{
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m_col; j++)
{
m_data[i][j] *= s;
}
}
}
GeoMatrix GeoMatrix::operator*(const double s)
{
GeoMatrix ret(m_row, m_col);
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m_col; j++)
{
ret[i][j] *= s;
}
}
return ret;
}
void GeoMatrix::operator+=(const GeoMatrix &m)
{
assert((m_col == m.Cols()) && (m_row == m.Rows()));
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m_col; j++)
{
m_data[i][j] += m[i][j];
}
}
}
void GeoMatrix::SetIdentity()
{
assert((m_row == m_col) && (m_row > 0));
for (unsigned int row = 0; row < m_row; row++)
{
for (unsigned int col = 0; col < m_col; col++)
{
if (row == col)
{
m_data[row][col] = 1.0f;
}
else
{
m_data[row][col] = 0.0f;
}
}
}
}
void GeoMatrix::Zeros()
{
for (unsigned int row = 0; row < m_row; row++)
{
m_data[row] = new double[m_col];
for (unsigned int col = 0; col < m_col; col++)
{
m_data[row][col] = 0.0f;
}
}
}
void GeoMatrix::Resharp(const unsigned int row, const unsigned int col)
{
if (m_row == row && m_col == col)
{
Zeros();
return;
}
Clear();
Init(row, col);
}
void GeoMatrix::Flatten(std::vector<float> &data) const
{
for (unsigned int j = 0; j < m_col; j++)
{
for (unsigned int i = 0; i < m_row; i++)
{
data.push_back((float)(m_data[i][j]));
}
}
}
GeoMatrix GeoMatrix::SubMatrix(const unsigned int sRow, const unsigned int eRow, const unsigned int sCol, const unsigned int eCol)
{
GeoMatrix m(eRow - sRow, eCol - sCol);
for (unsigned int i = sRow; i < eRow; i++)
{
for (unsigned int j = sCol; j < eCol; j++)
{
m[i - sRow][j - sCol] = m_data[i][j];
}
}
return m;
}
unsigned int GeoMatrix::Rows() const
{
return m_row;
}
unsigned int GeoMatrix::Cols() const
{
return m_col;
}
bool GeoMatrix::LUDecompose(GeoMatrix &up, GeoMatrix &low) const
{
if (!IsSquare())
{
return false;
}
up.Resharp(m_row, m_col);
low.Resharp(m_row, m_col);
unsigned int n = m_row;
double sum;
for (unsigned int i = 0; i < n; i++)
{
// Upper Triangular
for (unsigned int k = i; k < n; k++)
{
// Summation of L(i, j) * U(j, k)
sum = 0.0f;
for (unsigned int j = 0; j < i; j++)
sum += (low[i][j] * up[j][k]);
// Evaluating U(i, k)
up[i][k] = m_data[i][k] - sum;
if ((i == k) && (MathTools::IsZero(up[i][k])))
{
return false;
}
}
// Lower Triangular
for (unsigned int k = i; k < n; k++)
{
if (i == k)
{
low[i][i] = 1; // Diagonal as 1
}
else
{
// Summation of L(k, j) * U(j, i)
sum = 0;
for (unsigned int j = 0; j < i; j++)
{
sum += (low[k][j] * up[j][i]);
}
// Evaluating L(k, i)
low[k][i] = (m_data[k][i] - sum) / up[i][i];
}
}
}
return true;
}
double GeoMatrix::Det() const
{
GeoMatrix up(m_row, m_col);
GeoMatrix low(m_row, m_col);
if (!LUDecompose(up, low))
{
return 0;
}
double det = 1.0f;
for (unsigned int i = 0; i < m_row; i++)
{
det *= up[i][i];
}
return det;
}
bool GeoMatrix::Inverse(GeoMatrix &inverse) const
{
GeoMatrix up(m_row, m_col);
GeoMatrix low(m_row, m_col);
if (!LUDecompose(up, low))
{
return false;
}
inverse.Resharp(m_row, m_col);
for (unsigned int i = 0; i < m_row; i++)
{
GeoVector b(m_col);
for (unsigned int j = 0; j < m_col; j++)
{
b[j] = (i == j) ? 1 : 0;
}
GeoVector ret = GeoMatrix::SolveLinearEquation(up, low, b);
inverse.SetVector(i, ret, false);
}
return true;
}
bool GeoMatrix::IsSquare() const
{
assert((m_col > 0) && (m_col > 0));
return (m_col == m_row);
}
GeoMatrix &GeoMatrix::Transpose()
{
assert((m_col > 0) && (m_col > 0));
GeoMatrix tmp(m_col, m_row);
Transpose(tmp);
(*this) = (tmp);
return *this;
}
void GeoMatrix::Transpose(GeoMatrix &transpose) const
{
transpose.Resharp(m_col, m_row);
for (unsigned int row = 0; row < m_row; row++)
{
for (unsigned int col = 0; col < m_col; col++)
{
transpose[col][row] = m_data[row][col];
}
}
}
void GeoMatrix::SetVector(const unsigned int idx, const GeoVector &v, bool isRow)
{
if (isRow)
{
assert(m_col == v.Dim());
for (unsigned int col = 0; col < m_col; col++)
{
m_data[idx][col] = v[col];
}
}
else
{
assert(m_row == v.Dim());
for (unsigned int row = 0; row < m_row; row++)
{
m_data[row][idx] = v[row];
}
}
}
bool GeoMatrix::SolveLinearEquation(const GeoVector &b, GeoVector &x) const
{
assert(b.Dim() == x.Dim());
GeoMatrix up(m_row, m_col);
GeoMatrix low(m_row, m_col);
if (!LUDecompose(up, low))
{
return false;
}
x = GeoMatrix::SolveLinearEquation(up, low, b);
return true;
}
void GeoMatrix::Dump() const
{
std::cout.precision(5);
for (unsigned int i = 0; i < m_row; i++)
{
for (unsigned int j = 0; j < m_col; j++)
{
std::cout << m_data[i][j] << " ";
}
std::cout << std::endl;
}
}
void GeoMatrix::Clear()
{
for (unsigned int row = 0; row < m_row; row++)
{
SAFE_DELETE_ARRAY(m_data[row]);
}
SAFE_DELETE(m_data);
m_row = 0;
m_col = 0;
}
void GeoMatrix::Init(const unsigned int row, const unsigned int col)
{
m_row = row;
m_col = col;
m_data = new double *[m_row];
Zeros();
}
GeoMatrix GeoMatrix::TranslateMatrix(const GeoVector3D &trans)
{
GeoMatrix matrix(4, 4);
matrix.SetIdentity();
matrix[0][3] = trans[0];
matrix[1][3] = trans[1];
matrix[2][3] = trans[2];
return matrix;
}
GeoMatrix GeoMatrix::TranslateMatrix(const GeoVector4D &trans)
{
GeoMatrix matrix(4, 4);
matrix.SetIdentity();
matrix[0][3] = trans[0];
matrix[1][3] = trans[1];
matrix[2][3] = trans[2];
return matrix;
}
GeoMatrix GeoMatrix::RotateMatrix(const double angle, const GeoVector3D &axis)
{
GeoMatrix matrix(4, 4);
double c = cos(angle);
double s = sin(angle);
matrix[0][0] = c + (1 - c) * axis[0] * axis[0];
matrix[0][1] = (1 - c) * axis[0] * axis[1] - s * axis[2];
matrix[0][2] = (1 - c) * axis[0] * axis[2] + s * axis[1];
matrix[1][0] = (1 - c) * axis[0] * axis[1] + s * axis[2];
matrix[1][1] = c + (1 - c) * axis[1] * axis[1];
matrix[1][2] = (1 - c) * axis[1] * axis[2] - s * axis[0];
matrix[2][0] = (1 - c) * axis[0] * axis[2] - s * axis[1];
matrix[2][1] = (1 - c) * axis[1] * axis[2] + s * axis[0];
matrix[2][2] = c + (1 - c) * axis[2] * axis[2];
matrix[3][3] = 1.0f;
return matrix;
}
GeoMatrix GeoMatrix::ScaleMatrix(const double s)
{
GeoMatrix ret(4, 4);
ret.SetIdentity();
ret[0][0] = s;
ret[1][1] = s;
ret[2][2] = s;
return ret;
}
GeoVector GeoMatrix::SolveLinearEquation(const GeoMatrix &up, const GeoMatrix &low, const GeoVector &b)
{
double sum;
// Solve Lower
GeoVector y(b.Dim());
for (int row = 0; row < (int)low.Rows(); row++)
{
sum = 0.0f;
for (int col = 0; col < row; col++)
{
sum += low[row][col] * y[col];
}
y[row] = (b[row] - sum) / low[row][row];
}
GeoVector ret(y.Dim());
//Solve Upper
for (int row = (int)(up.Rows() - 1); row >= 0; row--)
{
sum = 0.0f;
for (int col = (int)(up.Cols() - 1); col > row; col--)
{
sum += up[row][col] * ret[col];
}
ret[row] = (y[row] - sum) / up[row][row];
}
return ret;
}
GeoVector4D operator*(const GeoVector4D &v, const GeoMatrix &m)
{
assert((GeoVector4D::Size() == m.Cols()) && (m.IsSquare()));
GeoVector4D ret;
ret[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2] + m[0][3] * v[3];
ret[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2] + m[1][3] * v[3];
ret[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2] + m[2][3] * v[3];
ret[3] = m[3][0] * v[0] + m[3][1] * v[1] + m[3][2] * v[2] + m[3][3] * v[3];
return ret;
}
GeoVector3D operator*(const GeoVector3D &v, const GeoMatrix &m)
{
assert((GeoVector3D::Size() == m.Cols()) && (m.IsSquare()));
GeoVector3D ret;
ret[0] = m[0][0] * v[0] + m[0][1] * v[1] + m[0][2] * v[2];
ret[1] = m[1][0] * v[0] + m[1][1] * v[1] + m[1][2] * v[2];
ret[2] = m[2][0] * v[0] + m[2][1] * v[1] + m[2][2] * v[2];
return ret;
}
GeoVector2D operator*(const GeoVector2D &v, const GeoMatrix &m)
{
assert((GeoVector2D::Size() == m.Cols()) && (m.IsSquare()));
GeoVector2D ret;
ret[0] = m[0][0] * v[0] + m[0][1] * v[1];
ret[1] = m[1][0] * v[0] + m[1][1] * v[1];
return ret;
} | 21.312812 | 130 | 0.487626 | tenglvjun |
980492efb2ca86c09bbc14d218251b3a45554a25 | 5,158 | hpp | C++ | store.servers/src/rs256-secure-server.hpp | once-ler/Store-cpp | 27d65057b2984c61a4b8be9d96d8fa6d70de1fb7 | [
"BSD-3-Clause"
] | 3 | 2019-08-18T19:14:02.000Z | 2019-09-20T05:38:58.000Z | store.servers/src/rs256-secure-server.hpp | once-ler/Store-cpp | 27d65057b2984c61a4b8be9d96d8fa6d70de1fb7 | [
"BSD-3-Clause"
] | null | null | null | store.servers/src/rs256-secure-server.hpp | once-ler/Store-cpp | 27d65057b2984c61a4b8be9d96d8fa6d70de1fb7 | [
"BSD-3-Clause"
] | 1 | 2019-09-20T05:39:01.000Z | 2019-09-20T05:39:01.000Z | #pragma once
#include <regex>
#include "store.common/src/web_token.hpp"
#include "store.servers/src/http-server.hpp"
#include "store.servers/src/session.hpp"
#include "store.servers/src/replies.hpp"
#include "store.models/src/ioc/service_provider.hpp"
using namespace store::common;
using namespace store::servers::util;
namespace ioc = store::ioc;
namespace store::servers {
namespace secured::routes {
using Route = std::pair<string, function<void((struct evhttp_request*, vector<string>, session_t&))>>;
Route getSession = {
"^/api/session(\\?.*)?",
[](struct evhttp_request* req, vector<string> segments = {}, session_t& sess){
if (evhttp_request_get_command(req) != EVHTTP_REQ_GET) {
evhttp_send_error(req, HTTP_BADREQUEST, "Bad Request");
return;
}
json j = sess;
store::servers::replyOK(req, j.dump(2), "application/json");
}
};
}
class RS256SecureServer : public HTTPServer {
using HTTPServer::HTTPServer;
public:
RS256SecureServer() : HTTPServer() {
using namespace secured::routes;
rs256KeyPair = ioc::ServiceProvider->GetInstance<RS256KeyPair>();
routes = { getSession };
unsecureRoutes = {};
}
map<string, function<void((struct evhttp_request*, vector<string>, session_t&))>> routes{};
// For delivering assets
map<string, function<void((struct evhttp_request*, vector<string>))>> unsecureRoutes{};
void ProcessRequest(struct evhttp_request* req) override {
// Handle CORS preflight.
if (evhttp_request_get_command(req) == EVHTTP_REQ_OPTIONS) {
auto origin = evhttp_find_header(req->input_headers, "Origin");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Access-Control-Allow-Origin", origin != NULL ? origin : "null");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Vary", "origin");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Access-Control-Allow-Credentials", "true");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Access-Control-Allow-Methods", "POST, GET, OPTIONS");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Access-Control-Allow-Headers", "Origin, Accept, Content-Type, x-access-token");
evhttp_add_header (evhttp_request_get_output_headers(req),
"Access-Control-Max-Age", "86400");
evhttp_send_reply(req, HTTP_OK, "OK", NULL);
return;
}
// Check whether route can be unsecured.
bool uri_matched = tryMatchUri(req);
if (uri_matched)
return;
// Secure session required.
json j;
bool authenticated = isAuthenticated(req, j);
if (!authenticated) {
evhttp_send_error(req, 401, NULL);
return;
}
// localhost:1718/a/b/c
// uri -> /a/b/c
// Pass the decrypted payload to expose fields such as "user" if needed.
uri_matched = tryMatchUri(req, j);
if (uri_matched)
return;
evhttp_send_error(req, HTTP_NOTFOUND, "Not Found");
}
private:
shared_ptr<RS256KeyPair> rs256KeyPair;
bool isAuthenticated(struct evhttp_request* req, json& j) {
const char* val = evhttp_find_header(req->input_headers, "x-access-token");
if (val != NULL)
return isRS256Authenticated(rs256KeyPair->publicKey, val, j);
// x-access-token not found in header. Expect in querystring if jsonp.
map<string, string> querystrings = tryGetQueryString(req);
string xtoken = querystrings["x-access-token"];
if (xtoken.size() > 0)
return isRS256Authenticated(rs256KeyPair->publicKey, xtoken, j);
return false;
}
// Secure routes.
bool tryMatchUri(struct evhttp_request* req, json& j) {
const char* uri = evhttp_request_uri(req);
string uri_str = string{uri};
bool uri_matched = false;
session_t sess = j;
for (const auto& a : routes) {
std::smatch seg_match;
vector<string> segments;
if (std::regex_search(uri_str, seg_match, std::regex((a.first)))) {
for (size_t i = 0; i < seg_match.size(); ++i)
segments.emplace_back(seg_match[i]);
uri_matched = true;
a.second(req, segments, sess);
break;
}
}
return uri_matched;
}
// Unsecure routes.
bool tryMatchUri(struct evhttp_request* req) {
const char* uri = evhttp_request_uri(req);
string uri_str = string{uri};
bool uri_matched = false;
for (const auto& a : unsecureRoutes) {
std::smatch seg_match;
vector<string> segments;
if (std::regex_search(uri_str, seg_match, std::regex((a.first)))) {
for (size_t i = 0; i < seg_match.size(); ++i)
segments.emplace_back(seg_match[i]);
uri_matched = true;
a.second(req, segments);
break;
}
}
return uri_matched;
}
};
} | 31.072289 | 106 | 0.620396 | once-ler |
980a8fd61df23f267be33d8b8c604340efb35ff7 | 803 | cc | C++ | src/storage/minfs/allocator/storage_host.cc | wwjiang007/fuchsia-1 | 0db66b52b5bcd3e27c8b8c2163925309e8522f94 | [
"BSD-2-Clause"
] | 210 | 2019-02-05T12:45:09.000Z | 2022-03-28T07:59:06.000Z | src/storage/minfs/allocator/storage_host.cc | wwjiang007/fuchsia-1 | 0db66b52b5bcd3e27c8b8c2163925309e8522f94 | [
"BSD-2-Clause"
] | 56 | 2021-06-03T03:16:25.000Z | 2022-03-20T01:07:44.000Z | src/storage/minfs/allocator/storage_host.cc | Prajwal-Koirala/fuchsia | ca7ae6c143cd4c10bad9aa1869ffcc24c3e4b795 | [
"BSD-2-Clause"
] | 73 | 2019-03-06T18:55:23.000Z | 2022-03-26T12:04:51.000Z | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <utility>
#include "src/storage/minfs/allocator/storage.h"
#include "src/storage/minfs/format.h"
namespace minfs {
PersistentStorage::PersistentStorage(SuperblockManager* sb, size_t unit_size, GrowHandler grow_cb,
AllocatorMetadata metadata, uint32_t block_size)
: sb_(sb),
grow_cb_(std::move(grow_cb)),
metadata_(std::move(metadata)),
block_size_(block_size) {}
zx_status_t PersistentStorage::Extend(PendingWork* write_transaction, WriteData data,
GrowMapCallback grow_map) {
return ZX_ERR_NO_SPACE;
}
} // namespace minfs
| 32.12 | 98 | 0.689913 | wwjiang007 |
980e45bcc8a334783d08781cb88a8be0339e8aa7 | 7,660 | hxx | C++ | include/itkSmoothBinarySurfaceImageFilter.hxx | Bonelab/ITKMorphometry | ee1480bc1a93425ae7fff1c9595b0688fc58abc5 | [
"Apache-2.0"
] | null | null | null | include/itkSmoothBinarySurfaceImageFilter.hxx | Bonelab/ITKMorphometry | ee1480bc1a93425ae7fff1c9595b0688fc58abc5 | [
"Apache-2.0"
] | null | null | null | include/itkSmoothBinarySurfaceImageFilter.hxx | Bonelab/ITKMorphometry | ee1480bc1a93425ae7fff1c9595b0688fc58abc5 | [
"Apache-2.0"
] | null | null | null | /*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkSmoothBinarySurfaceImageFilter_hxx
#define itkSmoothBinarySurfaceImageFilter_hxx
#include "itkSmoothBinarySurfaceImageFilter.h"
#include "itkImageScanlineIterator.h"
#include "itkShapedNeighborhoodIterator.h"
#include <queue>
#include <vector>
namespace itk
{
template <typename TInputImage>
SmoothBinarySurfaceImageFilter<TInputImage>
::SmoothBinarySurfaceImageFilter() :
Superclass()
{}
template <typename TInputImage>
void
SmoothBinarySurfaceImageFilter<TInputImage>
::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
if (this->GetInput())
{
auto * image = const_cast<InputImageType *>(this->GetInput());
image->SetRequestedRegionToLargestPossibleRegion();
}
}
template <typename TInputImage>
void
SmoothBinarySurfaceImageFilter<TInputImage>
::EnlargeOutputRequestedRegion(DataObject * output)
{
Superclass::EnlargeOutputRequestedRegion(output);
output->SetRequestedRegionToLargestPossibleRegion();
}
template <typename TInputImage>
void
SmoothBinarySurfaceImageFilter<TInputImage>
::DynamicThreadedGenerateData (const ImageRegionType &outputRegionForThread)
{
/* Create iterators */
TInputImage * output = this->GetOutput();
const TInputImage * input = this->GetInput();
ImageScanlineConstIterator<TInputImage> inputIt(input, outputRegionForThread);
ImageScanlineIterator<TInputImage> outputIt(output, outputRegionForThread);
while (!inputIt.IsAtEnd())
{
while (!inputIt.IsAtEndOfLine())
{
outputIt.Set(inputIt.Get()/1.1);
++inputIt;
++outputIt;
}
inputIt.NextLine();
outputIt.NextLine();
}
}
template <typename TInputImage>
void
SmoothBinarySurfaceImageFilter<TInputImage>
::AfterThreadedGenerateData()
{
TInputImage * output = this->GetOutput();
const TInputImage * input = this->GetInput();
typename TInputImage::Pointer temp_image = TInputImage::New();
temp_image->SetRegions(output->GetRequestedRegion());
temp_image->Allocate();
temp_image->FillBuffer(itk::NumericTraits<typename TInputImage::PixelType>::Zero);
/* Narrow band */
RealType gamma = 3.0;
// using QueueType = std::vector<IndexType>;
std::vector<IndexType> current, next;
ImageScanlineIterator<TInputImage> outputIt(output, output->GetRequestedRegion());
ImageScanlineIterator<TInputImage> tempIt(temp_image, output->GetRequestedRegion());
while (!outputIt.IsAtEnd())
{
while (!outputIt.IsAtEndOfLine())
{
if (std::abs(outputIt.Get()) < gamma) {
next.push_back(outputIt.GetIndex());
}
tempIt.Set(outputIt.Get());
++outputIt;
++tempIt;
}
outputIt.NextLine();
tempIt.NextLine();
}
std::cout << next.size() << std::endl;
RealType size = 1.;
for(auto &s: output->GetRequestedRegion().GetSize()){
size *= s;
}
StencilsType stencils = this->GenerateStencils();
auto spacing = output->GetSpacing();
auto region = output->GetRequestedRegion();
RealType error = NumericTraits<RealType>::max();
unsigned long i = 0;
while ( (error > 1e-12) && (i < 1000) ) {
error = 0.;
int l = 0;
int t = 0;
std::swap(current, next);
while (!current.empty()) {
IndexType index = current.back();
current.pop_back();
// RealType margin = std::tanh(input->GetPixel(index) / 3.0);
RealType margin = input->GetPixel(index);
RealType sign = (margin >= 0) ? (+1.) : (-1.);
RealType lastSolution;
if (i%2) {
lastSolution = output->GetPixel(index);
} else {
lastSolution = temp_image->GetPixel(index);
}
RealType a = 0.;
RealType b = 0.;
RealType c = 0.;
// −1/12 4/3 −5/2 4/3 −1/12
// Vector< RealType, 2*Order > coefficients = {{-1./12., 4./3., 4./3., -1./12.}};
// std::vector< RealType> coefficients = {{-1./12., 4./3., 4./3., -1./12.}};
// 1/90 −3/20 3/2 −49/18 3/2 −3/20 1/90
std::vector< RealType> coefficients = {{1./90., -3/20., 3./2., 3./2., -3./20., 1./90.}};
for (unsigned int i = 0; i < InputImageDimension; ++i) {
RealType q = 0;
for (unsigned int j = 0; j < 2*Order; ++j) {
IndexType thisIndex = index + stencils[i][j];
RealType qq = region.IsInside(thisIndex) ? (output->GetPixel(thisIndex)) : (lastSolution);
q += qq*coefficients[j];
}
// a += std::pow(-5./2./spacing[i]/spacing[i], 2);
a += std::pow(-49./18./spacing[i]/spacing[i], 2);
b += 2. * -5./2./spacing[i]/spacing[i] * q/spacing[i]/spacing[i];
c += std::pow(q/spacing[i]/spacing[i], 2);
}
/* Discrim */
RealType solution;
RealType discrim = b*b - 4.*a*c;
if (discrim < 0.0) {
solution = -b / (2.*a);
// std::cout << a << " " << b << " " << c << std::endl;
// itkExceptionMacro(<< "Discriminator is negative...");
t++;
} else {
RealType s1 = (-b + std::sqrt(discrim)) / (2.*a);
RealType s2 = (-b - std::sqrt(discrim)) / (2.*a);
solution = sign*std::max(sign*s1, sign*s2);
l++;
}
/* Solution */
// RealType s1 = (-b + std::sqrt(discrim)) / (2.*a);
// RealType s2 = (-b - std::sqrt(discrim)) / (2.*a);
// RealType solution = sign*std::max(sign*s1, sign*s2);
// RealType solution = -b / (2.*a);
RealType w = 0.95;
RealType propSolution = solution;
solution = (1.-w) * solution + w * lastSolution;
if (sign > 0) {
solution = std::max(solution, margin);
} else {
solution = std::min(solution, margin);
}
// output->SetPixel(index, solution);
if (i%2) {
temp_image->SetPixel(index, solution);
// lastSolution = output->GetPixel(index);
} else{
output->SetPixel(index, solution);
// lastSolution = temp_image->GetPixel(index);
}
// std::cout << lastSolution << " " << solution << " " << margin << std::endl;
next.push_back(index);
error += std::abs(lastSolution - propSolution);
// error += std::abs(lastSolution - solution);
}
error /= (RealType)(size);
i++;
std::cout << error << std::endl;
std::cout << l << " " << t << std::endl;
}
}
template <typename TInputImage>
typename SmoothBinarySurfaceImageFilter<TInputImage>::StencilsType
SmoothBinarySurfaceImageFilter<TInputImage>
::GenerateStencils()
{
StencilsType stencils;
for (unsigned int i = 0; i < InputImageDimension; ++i)
{
StencilType stencil;
unsigned int k = 0;
for (int j = -1*(int)Order; j <= (int)Order; ++j)
{
if (j == 0) {
k = 1;
continue;
}
OffsetType offset;
offset.Fill(0);
offset.SetElement(i, j);
stencil[j + Order - k] = offset;
}
stencils[i] = stencil;
}
return stencils;
}
} // end namespace itk
#endif // itkSmoothBinarySurfaceImageFilter_hxx
| 29.921875 | 100 | 0.610574 | Bonelab |
980eb949d5a49661297e009496862fb55df8ff9b | 12,175 | cpp | C++ | qt-creator-opensource-src-4.6.1/src/plugins/debugger/disassembleragent.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 5 | 2018-12-22T14:49:13.000Z | 2022-01-13T07:21:46.000Z | qt-creator-opensource-src-4.6.1/src/plugins/debugger/disassembleragent.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | null | null | null | qt-creator-opensource-src-4.6.1/src/plugins/debugger/disassembleragent.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 8 | 2018-07-17T03:55:48.000Z | 2021-12-22T06:37:53.000Z | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "disassembleragent.h"
#include "breakhandler.h"
#include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerengine.h"
#include "debuggerinternalconstants.h"
#include "disassemblerlines.h"
#include "sourceutils.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <texteditor/textmark.h>
#include <texteditor/textdocument.h>
#include <texteditor/texteditor.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <QTextBlock>
#include <QDir>
using namespace Core;
using namespace TextEditor;
namespace Debugger {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
// DisassemblerBreakpointMarker
//
///////////////////////////////////////////////////////////////////////
// The red blob on the left side in the cpp editor.
class DisassemblerBreakpointMarker : public TextMark
{
public:
DisassemblerBreakpointMarker(const Breakpoint &bp, int lineNumber)
: TextMark(QString(), lineNumber, Constants::TEXT_MARK_CATEGORY_BREAKPOINT), m_bp(bp)
{
setIcon(bp.icon());
setPriority(TextMark::NormalPriority);
}
bool isClickable() const { return true; }
void clicked() { m_bp.removeBreakpoint(); }
public:
Breakpoint m_bp;
};
///////////////////////////////////////////////////////////////////////
//
// FrameKey
//
///////////////////////////////////////////////////////////////////////
class FrameKey
{
public:
FrameKey() : startAddress(0), endAddress(0) {}
inline bool matches(const Location &loc) const;
QString functionName;
QString fileName;
quint64 startAddress;
quint64 endAddress;
};
bool FrameKey::matches(const Location &loc) const
{
return loc.address() >= startAddress
&& loc.address() <= endAddress
&& loc.fileName() == fileName
&& loc.functionName() == functionName;
}
typedef QPair<FrameKey, DisassemblerLines> CacheEntry;
///////////////////////////////////////////////////////////////////////
//
// DisassemblerAgentPrivate
//
///////////////////////////////////////////////////////////////////////
class DisassemblerAgentPrivate
{
public:
DisassemblerAgentPrivate(DebuggerEngine *engine);
~DisassemblerAgentPrivate();
void configureMimeType();
int lineForAddress(quint64 address) const;
public:
QPointer<TextDocument> document;
Location location;
QPointer<DebuggerEngine> engine;
LocationMark locationMark;
QList<DisassemblerBreakpointMarker *> breakpointMarks;
QList<CacheEntry> cache;
QString mimeType;
bool resetLocationScheduled;
};
DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine)
: document(0),
engine(engine),
locationMark(engine, QString(), 0),
mimeType("text/x-qtcreator-generic-asm"),
resetLocationScheduled(false)
{}
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
{
EditorManager::closeDocuments(QList<IDocument *>() << document);
document = 0;
qDeleteAll(breakpointMarks);
}
int DisassemblerAgentPrivate::lineForAddress(quint64 address) const
{
for (int i = 0, n = cache.size(); i != n; ++i) {
const CacheEntry &entry = cache.at(i);
if (entry.first.matches(location))
return entry.second.lineForAddress(address);
}
return 0;
}
///////////////////////////////////////////////////////////////////////
//
// DisassemblerAgent
//
///////////////////////////////////////////////////////////////////////
/*!
\class Debugger::Internal::DisassemblerAgent
Objects from this class are created in response to user actions in
the Gui for showing disassembled memory from the inferior. After creation
it handles communication between the engine and the editor.
*/
DisassemblerAgent::DisassemblerAgent(DebuggerEngine *engine)
: d(new DisassemblerAgentPrivate(engine))
{
connect(action(IntelFlavor), &Utils::SavedAction::valueChanged,
this, &DisassemblerAgent::reload);
}
DisassemblerAgent::~DisassemblerAgent()
{
delete d;
d = 0;
}
int DisassemblerAgent::indexOf(const Location &loc) const
{
for (int i = 0; i < d->cache.size(); i++)
if (d->cache.at(i).first.matches(loc))
return i;
return -1;
}
void DisassemblerAgent::cleanup()
{
d->cache.clear();
}
void DisassemblerAgent::scheduleResetLocation()
{
d->resetLocationScheduled = true;
}
void DisassemblerAgent::resetLocation()
{
if (!d->document)
return;
if (d->resetLocationScheduled) {
d->resetLocationScheduled = false;
d->document->removeMark(&d->locationMark);
}
}
const Location &DisassemblerAgent::location() const
{
return d->location;
}
void DisassemblerAgent::reload()
{
d->cache.clear();
d->engine->fetchDisassembler(this);
}
void DisassemblerAgent::setLocation(const Location &loc)
{
d->location = loc;
int index = indexOf(loc);
if (index != -1) {
// Refresh when not displaying a function and there is not sufficient
// context left past the address.
if (d->cache.at(index).first.endAddress - loc.address() < 24) {
index = -1;
d->cache.removeAt(index);
}
}
if (index != -1) {
const FrameKey &key = d->cache.at(index).first;
const QString msg =
QString("Using cached disassembly for 0x%1 (0x%2-0x%3) in \"%4\"/ \"%5\"")
.arg(loc.address(), 0, 16)
.arg(key.startAddress, 0, 16).arg(key.endAddress, 0, 16)
.arg(loc.functionName(), QDir::toNativeSeparators(loc.fileName()));
d->engine->showMessage(msg);
setContentsToDocument(d->cache.at(index).second);
d->resetLocationScheduled = false; // In case reset from previous run still pending.
} else {
d->engine->fetchDisassembler(this);
}
}
void DisassemblerAgentPrivate::configureMimeType()
{
QTC_ASSERT(document, return);
document->setMimeType(mimeType);
Utils::MimeType mtype = Utils::mimeTypeForName(mimeType);
if (mtype.isValid()) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget()))
widget->configureGenericHighlighter();
} else {
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
}
}
QString DisassemblerAgent::mimeType() const
{
return d->mimeType;
}
void DisassemblerAgent::setMimeType(const QString &mt)
{
if (mt == d->mimeType)
return;
d->mimeType = mt;
if (d->document)
d->configureMimeType();
}
void DisassemblerAgent::setContents(const DisassemblerLines &contents)
{
QTC_ASSERT(d, return);
if (contents.size()) {
const quint64 startAddress = contents.startAddress();
const quint64 endAddress = contents.endAddress();
if (startAddress) {
FrameKey key;
key.fileName = d->location.fileName();
key.functionName = d->location.functionName();
key.startAddress = startAddress;
key.endAddress = endAddress;
d->cache.append(CacheEntry(key, contents));
}
}
setContentsToDocument(contents);
}
void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents)
{
QTC_ASSERT(d, return);
if (!d->document) {
QString titlePattern = QLatin1String("Disassembler");
IEditor *editor = EditorManager::openEditorWithContents(
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
&titlePattern);
QTC_ASSERT(editor, return);
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
widget->setReadOnly(true);
widget->setRequestMarkEnabled(true);
}
d->document = qobject_cast<TextDocument *>(editor->document());
QTC_ASSERT(d->document, return);
d->document->setTemporary(true);
// FIXME: This is accumulating quite a bit out-of-band data.
// Make that a proper TextDocument reimplementation.
d->document->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true);
d->document->setProperty(Debugger::Constants::OPENED_WITH_DISASSEMBLY, true);
d->document->setProperty(Debugger::Constants::DISASSEMBLER_SOURCE_FILE, d->location.fileName());
d->configureMimeType();
} else {
EditorManager::activateEditorForDocument(d->document);
}
d->document->setPlainText(contents.toString());
d->document->setPreferredDisplayName(QString("Disassembler (%1)")
.arg(d->location.functionName()));
Breakpoints bps = breakHandler()->engineBreakpoints(d->engine);
foreach (Breakpoint bp, bps)
updateBreakpointMarker(bp);
updateLocationMarker();
}
void DisassemblerAgent::updateLocationMarker()
{
QTC_ASSERT(d->document, return);
int lineNumber = d->lineForAddress(d->location.address());
if (d->location.needsMarker()) {
d->document->removeMark(&d->locationMark);
d->locationMark.updateLineNumber(lineNumber);
d->document->addMark(&d->locationMark);
}
// Center cursor.
if (EditorManager::currentDocument() == d->document)
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(EditorManager::currentEditor()))
textEditor->gotoLine(lineNumber);
}
void DisassemblerAgent::removeBreakpointMarker(const Breakpoint &bp)
{
if (!d->document)
return;
BreakpointModelId id = bp.id();
foreach (DisassemblerBreakpointMarker *marker, d->breakpointMarks) {
if (marker->m_bp.id() == id) {
d->breakpointMarks.removeOne(marker);
d->document->removeMark(marker);
delete marker;
return;
}
}
}
void DisassemblerAgent::updateBreakpointMarker(const Breakpoint &bp)
{
removeBreakpointMarker(bp);
const quint64 address = bp.response().address;
if (!address)
return;
int lineNumber = d->lineForAddress(address);
if (!lineNumber)
return;
// HACK: If it's a FileAndLine breakpoint, and there's a source line
// above, move the marker up there. That allows setting and removing
// normal breakpoints from within the disassembler view.
if (bp.type() == BreakpointByFileAndLine) {
ContextData context = getLocationContext(d->document, lineNumber - 1);
if (context.type == LocationByFile)
--lineNumber;
}
auto marker = new DisassemblerBreakpointMarker(bp, lineNumber);
d->breakpointMarks.append(marker);
d->document->addMark(marker);
}
quint64 DisassemblerAgent::address() const
{
return d->location.address();
}
} // namespace Internal
} // namespace Debugger
| 30.061728 | 104 | 0.637043 | kevinlq |
9817001af4dcbe142760ce94ac6808dac7d2ad02 | 2,832 | cpp | C++ | src/random_object.cpp | scwfri/natalie | 11e874607a8ac7b934e57c4c7e5790623afaee7a | [
"MIT"
] | 7 | 2022-03-08T08:47:54.000Z | 2022-03-29T15:08:36.000Z | src/random_object.cpp | scwfri/natalie | 11e874607a8ac7b934e57c4c7e5790623afaee7a | [
"MIT"
] | 12 | 2022-03-10T13:04:42.000Z | 2022-03-24T01:40:23.000Z | src/random_object.cpp | scwfri/natalie | 11e874607a8ac7b934e57c4c7e5790623afaee7a | [
"MIT"
] | 5 | 2022-03-13T17:46:16.000Z | 2022-03-31T07:28:26.000Z | #include "natalie.hpp"
#include <natalie/random_object.hpp>
#include <random>
namespace Natalie {
Value RandomObject::initialize(Env *env, Value seed) {
if (!seed) {
m_seed = (nat_int_t)std::random_device()();
} else {
if (seed->is_float()) {
seed = seed->as_float()->to_i(env);
}
m_seed = IntegerObject::convert_to_nat_int_t(env, seed);
}
if (m_generator) delete m_generator;
this->m_generator = new std::mt19937(m_seed);
return this;
}
Value RandomObject::rand(Env *env, Value arg) {
if (arg) {
if (arg->is_float()) {
double max = arg->as_float()->to_double();
if (max <= 0) {
env->raise("ArgumentError", "invalid argument - {}", arg->inspect_str(env));
}
return generate_random(0.0, max);
} else if (arg->is_range()) {
Value min = arg->as_range()->begin();
Value max = arg->as_range()->end();
// TODO: There can be different types of objects that respond to + and - (according to the docs)
// I'm not sure how we should handle those though (coerce via to_int or to_f?)
if (min->is_numeric() && max->is_numeric()) {
if (min.send(env, ">"_s, { max })->is_true()) {
env->raise("ArgumentError", "invalid argument - {}", arg->inspect_str(env));
}
if (min->is_float() || max->is_float()) {
double min_rand, max_rand;
if (min->is_float()) {
min_rand = min->as_float()->to_double();
} else {
min_rand = (double)min->as_integer()->to_nat_int_t();
}
if (max->is_float()) {
max_rand = max->as_float()->to_double();
} else {
max_rand = (double)max->as_integer()->to_nat_int_t();
}
return generate_random(min_rand, max_rand);
} else {
nat_int_t min_rand = min->as_integer()->to_nat_int_t();
nat_int_t max_rand = max->as_integer()->to_nat_int_t();
if (arg->as_range()->exclude_end()) {
max_rand -= 1;
}
return generate_random(min_rand, max_rand);
}
}
env->raise("ArgumentError", "bad value for range");
}
nat_int_t max = IntegerObject::convert_to_nat_int_t(env, arg);
if (max <= 0) {
env->raise("ArgumentError", "invalid argument - {}", arg->inspect_str(env));
}
return generate_random(0, max - 1);
} else {
return generate_random(0.0, 1.0);
}
}
}
| 35.4 | 108 | 0.491172 | scwfri |
981fdb72c88b75efe1a3fed99f68cac73bed709d | 1,635 | cpp | C++ | backup/2/leetcode/c++/sum-of-nodes-with-even-valued-grandparent.cpp | yangyanzhan/code-camp | 4272564e916fc230a4a488f92ae32c07d355dee0 | [
"Apache-2.0"
] | 21 | 2019-11-16T19:08:35.000Z | 2021-11-12T12:26:01.000Z | backup/2/leetcode/c++/sum-of-nodes-with-even-valued-grandparent.cpp | yangyanzhan/code-camp | 4272564e916fc230a4a488f92ae32c07d355dee0 | [
"Apache-2.0"
] | 1 | 2022-02-04T16:02:53.000Z | 2022-02-04T16:02:53.000Z | backup/2/leetcode/c++/sum-of-nodes-with-even-valued-grandparent.cpp | yangyanzhan/code-camp | 4272564e916fc230a4a488f92ae32c07d355dee0 | [
"Apache-2.0"
] | 4 | 2020-05-15T19:39:41.000Z | 2021-10-30T06:40:31.000Z | // Hi, I'm Yanzhan. For more algothmic problems, visit my Youtube Channel (Yanzhan Yang's Youtube Channel) : https://www.youtube.com/channel/UCDkz-__gl3frqLexukpG0DA?view_as=subscriber or my Twitter Account (Yanzhan Yang's Twitter) : https://twitter.com/YangYanzhan or my GitHub HomePage (Yanzhan Yang's GitHub HomePage) : https://yanzhan.site .
// For this specific algothmic problem, visit my Youtube Video : .
// It's fascinating to solve algothmic problems, follow Yanzhan to learn more!
// Blog URL for this problem: https://yanzhan.site/leetcode/sum-of-nodes-with-even-valued-grandparent.html .
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int sumEvenGrandparent(TreeNode *root) {
if (!root) {
return 0;
}
auto left = root->left;
auto right = root->right;
int s1 = sumEvenGrandparent(left);
int s2 = sumEvenGrandparent(right);
int s = s1 + s2;
if (root->val % 2 == 0) {
if (left) {
if (left->left) {
s += left->left->val;
}
if (left->right) {
s += left->right->val;
}
}
if (right) {
if (right->left) {
s += right->left->val;
}
if (right->right) {
s += right->right->val;
}
}
}
return s;
}
};
| 34.0625 | 345 | 0.526606 | yangyanzhan |
98204080566ef43c3fe933280661d997ee0167d2 | 59 | cpp | C++ | build/CMakeTmp/check_qt_application.cpp | TradingLab/tldbinit | 1029ed59d97ca1200346b8dc94969777e567cd2b | [
"Apache-2.0"
] | null | null | null | build/CMakeTmp/check_qt_application.cpp | TradingLab/tldbinit | 1029ed59d97ca1200346b8dc94969777e567cd2b | [
"Apache-2.0"
] | null | null | null | build/CMakeTmp/check_qt_application.cpp | TradingLab/tldbinit | 1029ed59d97ca1200346b8dc94969777e567cd2b | [
"Apache-2.0"
] | null | null | null | #include <QtCore/QtGlobal>
int main()
{
return 0;
}
| 9.833333 | 26 | 0.59322 | TradingLab |
9821015105397b3217ca6269618e750c78ff3ca4 | 2,107 | cpp | C++ | src/layers/shuffle_channel_layer.cpp | ktts16/mini-caffe | 58a5007d7921c69c9c3105b20b92b2136af26a4e | [
"BSD-3-Clause"
] | 413 | 2015-07-09T09:33:07.000Z | 2022-03-10T02:26:27.000Z | src/layers/shuffle_channel_layer.cpp | ktts16/mini-caffe | 58a5007d7921c69c9c3105b20b92b2136af26a4e | [
"BSD-3-Clause"
] | 65 | 2015-07-10T01:38:10.000Z | 2020-08-06T07:27:42.000Z | src/layers/shuffle_channel_layer.cpp | ktts16/mini-caffe | 58a5007d7921c69c9c3105b20b92b2136af26a4e | [
"BSD-3-Clause"
] | 196 | 2015-08-18T07:59:33.000Z | 2021-07-27T02:44:21.000Z | #include <algorithm>
#include <vector>
#include "./shuffle_channel_layer.hpp"
#include "../util//math_functions.hpp"
namespace caffe {
void ShuffleChannelLayer::LayerSetUp(const vector<Blob*> &bottom,
const vector<Blob*> &top) {
group_ = this->layer_param_.shuffle_channel_param().group();
CHECK_GT(group_, 0) << "group must be greater than 0";
//temp_blob_.ReshapeLike(*bottom[0]);
top[0]->ReshapeLike(*bottom[0]);
}
static void Resize_cpu(real_t* output, const real_t* input,
int group_row, int group_column, int len) {
for (int i = 0; i < group_row; ++i) { // 2
for(int j = 0; j < group_column ; ++j) { // 3
const real_t* p_i = input + (i * group_column + j ) * len;
real_t* p_o = output + (j * group_row + i ) * len;
caffe_copy(len, p_i, p_o);
}
}
}
void ShuffleChannelLayer::Reshape(const vector<Blob*> &bottom,
const vector<Blob*> &top) {
int channels_ = bottom[0]->channels();
int height_ = bottom[0]->height();
int width_ = bottom[0]->width();
top[0]->Reshape(bottom[0]->num(), channels_, height_, width_);
}
void ShuffleChannelLayer::Forward_cpu(const vector<Blob*>& bottom,
const vector<Blob*>& top) {
const real_t* bottom_data = bottom[0]->cpu_data();
real_t* top_data = top[0]->mutable_cpu_data();
const int num = bottom[0]->shape(0);
const int feature_map_size = bottom[0]->count(1);
const int sp_sz = bottom[0]->count(2);
const int chs = bottom[0]->shape(1);
int group_row = group_;
int group_column = int(chs / group_row);
CHECK_EQ(chs, (group_column * group_row)) << "Wrong group size.";
//Dtype* temp_data = temp_blob_.mutable_cpu_data();
for(int n = 0; n < num; ++n) {
Resize_cpu(top_data + n*feature_map_size, bottom_data + n*feature_map_size, group_row, group_column, sp_sz);
}
//caffe_copy(bottom[0]->count(), temp_blob_.cpu_data(), top_data);
}
#ifndef USE_CUDA
STUB_GPU(ShuffleChannelLayer);
#endif
REGISTER_LAYER_CLASS(ShuffleChannel);
} // namespace caffe
| 32.921875 | 111 | 0.633128 | ktts16 |
9821474a8ffa4f55b9bfcf96b90b83f32ba2151a | 7,250 | cpp | C++ | day_15/src/ofApp.cpp | andymasteroffish/inktober_2020 | e836c33cf739e119d79570d7e870e97a52c2883a | [
"MIT"
] | 16 | 2020-10-09T12:02:06.000Z | 2022-01-06T01:49:03.000Z | day_15/src/ofApp.cpp | andymasteroffish/inktober_2020 | e836c33cf739e119d79570d7e870e97a52c2883a | [
"MIT"
] | null | null | null | day_15/src/ofApp.cpp | andymasteroffish/inktober_2020 | e836c33cf739e119d79570d7e870e97a52c2883a | [
"MIT"
] | null | null | null | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(250);
for (int i=0; i<NUM_COLS; i++){
gcode[i].setup(100);
gcode[i].show_transit_lines = false;
gcode[i].show_do_not_reverse = true;
}
gcode[PURPLE].demo_col = ofColor::purple;
gcode[LIGHT_PURPLE].demo_col = ofColor::magenta;
gcode[RED].demo_col = ofColor::red;
gcode[BLACK].demo_col = ofColor::black;
float outter_circle_size = 300;
int ring_pnts = 100;
//tentacles
int num_tentacles = 5;
for (int i=0; i<num_tentacles; i++){
float angle = 0.5+(TWO_PI/(float)num_tentacles) * i;
Tentacle tent;
tent.setup(angle, 600);
tentacles.push_back(tent);
tent.make_gcode(&gcode[PURPLE], &gcode[LIGHT_PURPLE]);
}
//rings
Circle outter_circle;
outter_circle.setup(ofVec2f(ofGetWidth()/2, ofGetHeight()/2), outter_circle_size, ring_pnts, 0);
Circle inner_circle;
inner_circle.setup(ofVec2f(ofGetWidth()/2, ofGetHeight()/2), 70);
//teeth
int num_triangles = 500;
for (float i=0; i<num_triangles; i++){
//float prc = 1.0 - i/(float)num_triangles;
float angle = 0.47 + i*0.2;// prc * TWO_PI * 3;
float dist = outter_circle_size + 30 - i*0.5;//100 + 200 * prc;
float size = 60 - i*0.08;//20 + 25 * prc;
Triangle tri;
tri.setup(angle, dist, size);
//chop 'em
tri.trim(triangles, tentacles);
tri.trim_inside(outter_circle.border);
tri.trim_outside(inner_circle.border);
tri.make_gcode(&gcode[RED]);
triangles.push_back(tri);
}
//outter ring
Circle outter_circle2;
outter_circle2.setup(ofVec2f(ofGetWidth()/2, ofGetHeight()/2), outter_circle_size+30, ring_pnts, PI/16);
for (int i=0; i<ring_pnts; i++){
ofVec2f a = outter_circle.border[i];
ofVec2f b = outter_circle2.border[i];
GLine line;
line.set(a,b);
for (int t=0; t<tentacles.size(); t++){
line.clip_outside_polygon(tentacles[t].border);
}
gcode[PURPLE].line(line);
}
for (int t=0; t<tentacles.size(); t++){
outter_circle.trim_outside(tentacles[t].border);
outter_circle2.trim_outside(tentacles[t].border);
}
outter_circle.make_gcode(&gcode[PURPLE]);
outter_circle2.make_gcode(&gcode[PURPLE]);
//hexagon mouth
float angle_step = TWO_PI/5;
for(float d = 5; d<69; d+=4){
gcode[BLACK].begin_shape();
for (int i=0; i<5; i++){
float angle = 0.3 + angle_step*i + sin(d*0.01)*TWO_PI;
gcode[BLACK].vertex(ofGetWidth()/2+cos(angle)*d, ofGetHeight()/2+sin(angle)*d);
}
gcode[BLACK].end_shape(true);
}
//shoot some lines
int num_noise_lines = 40;
angle_step = TWO_PI/num_noise_lines;
for (int k=0; k<num_noise_lines; k++){
float angle = angle_step * k;
float start_dist = outter_circle_size+50;
if (k%2==0){
start_dist += 100;
}
ofVec2f start_pos = ofVec2f(ofGetWidth()/2+cos(angle)*start_dist, ofGetHeight()/2+sin(angle)*start_dist);
ofVec2f pos = ofVec2f(start_pos);
ofVec2f prev_pos;
int num_steps = 300;//ofRandom(100, 400);
float stepDist = 2;
float curve_range = 0.02;
float curve = 0.005;//ofRandom(-curve_range,curve_range);
vector<GLine> lines;
for (int i=0; i<num_steps; i++){
pos.x += cos(angle) * stepDist;
pos.y += sin(angle) * stepDist;
angle += curve;
//angle += (1-ofNoise(start_pos.x, start_pos.y, i*0.005) *2) * 0.02;
if (ofDistSquared(pos.x, pos.y, ofGetWidth()/2, ofGetHeight()/2) < powf(start_dist,2)){
break;
}
if (i!=0){
//if (ofRandomuf() < 0.5){
GLine line;
line.set(pos, prev_pos);
for (int t=0; t<tentacles.size(); t++){
line.clip_outside_polygon(tentacles[t].border);
}
lines.push_back(line);
//gcode.line(line);
//}
}
prev_pos.set(pos);
if (pos.x < -10 || pos.x >ofGetWidth()+10 || pos.y < -10 || pos.y >= ofGetHeight()+10){
break;
}
}
//draw it
bool is_on = ofRandomuf() < 0.5;
int counter = 0;
for (int i=0; i<lines.size(); i++){
counter--;
if(counter <= 0){
is_on = !is_on;
if (is_on){
counter = ofRandom(5,12);
}else{
counter = ofRandom(4,10);
}
}
if (is_on){
gcode[BLACK].line(lines[i]);
}
}
}
for (int i=0; i<NUM_COLS; i++){
ofRectangle safe_zone;
safe_zone.set(20, 20, ofGetWidth()-20, ofGetHeight()-20);
gcode[i].set_outwards_only_bounds(safe_zone);
gcode[i].sort();
gcode[i].save("inktober_15_"+ofToString(i)+".nc");
}
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
for (int i=0; i<NUM_COLS; i++){
gcode[i].draw();
}
// ofSetColor(0,100,0);
// ofNoFill();
// for (int i=0; i<tentacles.size(); i++){
// tentacles[i].draw();
// }
//
//
// ofSetColor(255,0,0);
// ofNoFill();
// for (int i=0; i<triangles.size(); i++){
// triangles[i].test_draw();
// }
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
| 27.358491 | 113 | 0.452966 | andymasteroffish |
982461c88165acbb09822c12edde8d727e177f15 | 42,625 | cpp | C++ | src/gm/types/tests/testVec4iRange.cpp | moddyz/GraphicsMath | b15f9c52a090ffdb4028f7b2aa70d7ef3dfc14f2 | [
"MIT"
] | null | null | null | src/gm/types/tests/testVec4iRange.cpp | moddyz/GraphicsMath | b15f9c52a090ffdb4028f7b2aa70d7ef3dfc14f2 | [
"MIT"
] | null | null | null | src/gm/types/tests/testVec4iRange.cpp | moddyz/GraphicsMath | b15f9c52a090ffdb4028f7b2aa70d7ef3dfc14f2 | [
"MIT"
] | 1 | 2020-12-08T11:32:04.000Z | 2020-12-08T11:32:04.000Z | //
// This file is auto-generated, please do not modify directly!
//
#include <catch2/catch.hpp>
#include <gm/types/vec4iRange.h>
#include <vector>
TEST_CASE( "Vec4iRange_DefaultConstructor" )
{
gm::Vec4iRange range;
CHECK( range.Min() == gm::Vec4i( std::numeric_limits< int >::max(),
std::numeric_limits< int >::max(),
std::numeric_limits< int >::max(),
std::numeric_limits< int >::max() ) );
CHECK( range.Max() == gm::Vec4i( std::numeric_limits< int >::min(),
std::numeric_limits< int >::min(),
std::numeric_limits< int >::min(),
std::numeric_limits< int >::min() ) );
}
TEST_CASE( "Vec4iRange_MinMaxConstructor" )
{
gm::Vec4iRange range( gm::Vec4i( -1, -1, -1, -1 ), gm::Vec4i( 1, 1, 1, 1 ) );
CHECK( range.Min() == gm::Vec4i( -1, -1, -1, -1 ) );
CHECK( range.Max() == gm::Vec4i( 1, 1, 1, 1 ) );
}
TEST_CASE( "Vec4iRange_MinAccessor" )
{
gm::Vec4iRange range;
range.Min() = gm::Vec4i( -1, -1, -1, -1 );
CHECK( range.Min() == gm::Vec4i( -1, -1, -1, -1 ) );
}
TEST_CASE( "Vec4iRange_MaxAccessor" )
{
gm::Vec4iRange range;
range.Max() = gm::Vec4i( 1, 1, 1, 1 );
CHECK( range.Max() == gm::Vec4i( 1, 1, 1, 1 ) );
}
TEST_CASE( "Vec4iRange_EqualityComparison" )
{
CHECK( gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) ==
gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) );
CHECK( !( gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) ==
gm::Vec4iRange( gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( -2, -2, -2, -2 ) ) ) );
}
TEST_CASE( "Vec4iRange_InequalityComparison" )
{
CHECK( gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) !=
gm::Vec4iRange( gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( -2, -2, -2, -2 ) ) );
CHECK( !( gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) !=
gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ) ) );
}
TEST_CASE( "Vec4iRange_IsEmpty" )
{
CHECK( gm::Vec4iRange( gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( -2, -2, -2, -2 ) ).IsEmpty() );
CHECK( !gm::Vec4iRange( gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( -2, -2, -2, -2 ) ).IsEmpty() );
CHECK( !gm::Vec4iRange( gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( 2, 2, 2, 2 ) ).IsEmpty() );
}
TEST_CASE( "Vec4iRange_RangeIteration" )
{
gm::Vec4iRange range( gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( 4, 4, 4, 4 ) );
std::vector< gm::Vec4i > array;
for ( const gm::Vec4i& value : range )
{
array.push_back( value );
}
std::vector< gm::Vec4i > expectedArray = {
gm::Vec4i( -2, -2, -2, -2 ), gm::Vec4i( -1, -2, -2, -2 ), gm::Vec4i( 0, -2, -2, -2 ),
gm::Vec4i( 1, -2, -2, -2 ), gm::Vec4i( 2, -2, -2, -2 ), gm::Vec4i( 3, -2, -2, -2 ),
gm::Vec4i( -2, -1, -2, -2 ), gm::Vec4i( -1, -1, -2, -2 ), gm::Vec4i( 0, -1, -2, -2 ),
gm::Vec4i( 1, -1, -2, -2 ), gm::Vec4i( 2, -1, -2, -2 ), gm::Vec4i( 3, -1, -2, -2 ),
gm::Vec4i( -2, 0, -2, -2 ), gm::Vec4i( -1, 0, -2, -2 ), gm::Vec4i( 0, 0, -2, -2 ),
gm::Vec4i( 1, 0, -2, -2 ), gm::Vec4i( 2, 0, -2, -2 ), gm::Vec4i( 3, 0, -2, -2 ),
gm::Vec4i( -2, 1, -2, -2 ), gm::Vec4i( -1, 1, -2, -2 ), gm::Vec4i( 0, 1, -2, -2 ),
gm::Vec4i( 1, 1, -2, -2 ), gm::Vec4i( 2, 1, -2, -2 ), gm::Vec4i( 3, 1, -2, -2 ),
gm::Vec4i( -2, 2, -2, -2 ), gm::Vec4i( -1, 2, -2, -2 ), gm::Vec4i( 0, 2, -2, -2 ),
gm::Vec4i( 1, 2, -2, -2 ), gm::Vec4i( 2, 2, -2, -2 ), gm::Vec4i( 3, 2, -2, -2 ),
gm::Vec4i( -2, 3, -2, -2 ), gm::Vec4i( -1, 3, -2, -2 ), gm::Vec4i( 0, 3, -2, -2 ),
gm::Vec4i( 1, 3, -2, -2 ), gm::Vec4i( 2, 3, -2, -2 ), gm::Vec4i( 3, 3, -2, -2 ),
gm::Vec4i( -2, -2, -1, -2 ), gm::Vec4i( -1, -2, -1, -2 ), gm::Vec4i( 0, -2, -1, -2 ),
gm::Vec4i( 1, -2, -1, -2 ), gm::Vec4i( 2, -2, -1, -2 ), gm::Vec4i( 3, -2, -1, -2 ),
gm::Vec4i( -2, -1, -1, -2 ), gm::Vec4i( -1, -1, -1, -2 ), gm::Vec4i( 0, -1, -1, -2 ),
gm::Vec4i( 1, -1, -1, -2 ), gm::Vec4i( 2, -1, -1, -2 ), gm::Vec4i( 3, -1, -1, -2 ),
gm::Vec4i( -2, 0, -1, -2 ), gm::Vec4i( -1, 0, -1, -2 ), gm::Vec4i( 0, 0, -1, -2 ),
gm::Vec4i( 1, 0, -1, -2 ), gm::Vec4i( 2, 0, -1, -2 ), gm::Vec4i( 3, 0, -1, -2 ),
gm::Vec4i( -2, 1, -1, -2 ), gm::Vec4i( -1, 1, -1, -2 ), gm::Vec4i( 0, 1, -1, -2 ),
gm::Vec4i( 1, 1, -1, -2 ), gm::Vec4i( 2, 1, -1, -2 ), gm::Vec4i( 3, 1, -1, -2 ),
gm::Vec4i( -2, 2, -1, -2 ), gm::Vec4i( -1, 2, -1, -2 ), gm::Vec4i( 0, 2, -1, -2 ),
gm::Vec4i( 1, 2, -1, -2 ), gm::Vec4i( 2, 2, -1, -2 ), gm::Vec4i( 3, 2, -1, -2 ),
gm::Vec4i( -2, 3, -1, -2 ), gm::Vec4i( -1, 3, -1, -2 ), gm::Vec4i( 0, 3, -1, -2 ),
gm::Vec4i( 1, 3, -1, -2 ), gm::Vec4i( 2, 3, -1, -2 ), gm::Vec4i( 3, 3, -1, -2 ),
gm::Vec4i( -2, -2, 0, -2 ), gm::Vec4i( -1, -2, 0, -2 ), gm::Vec4i( 0, -2, 0, -2 ),
gm::Vec4i( 1, -2, 0, -2 ), gm::Vec4i( 2, -2, 0, -2 ), gm::Vec4i( 3, -2, 0, -2 ),
gm::Vec4i( -2, -1, 0, -2 ), gm::Vec4i( -1, -1, 0, -2 ), gm::Vec4i( 0, -1, 0, -2 ),
gm::Vec4i( 1, -1, 0, -2 ), gm::Vec4i( 2, -1, 0, -2 ), gm::Vec4i( 3, -1, 0, -2 ),
gm::Vec4i( -2, 0, 0, -2 ), gm::Vec4i( -1, 0, 0, -2 ), gm::Vec4i( 0, 0, 0, -2 ),
gm::Vec4i( 1, 0, 0, -2 ), gm::Vec4i( 2, 0, 0, -2 ), gm::Vec4i( 3, 0, 0, -2 ),
gm::Vec4i( -2, 1, 0, -2 ), gm::Vec4i( -1, 1, 0, -2 ), gm::Vec4i( 0, 1, 0, -2 ),
gm::Vec4i( 1, 1, 0, -2 ), gm::Vec4i( 2, 1, 0, -2 ), gm::Vec4i( 3, 1, 0, -2 ),
gm::Vec4i( -2, 2, 0, -2 ), gm::Vec4i( -1, 2, 0, -2 ), gm::Vec4i( 0, 2, 0, -2 ),
gm::Vec4i( 1, 2, 0, -2 ), gm::Vec4i( 2, 2, 0, -2 ), gm::Vec4i( 3, 2, 0, -2 ),
gm::Vec4i( -2, 3, 0, -2 ), gm::Vec4i( -1, 3, 0, -2 ), gm::Vec4i( 0, 3, 0, -2 ),
gm::Vec4i( 1, 3, 0, -2 ), gm::Vec4i( 2, 3, 0, -2 ), gm::Vec4i( 3, 3, 0, -2 ),
gm::Vec4i( -2, -2, 1, -2 ), gm::Vec4i( -1, -2, 1, -2 ), gm::Vec4i( 0, -2, 1, -2 ),
gm::Vec4i( 1, -2, 1, -2 ), gm::Vec4i( 2, -2, 1, -2 ), gm::Vec4i( 3, -2, 1, -2 ),
gm::Vec4i( -2, -1, 1, -2 ), gm::Vec4i( -1, -1, 1, -2 ), gm::Vec4i( 0, -1, 1, -2 ),
gm::Vec4i( 1, -1, 1, -2 ), gm::Vec4i( 2, -1, 1, -2 ), gm::Vec4i( 3, -1, 1, -2 ),
gm::Vec4i( -2, 0, 1, -2 ), gm::Vec4i( -1, 0, 1, -2 ), gm::Vec4i( 0, 0, 1, -2 ),
gm::Vec4i( 1, 0, 1, -2 ), gm::Vec4i( 2, 0, 1, -2 ), gm::Vec4i( 3, 0, 1, -2 ),
gm::Vec4i( -2, 1, 1, -2 ), gm::Vec4i( -1, 1, 1, -2 ), gm::Vec4i( 0, 1, 1, -2 ),
gm::Vec4i( 1, 1, 1, -2 ), gm::Vec4i( 2, 1, 1, -2 ), gm::Vec4i( 3, 1, 1, -2 ),
gm::Vec4i( -2, 2, 1, -2 ), gm::Vec4i( -1, 2, 1, -2 ), gm::Vec4i( 0, 2, 1, -2 ),
gm::Vec4i( 1, 2, 1, -2 ), gm::Vec4i( 2, 2, 1, -2 ), gm::Vec4i( 3, 2, 1, -2 ),
gm::Vec4i( -2, 3, 1, -2 ), gm::Vec4i( -1, 3, 1, -2 ), gm::Vec4i( 0, 3, 1, -2 ),
gm::Vec4i( 1, 3, 1, -2 ), gm::Vec4i( 2, 3, 1, -2 ), gm::Vec4i( 3, 3, 1, -2 ),
gm::Vec4i( -2, -2, 2, -2 ), gm::Vec4i( -1, -2, 2, -2 ), gm::Vec4i( 0, -2, 2, -2 ),
gm::Vec4i( 1, -2, 2, -2 ), gm::Vec4i( 2, -2, 2, -2 ), gm::Vec4i( 3, -2, 2, -2 ),
gm::Vec4i( -2, -1, 2, -2 ), gm::Vec4i( -1, -1, 2, -2 ), gm::Vec4i( 0, -1, 2, -2 ),
gm::Vec4i( 1, -1, 2, -2 ), gm::Vec4i( 2, -1, 2, -2 ), gm::Vec4i( 3, -1, 2, -2 ),
gm::Vec4i( -2, 0, 2, -2 ), gm::Vec4i( -1, 0, 2, -2 ), gm::Vec4i( 0, 0, 2, -2 ),
gm::Vec4i( 1, 0, 2, -2 ), gm::Vec4i( 2, 0, 2, -2 ), gm::Vec4i( 3, 0, 2, -2 ),
gm::Vec4i( -2, 1, 2, -2 ), gm::Vec4i( -1, 1, 2, -2 ), gm::Vec4i( 0, 1, 2, -2 ),
gm::Vec4i( 1, 1, 2, -2 ), gm::Vec4i( 2, 1, 2, -2 ), gm::Vec4i( 3, 1, 2, -2 ),
gm::Vec4i( -2, 2, 2, -2 ), gm::Vec4i( -1, 2, 2, -2 ), gm::Vec4i( 0, 2, 2, -2 ),
gm::Vec4i( 1, 2, 2, -2 ), gm::Vec4i( 2, 2, 2, -2 ), gm::Vec4i( 3, 2, 2, -2 ),
gm::Vec4i( -2, 3, 2, -2 ), gm::Vec4i( -1, 3, 2, -2 ), gm::Vec4i( 0, 3, 2, -2 ),
gm::Vec4i( 1, 3, 2, -2 ), gm::Vec4i( 2, 3, 2, -2 ), gm::Vec4i( 3, 3, 2, -2 ),
gm::Vec4i( -2, -2, 3, -2 ), gm::Vec4i( -1, -2, 3, -2 ), gm::Vec4i( 0, -2, 3, -2 ),
gm::Vec4i( 1, -2, 3, -2 ), gm::Vec4i( 2, -2, 3, -2 ), gm::Vec4i( 3, -2, 3, -2 ),
gm::Vec4i( -2, -1, 3, -2 ), gm::Vec4i( -1, -1, 3, -2 ), gm::Vec4i( 0, -1, 3, -2 ),
gm::Vec4i( 1, -1, 3, -2 ), gm::Vec4i( 2, -1, 3, -2 ), gm::Vec4i( 3, -1, 3, -2 ),
gm::Vec4i( -2, 0, 3, -2 ), gm::Vec4i( -1, 0, 3, -2 ), gm::Vec4i( 0, 0, 3, -2 ),
gm::Vec4i( 1, 0, 3, -2 ), gm::Vec4i( 2, 0, 3, -2 ), gm::Vec4i( 3, 0, 3, -2 ),
gm::Vec4i( -2, 1, 3, -2 ), gm::Vec4i( -1, 1, 3, -2 ), gm::Vec4i( 0, 1, 3, -2 ),
gm::Vec4i( 1, 1, 3, -2 ), gm::Vec4i( 2, 1, 3, -2 ), gm::Vec4i( 3, 1, 3, -2 ),
gm::Vec4i( -2, 2, 3, -2 ), gm::Vec4i( -1, 2, 3, -2 ), gm::Vec4i( 0, 2, 3, -2 ),
gm::Vec4i( 1, 2, 3, -2 ), gm::Vec4i( 2, 2, 3, -2 ), gm::Vec4i( 3, 2, 3, -2 ),
gm::Vec4i( -2, 3, 3, -2 ), gm::Vec4i( -1, 3, 3, -2 ), gm::Vec4i( 0, 3, 3, -2 ),
gm::Vec4i( 1, 3, 3, -2 ), gm::Vec4i( 2, 3, 3, -2 ), gm::Vec4i( 3, 3, 3, -2 ),
gm::Vec4i( -2, -2, -2, -1 ), gm::Vec4i( -1, -2, -2, -1 ), gm::Vec4i( 0, -2, -2, -1 ),
gm::Vec4i( 1, -2, -2, -1 ), gm::Vec4i( 2, -2, -2, -1 ), gm::Vec4i( 3, -2, -2, -1 ),
gm::Vec4i( -2, -1, -2, -1 ), gm::Vec4i( -1, -1, -2, -1 ), gm::Vec4i( 0, -1, -2, -1 ),
gm::Vec4i( 1, -1, -2, -1 ), gm::Vec4i( 2, -1, -2, -1 ), gm::Vec4i( 3, -1, -2, -1 ),
gm::Vec4i( -2, 0, -2, -1 ), gm::Vec4i( -1, 0, -2, -1 ), gm::Vec4i( 0, 0, -2, -1 ),
gm::Vec4i( 1, 0, -2, -1 ), gm::Vec4i( 2, 0, -2, -1 ), gm::Vec4i( 3, 0, -2, -1 ),
gm::Vec4i( -2, 1, -2, -1 ), gm::Vec4i( -1, 1, -2, -1 ), gm::Vec4i( 0, 1, -2, -1 ),
gm::Vec4i( 1, 1, -2, -1 ), gm::Vec4i( 2, 1, -2, -1 ), gm::Vec4i( 3, 1, -2, -1 ),
gm::Vec4i( -2, 2, -2, -1 ), gm::Vec4i( -1, 2, -2, -1 ), gm::Vec4i( 0, 2, -2, -1 ),
gm::Vec4i( 1, 2, -2, -1 ), gm::Vec4i( 2, 2, -2, -1 ), gm::Vec4i( 3, 2, -2, -1 ),
gm::Vec4i( -2, 3, -2, -1 ), gm::Vec4i( -1, 3, -2, -1 ), gm::Vec4i( 0, 3, -2, -1 ),
gm::Vec4i( 1, 3, -2, -1 ), gm::Vec4i( 2, 3, -2, -1 ), gm::Vec4i( 3, 3, -2, -1 ),
gm::Vec4i( -2, -2, -1, -1 ), gm::Vec4i( -1, -2, -1, -1 ), gm::Vec4i( 0, -2, -1, -1 ),
gm::Vec4i( 1, -2, -1, -1 ), gm::Vec4i( 2, -2, -1, -1 ), gm::Vec4i( 3, -2, -1, -1 ),
gm::Vec4i( -2, -1, -1, -1 ), gm::Vec4i( -1, -1, -1, -1 ), gm::Vec4i( 0, -1, -1, -1 ),
gm::Vec4i( 1, -1, -1, -1 ), gm::Vec4i( 2, -1, -1, -1 ), gm::Vec4i( 3, -1, -1, -1 ),
gm::Vec4i( -2, 0, -1, -1 ), gm::Vec4i( -1, 0, -1, -1 ), gm::Vec4i( 0, 0, -1, -1 ),
gm::Vec4i( 1, 0, -1, -1 ), gm::Vec4i( 2, 0, -1, -1 ), gm::Vec4i( 3, 0, -1, -1 ),
gm::Vec4i( -2, 1, -1, -1 ), gm::Vec4i( -1, 1, -1, -1 ), gm::Vec4i( 0, 1, -1, -1 ),
gm::Vec4i( 1, 1, -1, -1 ), gm::Vec4i( 2, 1, -1, -1 ), gm::Vec4i( 3, 1, -1, -1 ),
gm::Vec4i( -2, 2, -1, -1 ), gm::Vec4i( -1, 2, -1, -1 ), gm::Vec4i( 0, 2, -1, -1 ),
gm::Vec4i( 1, 2, -1, -1 ), gm::Vec4i( 2, 2, -1, -1 ), gm::Vec4i( 3, 2, -1, -1 ),
gm::Vec4i( -2, 3, -1, -1 ), gm::Vec4i( -1, 3, -1, -1 ), gm::Vec4i( 0, 3, -1, -1 ),
gm::Vec4i( 1, 3, -1, -1 ), gm::Vec4i( 2, 3, -1, -1 ), gm::Vec4i( 3, 3, -1, -1 ),
gm::Vec4i( -2, -2, 0, -1 ), gm::Vec4i( -1, -2, 0, -1 ), gm::Vec4i( 0, -2, 0, -1 ),
gm::Vec4i( 1, -2, 0, -1 ), gm::Vec4i( 2, -2, 0, -1 ), gm::Vec4i( 3, -2, 0, -1 ),
gm::Vec4i( -2, -1, 0, -1 ), gm::Vec4i( -1, -1, 0, -1 ), gm::Vec4i( 0, -1, 0, -1 ),
gm::Vec4i( 1, -1, 0, -1 ), gm::Vec4i( 2, -1, 0, -1 ), gm::Vec4i( 3, -1, 0, -1 ),
gm::Vec4i( -2, 0, 0, -1 ), gm::Vec4i( -1, 0, 0, -1 ), gm::Vec4i( 0, 0, 0, -1 ),
gm::Vec4i( 1, 0, 0, -1 ), gm::Vec4i( 2, 0, 0, -1 ), gm::Vec4i( 3, 0, 0, -1 ),
gm::Vec4i( -2, 1, 0, -1 ), gm::Vec4i( -1, 1, 0, -1 ), gm::Vec4i( 0, 1, 0, -1 ),
gm::Vec4i( 1, 1, 0, -1 ), gm::Vec4i( 2, 1, 0, -1 ), gm::Vec4i( 3, 1, 0, -1 ),
gm::Vec4i( -2, 2, 0, -1 ), gm::Vec4i( -1, 2, 0, -1 ), gm::Vec4i( 0, 2, 0, -1 ),
gm::Vec4i( 1, 2, 0, -1 ), gm::Vec4i( 2, 2, 0, -1 ), gm::Vec4i( 3, 2, 0, -1 ),
gm::Vec4i( -2, 3, 0, -1 ), gm::Vec4i( -1, 3, 0, -1 ), gm::Vec4i( 0, 3, 0, -1 ),
gm::Vec4i( 1, 3, 0, -1 ), gm::Vec4i( 2, 3, 0, -1 ), gm::Vec4i( 3, 3, 0, -1 ),
gm::Vec4i( -2, -2, 1, -1 ), gm::Vec4i( -1, -2, 1, -1 ), gm::Vec4i( 0, -2, 1, -1 ),
gm::Vec4i( 1, -2, 1, -1 ), gm::Vec4i( 2, -2, 1, -1 ), gm::Vec4i( 3, -2, 1, -1 ),
gm::Vec4i( -2, -1, 1, -1 ), gm::Vec4i( -1, -1, 1, -1 ), gm::Vec4i( 0, -1, 1, -1 ),
gm::Vec4i( 1, -1, 1, -1 ), gm::Vec4i( 2, -1, 1, -1 ), gm::Vec4i( 3, -1, 1, -1 ),
gm::Vec4i( -2, 0, 1, -1 ), gm::Vec4i( -1, 0, 1, -1 ), gm::Vec4i( 0, 0, 1, -1 ),
gm::Vec4i( 1, 0, 1, -1 ), gm::Vec4i( 2, 0, 1, -1 ), gm::Vec4i( 3, 0, 1, -1 ),
gm::Vec4i( -2, 1, 1, -1 ), gm::Vec4i( -1, 1, 1, -1 ), gm::Vec4i( 0, 1, 1, -1 ),
gm::Vec4i( 1, 1, 1, -1 ), gm::Vec4i( 2, 1, 1, -1 ), gm::Vec4i( 3, 1, 1, -1 ),
gm::Vec4i( -2, 2, 1, -1 ), gm::Vec4i( -1, 2, 1, -1 ), gm::Vec4i( 0, 2, 1, -1 ),
gm::Vec4i( 1, 2, 1, -1 ), gm::Vec4i( 2, 2, 1, -1 ), gm::Vec4i( 3, 2, 1, -1 ),
gm::Vec4i( -2, 3, 1, -1 ), gm::Vec4i( -1, 3, 1, -1 ), gm::Vec4i( 0, 3, 1, -1 ),
gm::Vec4i( 1, 3, 1, -1 ), gm::Vec4i( 2, 3, 1, -1 ), gm::Vec4i( 3, 3, 1, -1 ),
gm::Vec4i( -2, -2, 2, -1 ), gm::Vec4i( -1, -2, 2, -1 ), gm::Vec4i( 0, -2, 2, -1 ),
gm::Vec4i( 1, -2, 2, -1 ), gm::Vec4i( 2, -2, 2, -1 ), gm::Vec4i( 3, -2, 2, -1 ),
gm::Vec4i( -2, -1, 2, -1 ), gm::Vec4i( -1, -1, 2, -1 ), gm::Vec4i( 0, -1, 2, -1 ),
gm::Vec4i( 1, -1, 2, -1 ), gm::Vec4i( 2, -1, 2, -1 ), gm::Vec4i( 3, -1, 2, -1 ),
gm::Vec4i( -2, 0, 2, -1 ), gm::Vec4i( -1, 0, 2, -1 ), gm::Vec4i( 0, 0, 2, -1 ),
gm::Vec4i( 1, 0, 2, -1 ), gm::Vec4i( 2, 0, 2, -1 ), gm::Vec4i( 3, 0, 2, -1 ),
gm::Vec4i( -2, 1, 2, -1 ), gm::Vec4i( -1, 1, 2, -1 ), gm::Vec4i( 0, 1, 2, -1 ),
gm::Vec4i( 1, 1, 2, -1 ), gm::Vec4i( 2, 1, 2, -1 ), gm::Vec4i( 3, 1, 2, -1 ),
gm::Vec4i( -2, 2, 2, -1 ), gm::Vec4i( -1, 2, 2, -1 ), gm::Vec4i( 0, 2, 2, -1 ),
gm::Vec4i( 1, 2, 2, -1 ), gm::Vec4i( 2, 2, 2, -1 ), gm::Vec4i( 3, 2, 2, -1 ),
gm::Vec4i( -2, 3, 2, -1 ), gm::Vec4i( -1, 3, 2, -1 ), gm::Vec4i( 0, 3, 2, -1 ),
gm::Vec4i( 1, 3, 2, -1 ), gm::Vec4i( 2, 3, 2, -1 ), gm::Vec4i( 3, 3, 2, -1 ),
gm::Vec4i( -2, -2, 3, -1 ), gm::Vec4i( -1, -2, 3, -1 ), gm::Vec4i( 0, -2, 3, -1 ),
gm::Vec4i( 1, -2, 3, -1 ), gm::Vec4i( 2, -2, 3, -1 ), gm::Vec4i( 3, -2, 3, -1 ),
gm::Vec4i( -2, -1, 3, -1 ), gm::Vec4i( -1, -1, 3, -1 ), gm::Vec4i( 0, -1, 3, -1 ),
gm::Vec4i( 1, -1, 3, -1 ), gm::Vec4i( 2, -1, 3, -1 ), gm::Vec4i( 3, -1, 3, -1 ),
gm::Vec4i( -2, 0, 3, -1 ), gm::Vec4i( -1, 0, 3, -1 ), gm::Vec4i( 0, 0, 3, -1 ),
gm::Vec4i( 1, 0, 3, -1 ), gm::Vec4i( 2, 0, 3, -1 ), gm::Vec4i( 3, 0, 3, -1 ),
gm::Vec4i( -2, 1, 3, -1 ), gm::Vec4i( -1, 1, 3, -1 ), gm::Vec4i( 0, 1, 3, -1 ),
gm::Vec4i( 1, 1, 3, -1 ), gm::Vec4i( 2, 1, 3, -1 ), gm::Vec4i( 3, 1, 3, -1 ),
gm::Vec4i( -2, 2, 3, -1 ), gm::Vec4i( -1, 2, 3, -1 ), gm::Vec4i( 0, 2, 3, -1 ),
gm::Vec4i( 1, 2, 3, -1 ), gm::Vec4i( 2, 2, 3, -1 ), gm::Vec4i( 3, 2, 3, -1 ),
gm::Vec4i( -2, 3, 3, -1 ), gm::Vec4i( -1, 3, 3, -1 ), gm::Vec4i( 0, 3, 3, -1 ),
gm::Vec4i( 1, 3, 3, -1 ), gm::Vec4i( 2, 3, 3, -1 ), gm::Vec4i( 3, 3, 3, -1 ),
gm::Vec4i( -2, -2, -2, 0 ), gm::Vec4i( -1, -2, -2, 0 ), gm::Vec4i( 0, -2, -2, 0 ),
gm::Vec4i( 1, -2, -2, 0 ), gm::Vec4i( 2, -2, -2, 0 ), gm::Vec4i( 3, -2, -2, 0 ),
gm::Vec4i( -2, -1, -2, 0 ), gm::Vec4i( -1, -1, -2, 0 ), gm::Vec4i( 0, -1, -2, 0 ),
gm::Vec4i( 1, -1, -2, 0 ), gm::Vec4i( 2, -1, -2, 0 ), gm::Vec4i( 3, -1, -2, 0 ),
gm::Vec4i( -2, 0, -2, 0 ), gm::Vec4i( -1, 0, -2, 0 ), gm::Vec4i( 0, 0, -2, 0 ),
gm::Vec4i( 1, 0, -2, 0 ), gm::Vec4i( 2, 0, -2, 0 ), gm::Vec4i( 3, 0, -2, 0 ),
gm::Vec4i( -2, 1, -2, 0 ), gm::Vec4i( -1, 1, -2, 0 ), gm::Vec4i( 0, 1, -2, 0 ),
gm::Vec4i( 1, 1, -2, 0 ), gm::Vec4i( 2, 1, -2, 0 ), gm::Vec4i( 3, 1, -2, 0 ),
gm::Vec4i( -2, 2, -2, 0 ), gm::Vec4i( -1, 2, -2, 0 ), gm::Vec4i( 0, 2, -2, 0 ),
gm::Vec4i( 1, 2, -2, 0 ), gm::Vec4i( 2, 2, -2, 0 ), gm::Vec4i( 3, 2, -2, 0 ),
gm::Vec4i( -2, 3, -2, 0 ), gm::Vec4i( -1, 3, -2, 0 ), gm::Vec4i( 0, 3, -2, 0 ),
gm::Vec4i( 1, 3, -2, 0 ), gm::Vec4i( 2, 3, -2, 0 ), gm::Vec4i( 3, 3, -2, 0 ),
gm::Vec4i( -2, -2, -1, 0 ), gm::Vec4i( -1, -2, -1, 0 ), gm::Vec4i( 0, -2, -1, 0 ),
gm::Vec4i( 1, -2, -1, 0 ), gm::Vec4i( 2, -2, -1, 0 ), gm::Vec4i( 3, -2, -1, 0 ),
gm::Vec4i( -2, -1, -1, 0 ), gm::Vec4i( -1, -1, -1, 0 ), gm::Vec4i( 0, -1, -1, 0 ),
gm::Vec4i( 1, -1, -1, 0 ), gm::Vec4i( 2, -1, -1, 0 ), gm::Vec4i( 3, -1, -1, 0 ),
gm::Vec4i( -2, 0, -1, 0 ), gm::Vec4i( -1, 0, -1, 0 ), gm::Vec4i( 0, 0, -1, 0 ),
gm::Vec4i( 1, 0, -1, 0 ), gm::Vec4i( 2, 0, -1, 0 ), gm::Vec4i( 3, 0, -1, 0 ),
gm::Vec4i( -2, 1, -1, 0 ), gm::Vec4i( -1, 1, -1, 0 ), gm::Vec4i( 0, 1, -1, 0 ),
gm::Vec4i( 1, 1, -1, 0 ), gm::Vec4i( 2, 1, -1, 0 ), gm::Vec4i( 3, 1, -1, 0 ),
gm::Vec4i( -2, 2, -1, 0 ), gm::Vec4i( -1, 2, -1, 0 ), gm::Vec4i( 0, 2, -1, 0 ),
gm::Vec4i( 1, 2, -1, 0 ), gm::Vec4i( 2, 2, -1, 0 ), gm::Vec4i( 3, 2, -1, 0 ),
gm::Vec4i( -2, 3, -1, 0 ), gm::Vec4i( -1, 3, -1, 0 ), gm::Vec4i( 0, 3, -1, 0 ),
gm::Vec4i( 1, 3, -1, 0 ), gm::Vec4i( 2, 3, -1, 0 ), gm::Vec4i( 3, 3, -1, 0 ),
gm::Vec4i( -2, -2, 0, 0 ), gm::Vec4i( -1, -2, 0, 0 ), gm::Vec4i( 0, -2, 0, 0 ),
gm::Vec4i( 1, -2, 0, 0 ), gm::Vec4i( 2, -2, 0, 0 ), gm::Vec4i( 3, -2, 0, 0 ),
gm::Vec4i( -2, -1, 0, 0 ), gm::Vec4i( -1, -1, 0, 0 ), gm::Vec4i( 0, -1, 0, 0 ),
gm::Vec4i( 1, -1, 0, 0 ), gm::Vec4i( 2, -1, 0, 0 ), gm::Vec4i( 3, -1, 0, 0 ),
gm::Vec4i( -2, 0, 0, 0 ), gm::Vec4i( -1, 0, 0, 0 ), gm::Vec4i( 0, 0, 0, 0 ),
gm::Vec4i( 1, 0, 0, 0 ), gm::Vec4i( 2, 0, 0, 0 ), gm::Vec4i( 3, 0, 0, 0 ),
gm::Vec4i( -2, 1, 0, 0 ), gm::Vec4i( -1, 1, 0, 0 ), gm::Vec4i( 0, 1, 0, 0 ),
gm::Vec4i( 1, 1, 0, 0 ), gm::Vec4i( 2, 1, 0, 0 ), gm::Vec4i( 3, 1, 0, 0 ),
gm::Vec4i( -2, 2, 0, 0 ), gm::Vec4i( -1, 2, 0, 0 ), gm::Vec4i( 0, 2, 0, 0 ),
gm::Vec4i( 1, 2, 0, 0 ), gm::Vec4i( 2, 2, 0, 0 ), gm::Vec4i( 3, 2, 0, 0 ),
gm::Vec4i( -2, 3, 0, 0 ), gm::Vec4i( -1, 3, 0, 0 ), gm::Vec4i( 0, 3, 0, 0 ),
gm::Vec4i( 1, 3, 0, 0 ), gm::Vec4i( 2, 3, 0, 0 ), gm::Vec4i( 3, 3, 0, 0 ),
gm::Vec4i( -2, -2, 1, 0 ), gm::Vec4i( -1, -2, 1, 0 ), gm::Vec4i( 0, -2, 1, 0 ),
gm::Vec4i( 1, -2, 1, 0 ), gm::Vec4i( 2, -2, 1, 0 ), gm::Vec4i( 3, -2, 1, 0 ),
gm::Vec4i( -2, -1, 1, 0 ), gm::Vec4i( -1, -1, 1, 0 ), gm::Vec4i( 0, -1, 1, 0 ),
gm::Vec4i( 1, -1, 1, 0 ), gm::Vec4i( 2, -1, 1, 0 ), gm::Vec4i( 3, -1, 1, 0 ),
gm::Vec4i( -2, 0, 1, 0 ), gm::Vec4i( -1, 0, 1, 0 ), gm::Vec4i( 0, 0, 1, 0 ),
gm::Vec4i( 1, 0, 1, 0 ), gm::Vec4i( 2, 0, 1, 0 ), gm::Vec4i( 3, 0, 1, 0 ),
gm::Vec4i( -2, 1, 1, 0 ), gm::Vec4i( -1, 1, 1, 0 ), gm::Vec4i( 0, 1, 1, 0 ),
gm::Vec4i( 1, 1, 1, 0 ), gm::Vec4i( 2, 1, 1, 0 ), gm::Vec4i( 3, 1, 1, 0 ),
gm::Vec4i( -2, 2, 1, 0 ), gm::Vec4i( -1, 2, 1, 0 ), gm::Vec4i( 0, 2, 1, 0 ),
gm::Vec4i( 1, 2, 1, 0 ), gm::Vec4i( 2, 2, 1, 0 ), gm::Vec4i( 3, 2, 1, 0 ),
gm::Vec4i( -2, 3, 1, 0 ), gm::Vec4i( -1, 3, 1, 0 ), gm::Vec4i( 0, 3, 1, 0 ),
gm::Vec4i( 1, 3, 1, 0 ), gm::Vec4i( 2, 3, 1, 0 ), gm::Vec4i( 3, 3, 1, 0 ),
gm::Vec4i( -2, -2, 2, 0 ), gm::Vec4i( -1, -2, 2, 0 ), gm::Vec4i( 0, -2, 2, 0 ),
gm::Vec4i( 1, -2, 2, 0 ), gm::Vec4i( 2, -2, 2, 0 ), gm::Vec4i( 3, -2, 2, 0 ),
gm::Vec4i( -2, -1, 2, 0 ), gm::Vec4i( -1, -1, 2, 0 ), gm::Vec4i( 0, -1, 2, 0 ),
gm::Vec4i( 1, -1, 2, 0 ), gm::Vec4i( 2, -1, 2, 0 ), gm::Vec4i( 3, -1, 2, 0 ),
gm::Vec4i( -2, 0, 2, 0 ), gm::Vec4i( -1, 0, 2, 0 ), gm::Vec4i( 0, 0, 2, 0 ),
gm::Vec4i( 1, 0, 2, 0 ), gm::Vec4i( 2, 0, 2, 0 ), gm::Vec4i( 3, 0, 2, 0 ),
gm::Vec4i( -2, 1, 2, 0 ), gm::Vec4i( -1, 1, 2, 0 ), gm::Vec4i( 0, 1, 2, 0 ),
gm::Vec4i( 1, 1, 2, 0 ), gm::Vec4i( 2, 1, 2, 0 ), gm::Vec4i( 3, 1, 2, 0 ),
gm::Vec4i( -2, 2, 2, 0 ), gm::Vec4i( -1, 2, 2, 0 ), gm::Vec4i( 0, 2, 2, 0 ),
gm::Vec4i( 1, 2, 2, 0 ), gm::Vec4i( 2, 2, 2, 0 ), gm::Vec4i( 3, 2, 2, 0 ),
gm::Vec4i( -2, 3, 2, 0 ), gm::Vec4i( -1, 3, 2, 0 ), gm::Vec4i( 0, 3, 2, 0 ),
gm::Vec4i( 1, 3, 2, 0 ), gm::Vec4i( 2, 3, 2, 0 ), gm::Vec4i( 3, 3, 2, 0 ),
gm::Vec4i( -2, -2, 3, 0 ), gm::Vec4i( -1, -2, 3, 0 ), gm::Vec4i( 0, -2, 3, 0 ),
gm::Vec4i( 1, -2, 3, 0 ), gm::Vec4i( 2, -2, 3, 0 ), gm::Vec4i( 3, -2, 3, 0 ),
gm::Vec4i( -2, -1, 3, 0 ), gm::Vec4i( -1, -1, 3, 0 ), gm::Vec4i( 0, -1, 3, 0 ),
gm::Vec4i( 1, -1, 3, 0 ), gm::Vec4i( 2, -1, 3, 0 ), gm::Vec4i( 3, -1, 3, 0 ),
gm::Vec4i( -2, 0, 3, 0 ), gm::Vec4i( -1, 0, 3, 0 ), gm::Vec4i( 0, 0, 3, 0 ),
gm::Vec4i( 1, 0, 3, 0 ), gm::Vec4i( 2, 0, 3, 0 ), gm::Vec4i( 3, 0, 3, 0 ),
gm::Vec4i( -2, 1, 3, 0 ), gm::Vec4i( -1, 1, 3, 0 ), gm::Vec4i( 0, 1, 3, 0 ),
gm::Vec4i( 1, 1, 3, 0 ), gm::Vec4i( 2, 1, 3, 0 ), gm::Vec4i( 3, 1, 3, 0 ),
gm::Vec4i( -2, 2, 3, 0 ), gm::Vec4i( -1, 2, 3, 0 ), gm::Vec4i( 0, 2, 3, 0 ),
gm::Vec4i( 1, 2, 3, 0 ), gm::Vec4i( 2, 2, 3, 0 ), gm::Vec4i( 3, 2, 3, 0 ),
gm::Vec4i( -2, 3, 3, 0 ), gm::Vec4i( -1, 3, 3, 0 ), gm::Vec4i( 0, 3, 3, 0 ),
gm::Vec4i( 1, 3, 3, 0 ), gm::Vec4i( 2, 3, 3, 0 ), gm::Vec4i( 3, 3, 3, 0 ),
gm::Vec4i( -2, -2, -2, 1 ), gm::Vec4i( -1, -2, -2, 1 ), gm::Vec4i( 0, -2, -2, 1 ),
gm::Vec4i( 1, -2, -2, 1 ), gm::Vec4i( 2, -2, -2, 1 ), gm::Vec4i( 3, -2, -2, 1 ),
gm::Vec4i( -2, -1, -2, 1 ), gm::Vec4i( -1, -1, -2, 1 ), gm::Vec4i( 0, -1, -2, 1 ),
gm::Vec4i( 1, -1, -2, 1 ), gm::Vec4i( 2, -1, -2, 1 ), gm::Vec4i( 3, -1, -2, 1 ),
gm::Vec4i( -2, 0, -2, 1 ), gm::Vec4i( -1, 0, -2, 1 ), gm::Vec4i( 0, 0, -2, 1 ),
gm::Vec4i( 1, 0, -2, 1 ), gm::Vec4i( 2, 0, -2, 1 ), gm::Vec4i( 3, 0, -2, 1 ),
gm::Vec4i( -2, 1, -2, 1 ), gm::Vec4i( -1, 1, -2, 1 ), gm::Vec4i( 0, 1, -2, 1 ),
gm::Vec4i( 1, 1, -2, 1 ), gm::Vec4i( 2, 1, -2, 1 ), gm::Vec4i( 3, 1, -2, 1 ),
gm::Vec4i( -2, 2, -2, 1 ), gm::Vec4i( -1, 2, -2, 1 ), gm::Vec4i( 0, 2, -2, 1 ),
gm::Vec4i( 1, 2, -2, 1 ), gm::Vec4i( 2, 2, -2, 1 ), gm::Vec4i( 3, 2, -2, 1 ),
gm::Vec4i( -2, 3, -2, 1 ), gm::Vec4i( -1, 3, -2, 1 ), gm::Vec4i( 0, 3, -2, 1 ),
gm::Vec4i( 1, 3, -2, 1 ), gm::Vec4i( 2, 3, -2, 1 ), gm::Vec4i( 3, 3, -2, 1 ),
gm::Vec4i( -2, -2, -1, 1 ), gm::Vec4i( -1, -2, -1, 1 ), gm::Vec4i( 0, -2, -1, 1 ),
gm::Vec4i( 1, -2, -1, 1 ), gm::Vec4i( 2, -2, -1, 1 ), gm::Vec4i( 3, -2, -1, 1 ),
gm::Vec4i( -2, -1, -1, 1 ), gm::Vec4i( -1, -1, -1, 1 ), gm::Vec4i( 0, -1, -1, 1 ),
gm::Vec4i( 1, -1, -1, 1 ), gm::Vec4i( 2, -1, -1, 1 ), gm::Vec4i( 3, -1, -1, 1 ),
gm::Vec4i( -2, 0, -1, 1 ), gm::Vec4i( -1, 0, -1, 1 ), gm::Vec4i( 0, 0, -1, 1 ),
gm::Vec4i( 1, 0, -1, 1 ), gm::Vec4i( 2, 0, -1, 1 ), gm::Vec4i( 3, 0, -1, 1 ),
gm::Vec4i( -2, 1, -1, 1 ), gm::Vec4i( -1, 1, -1, 1 ), gm::Vec4i( 0, 1, -1, 1 ),
gm::Vec4i( 1, 1, -1, 1 ), gm::Vec4i( 2, 1, -1, 1 ), gm::Vec4i( 3, 1, -1, 1 ),
gm::Vec4i( -2, 2, -1, 1 ), gm::Vec4i( -1, 2, -1, 1 ), gm::Vec4i( 0, 2, -1, 1 ),
gm::Vec4i( 1, 2, -1, 1 ), gm::Vec4i( 2, 2, -1, 1 ), gm::Vec4i( 3, 2, -1, 1 ),
gm::Vec4i( -2, 3, -1, 1 ), gm::Vec4i( -1, 3, -1, 1 ), gm::Vec4i( 0, 3, -1, 1 ),
gm::Vec4i( 1, 3, -1, 1 ), gm::Vec4i( 2, 3, -1, 1 ), gm::Vec4i( 3, 3, -1, 1 ),
gm::Vec4i( -2, -2, 0, 1 ), gm::Vec4i( -1, -2, 0, 1 ), gm::Vec4i( 0, -2, 0, 1 ),
gm::Vec4i( 1, -2, 0, 1 ), gm::Vec4i( 2, -2, 0, 1 ), gm::Vec4i( 3, -2, 0, 1 ),
gm::Vec4i( -2, -1, 0, 1 ), gm::Vec4i( -1, -1, 0, 1 ), gm::Vec4i( 0, -1, 0, 1 ),
gm::Vec4i( 1, -1, 0, 1 ), gm::Vec4i( 2, -1, 0, 1 ), gm::Vec4i( 3, -1, 0, 1 ),
gm::Vec4i( -2, 0, 0, 1 ), gm::Vec4i( -1, 0, 0, 1 ), gm::Vec4i( 0, 0, 0, 1 ),
gm::Vec4i( 1, 0, 0, 1 ), gm::Vec4i( 2, 0, 0, 1 ), gm::Vec4i( 3, 0, 0, 1 ),
gm::Vec4i( -2, 1, 0, 1 ), gm::Vec4i( -1, 1, 0, 1 ), gm::Vec4i( 0, 1, 0, 1 ),
gm::Vec4i( 1, 1, 0, 1 ), gm::Vec4i( 2, 1, 0, 1 ), gm::Vec4i( 3, 1, 0, 1 ),
gm::Vec4i( -2, 2, 0, 1 ), gm::Vec4i( -1, 2, 0, 1 ), gm::Vec4i( 0, 2, 0, 1 ),
gm::Vec4i( 1, 2, 0, 1 ), gm::Vec4i( 2, 2, 0, 1 ), gm::Vec4i( 3, 2, 0, 1 ),
gm::Vec4i( -2, 3, 0, 1 ), gm::Vec4i( -1, 3, 0, 1 ), gm::Vec4i( 0, 3, 0, 1 ),
gm::Vec4i( 1, 3, 0, 1 ), gm::Vec4i( 2, 3, 0, 1 ), gm::Vec4i( 3, 3, 0, 1 ),
gm::Vec4i( -2, -2, 1, 1 ), gm::Vec4i( -1, -2, 1, 1 ), gm::Vec4i( 0, -2, 1, 1 ),
gm::Vec4i( 1, -2, 1, 1 ), gm::Vec4i( 2, -2, 1, 1 ), gm::Vec4i( 3, -2, 1, 1 ),
gm::Vec4i( -2, -1, 1, 1 ), gm::Vec4i( -1, -1, 1, 1 ), gm::Vec4i( 0, -1, 1, 1 ),
gm::Vec4i( 1, -1, 1, 1 ), gm::Vec4i( 2, -1, 1, 1 ), gm::Vec4i( 3, -1, 1, 1 ),
gm::Vec4i( -2, 0, 1, 1 ), gm::Vec4i( -1, 0, 1, 1 ), gm::Vec4i( 0, 0, 1, 1 ),
gm::Vec4i( 1, 0, 1, 1 ), gm::Vec4i( 2, 0, 1, 1 ), gm::Vec4i( 3, 0, 1, 1 ),
gm::Vec4i( -2, 1, 1, 1 ), gm::Vec4i( -1, 1, 1, 1 ), gm::Vec4i( 0, 1, 1, 1 ),
gm::Vec4i( 1, 1, 1, 1 ), gm::Vec4i( 2, 1, 1, 1 ), gm::Vec4i( 3, 1, 1, 1 ),
gm::Vec4i( -2, 2, 1, 1 ), gm::Vec4i( -1, 2, 1, 1 ), gm::Vec4i( 0, 2, 1, 1 ),
gm::Vec4i( 1, 2, 1, 1 ), gm::Vec4i( 2, 2, 1, 1 ), gm::Vec4i( 3, 2, 1, 1 ),
gm::Vec4i( -2, 3, 1, 1 ), gm::Vec4i( -1, 3, 1, 1 ), gm::Vec4i( 0, 3, 1, 1 ),
gm::Vec4i( 1, 3, 1, 1 ), gm::Vec4i( 2, 3, 1, 1 ), gm::Vec4i( 3, 3, 1, 1 ),
gm::Vec4i( -2, -2, 2, 1 ), gm::Vec4i( -1, -2, 2, 1 ), gm::Vec4i( 0, -2, 2, 1 ),
gm::Vec4i( 1, -2, 2, 1 ), gm::Vec4i( 2, -2, 2, 1 ), gm::Vec4i( 3, -2, 2, 1 ),
gm::Vec4i( -2, -1, 2, 1 ), gm::Vec4i( -1, -1, 2, 1 ), gm::Vec4i( 0, -1, 2, 1 ),
gm::Vec4i( 1, -1, 2, 1 ), gm::Vec4i( 2, -1, 2, 1 ), gm::Vec4i( 3, -1, 2, 1 ),
gm::Vec4i( -2, 0, 2, 1 ), gm::Vec4i( -1, 0, 2, 1 ), gm::Vec4i( 0, 0, 2, 1 ),
gm::Vec4i( 1, 0, 2, 1 ), gm::Vec4i( 2, 0, 2, 1 ), gm::Vec4i( 3, 0, 2, 1 ),
gm::Vec4i( -2, 1, 2, 1 ), gm::Vec4i( -1, 1, 2, 1 ), gm::Vec4i( 0, 1, 2, 1 ),
gm::Vec4i( 1, 1, 2, 1 ), gm::Vec4i( 2, 1, 2, 1 ), gm::Vec4i( 3, 1, 2, 1 ),
gm::Vec4i( -2, 2, 2, 1 ), gm::Vec4i( -1, 2, 2, 1 ), gm::Vec4i( 0, 2, 2, 1 ),
gm::Vec4i( 1, 2, 2, 1 ), gm::Vec4i( 2, 2, 2, 1 ), gm::Vec4i( 3, 2, 2, 1 ),
gm::Vec4i( -2, 3, 2, 1 ), gm::Vec4i( -1, 3, 2, 1 ), gm::Vec4i( 0, 3, 2, 1 ),
gm::Vec4i( 1, 3, 2, 1 ), gm::Vec4i( 2, 3, 2, 1 ), gm::Vec4i( 3, 3, 2, 1 ),
gm::Vec4i( -2, -2, 3, 1 ), gm::Vec4i( -1, -2, 3, 1 ), gm::Vec4i( 0, -2, 3, 1 ),
gm::Vec4i( 1, -2, 3, 1 ), gm::Vec4i( 2, -2, 3, 1 ), gm::Vec4i( 3, -2, 3, 1 ),
gm::Vec4i( -2, -1, 3, 1 ), gm::Vec4i( -1, -1, 3, 1 ), gm::Vec4i( 0, -1, 3, 1 ),
gm::Vec4i( 1, -1, 3, 1 ), gm::Vec4i( 2, -1, 3, 1 ), gm::Vec4i( 3, -1, 3, 1 ),
gm::Vec4i( -2, 0, 3, 1 ), gm::Vec4i( -1, 0, 3, 1 ), gm::Vec4i( 0, 0, 3, 1 ),
gm::Vec4i( 1, 0, 3, 1 ), gm::Vec4i( 2, 0, 3, 1 ), gm::Vec4i( 3, 0, 3, 1 ),
gm::Vec4i( -2, 1, 3, 1 ), gm::Vec4i( -1, 1, 3, 1 ), gm::Vec4i( 0, 1, 3, 1 ),
gm::Vec4i( 1, 1, 3, 1 ), gm::Vec4i( 2, 1, 3, 1 ), gm::Vec4i( 3, 1, 3, 1 ),
gm::Vec4i( -2, 2, 3, 1 ), gm::Vec4i( -1, 2, 3, 1 ), gm::Vec4i( 0, 2, 3, 1 ),
gm::Vec4i( 1, 2, 3, 1 ), gm::Vec4i( 2, 2, 3, 1 ), gm::Vec4i( 3, 2, 3, 1 ),
gm::Vec4i( -2, 3, 3, 1 ), gm::Vec4i( -1, 3, 3, 1 ), gm::Vec4i( 0, 3, 3, 1 ),
gm::Vec4i( 1, 3, 3, 1 ), gm::Vec4i( 2, 3, 3, 1 ), gm::Vec4i( 3, 3, 3, 1 ),
gm::Vec4i( -2, -2, -2, 2 ), gm::Vec4i( -1, -2, -2, 2 ), gm::Vec4i( 0, -2, -2, 2 ),
gm::Vec4i( 1, -2, -2, 2 ), gm::Vec4i( 2, -2, -2, 2 ), gm::Vec4i( 3, -2, -2, 2 ),
gm::Vec4i( -2, -1, -2, 2 ), gm::Vec4i( -1, -1, -2, 2 ), gm::Vec4i( 0, -1, -2, 2 ),
gm::Vec4i( 1, -1, -2, 2 ), gm::Vec4i( 2, -1, -2, 2 ), gm::Vec4i( 3, -1, -2, 2 ),
gm::Vec4i( -2, 0, -2, 2 ), gm::Vec4i( -1, 0, -2, 2 ), gm::Vec4i( 0, 0, -2, 2 ),
gm::Vec4i( 1, 0, -2, 2 ), gm::Vec4i( 2, 0, -2, 2 ), gm::Vec4i( 3, 0, -2, 2 ),
gm::Vec4i( -2, 1, -2, 2 ), gm::Vec4i( -1, 1, -2, 2 ), gm::Vec4i( 0, 1, -2, 2 ),
gm::Vec4i( 1, 1, -2, 2 ), gm::Vec4i( 2, 1, -2, 2 ), gm::Vec4i( 3, 1, -2, 2 ),
gm::Vec4i( -2, 2, -2, 2 ), gm::Vec4i( -1, 2, -2, 2 ), gm::Vec4i( 0, 2, -2, 2 ),
gm::Vec4i( 1, 2, -2, 2 ), gm::Vec4i( 2, 2, -2, 2 ), gm::Vec4i( 3, 2, -2, 2 ),
gm::Vec4i( -2, 3, -2, 2 ), gm::Vec4i( -1, 3, -2, 2 ), gm::Vec4i( 0, 3, -2, 2 ),
gm::Vec4i( 1, 3, -2, 2 ), gm::Vec4i( 2, 3, -2, 2 ), gm::Vec4i( 3, 3, -2, 2 ),
gm::Vec4i( -2, -2, -1, 2 ), gm::Vec4i( -1, -2, -1, 2 ), gm::Vec4i( 0, -2, -1, 2 ),
gm::Vec4i( 1, -2, -1, 2 ), gm::Vec4i( 2, -2, -1, 2 ), gm::Vec4i( 3, -2, -1, 2 ),
gm::Vec4i( -2, -1, -1, 2 ), gm::Vec4i( -1, -1, -1, 2 ), gm::Vec4i( 0, -1, -1, 2 ),
gm::Vec4i( 1, -1, -1, 2 ), gm::Vec4i( 2, -1, -1, 2 ), gm::Vec4i( 3, -1, -1, 2 ),
gm::Vec4i( -2, 0, -1, 2 ), gm::Vec4i( -1, 0, -1, 2 ), gm::Vec4i( 0, 0, -1, 2 ),
gm::Vec4i( 1, 0, -1, 2 ), gm::Vec4i( 2, 0, -1, 2 ), gm::Vec4i( 3, 0, -1, 2 ),
gm::Vec4i( -2, 1, -1, 2 ), gm::Vec4i( -1, 1, -1, 2 ), gm::Vec4i( 0, 1, -1, 2 ),
gm::Vec4i( 1, 1, -1, 2 ), gm::Vec4i( 2, 1, -1, 2 ), gm::Vec4i( 3, 1, -1, 2 ),
gm::Vec4i( -2, 2, -1, 2 ), gm::Vec4i( -1, 2, -1, 2 ), gm::Vec4i( 0, 2, -1, 2 ),
gm::Vec4i( 1, 2, -1, 2 ), gm::Vec4i( 2, 2, -1, 2 ), gm::Vec4i( 3, 2, -1, 2 ),
gm::Vec4i( -2, 3, -1, 2 ), gm::Vec4i( -1, 3, -1, 2 ), gm::Vec4i( 0, 3, -1, 2 ),
gm::Vec4i( 1, 3, -1, 2 ), gm::Vec4i( 2, 3, -1, 2 ), gm::Vec4i( 3, 3, -1, 2 ),
gm::Vec4i( -2, -2, 0, 2 ), gm::Vec4i( -1, -2, 0, 2 ), gm::Vec4i( 0, -2, 0, 2 ),
gm::Vec4i( 1, -2, 0, 2 ), gm::Vec4i( 2, -2, 0, 2 ), gm::Vec4i( 3, -2, 0, 2 ),
gm::Vec4i( -2, -1, 0, 2 ), gm::Vec4i( -1, -1, 0, 2 ), gm::Vec4i( 0, -1, 0, 2 ),
gm::Vec4i( 1, -1, 0, 2 ), gm::Vec4i( 2, -1, 0, 2 ), gm::Vec4i( 3, -1, 0, 2 ),
gm::Vec4i( -2, 0, 0, 2 ), gm::Vec4i( -1, 0, 0, 2 ), gm::Vec4i( 0, 0, 0, 2 ),
gm::Vec4i( 1, 0, 0, 2 ), gm::Vec4i( 2, 0, 0, 2 ), gm::Vec4i( 3, 0, 0, 2 ),
gm::Vec4i( -2, 1, 0, 2 ), gm::Vec4i( -1, 1, 0, 2 ), gm::Vec4i( 0, 1, 0, 2 ),
gm::Vec4i( 1, 1, 0, 2 ), gm::Vec4i( 2, 1, 0, 2 ), gm::Vec4i( 3, 1, 0, 2 ),
gm::Vec4i( -2, 2, 0, 2 ), gm::Vec4i( -1, 2, 0, 2 ), gm::Vec4i( 0, 2, 0, 2 ),
gm::Vec4i( 1, 2, 0, 2 ), gm::Vec4i( 2, 2, 0, 2 ), gm::Vec4i( 3, 2, 0, 2 ),
gm::Vec4i( -2, 3, 0, 2 ), gm::Vec4i( -1, 3, 0, 2 ), gm::Vec4i( 0, 3, 0, 2 ),
gm::Vec4i( 1, 3, 0, 2 ), gm::Vec4i( 2, 3, 0, 2 ), gm::Vec4i( 3, 3, 0, 2 ),
gm::Vec4i( -2, -2, 1, 2 ), gm::Vec4i( -1, -2, 1, 2 ), gm::Vec4i( 0, -2, 1, 2 ),
gm::Vec4i( 1, -2, 1, 2 ), gm::Vec4i( 2, -2, 1, 2 ), gm::Vec4i( 3, -2, 1, 2 ),
gm::Vec4i( -2, -1, 1, 2 ), gm::Vec4i( -1, -1, 1, 2 ), gm::Vec4i( 0, -1, 1, 2 ),
gm::Vec4i( 1, -1, 1, 2 ), gm::Vec4i( 2, -1, 1, 2 ), gm::Vec4i( 3, -1, 1, 2 ),
gm::Vec4i( -2, 0, 1, 2 ), gm::Vec4i( -1, 0, 1, 2 ), gm::Vec4i( 0, 0, 1, 2 ),
gm::Vec4i( 1, 0, 1, 2 ), gm::Vec4i( 2, 0, 1, 2 ), gm::Vec4i( 3, 0, 1, 2 ),
gm::Vec4i( -2, 1, 1, 2 ), gm::Vec4i( -1, 1, 1, 2 ), gm::Vec4i( 0, 1, 1, 2 ),
gm::Vec4i( 1, 1, 1, 2 ), gm::Vec4i( 2, 1, 1, 2 ), gm::Vec4i( 3, 1, 1, 2 ),
gm::Vec4i( -2, 2, 1, 2 ), gm::Vec4i( -1, 2, 1, 2 ), gm::Vec4i( 0, 2, 1, 2 ),
gm::Vec4i( 1, 2, 1, 2 ), gm::Vec4i( 2, 2, 1, 2 ), gm::Vec4i( 3, 2, 1, 2 ),
gm::Vec4i( -2, 3, 1, 2 ), gm::Vec4i( -1, 3, 1, 2 ), gm::Vec4i( 0, 3, 1, 2 ),
gm::Vec4i( 1, 3, 1, 2 ), gm::Vec4i( 2, 3, 1, 2 ), gm::Vec4i( 3, 3, 1, 2 ),
gm::Vec4i( -2, -2, 2, 2 ), gm::Vec4i( -1, -2, 2, 2 ), gm::Vec4i( 0, -2, 2, 2 ),
gm::Vec4i( 1, -2, 2, 2 ), gm::Vec4i( 2, -2, 2, 2 ), gm::Vec4i( 3, -2, 2, 2 ),
gm::Vec4i( -2, -1, 2, 2 ), gm::Vec4i( -1, -1, 2, 2 ), gm::Vec4i( 0, -1, 2, 2 ),
gm::Vec4i( 1, -1, 2, 2 ), gm::Vec4i( 2, -1, 2, 2 ), gm::Vec4i( 3, -1, 2, 2 ),
gm::Vec4i( -2, 0, 2, 2 ), gm::Vec4i( -1, 0, 2, 2 ), gm::Vec4i( 0, 0, 2, 2 ),
gm::Vec4i( 1, 0, 2, 2 ), gm::Vec4i( 2, 0, 2, 2 ), gm::Vec4i( 3, 0, 2, 2 ),
gm::Vec4i( -2, 1, 2, 2 ), gm::Vec4i( -1, 1, 2, 2 ), gm::Vec4i( 0, 1, 2, 2 ),
gm::Vec4i( 1, 1, 2, 2 ), gm::Vec4i( 2, 1, 2, 2 ), gm::Vec4i( 3, 1, 2, 2 ),
gm::Vec4i( -2, 2, 2, 2 ), gm::Vec4i( -1, 2, 2, 2 ), gm::Vec4i( 0, 2, 2, 2 ),
gm::Vec4i( 1, 2, 2, 2 ), gm::Vec4i( 2, 2, 2, 2 ), gm::Vec4i( 3, 2, 2, 2 ),
gm::Vec4i( -2, 3, 2, 2 ), gm::Vec4i( -1, 3, 2, 2 ), gm::Vec4i( 0, 3, 2, 2 ),
gm::Vec4i( 1, 3, 2, 2 ), gm::Vec4i( 2, 3, 2, 2 ), gm::Vec4i( 3, 3, 2, 2 ),
gm::Vec4i( -2, -2, 3, 2 ), gm::Vec4i( -1, -2, 3, 2 ), gm::Vec4i( 0, -2, 3, 2 ),
gm::Vec4i( 1, -2, 3, 2 ), gm::Vec4i( 2, -2, 3, 2 ), gm::Vec4i( 3, -2, 3, 2 ),
gm::Vec4i( -2, -1, 3, 2 ), gm::Vec4i( -1, -1, 3, 2 ), gm::Vec4i( 0, -1, 3, 2 ),
gm::Vec4i( 1, -1, 3, 2 ), gm::Vec4i( 2, -1, 3, 2 ), gm::Vec4i( 3, -1, 3, 2 ),
gm::Vec4i( -2, 0, 3, 2 ), gm::Vec4i( -1, 0, 3, 2 ), gm::Vec4i( 0, 0, 3, 2 ),
gm::Vec4i( 1, 0, 3, 2 ), gm::Vec4i( 2, 0, 3, 2 ), gm::Vec4i( 3, 0, 3, 2 ),
gm::Vec4i( -2, 1, 3, 2 ), gm::Vec4i( -1, 1, 3, 2 ), gm::Vec4i( 0, 1, 3, 2 ),
gm::Vec4i( 1, 1, 3, 2 ), gm::Vec4i( 2, 1, 3, 2 ), gm::Vec4i( 3, 1, 3, 2 ),
gm::Vec4i( -2, 2, 3, 2 ), gm::Vec4i( -1, 2, 3, 2 ), gm::Vec4i( 0, 2, 3, 2 ),
gm::Vec4i( 1, 2, 3, 2 ), gm::Vec4i( 2, 2, 3, 2 ), gm::Vec4i( 3, 2, 3, 2 ),
gm::Vec4i( -2, 3, 3, 2 ), gm::Vec4i( -1, 3, 3, 2 ), gm::Vec4i( 0, 3, 3, 2 ),
gm::Vec4i( 1, 3, 3, 2 ), gm::Vec4i( 2, 3, 3, 2 ), gm::Vec4i( 3, 3, 3, 2 ),
gm::Vec4i( -2, -2, -2, 3 ), gm::Vec4i( -1, -2, -2, 3 ), gm::Vec4i( 0, -2, -2, 3 ),
gm::Vec4i( 1, -2, -2, 3 ), gm::Vec4i( 2, -2, -2, 3 ), gm::Vec4i( 3, -2, -2, 3 ),
gm::Vec4i( -2, -1, -2, 3 ), gm::Vec4i( -1, -1, -2, 3 ), gm::Vec4i( 0, -1, -2, 3 ),
gm::Vec4i( 1, -1, -2, 3 ), gm::Vec4i( 2, -1, -2, 3 ), gm::Vec4i( 3, -1, -2, 3 ),
gm::Vec4i( -2, 0, -2, 3 ), gm::Vec4i( -1, 0, -2, 3 ), gm::Vec4i( 0, 0, -2, 3 ),
gm::Vec4i( 1, 0, -2, 3 ), gm::Vec4i( 2, 0, -2, 3 ), gm::Vec4i( 3, 0, -2, 3 ),
gm::Vec4i( -2, 1, -2, 3 ), gm::Vec4i( -1, 1, -2, 3 ), gm::Vec4i( 0, 1, -2, 3 ),
gm::Vec4i( 1, 1, -2, 3 ), gm::Vec4i( 2, 1, -2, 3 ), gm::Vec4i( 3, 1, -2, 3 ),
gm::Vec4i( -2, 2, -2, 3 ), gm::Vec4i( -1, 2, -2, 3 ), gm::Vec4i( 0, 2, -2, 3 ),
gm::Vec4i( 1, 2, -2, 3 ), gm::Vec4i( 2, 2, -2, 3 ), gm::Vec4i( 3, 2, -2, 3 ),
gm::Vec4i( -2, 3, -2, 3 ), gm::Vec4i( -1, 3, -2, 3 ), gm::Vec4i( 0, 3, -2, 3 ),
gm::Vec4i( 1, 3, -2, 3 ), gm::Vec4i( 2, 3, -2, 3 ), gm::Vec4i( 3, 3, -2, 3 ),
gm::Vec4i( -2, -2, -1, 3 ), gm::Vec4i( -1, -2, -1, 3 ), gm::Vec4i( 0, -2, -1, 3 ),
gm::Vec4i( 1, -2, -1, 3 ), gm::Vec4i( 2, -2, -1, 3 ), gm::Vec4i( 3, -2, -1, 3 ),
gm::Vec4i( -2, -1, -1, 3 ), gm::Vec4i( -1, -1, -1, 3 ), gm::Vec4i( 0, -1, -1, 3 ),
gm::Vec4i( 1, -1, -1, 3 ), gm::Vec4i( 2, -1, -1, 3 ), gm::Vec4i( 3, -1, -1, 3 ),
gm::Vec4i( -2, 0, -1, 3 ), gm::Vec4i( -1, 0, -1, 3 ), gm::Vec4i( 0, 0, -1, 3 ),
gm::Vec4i( 1, 0, -1, 3 ), gm::Vec4i( 2, 0, -1, 3 ), gm::Vec4i( 3, 0, -1, 3 ),
gm::Vec4i( -2, 1, -1, 3 ), gm::Vec4i( -1, 1, -1, 3 ), gm::Vec4i( 0, 1, -1, 3 ),
gm::Vec4i( 1, 1, -1, 3 ), gm::Vec4i( 2, 1, -1, 3 ), gm::Vec4i( 3, 1, -1, 3 ),
gm::Vec4i( -2, 2, -1, 3 ), gm::Vec4i( -1, 2, -1, 3 ), gm::Vec4i( 0, 2, -1, 3 ),
gm::Vec4i( 1, 2, -1, 3 ), gm::Vec4i( 2, 2, -1, 3 ), gm::Vec4i( 3, 2, -1, 3 ),
gm::Vec4i( -2, 3, -1, 3 ), gm::Vec4i( -1, 3, -1, 3 ), gm::Vec4i( 0, 3, -1, 3 ),
gm::Vec4i( 1, 3, -1, 3 ), gm::Vec4i( 2, 3, -1, 3 ), gm::Vec4i( 3, 3, -1, 3 ),
gm::Vec4i( -2, -2, 0, 3 ), gm::Vec4i( -1, -2, 0, 3 ), gm::Vec4i( 0, -2, 0, 3 ),
gm::Vec4i( 1, -2, 0, 3 ), gm::Vec4i( 2, -2, 0, 3 ), gm::Vec4i( 3, -2, 0, 3 ),
gm::Vec4i( -2, -1, 0, 3 ), gm::Vec4i( -1, -1, 0, 3 ), gm::Vec4i( 0, -1, 0, 3 ),
gm::Vec4i( 1, -1, 0, 3 ), gm::Vec4i( 2, -1, 0, 3 ), gm::Vec4i( 3, -1, 0, 3 ),
gm::Vec4i( -2, 0, 0, 3 ), gm::Vec4i( -1, 0, 0, 3 ), gm::Vec4i( 0, 0, 0, 3 ),
gm::Vec4i( 1, 0, 0, 3 ), gm::Vec4i( 2, 0, 0, 3 ), gm::Vec4i( 3, 0, 0, 3 ),
gm::Vec4i( -2, 1, 0, 3 ), gm::Vec4i( -1, 1, 0, 3 ), gm::Vec4i( 0, 1, 0, 3 ),
gm::Vec4i( 1, 1, 0, 3 ), gm::Vec4i( 2, 1, 0, 3 ), gm::Vec4i( 3, 1, 0, 3 ),
gm::Vec4i( -2, 2, 0, 3 ), gm::Vec4i( -1, 2, 0, 3 ), gm::Vec4i( 0, 2, 0, 3 ),
gm::Vec4i( 1, 2, 0, 3 ), gm::Vec4i( 2, 2, 0, 3 ), gm::Vec4i( 3, 2, 0, 3 ),
gm::Vec4i( -2, 3, 0, 3 ), gm::Vec4i( -1, 3, 0, 3 ), gm::Vec4i( 0, 3, 0, 3 ),
gm::Vec4i( 1, 3, 0, 3 ), gm::Vec4i( 2, 3, 0, 3 ), gm::Vec4i( 3, 3, 0, 3 ),
gm::Vec4i( -2, -2, 1, 3 ), gm::Vec4i( -1, -2, 1, 3 ), gm::Vec4i( 0, -2, 1, 3 ),
gm::Vec4i( 1, -2, 1, 3 ), gm::Vec4i( 2, -2, 1, 3 ), gm::Vec4i( 3, -2, 1, 3 ),
gm::Vec4i( -2, -1, 1, 3 ), gm::Vec4i( -1, -1, 1, 3 ), gm::Vec4i( 0, -1, 1, 3 ),
gm::Vec4i( 1, -1, 1, 3 ), gm::Vec4i( 2, -1, 1, 3 ), gm::Vec4i( 3, -1, 1, 3 ),
gm::Vec4i( -2, 0, 1, 3 ), gm::Vec4i( -1, 0, 1, 3 ), gm::Vec4i( 0, 0, 1, 3 ),
gm::Vec4i( 1, 0, 1, 3 ), gm::Vec4i( 2, 0, 1, 3 ), gm::Vec4i( 3, 0, 1, 3 ),
gm::Vec4i( -2, 1, 1, 3 ), gm::Vec4i( -1, 1, 1, 3 ), gm::Vec4i( 0, 1, 1, 3 ),
gm::Vec4i( 1, 1, 1, 3 ), gm::Vec4i( 2, 1, 1, 3 ), gm::Vec4i( 3, 1, 1, 3 ),
gm::Vec4i( -2, 2, 1, 3 ), gm::Vec4i( -1, 2, 1, 3 ), gm::Vec4i( 0, 2, 1, 3 ),
gm::Vec4i( 1, 2, 1, 3 ), gm::Vec4i( 2, 2, 1, 3 ), gm::Vec4i( 3, 2, 1, 3 ),
gm::Vec4i( -2, 3, 1, 3 ), gm::Vec4i( -1, 3, 1, 3 ), gm::Vec4i( 0, 3, 1, 3 ),
gm::Vec4i( 1, 3, 1, 3 ), gm::Vec4i( 2, 3, 1, 3 ), gm::Vec4i( 3, 3, 1, 3 ),
gm::Vec4i( -2, -2, 2, 3 ), gm::Vec4i( -1, -2, 2, 3 ), gm::Vec4i( 0, -2, 2, 3 ),
gm::Vec4i( 1, -2, 2, 3 ), gm::Vec4i( 2, -2, 2, 3 ), gm::Vec4i( 3, -2, 2, 3 ),
gm::Vec4i( -2, -1, 2, 3 ), gm::Vec4i( -1, -1, 2, 3 ), gm::Vec4i( 0, -1, 2, 3 ),
gm::Vec4i( 1, -1, 2, 3 ), gm::Vec4i( 2, -1, 2, 3 ), gm::Vec4i( 3, -1, 2, 3 ),
gm::Vec4i( -2, 0, 2, 3 ), gm::Vec4i( -1, 0, 2, 3 ), gm::Vec4i( 0, 0, 2, 3 ),
gm::Vec4i( 1, 0, 2, 3 ), gm::Vec4i( 2, 0, 2, 3 ), gm::Vec4i( 3, 0, 2, 3 ),
gm::Vec4i( -2, 1, 2, 3 ), gm::Vec4i( -1, 1, 2, 3 ), gm::Vec4i( 0, 1, 2, 3 ),
gm::Vec4i( 1, 1, 2, 3 ), gm::Vec4i( 2, 1, 2, 3 ), gm::Vec4i( 3, 1, 2, 3 ),
gm::Vec4i( -2, 2, 2, 3 ), gm::Vec4i( -1, 2, 2, 3 ), gm::Vec4i( 0, 2, 2, 3 ),
gm::Vec4i( 1, 2, 2, 3 ), gm::Vec4i( 2, 2, 2, 3 ), gm::Vec4i( 3, 2, 2, 3 ),
gm::Vec4i( -2, 3, 2, 3 ), gm::Vec4i( -1, 3, 2, 3 ), gm::Vec4i( 0, 3, 2, 3 ),
gm::Vec4i( 1, 3, 2, 3 ), gm::Vec4i( 2, 3, 2, 3 ), gm::Vec4i( 3, 3, 2, 3 ),
gm::Vec4i( -2, -2, 3, 3 ), gm::Vec4i( -1, -2, 3, 3 ), gm::Vec4i( 0, -2, 3, 3 ),
gm::Vec4i( 1, -2, 3, 3 ), gm::Vec4i( 2, -2, 3, 3 ), gm::Vec4i( 3, -2, 3, 3 ),
gm::Vec4i( -2, -1, 3, 3 ), gm::Vec4i( -1, -1, 3, 3 ), gm::Vec4i( 0, -1, 3, 3 ),
gm::Vec4i( 1, -1, 3, 3 ), gm::Vec4i( 2, -1, 3, 3 ), gm::Vec4i( 3, -1, 3, 3 ),
gm::Vec4i( -2, 0, 3, 3 ), gm::Vec4i( -1, 0, 3, 3 ), gm::Vec4i( 0, 0, 3, 3 ),
gm::Vec4i( 1, 0, 3, 3 ), gm::Vec4i( 2, 0, 3, 3 ), gm::Vec4i( 3, 0, 3, 3 ),
gm::Vec4i( -2, 1, 3, 3 ), gm::Vec4i( -1, 1, 3, 3 ), gm::Vec4i( 0, 1, 3, 3 ),
gm::Vec4i( 1, 1, 3, 3 ), gm::Vec4i( 2, 1, 3, 3 ), gm::Vec4i( 3, 1, 3, 3 ),
gm::Vec4i( -2, 2, 3, 3 ), gm::Vec4i( -1, 2, 3, 3 ), gm::Vec4i( 0, 2, 3, 3 ),
gm::Vec4i( 1, 2, 3, 3 ), gm::Vec4i( 2, 2, 3, 3 ), gm::Vec4i( 3, 2, 3, 3 ),
gm::Vec4i( -2, 3, 3, 3 ), gm::Vec4i( -1, 3, 3, 3 ), gm::Vec4i( 0, 3, 3, 3 ),
gm::Vec4i( 1, 3, 3, 3 ), gm::Vec4i( 2, 3, 3, 3 ), gm::Vec4i( 3, 3, 3, 3 ),
};
CHECK( array == expectedArray );
}
| 83.089669 | 99 | 0.367695 | moddyz |
982689cfbb60495a477caab60651c602e58226a4 | 3,974 | cpp | C++ | src/Engine/App/AssetRegistry.cpp | kimkulling/osre | b738c87e37d0b1d2d0779a412b88ce68517c4328 | [
"MIT"
] | 118 | 2015-05-12T15:12:14.000Z | 2021-11-14T15:41:11.000Z | src/Engine/App/AssetRegistry.cpp | kimkulling/osre | b738c87e37d0b1d2d0779a412b88ce68517c4328 | [
"MIT"
] | 76 | 2015-06-06T18:04:24.000Z | 2022-01-14T20:17:37.000Z | src/Engine/App/AssetRegistry.cpp | kimkulling/osre | b738c87e37d0b1d2d0779a412b88ce68517c4328 | [
"MIT"
] | 7 | 2016-06-28T09:14:38.000Z | 2021-03-12T02:07:52.000Z | /*-----------------------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2015-2021 OSRE ( Open Source Render Engine ) by Kim Kulling
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------------------------*/
#include <osre/App/AssetRegistry.h>
#include <osre/Common/Logger.h>
#include <osre/Common/StringUtils.h>
#include <osre/IO/Uri.h>
#include <osre/IO/Stream.h>
namespace OSRE {
namespace App {
using namespace ::OSRE::Common;
AssetRegistry *AssetRegistry::s_instance = nullptr;
static const String Tag = "AssetRegistry";
AssetRegistry *AssetRegistry::create() {
if ( nullptr == s_instance ) {
s_instance = new AssetRegistry;
}
return s_instance;
}
void AssetRegistry::destroy() {
if ( nullptr==s_instance ) {
return;
}
delete s_instance;
s_instance = nullptr;
}
bool AssetRegistry::registerAssetPath( const String &mount, const String &path ) {
if ( nullptr == s_instance ) {
return false;
}
const ui32 hashId( StringUtils::hashName( mount ) );
s_instance->m_name2pathMap.insert( hashId, path );
return true;
}
bool AssetRegistry::hasPath( const String &mount ) {
if ( nullptr == s_instance ) {
return false;
}
const ui32 hashId( StringUtils::hashName( mount ) );
if ( !s_instance->m_name2pathMap.hasKey( hashId ) ) {
return false;
}
return true;
}
static const String Dummy("");
String AssetRegistry::getPath( const String &mount ) {
if ( nullptr == s_instance ) {
return Dummy;
}
const HashId hashId( StringUtils::hashName( mount ) );
if ( !s_instance->m_name2pathMap.hasKey( hashId ) ) {
return Dummy;
}
String path;
if ( s_instance->m_name2pathMap.getValue( hashId, path ) ) {
return path;
}
return Dummy;
}
String AssetRegistry::resolvePathFromUri( const IO::Uri &location ) {
if ( location.isEmpty() ) {
return Dummy;
}
const String pathToCheck( location.getAbsPath() );
String absPath( pathToCheck );
const String::size_type pos = pathToCheck.find( "/" );
String mountPoint = pathToCheck.substr( 0, pos );
String::size_type offset = pos + mountPoint.size() + 1;
if ( hasPath( mountPoint ) ) {
absPath = getPath( mountPoint );
if ( absPath[ absPath.size()-1 ]!='/' ) {
absPath += '/';
offset++;
}
const String rest = pathToCheck.substr( pos+1, pathToCheck.size() - pos-1 );
absPath += rest;
}
return absPath;
}
bool AssetRegistry::clear() {
if ( nullptr == s_instance ) {
return false;
}
s_instance->m_name2pathMap.clear();
return true;
}
AssetRegistry::AssetRegistry()
: m_name2pathMap() {
// empty
}
AssetRegistry::~AssetRegistry() {
// empty
}
} // Namespace Assets
} // Namespace OSRE
| 27.985915 | 97 | 0.638903 | kimkulling |
9828a78dcc719784a1e07d059d2c2bd1aa853a37 | 2,629 | cpp | C++ | debugger/src/gui_plugin/qt_wrapper.cpp | hossameldin1995/riscv_vhdl | aab7196a6b9962626ed7314b7c86b93760e76f83 | [
"Apache-2.0"
] | 2 | 2020-08-12T17:01:28.000Z | 2020-10-06T02:50:49.000Z | debugger/src/gui_plugin/qt_wrapper.cpp | hossameldin1995/riscv_vhdl | aab7196a6b9962626ed7314b7c86b93760e76f83 | [
"Apache-2.0"
] | null | null | null | debugger/src/gui_plugin/qt_wrapper.cpp | hossameldin1995/riscv_vhdl | aab7196a6b9962626ed7314b7c86b93760e76f83 | [
"Apache-2.0"
] | 1 | 2021-11-18T17:40:35.000Z | 2021-11-18T17:40:35.000Z | /*
* Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "api_core.h"
#include "qt_wrapper.h"
#include "moc_qt_wrapper.h"
#include <string>
#include <QtWidgets/QApplication>
#define QT_EXEC_IMPL
namespace debugger {
static event_def eventAppDestroyed_;
/** It's a blocking event that runs only once */
void ui_events_update(void *args) {
QtWrapper *ui = reinterpret_cast<QtWrapper *>(args);
ui->eventsUpdate();
RISCV_event_set(&eventAppDestroyed_);
//RISCV_event_close(&eventAppDestroyed_);
}
QtWrapper::QtWrapper(IGui *igui)
: QObject() {
igui_ = igui;
exiting_ = false;
pextRequest_ = extRequest_;
RISCV_event_create(&eventAppDestroyed_, "eventAppDestroyed_");
}
QtWrapper::~QtWrapper() {
}
void QtWrapper::postInit(AttributeType *gui_cfg) {
RISCV_register_timer(1, 1, ui_events_update, this);
}
void QtWrapper::eventsUpdate() {
int argc = 0;
char *argv[] = {0};
QApplication app(argc, argv);
app.setQuitOnLastWindowClosed(true);
mainWindow_ = new DbgMainWindow(igui_);
connect(mainWindow_, SIGNAL(signalAboutToClose()),
this, SLOT(slotMainWindowAboutToClose()));
mainWindow_->show();
app.exec();
RISCV_unregister_timer(ui_events_update);
delete mainWindow_;
app.quit();
}
void QtWrapper::gracefulClose() {
if (!exiting_) {
/** Exit through console command 'exit' */
mainWindow_->close();
RISCV_event_wait_ms(&eventAppDestroyed_, 10000);
}
}
void QtWrapper::externalCommand(AttributeType *req) {
size_t free_cnt = sizeof(extRequest_) - (pextRequest_ - extRequest_);
if (free_cnt <= req->size()) {
pextRequest_ = extRequest_;
}
memcpy(pextRequest_, req->to_string(), req->size() + 1);
emit signalExternalCommand(pextRequest_);
pextRequest_ += req->size() + 1;
}
void QtWrapper::slotMainWindowAboutToClose() {
if (exiting_) {
return;
}
/** Exit from GUI button push */
exiting_ = true;
RISCV_break_simulation();
}
} // namespace debugger
| 26.555556 | 76 | 0.689996 | hossameldin1995 |
982906f4cd13ded5d2c44e8db8fb29279191ad00 | 138 | cpp | C++ | SimpleUI/ComboBox.cpp | 958328814/dreamdota | 2d71c5ebe1b3fb2726bf20e514025dbe28152a35 | [
"MIT"
] | 4 | 2020-06-16T13:43:33.000Z | 2021-11-26T02:18:24.000Z | SimpleUI/ComboBox.cpp | hackerlank/dreamdota | 2d71c5ebe1b3fb2726bf20e514025dbe28152a35 | [
"MIT"
] | null | null | null | SimpleUI/ComboBox.cpp | hackerlank/dreamdota | 2d71c5ebe1b3fb2726bf20e514025dbe28152a35 | [
"MIT"
] | 5 | 2020-06-16T13:55:00.000Z | 2022-02-09T09:36:53.000Z | #include "ComboBox.h"
namespace SimpleUI {
ComboBox::ComboBox(HWND handle) : Control(handle) {
}
ComboBox::~ComboBox() {
}
} | 9.2 | 52 | 0.637681 | 958328814 |
982a75a9741b990d28e90c87657a0f1083614c4c | 18,269 | cpp | C++ | contracts/contracts/rem.system/src/producer_pay.cpp | kushnirenko/remprotocol | ec450227a40bb18527b473266b07b982efc1d093 | [
"MIT"
] | 1 | 2020-07-13T04:53:53.000Z | 2020-07-13T04:53:53.000Z | contracts/contracts/rem.system/src/producer_pay.cpp | kushnirenko/remprotocol | ec450227a40bb18527b473266b07b982efc1d093 | [
"MIT"
] | 1 | 2020-05-20T20:14:13.000Z | 2020-05-20T20:14:13.000Z | contracts/contracts/rem.system/src/producer_pay.cpp | kushnirenko/remprotocol | ec450227a40bb18527b473266b07b982efc1d093 | [
"MIT"
] | 1 | 2020-05-13T14:06:06.000Z | 2020-05-13T14:06:06.000Z | #include <rem.system/rem.system.hpp>
#include <rem.token/rem.token.hpp>
#include <cmath>
#include <numeric>
namespace eosiosystem {
const static int producer_repetitions = 12;
const static int blocks_per_round = system_contract::max_block_producers * producer_repetitions;
using eosio::current_time_point;
using eosio::microseconds;
using eosio::token;
int64_t system_contract::share_pervote_reward_between_producers(int64_t amount)
{
const auto reward_period_without_producing = microseconds(_grotation.rotation_period.count() * _grotation.standby_prods_to_rotate);
const auto ct = current_time_point();
int64_t total_reward_distributed = 0;
for (const auto& p: _gstate.last_schedule) {
const auto reward = int64_t(amount * p.second);
total_reward_distributed += reward;
const auto& prod = _producers.get(p.first.value);
if (ct - prod.last_block_time <= reward_period_without_producing) {
_producers.modify(prod, eosio::same_payer, [&](auto &p) {
p.pending_pervote_reward += reward;
});
}
}
for (const auto& p: _gstate.standby) {
const auto reward = int64_t(amount * p.second);
total_reward_distributed += reward;
const auto& prod = _producers.get(p.first.value);
if (ct - prod.last_block_time <= reward_period_without_producing) {
_producers.modify(prod, eosio::same_payer, [&](auto &p) {
p.pending_pervote_reward += reward;
});
}
}
check(total_reward_distributed <= amount, "distributed reward above the given amount");
return total_reward_distributed;
}
void system_contract::update_pervote_shares()
{
auto share_accumulator = [this](double l, const std::pair<name, double>& r) -> double
{
const auto& prod = _producers.get(r.first.value);
return l + prod.total_votes;
};
double total_share = 0.0;
total_share = std::accumulate(std::begin(_gstate.last_schedule), std::end(_gstate.last_schedule),
total_share, share_accumulator);
total_share = std::accumulate(std::begin(_gstate.standby), std::end(_gstate.standby),
total_share, share_accumulator);
_gstate.total_active_producer_vote_weight = total_share;
auto update_pervote_share = [this](auto& p) {
const auto& prod_name = p.first;
const auto& prod = _producers.get(prod_name.value);
const double share = prod.total_votes / _gstate.total_active_producer_vote_weight;
// need to cut precision because sum of all shares can be greater that 1 due to floating point arithmetics
p.second = std::floor(share * 100000.0) / 100000.0;
};
std::for_each(std::begin(_gstate.last_schedule), std::end(_gstate.last_schedule), update_pervote_share);
std::for_each(std::begin(_gstate.standby), std::end(_gstate.standby), update_pervote_share);
}
void system_contract::update_standby()
{
std::vector<std::pair<name, double>> rotation;
std::transform(std::begin(_grotation.standby_rotation),
std::end(_grotation.standby_rotation),
std::back_inserter(rotation),
[](const auto& auth) { return std::make_pair(auth.producer_name, 0.0); });
_gstate.standby.clear();
_gstate.standby.reserve(rotation.size());
auto name_double_comparator = [](const std::pair<name, double>& l, const std::pair<name, double>& r) { return l.first < r.first; };
std::sort(std::begin(rotation), std::end(rotation), name_double_comparator);
std::set_difference(std::begin(rotation), std::end(rotation),
std::begin(_gstate.last_schedule), std::end(_gstate.last_schedule),
std::back_inserter(_gstate.standby),
name_double_comparator);
}
int64_t system_contract::share_perstake_reward_between_guardians(int64_t amount)
{
using namespace eosio;
int64_t total_reward_distributed = 0;
const auto sorted_voters = _voters.get_index<"bystake"_n>();
_gstate.total_guardians_stake = 0;
for (auto it = sorted_voters.rbegin(); it != sorted_voters.rend() && it->staked >= _gremstate.guardian_stake_threshold; it++) {
if ( vote_is_reasserted( it->last_reassertion_time ) ) {
_gstate.total_guardians_stake += it->staked;
}
}
for (auto it = sorted_voters.rbegin(); it != sorted_voters.rend() && it->staked >= _gremstate.guardian_stake_threshold; it++) {
if ( vote_is_reasserted( it->last_reassertion_time ) ) {
const int64_t pending_perstake_reward = amount * ( double(it->staked) / double(_gstate.total_guardians_stake) );
_voters.modify( *it, same_payer, [&](auto &v) {
v.pending_perstake_reward += pending_perstake_reward;
});
total_reward_distributed += pending_perstake_reward;
}
}
check(total_reward_distributed <= amount, "distributed reward above the given amount");
return total_reward_distributed;
}
void system_contract::onblock( ignore<block_header> ) {
using namespace eosio;
require_auth(get_self());
block_timestamp timestamp;
name producer;
uint16_t confirmed;
checksum256 previous;
checksum256 transaction_mroot;
checksum256 action_mroot;
uint32_t schedule_version = 0;
_ds >> timestamp >> producer >> confirmed >> previous >> transaction_mroot >> action_mroot >> schedule_version;
// _gstate2.last_block_num is not used anywhere in the system contract code anymore.
// Although this field is deprecated, we will continue updating it for now until the last_block_num field
// is eventually completely removed, at which point this line can be removed.
_gstate2.last_block_num = timestamp;
/** until activated stake crosses this threshold no new rewards are paid */
if( _gstate.total_activated_stake < min_activated_stake )
return;
//end of round: count all unpaid blocks produced within this round
if (timestamp.slot >= _gstate.current_round_start_time.slot + blocks_per_round) {
const auto rounds_passed = (timestamp.slot - _gstate.current_round_start_time.slot) / blocks_per_round;
_gstate.current_round_start_time = block_timestamp(_gstate.current_round_start_time.slot + (rounds_passed * blocks_per_round));
for (const auto p: _gstate.last_schedule) {
const auto& prod = _producers.get(p.first.value);
_producers.modify(prod, same_payer, [&](auto& p) {
p.unpaid_blocks += p.current_round_unpaid_blocks;
p.current_round_unpaid_blocks = 0;
});
}
}
if (schedule_version > _gstate.last_schedule_version) {
std::vector<name> active_producers = eosio::get_active_producers();
for (size_t producer_index = 0; producer_index < _gstate.last_schedule.size(); producer_index++) {
const auto producer_name = _gstate.last_schedule[producer_index].first;
const auto& prod = _producers.get(producer_name.value);
if( std::find(active_producers.begin(), active_producers.end(), producer_name) == active_producers.end() ) {
_producers.modify(prod, same_payer, [&](auto& p) {
p.top21_chosen_time = time_point(eosio::seconds(0));
});
}
//blocks from full rounds
const auto full_rounds_passed = (timestamp.slot - prod.last_expected_produced_blocks_update.slot) / blocks_per_round;
uint32_t expected_produced_blocks = full_rounds_passed * producer_repetitions;
if ((timestamp.slot - prod.last_expected_produced_blocks_update.slot) % blocks_per_round != 0) {
//if last round is incomplete, calculate number of blocks produced in this round by prod
const auto current_round_start_position = _gstate.current_round_start_time.slot % blocks_per_round;
const auto producer_first_block_position = producer_repetitions * producer_index;
const uint32_t current_round_blocks_before_producer_start_producing = current_round_start_position <= producer_first_block_position ?
producer_first_block_position - current_round_start_position :
blocks_per_round - (current_round_start_position - producer_first_block_position);
const auto total_current_round_blocks = timestamp.slot - _gstate.current_round_start_time.slot;
if (current_round_blocks_before_producer_start_producing < total_current_round_blocks) {
expected_produced_blocks += std::min(total_current_round_blocks - current_round_blocks_before_producer_start_producing, uint32_t(producer_repetitions));
} else if (blocks_per_round - current_round_blocks_before_producer_start_producing < producer_repetitions) {
expected_produced_blocks += std::min(producer_repetitions - (blocks_per_round - current_round_blocks_before_producer_start_producing), total_current_round_blocks);
}
}
_producers.modify(prod, same_payer, [&](auto& p) {
p.expected_produced_blocks += expected_produced_blocks;
p.last_expected_produced_blocks_update = timestamp;
p.unpaid_blocks += p.current_round_unpaid_blocks;
p.current_round_unpaid_blocks = 0;
});
}
_gstate.current_round_start_time = timestamp;
_gstate.last_schedule_version = schedule_version;
for (size_t i = 0; i < active_producers.size(); i++) {
const auto& prod_name = active_producers[i];
const auto& prod = _producers.get(prod_name.value);
auto res = std::find_if(_gstate.last_schedule.begin(),
_gstate.last_schedule.end(),
[&prod_name](const std::pair<eosio::name, double>& element){ return element.first == prod_name;});
if( res == _gstate.last_schedule.end() ) {
_producers.modify(prod, same_payer, [&](auto& p) {
p.top21_chosen_time = current_time_point();
});
}
}
if (active_producers.size() != _gstate.last_schedule.size()) {
_gstate.last_schedule.resize(active_producers.size());
}
for (size_t i = 0; i < active_producers.size(); i++) {
const auto& prod_name = active_producers[i];
const auto& prod = _producers.get(prod_name.value);
_gstate.last_schedule[i] = std::make_pair(prod_name, 0.0);
_producers.modify(prod, same_payer, [&](auto& p) {
p.last_expected_produced_blocks_update = timestamp;
});
}
get_rotated_schedule();
update_standby();
update_pervote_shares();
}
if( _gstate.last_pervote_bucket_fill == time_point() ) /// start the presses
_gstate.last_pervote_bucket_fill = current_time_point();
/**
* At startup the initial producer may not be one that is registered / elected
* and therefore there may be no producer object for them.
*/
auto prod = _producers.find( producer.value );
if ( prod != _producers.end() ) {
_gstate.total_unpaid_blocks++;
_producers.modify( prod, same_payer, [&](auto& p ) {
p.current_round_unpaid_blocks++;
p.last_block_time = timestamp;
});
}
/// only update block producers once every minute, block_timestamp is in half seconds
if( timestamp.slot - _gstate.last_producer_schedule_update.slot > 120 ) {
update_elected_producers( timestamp );
if( (timestamp.slot - _gstate.last_name_close.slot) > blocks_per_day ) {
name_bid_table bids(get_self(), get_self().value);
auto idx = bids.get_index<"highbid"_n>();
auto highest = idx.lower_bound( std::numeric_limits<uint64_t>::max()/2 );
if( highest != idx.end() &&
highest->high_bid > 0 &&
(current_time_point() - highest->last_bid_time) > microseconds(useconds_per_day) &&
_gstate.thresh_activated_stake_time > time_point() &&
(current_time_point() - _gstate.thresh_activated_stake_time) > microseconds(14 * useconds_per_day)
) {
_gstate.last_name_close = timestamp;
channel_namebid_to_rex( highest->high_bid );
idx.modify( highest, same_payer, [&]( auto& b ){
b.high_bid = -b.high_bid;
});
}
}
}
}
using namespace eosio;
void system_contract::claim_perstake( const name& guardian )
{
const auto& voter = _voters.get( guardian.value );
const auto ct = current_time_point();
check( ct - voter.last_claim_time > microseconds(useconds_per_day), "already claimed rewards within past day" );
_gstate.perstake_bucket -= voter.pending_perstake_reward;
if ( voter.pending_perstake_reward > 0 ) {
token::transfer_action transfer_act{ token_account, { {spay_account, active_permission}, {guardian, active_permission} } };
transfer_act.send( spay_account, guardian, asset(voter.pending_perstake_reward, core_symbol()), "guardian stake pay" );
}
_voters.modify( voter, same_payer, [&](auto& v) {
v.last_claim_time = ct;
v.pending_perstake_reward = 0;
});
}
void system_contract::claim_pervote( const name& producer )
{
const auto& prod = _producers.get( producer.value );
const auto ct = current_time_point();
check( ct - prod.last_claim_time > microseconds(useconds_per_day), "already claimed rewards within past day" );
int64_t producer_per_vote_pay = prod.pending_pervote_reward;
auto expected_produced_blocks = prod.expected_produced_blocks;
if (std::find_if(std::begin(_gstate.last_schedule), std::end(_gstate.last_schedule),
[&producer](const auto& prod){ return prod.first.value == producer.value; }) != std::end(_gstate.last_schedule)) {
const auto full_rounds_passed = (_gstate.current_round_start_time.slot - prod.last_expected_produced_blocks_update.slot) / blocks_per_round;
expected_produced_blocks += full_rounds_passed * producer_repetitions;
}
if (prod.unpaid_blocks != expected_produced_blocks && expected_produced_blocks > 0) {
producer_per_vote_pay = (prod.pending_pervote_reward * prod.unpaid_blocks) / expected_produced_blocks;
}
const auto punishment = prod.pending_pervote_reward - producer_per_vote_pay;
if ( producer_per_vote_pay > 0 ) {
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission}, {producer, active_permission} } };
transfer_act.send( vpay_account, producer, asset(producer_per_vote_pay, core_symbol()), "producer vote pay" );
}
if ( punishment > 0 ) {
string punishment_memo = "punishment transfer: missed " + std::to_string(expected_produced_blocks - prod.unpaid_blocks) + " blocks out of " + std::to_string(expected_produced_blocks);
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission} } };
transfer_act.send( vpay_account, saving_account, asset(punishment, core_symbol()), punishment_memo );
}
_gstate.pervote_bucket -= producer_per_vote_pay;
_gstate.total_unpaid_blocks -= prod.unpaid_blocks;
_producers.modify( prod, same_payer, [&](auto& p) {
p.last_claim_time = ct;
p.last_expected_produced_blocks_update = _gstate.current_round_start_time;
p.unpaid_blocks = 0;
p.expected_produced_blocks = 0;
p.pending_pervote_reward = 0;
});
}
void system_contract::claimrewards( const name& owner ) {
require_auth( owner );
check( _gstate.total_activated_stake >= min_activated_stake, "cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)" );
auto voter = _voters.find( owner.value );
if( voter != _voters.end() ) {
claim_perstake( owner );
}
auto prod = _producers.find( owner.value );
if( prod != _producers.end() ) {
claim_pervote( owner );
}
}
void system_contract::torewards( const name& payer, const asset& amount ) {
require_auth( payer );
check( amount.is_valid(), "invalid amount" );
check( amount.symbol == core_symbol(), "invalid symbol" );
check( amount.amount > 0, "amount must be positive" );
const auto to_per_stake_pay = share_perstake_reward_between_guardians( amount.amount * _gremstate.per_stake_share );
const auto to_per_vote_pay = share_pervote_reward_between_producers( amount.amount * _gremstate.per_vote_share );
const auto to_rem = amount.amount - (to_per_stake_pay + to_per_vote_pay);
if( amount.amount > 0 ) {
token::transfer_action transfer_act{ token_account, { {payer, active_permission} } };
if( to_rem > 0 ) {
transfer_act.send( payer, saving_account, asset(to_rem, amount.symbol), "Remme Savings" );
}
if( to_per_stake_pay > 0 ) {
transfer_act.send( payer, spay_account, asset(to_per_stake_pay, amount.symbol), "fund per-stake bucket" );
}
if( to_per_vote_pay > 0 ) {
transfer_act.send( payer, vpay_account, asset(to_per_vote_pay, amount.symbol), "fund per-vote bucket" );
}
}
_gstate.pervote_bucket += to_per_vote_pay;
_gstate.perstake_bucket += to_per_stake_pay;
}
} //namespace eosiosystem
| 49.375676 | 192 | 0.647873 | kushnirenko |
982af8ecf9502e6c01bf5fb2971827969a5708f1 | 1,045 | hpp | C++ | binspector/fuzzer.hpp | sur5r/binspector | 9eeb9af463254edf1056d59944c49d00770e36f0 | [
"BSL-1.0"
] | 119 | 2015-01-14T18:03:20.000Z | 2022-03-18T14:02:46.000Z | binspector/fuzzer.hpp | sur5r/binspector | 9eeb9af463254edf1056d59944c49d00770e36f0 | [
"BSL-1.0"
] | 8 | 2015-03-06T01:18:39.000Z | 2021-05-04T21:55:34.000Z | binspector/fuzzer.hpp | sur5r/binspector | 9eeb9af463254edf1056d59944c49d00770e36f0 | [
"BSL-1.0"
] | 22 | 2015-01-09T16:18:38.000Z | 2022-03-13T13:41:04.000Z | /*
Copyright 2014 Adobe
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
/****************************************************************************************************/
#ifndef BINSPECTOR_FUZZER_HPP
#define BINSPECTOR_FUZZER_HPP
// boost
#include <boost/filesystem.hpp>
// application
#include <binspector/forest.hpp>
/****************************************************************************************************/
void fuzz(const inspection_forest_t& forest,
const boost::filesystem::path& input_path,
const boost::filesystem::path& output_root,
bool path_hash,
bool recurse);
/****************************************************************************************************/
// BINSPECTOR_FUZZER_HPP
#endif
/****************************************************************************************************/
| 34.833333 | 102 | 0.396172 | sur5r |
982ff1eb1b47c7de70e0623986d562615065e2ac | 8,073 | cpp | C++ | PEOperator/ThreadAnalysisFile.cpp | JokerRound/PEOperator | 19dcbaa42ea2888369e380d01652ea815eadfdd4 | [
"MIT"
] | null | null | null | PEOperator/ThreadAnalysisFile.cpp | JokerRound/PEOperator | 19dcbaa42ea2888369e380d01652ea815eadfdd4 | [
"MIT"
] | null | null | null | PEOperator/ThreadAnalysisFile.cpp | JokerRound/PEOperator | 19dcbaa42ea2888369e380d01652ea815eadfdd4 | [
"MIT"
] | 1 | 2022-02-08T09:07:50.000Z | 2022-02-08T09:07:50.000Z | #include "stdafx.h"
#include "ThreadAnalysisFile.h"
#include "PEOperatorDlg.h"
CThreadAnalysisFile::CThreadAnalysisFile()
{
}
CThreadAnalysisFile::~CThreadAnalysisFile()
{
}
bool CThreadAnalysisFile::OnThreadEventRun(LPVOID lpParam)
{
#ifdef DEBUG
DWORD dwError = -1;
CString csErrorMessage;
#endif // DEBUG
// Analysis parament.
CPEOperatorDlg *pPEOperatorDlg = (CPEOperatorDlg *)lpParam;
BOOL bRet = FALSE;
// Main work loop
while (TRUE)
{
// Wait for the event.
bRet = pPEOperatorDlg->CheckAnalysisFileEvent();
if (!bRet)
{
break;
}
// Check quit info is true or not.
bRet = pPEOperatorDlg->GetProcessQuitInfo();
if (bRet)
{
break;
}
// Get file's handle.
HANDLE hTargetFile = CreateFile(pPEOperatorDlg->GetTargetFileName(),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (INVALID_HANDLE_VALUE == hTargetFile)
{
#ifdef DEBUG
dwError = GetLastError();
GetErrorMessage(dwError, csErrorMessage);
OutputDebugStringWithInfo(csErrorMessage, __FILET__, __LINE__);
#endif // DEBUG
CString csOperationNotify = _T("Please choice a file.");
pPEOperatorDlg->SendMessage(WM_UPDATEUI,
(WPARAM)_T("Open file failed."
"Please check it."));
continue;
}
CFile fTargetFile(hTargetFile);
// Get file info.
//******************************************************
//* Alarm * This memory will free when main dialog close.
//******************************************************
PTARGETFILEINFO pstTargetFileInfo = new TARGETFILEINFO;
CFileStatus TargetFileStatus;
fTargetFile.GetStatus(TargetFileStatus);
CPath pathFilePath = pPEOperatorDlg->GetTargetFileName();
CPath pathFileName = pPEOperatorDlg->GetTargetFileName();
pathFileName.StripPath();
pathFilePath.RemoveFileSpec();
// File path and name.
pstTargetFileInfo->csFileName_ = pathFileName.m_strPath;
pstTargetFileInfo->csFilePath_ = pathFilePath.m_strPath;
// Carete time.
pstTargetFileInfo->csCreatTime_.Format(
_T("%d:%d:%d, %d.%d.%d"),
TargetFileStatus.m_ctime.GetHour(),
TargetFileStatus.m_ctime.GetMinute(),
TargetFileStatus.m_ctime.GetSecond(),
TargetFileStatus.m_ctime.GetDay(),
TargetFileStatus.m_ctime.GetMonth(),
TargetFileStatus.m_ctime.GetYear());
pstTargetFileInfo->csLastAccessedTime_.Format(
_T("%d:%d:%d, %d.%d.%d"),
TargetFileStatus.m_atime.GetHour(),
TargetFileStatus.m_atime.GetMinute(),
TargetFileStatus.m_atime.GetSecond(),
TargetFileStatus.m_atime.GetDay(),
TargetFileStatus.m_atime.GetMonth(),
TargetFileStatus.m_atime.GetYear());
pstTargetFileInfo->csLastModifyTime_.Format(_T("%d:%d:%d, %d.%d.%d"),
TargetFileStatus.m_mtime.GetHour(),
TargetFileStatus.m_mtime.GetMinute(),
TargetFileStatus.m_mtime.GetSecond(),
TargetFileStatus.m_mtime.GetDay(),
TargetFileStatus.m_mtime.GetMonth(),
TargetFileStatus.m_mtime.GetYear());
pstTargetFileInfo->csSize_.Format(_T("%I64u"), TargetFileStatus.m_size);
// Begin to analysis.
BOOL bHasError = FALSE;
do
{
// Read dos header.
IMAGE_DOS_HEADER stDosHeader = { 0 };
fTargetFile.Read(&stDosHeader, sizeof(stDosHeader));
// Check the magic member.
if (0x5a4d != stDosHeader.e_magic)
{
bHasError = TRUE;
break;
}
// Move the pointer of file to NT header.
fTargetFile.Seek(stDosHeader.e_lfanew, CFile::begin);
// Read PE fingerprint
DWORD dwPEFingerprint;
fTargetFile.Read(&dwPEFingerprint, sizeof(dwPEFingerprint));
// Check PE fingerprint.
if (0x4550 != dwPEFingerprint)
{
bHasError = TRUE;
break;
}
// Move the pointer of file to type of optional header.
int iOptionalHeaderTyepPos =
stDosHeader.e_lfanew + sizeof(DWORD) +
sizeof(IMAGE_FILE_HEADER);
fTargetFile.Seek(iOptionalHeaderTyepPos, CFile::begin);
// Read Optional header type.
WORD wOptionalHeaderType = 0;
fTargetFile.Read(&wOptionalHeaderType, sizeof(WORD));
// Move the pointer of file to NT header.
fTargetFile.Seek(stDosHeader.e_lfanew, CFile::begin);
// Create struct of PE file 32bit.
if (0x10b == wOptionalHeaderType)
{
//**************************************************************
//* Alarm * This memory will free when main dialog close.
//**************************************************************
PPEFILESTRUCT32 pstPEFileStruct32 = new PEFILESTRUCT32;
pstPEFileStruct32->stDosHeader_ = stDosHeader;
// Read NT headers.
fTargetFile.Read(&pstPEFileStruct32->stNtHeader_,
sizeof(pstPEFileStruct32->stNtHeader_));
// Main dislog gets the PE file info.
pPEOperatorDlg->SetPEFileStruct32(pstPEFileStruct32);
// Read section info.
WORD wSectionNumber =
pstPEFileStruct32->stNtHeader_.FileHeader.NumberOfSections;
WORD cntI = 0;
while (cntI < wSectionNumber)
{
//**********************************************************
//* Alarm * This memory will free when
// CPESectionInfo destroy.
//**********************************************************
IMAGE_SECTION_HEADER stSectionInfo = { 0 };
fTargetFile.Read(&stSectionInfo,
sizeof(stSectionInfo));
pPEOperatorDlg->m_vctSectionInfo.push_back(stSectionInfo);
cntI++;
}
}
// TODO: Create struct of PE file 64bit.
else if (0x20b == wOptionalHeaderType)
{
}
// Another
else
{
bHasError = TRUE;
break;
}
} while (FALSE); // do "Begin to analysis" END
// Close file handle.
fTargetFile.Close();
// Deal with analysis failed.
if (bHasError)
{
CString csOperationNotify = _T("Target file don't belong PE.");
pPEOperatorDlg->SendMessage(
WM_UPDATEUI,
MDUI_OPERATIONNOTIFY,
(WPARAM)&csOperationNotify);
continue;
}
pstTargetFileInfo->csIsPEFile_ = _T("Yes");
// Main dialog gets file info.
pPEOperatorDlg->SetTargetFileInfo(pstTargetFileInfo);
// Notify analysis completed to main dailog.
pPEOperatorDlg->SendMessage(WM_FILEHADANALYSISED);
} //! while "Main work loop" END
return true;
} //! CThreadAnalysisFile::OnThreadEventRun END | 36.040179 | 80 | 0.503778 | JokerRound |
98301e097fdeb4530c3eab82151022723e861abf | 14,784 | cpp | C++ | src/widgets/portfiltersettingswidget.cpp | dehnhardt/mioconfig | 6d1ac1d85379eaf168d2c2fce81b09f020500605 | [
"MIT"
] | 16 | 2018-07-16T14:13:10.000Z | 2021-02-07T06:43:57.000Z | src/widgets/portfiltersettingswidget.cpp | dehnhardt/iconnconfig | 6d1ac1d85379eaf168d2c2fce81b09f020500605 | [
"MIT"
] | 16 | 2017-09-06T19:38:15.000Z | 2021-01-04T17:54:02.000Z | src/widgets/portfiltersettingswidget.cpp | dehnhardt/mioconfig | 6d1ac1d85379eaf168d2c2fce81b09f020500605 | [
"MIT"
] | 10 | 2018-03-03T14:50:03.000Z | 2020-09-30T18:08:55.000Z | #include "portfiltersettingswidget.h"
#include "controls/midicontrollercombodelegate.h"
#include "ui_portfiltersettingswidget.h"
#include <QLabel>
PortFilterSettingsWidget::PortFilterSettingsWidget(pk::PortDirection direction,
QWidget *parent)
: QWidget(parent), ui(new Ui::PortFilterSettingsWidget),
portFilterDirection(direction) {
ui->setupUi(this);
const QString style = "QTableView { \
gridline-color: #aaaaa8; \
padding: 0; \
font-size: 8pt; \
} \
QTableView::indicator{ \
width: 14; \
height: 14; \
border-radius: 7px; \
border: 0; \
} \
QTableView::indicator:enabled{ \
background-color: #c9c9c9; \
} \
QTableView::indicator:checked{ \
background-color: #a23232; \
}";
MidiControllerComboDelegate *comboDelegate =
new MidiControllerComboDelegate();
ui->m_pTblMidiControllerFilter->setItemDelegateForColumn(0, comboDelegate);
ui->m_pTblMidiControllerFilter->horizontalHeader()->setSectionResizeMode(
QHeaderView::ResizeToContents);
ui->m_pTblMidiControllerFilter->verticalHeader()->setSectionResizeMode(
QHeaderView::ResizeToContents);
ui->m_pTblMidiControllerFilter->setStyleSheet(style);
ui->m_pTblMidiControllerFilter->setFocusPolicy(Qt::NoFocus);
ui->m_pTblMidiChannelMessageFilter->horizontalHeader()
->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->m_pTblMidiChannelMessageFilter->verticalHeader()->setSectionResizeMode(
QHeaderView::ResizeToContents);
ui->m_pTblMidiChannelMessageFilter->setStyleSheet(style);
ui->m_pTblMidiChannelMessageFilter->setFocusPolicy(Qt::NoFocus);
createConnections();
}
PortFilterSettingsWidget::~PortFilterSettingsWidget() {
ui->m_pTblMidiChannelMessageFilter->model()->deleteLater();
delete ui;
}
void PortFilterSettingsWidget::setMIDISystemMessagesFilter(
MIDISystemMessagesFilter *midiSystemMessagesFilter) {
this->m_pMidiSystemMessagesFilter = midiSystemMessagesFilter;
ui->m_pCbFilterMidiActiveSensingEvents->setChecked(
midiSystemMessagesFilter->filterMidiActiveSensingEvents);
ui->m_pCbFilterMidiRealtimeEvents->setChecked(
midiSystemMessagesFilter->filterMidiRealtimeEvents);
ui->m_pCbFilterMidiResetEvents->setChecked(
midiSystemMessagesFilter->filterMidiResetEvents);
ui->m_pCbFilterMidiSongPositionPointer->setChecked(
midiSystemMessagesFilter->filterMidiSongPositionPointerEvents);
ui->m_pCbFilterMidiSongSelectEvents->setChecked(
midiSystemMessagesFilter->filterMidiSongSelectEvents);
ui->m_pCbFilterMidiSysexEvents->setChecked(
midiSystemMessagesFilter->filterMidiSysExEvents);
ui->m_pCbFilterMidiTimeCodeEvents->setChecked(
midiSystemMessagesFilter->filterMidiTimeCodeEvents);
ui->m_pCbFilterMidiTuneRequestEvents->setChecked(
midiSystemMessagesFilter->filterMidiTuneRequestEvents);
}
void PortFilterSettingsWidget::setMidiControllerFilter(
MIDIControllerFilter **midiControllerFilter) {
MidiControllerFilterTM *midiControllerFilterTM =
new MidiControllerFilterTM(midiControllerFilter);
ui->m_pTblMidiControllerFilter->setModel(midiControllerFilterTM);
int numberOfMidiContollers =
static_cast<int>(sizeof(*midiControllerFilter));
for (int i = 0; i < numberOfMidiContollers; i++) {
QModelIndex modelIndex =
ui->m_pTblMidiControllerFilter->model()->index(i, 0, QModelIndex());
ui->m_pTblMidiControllerFilter->openPersistentEditor(modelIndex);
}
connect(midiControllerFilterTM, &MidiControllerFilterTM::modelDataChanged,
this, [=]() { emit filterDataChanged(portFilterDirection); });
}
void PortFilterSettingsWidget::setMidiChannelMessagesFilter(
MIDIChannelMessagesFilter **midiChannelMessagesFilter) {
MidiChannelMessagesFilterTM *midiChannelMessagesFilterTM =
new MidiChannelMessagesFilterTM(midiChannelMessagesFilter);
ui->m_pTblMidiChannelMessageFilter->setModel(midiChannelMessagesFilterTM);
connect(midiChannelMessagesFilterTM,
&MidiChannelMessagesFilterTM::modelDataChanged, this,
[=]() { emit filterDataChanged(portFilterDirection); });
}
MIDISystemMessagesFilter *
PortFilterSettingsWidget::getMIDISystemMessagesFilter() {
MIDISystemMessagesFilter *midiSystemMessagesFilter =
new MIDISystemMessagesFilter();
midiSystemMessagesFilter->filterMidiActiveSensingEvents =
ui->m_pCbFilterMidiActiveSensingEvents->isChecked();
midiSystemMessagesFilter->filterMidiRealtimeEvents =
ui->m_pCbFilterMidiRealtimeEvents->isChecked();
midiSystemMessagesFilter->filterMidiResetEvents =
ui->m_pCbFilterMidiResetEvents->isChecked();
midiSystemMessagesFilter->filterMidiSongPositionPointerEvents =
ui->m_pCbFilterMidiSongPositionPointer->isChecked();
midiSystemMessagesFilter->filterMidiSongSelectEvents =
ui->m_pCbFilterMidiSongSelectEvents->isChecked();
midiSystemMessagesFilter->filterMidiSysExEvents =
ui->m_pCbFilterMidiSysexEvents->isChecked();
midiSystemMessagesFilter->filterMidiTimeCodeEvents =
ui->m_pCbFilterMidiTimeCodeEvents->isChecked();
midiSystemMessagesFilter->filterMidiTuneRequestEvents =
ui->m_pCbFilterMidiTuneRequestEvents->isChecked();
return midiSystemMessagesFilter;
}
MIDIPortFilter *PortFilterSettingsWidget::getMidiPortFilter() {
MIDIPortFilter *filter = new MIDIPortFilter();
return filter;
}
QTableWidgetItem *PortFilterSettingsWidget::getCheckStateItem(bool checked) {
QTableWidgetItem *item = new QTableWidgetItem();
item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
return item;
}
void PortFilterSettingsWidget::createConnections() {
connect(ui->m_pCbFilterMidiResetEvents, &QCheckBox::stateChanged, this,
[=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiResetEvents);
});
connect(ui->m_pCbFilterMidiActiveSensingEvents, &QCheckBox::stateChanged,
this, [=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiActiveSensingEvents);
});
connect(ui->m_pCbFilterMidiRealtimeEvents, &QCheckBox::stateChanged, this,
[=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiRealtimeEvents);
});
connect(ui->m_pCbFilterMidiTuneRequestEvents, &QCheckBox::stateChanged,
this, [=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiTuneRequestEvents);
});
connect(ui->m_pCbFilterMidiSongSelectEvents, &QCheckBox::stateChanged, this,
[=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiSongSelectEvents);
});
connect(ui->m_pCbFilterMidiSongPositionPointer, &QCheckBox::stateChanged,
this, [=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiSongPositionPointer);
});
connect(ui->m_pCbFilterMidiTimeCodeEvents, &QCheckBox::stateChanged, this,
[=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiTimeCodeEvents);
});
connect(ui->m_pCbFilterMidiSysexEvents, &QCheckBox::stateChanged, this,
[=](int state) {
checkboxUpdated(state, ui->m_pCbFilterMidiSysexEvents);
});
}
void PortFilterSettingsWidget::checkboxUpdated(int state, QCheckBox *checkBox) {
if (checkBox->objectName() == "m_pCbFilterMidiResetEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiResetEvents = state;
}
if (checkBox->objectName() == "m_pCbFilterMidiActiveSensingEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiActiveSensingEvents =
state;
}
if (checkBox->objectName() == "m_pCbFilterMidiRealtimeEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiRealtimeEvents = state;
}
if (checkBox->objectName() == "m_pCbFilterMidiTuneRequestEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiTuneRequestEvents = state;
}
if (checkBox->objectName() == "m_pCbFilterMidiSongSelectEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiSongSelectEvents = state;
}
if (checkBox->objectName() == "m_pCbFilterMidiSongPositionPointer") {
this->m_pMidiSystemMessagesFilter->filterMidiSongPositionPointerEvents =
state;
}
if (checkBox->objectName() == "m_pCbFilterMidiTimeCodeEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiTimeCodeEvents = state;
}
if (checkBox->objectName() == "m_pCbFilterMidiSysexEvents") {
this->m_pMidiSystemMessagesFilter->filterMidiSysExEvents = state;
}
emit filterDataChanged(this->portFilterDirection);
}
/* ************************
* MidiControllerFilterTM *
**************************/
MidiControllerFilterTM::MidiControllerFilterTM(
MIDIControllerFilter **midiControllerFilter) {
this->m_ppMidiControllerFilter = midiControllerFilter;
}
MidiControllerFilterTM::~MidiControllerFilterTM() {
delete[] m_ppMidiControllerFilter;
}
int MidiControllerFilterTM::rowCount(const QModelIndex &parent
__attribute__((unused))) const {
return sizeof(m_ppMidiControllerFilter);
}
int MidiControllerFilterTM::columnCount(const QModelIndex &) const {
return MIDI_CHANNELS + 2;
}
QVariant MidiControllerFilterTM::data(const QModelIndex &index,
int role) const {
int row = index.row();
MIDIControllerFilter *midiControllerFilter = m_ppMidiControllerFilter[row];
switch (role) {
case Qt::DisplayRole:
if (index.column() == 0) {
std::cout << "Model - controller number: "
<< midiControllerFilter->midiContollerNumber << std::endl;
return midiControllerFilter->midiContollerNumber;
}
break;
case Qt::CheckStateRole:
if (index.column() == 1) {
for (int channel = 0; channel < MIDI_CHANNELS; channel++) {
if (!midiControllerFilter->channel[channel])
return Qt::Unchecked;
}
return Qt::Checked;
}
if (index.column() > 1)
return midiControllerFilter->channel[index.column() - 2]
? Qt::Checked
: Qt::Unchecked;
break;
case Qt::BackgroundRole:
return QColor(220, 220, 220);
}
return QVariant();
}
QVariant MidiControllerFilterTM::headerData(int section,
Qt::Orientation orientation,
int role) const {
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
switch (section) {
case 0:
return QString(tr("MIDI-Controller"));
case 1:
return QString(tr("all"));
default:
return QString::number(section - 1);
}
}
if (role == Qt::DisplayRole && orientation == Qt::Vertical) {
return QString::number(section + 1);
}
return QVariant();
}
bool MidiControllerFilterTM::setData(const QModelIndex &index,
const QVariant &value, int role) {
MIDIControllerFilter *midiControllerFilter =
m_ppMidiControllerFilter[index.row()];
if (role == Qt::EditRole) {
if (!hasIndex(index.row(), index.column()))
return false;
if (index.column() == 0) {
midiControllerFilter->midiContollerNumber = value.toUInt();
emit modelDataChanged();
return true;
}
}
if (role == Qt::CheckStateRole) {
if (index.column() == 1) {
for (int column = 0; column < MIDI_CHANNELS; column++) {
midiControllerFilter->channel[column] = value.toBool();
}
emit dataChanged(createIndex(index.row(), 2),
createIndex(index.row(), MIDI_CHANNELS + 1));
emit modelDataChanged();
} else if (index.column() > 1) {
midiControllerFilter->channel[index.column() - 2] = value.toBool();
emit dataChanged(createIndex(index.row(), 1),
createIndex(index.row(), 1));
emit modelDataChanged();
}
return true;
}
return false;
}
Qt::ItemFlags MidiControllerFilterTM::flags(const QModelIndex &index) const {
if (index.column() > 0)
return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
}
/* *****************************
* MidiChannelMessagesFilterTM *
*******************************/
MidiChannelMessagesFilterTM::MidiChannelMessagesFilterTM(
MIDIChannelMessagesFilter **midiChannelMessagesFilter) {
this->m_ppMidiChannelMessagesFilter = midiChannelMessagesFilter;
}
MidiChannelMessagesFilterTM::~MidiChannelMessagesFilterTM() { deleteLater(); }
int MidiChannelMessagesFilterTM::rowCount(const QModelIndex &) const {
return 6;
}
int MidiChannelMessagesFilterTM::columnCount(const QModelIndex &) const {
return MIDI_CHANNELS;
}
QVariant MidiChannelMessagesFilterTM::data(const QModelIndex &index,
int role) const {
MIDIChannelMessagesFilter *midiChannelMessagesFilter =
this->m_ppMidiChannelMessagesFilter[index.column()];
switch (role) {
case Qt::CheckStateRole:
switch (index.row()) {
case 0:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiPitchBendEvents);
case 1:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiChannelPressureEvents);
case 2:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiProgrammChangeEvents);
case 3:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiControlChangeEvents);
case 4:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiPolyKeyPressureEvents);
case 5:
return boolToCheckState(
midiChannelMessagesFilter->filterMidiNoteOnOffEvents);
}
case Qt::BackgroundRole:
return QColor(220, 220, 220);
}
return QVariant();
}
QVariant MidiChannelMessagesFilterTM::headerData(int section,
Qt::Orientation orientation,
int role) const {
if (role == Qt::DisplayRole && orientation == Qt::Vertical) {
switch (section) {
case 0:
return QString(tr("Pitch Bend"));
case 1:
return QString(tr("Mono Key Pressure"));
case 2:
return QString(tr("Program Change"));
case 3:
return QString(tr("Control Change"));
case 4:
return QString(tr("Poly Key Pressure"));
case 5:
return QString(tr("Note On / Note Off"));
default:
return QVariant();
}
}
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
return QString::number(section + 1);
}
return QVariant();
}
bool MidiChannelMessagesFilterTM::setData(const QModelIndex &index,
const QVariant &value, int role) {
MIDIChannelMessagesFilter *midiChannelMessagesFilter =
this->m_ppMidiChannelMessagesFilter[index.column()];
if (role == Qt::CheckStateRole) {
switch (index.row()) {
case 0:
midiChannelMessagesFilter->filterMidiPitchBendEvents =
value.toBool();
break;
case 1:
midiChannelMessagesFilter->filterMidiChannelPressureEvents =
value.toBool();
break;
case 2:
midiChannelMessagesFilter->filterMidiProgrammChangeEvents =
value.toBool();
break;
case 3:
midiChannelMessagesFilter->filterMidiControlChangeEvents =
value.toBool();
break;
case 4:
midiChannelMessagesFilter->filterMidiPolyKeyPressureEvents =
value.toBool();
break;
case 5:
midiChannelMessagesFilter->filterMidiNoteOnOffEvents =
value.toBool();
break;
}
emit modelDataChanged();
return true;
}
return false;
}
Qt::ItemFlags MidiChannelMessagesFilterTM::flags(const QModelIndex
__attribute__((unused)) &
index) const {
return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
}
Qt::CheckState MidiChannelMessagesFilterTM::boolToCheckState(bool value) const {
if (value)
return Qt::Checked;
else
return Qt::Unchecked;
}
| 33.753425 | 80 | 0.753314 | dehnhardt |
98330e664b439905402cc0bc827383cf5479bfad | 186 | cpp | C++ | examples/infinite_loop.cpp | stateos/IntrOS | 76ee5025442cefe37bc1434cdb95ea1b335ca667 | [
"MIT"
] | 36 | 2016-11-08T16:01:58.000Z | 2022-02-24T05:26:32.000Z | examples/infinite_loop.cpp | stateos/IntrOS | 76ee5025442cefe37bc1434cdb95ea1b335ca667 | [
"MIT"
] | null | null | null | examples/infinite_loop.cpp | stateos/IntrOS | 76ee5025442cefe37bc1434cdb95ea1b335ca667 | [
"MIT"
] | 9 | 2018-05-22T16:02:01.000Z | 2022-02-24T05:26:37.000Z | #include <stm32f4_discovery.h>
#include <os.h>
using namespace device;
using namespace intros;
int main()
{
auto led = Led();
for (;;)
{
thisTask::delay(SEC);
led.tick();
}
}
| 10.941176 | 30 | 0.634409 | stateos |
98342bc3b11cdbf40f251abab736b2083858853c | 2,723 | cpp | C++ | Chapter-4-Making-Decisions/Review Questions and Exercises/Programming Challenges/10.cpp | jesushilarioh/DelMarCSi.cpp | 6dd7905daea510452691fd25b0e3b0d2da0b06aa | [
"MIT"
] | 3 | 2019-02-02T16:59:48.000Z | 2019-02-28T14:50:08.000Z | Chapter-4-Making-Decisions/Review Questions and Exercises/Programming Challenges/10.cpp | jesushilariohernandez/DelMarCSi.cpp | 6dd7905daea510452691fd25b0e3b0d2da0b06aa | [
"MIT"
] | null | null | null | Chapter-4-Making-Decisions/Review Questions and Exercises/Programming Challenges/10.cpp | jesushilariohernandez/DelMarCSi.cpp | 6dd7905daea510452691fd25b0e3b0d2da0b06aa | [
"MIT"
] | 1 | 2021-07-25T09:50:07.000Z | 2021-07-25T09:50:07.000Z | /********************************************************************
*
* 10. Days in a Month
*
* Write a program that asks the user to enter the month
* (letting the user enter an integer in the range of 1
* through 12) and the year. The program should then display
* the number of days in that month. Use the following criteria to
* identify leap years:
*
* 1. Determine whether the year is divisible by 100.
* If it is, then it is a leap year if and only
* if it is divisible by 400. For example, 2000 is a
* leap year but 2100 is not.
*
* 2. If the year is not divisible by 100, then it is a
* leap year if and if only it is divisible by 4. For
* example, 2008 is a leap year but 2009 is not.
*
* Here is a sample run of the program:
* Enter a month (1-12): 2 [Enter]
* Enter a year: 2008 [Enter]
* 29 days
*
* Jesus Hilario Hernandez
* February 17, 2018
*
********************************************************************/
#include <iostream>
using namespace std;
int main()
{
// Variables
int year, month;
// Ask user to enter month
cout << endl;
cout << "Enter the month (1 - 12): ";
cin >> month;
cout << "Enter the year (up to 9000): ";
cin >> year;
cout << endl;
// Error check for valid year
if (year >= 0 && year <= 9000)
{
// Decision statement for month
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
cout << "31 days";
break;
case 4:
case 6:
case 9:
case 11:
cout << "30 days";
break;
case 2:
// Decision statement for leap year
if (year % 100 == 0)
{
if (year % 400 == 0)
cout << "29 days" << endl;
else
cout << "28 days" << endl;
}
else if (year % 100 != 0)
{
if (year % 4 == 0)
cout << "29 days" << endl;
else
cout << "28 days" << endl;
}
break;
default:
cout << "Invalid month. Rerun program. Try again." << endl;
}
}
else
cout << "Invalid year. Rerun program. Try again." << endl;
// Format line break
cout << endl;
// Terminate program
return 0;
}
| 27.23 | 75 | 0.423797 | jesushilarioh |
98345aa435f375b031b936b25836e00ec0bfbf8a | 10,792 | cpp | C++ | Source/Gui/TranslatorPanel.cpp | alvinahmadov/Dixter | 6f98f1e84192e1e43eee409bdee6b3dac75d6443 | [
"MIT"
] | 4 | 2018-12-06T01:20:50.000Z | 2019-08-04T10:19:23.000Z | Source/Gui/TranslatorPanel.cpp | alvinahmadov/Dixter | 6f98f1e84192e1e43eee409bdee6b3dac75d6443 | [
"MIT"
] | null | null | null | Source/Gui/TranslatorPanel.cpp | alvinahmadov/Dixter | 6f98f1e84192e1e43eee409bdee6b3dac75d6443 | [
"MIT"
] | null | null | null | /**
* Copyright (C) 2015-2019
* Author Alvin Ahmadov <alvin.dev.ahmadov@gmail.com>
*
* This file is part of Dixter Project
* License-Identifier: MIT License
* See README.md for more information.
*/
#include <QBoxLayout>
#include <QButtonGroup>
#include <QGroupBox>
#include "Configuration.hpp"
#include "Constants.hpp"
#include "Group.hpp"
#include "Utilities.hpp"
#include "Gui/TranslatorPanel.hpp"
#include "Gui/TextEdit.hpp"
#include "Gui/Label.hpp"
#include "Gui/Button.hpp"
#include "Gui/OptionBox.hpp"
namespace Dixter
{
namespace NAlgoUtils = Utilities::Algorithms;
namespace Gui
{
TTranslatorPanel::TTranslatorPanel(QWidget* parent, int width, int height, const QString& name)
: APanel(parent, QSize(width, height)),
m_grids(new GridGroup),
m_widgets(new WidgetGroup)
#ifdef USE_SPEECHD
,m_narrator(new VSynth::SpeechDispatcher("dix", "Dixter_conn", "Dixter_user", SPDConnectionMode::SPD_MODE_SINGLE))
#endif
{
init();
connectEvents();
name.isEmpty() ? setObjectName(g_translatorName)
: setObjectName(name);
}
TTranslatorPanel::~TTranslatorPanel()
{
#ifdef USE_SPEECHD
delete m_narrator;
#endif
delete m_grids;
delete m_widgets;
}
void TTranslatorPanel::show(bool show)
{
m_widgets->forEach(&QWidget::setVisible, show);
}
APanel::TOptionBoxPtr
TTranslatorPanel::getOptionBox(EWidgetID id)
{
return dxMAKE_SHARED(TOptionBox, m_widgets->get<TOptionBox>(g_controlGroup, id));
}
void TTranslatorPanel::setValues()
{
auto __languageNames = std::vector<TUString>();
auto __languageDisplayNames = std::vector<TUString>();
auto __languageIds = std::vector<TUString>();
auto __voiceNames = std::vector<TUString>();
try
{
TConfigurationManager::getManager(EConfiguration::XML)
->accessor()
->getValues(NodeKey::kLangNameNode, __languageNames, NodeKey::kLangRoot)
->getValues(NodeKey::kLangNameDisplayNode, __languageDisplayNames, NodeKey::kLangRoot)
->getValues(NodeKey::kLangIdNode, __languageIds, NodeKey::kLangRoot)
->getValues(NodeKey::kVoiceNameNode, __voiceNames, NodeKey::kVoiceRoot);
} catch (std::exception& e)
{ printerr(e.what()); }
NAlgoUtils::foreachCompound(__languageNames, __languageDisplayNames,
[](TUString& languageName, const TUString& languageDisplayName)
{ languageName.append(u" / ").append(languageDisplayName); });
m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::LangboxWest)->setValues(__languageNames);
m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::LangboxEast)->setValues(__languageNames);
m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::VoiceBoxT)->setValues(__voiceNames);
}
void TTranslatorPanel::init()
{
// init widgets
const QSize __buttonSize = QSize(150, 50);
auto __voiceBox = m_widgets
->add<TOptionBox>(g_widgetGroup,
new TOptionBox(nullptr, tr("Select voice...")),
EWidgetID::VoiceBoxT);
auto __texteditWest = m_widgets
->add<TTextEdit>(g_widgetGroup,
new TTextEdit(this, tr("Translation")),
EWidgetID::TranslatorAreaWest);
auto __texteditEast = m_widgets
->add<TTextEdit>(g_widgetGroup,
new TTextEdit(this, tr("Translation"), true),
EWidgetID::TranslatorAreaEast);
auto __languageBoxWest = m_widgets
->add<TOptionBox>(g_widgetGroup,
new TOptionBox(tr("Select language...")),
EWidgetID::LangboxWest);
auto __languageBoxEast = m_widgets
->add<TOptionBox>(g_widgetGroup,
new TOptionBox(tr("Select language...")),
EWidgetID::LangboxEast);
auto __widgetLayoutWest = new QVBoxLayout();
auto __widgetLayoutEast = new QVBoxLayout();
auto __widgetGroupWest = new QGroupBox();
auto __widgetGroupEast = new QGroupBox();
auto __buttonLayoutWest = new QHBoxLayout();
auto __buttonLayoutEast = new QHBoxLayout();
//Buttons
auto __speakButtonWest = m_widgets
->add<TButton>(g_controlGroup,
new TButton(QIcon(":Resources/icons/speak.png")),
EWidgetID::ButtonSpeakWest);
auto __translateButtonWest = m_widgets
->add<TButton>(g_controlGroup,
new TButton(QIcon(":Resources/icons/translate.png")),
EWidgetID::ButtonTranslateWest);
auto __speakButtonEast = m_widgets
->add<TButton>(g_controlGroup,
new TButton(QIcon(":Resources/icons/speak.png")),
EWidgetID::ButtonSpeakEast);
auto __translateButtonEast = m_widgets
->add<TButton>(g_controlGroup,
new TButton(QIcon(":Resources/icons/translate.png")),
EWidgetID::ButtonTranslateEast);
__speakButtonWest->setFixedSize(__buttonSize);
__speakButtonEast->setFixedSize(__buttonSize);
__translateButtonWest->setFixedSize(__buttonSize);
__translateButtonEast->setFixedSize(__buttonSize);
// auto btnGroup = new QButtonGroup()
__buttonLayoutWest->addWidget(__speakButtonWest);
__buttonLayoutWest->addWidget(__translateButtonWest);
__buttonLayoutEast->addWidget(__speakButtonEast);
__buttonLayoutEast->addWidget(__translateButtonEast);
// Set left box
auto __optionBoxWest = new QHBoxLayout();
__optionBoxWest->addWidget(new TLabel(tr("From"), __languageBoxWest));
__optionBoxWest->addWidget(__languageBoxWest);
__widgetLayoutWest->addLayout(__optionBoxWest);
__widgetLayoutWest->addWidget(__texteditWest);
__widgetLayoutWest->addLayout(__buttonLayoutWest);
__widgetGroupWest->setLayout(__widgetLayoutWest);
// Set central box
auto __widgetLayoutCenter = new QVBoxLayout;
auto __flipButton = m_widgets
->add<TButton>(g_controlGroup,
new TButton(QIcon(":Resources/icons/flip.png")),
EWidgetID::ButtonFlip);
__flipButton->setFixedSize(__buttonSize);
__widgetLayoutCenter->addSpacing(44);
__widgetLayoutCenter->addWidget(__voiceBox, 0, Qt::AlignmentFlag::AlignTop);
__widgetLayoutCenter->addWidget(__flipButton, 0, Qt::AlignmentFlag::AlignBottom);
__widgetLayoutCenter->addSpacing(15);
// Set right box
auto __optionBoxEast = new QHBoxLayout();
__optionBoxEast->addWidget(new TLabel(tr("To"), __languageBoxEast));
__optionBoxEast->addWidget(__languageBoxEast);
__widgetLayoutEast->addLayout(__optionBoxEast);
__widgetLayoutEast->addWidget(__texteditEast);
__widgetLayoutEast->addLayout(__buttonLayoutEast);
__widgetGroupEast->setLayout(__widgetLayoutEast);
// Main grid
auto __mainGrid = m_grids->add<QHBoxLayout>(g_layoutGroup, new QHBoxLayout(this),
EWidgetID::Grid);
__mainGrid->addWidget(__widgetGroupWest);
__mainGrid->addLayout(__widgetLayoutCenter);
__mainGrid->addWidget(__widgetGroupEast);
setValues();
setLayout(__mainGrid);
}
TStringPair
TTranslatorPanel::getCurrentLanguage()
{
TString __languageId, __languageName;
try
{
auto __languageBoxWest = m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::LangboxWest);
if (__languageBoxWest->isPlaceholderSet())
return {};
__languageName = __languageBoxWest->currentText().toStdString();
__languageId = getXmlManager({ g_langConfigPath })
->accessor()
->getValue(NodeKey::kLangNameNode, __languageName, NodeKey::kLangRoot).asUTF8();
}
catch (TException& e)
{
printerr(e.what())
}
return std::make_pair(__languageId, __languageName);
}
void TTranslatorPanel::onBufferChange()
{ }
void TTranslatorPanel::onFlip()
{
auto __texteditWest = m_widgets->get<TTextEdit>(g_widgetGroup, EWidgetID::TranslatorAreaWest);
auto __languageBoxWest = m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::LangboxWest);
auto __texteditEast = m_widgets->get<TTextEdit>(g_widgetGroup, EWidgetID::TranslatorAreaEast);
auto __languageBoxEast = m_widgets->get<TOptionBox>(g_widgetGroup, EWidgetID::LangboxEast);
__languageBoxWest->swapCurrent(__languageBoxEast);
__texteditWest->swapContent(__texteditEast);
}
void TTranslatorPanel::onSpeakWest()
{
auto __content = m_widgets->get<TTextEdit>(g_widgetGroup, EWidgetID::TranslatorAreaWest)
->getContent();
if (not __content.isEmpty())
{
#ifdef USE_SPEECHD
if (not __langId.empty())
m_narrator->setLanguage(TargetMode::DirAll, lang.first.c_str());
m_narrator->say(SPD_TEXT, __content);
#endif
}
}
void TTranslatorPanel::onTranslateWest()
{ }
void TTranslatorPanel::onSpeakEast()
{
printl_log(__FUNCTION__)
}
void TTranslatorPanel::onTranslateEast()
{
printl_log(__FUNCTION__)
}
void TTranslatorPanel::onLanguageChangeFrom()
{
#ifdef USE_SPEECHD
m_widgets->get<OptionBox>(g_widgetGroup, EWidgetID::LangboxWest)->onChanged(choiceEvent);
TUString __langId {};
auto __pLangBox = m_widgets->get<OptionBox>(g_widgetGroup, EWidgetID::LangboxWest);
auto __langName = __pLangBox->GetStringSelection();
try
{
auto confMgr = ConfigurationManager::getManager();
__langId = confMgr->xmlManager()->getValue(NodeKey::kLangRoot, NodeKey::kLangNameNode, __langName);
} catch (...) {}
m_narrator->setLanguage(TargetMode::DirAll, __langId);
#endif
}
void TTranslatorPanel::onLanguageChangeTo()
{ }
void TTranslatorPanel::onTextAreaEdit()
{ }
void TTranslatorPanel::onVoiceChange()
{
#ifdef USE_SPEECHD
QString __voiceId {};
auto __voiceName = m_widgets->get<OptionBox>(g_widgetGroup, EWidgetID::VoiceBoxT)->GetStringSelection();
try
{
auto confMgr = ConfigurationManager::getManager();
__voiceId = confMgr->xmlManager()->getValue(NodeKey::kVoiceRoot, NodeKey::kVoiceNameNode, __voiceName);
#ifdef DIXTER_DEBUG
delete confMgr;
#endif
} catch (...) {}
if (not __voiceId.empty())
m_narrator->setSynthesisVoice(TargetMode::Single, __voiceId);
printl_log(__voiceName)
#endif
}
void TTranslatorPanel::connectEvents()
{
connect(m_widgets->get<TButton>(g_controlGroup, EWidgetID::ButtonFlip),
SIGNAL(clicked()), SLOT(onFlip()));
connect(m_widgets->get<TButton>(g_controlGroup, EWidgetID::ButtonSpeakWest),
SIGNAL(clicked()), SLOT(onSpeakWest()));
connect(m_widgets->get<TButton>(g_controlGroup, EWidgetID::ButtonTranslateWest),
SIGNAL(clicked()), SLOT(onTranslateWest()));
connect(m_widgets->get<TButton>(g_controlGroup, EWidgetID::ButtonSpeakEast),
SIGNAL(clicked()), SLOT(onSpeakEast()));
connect(m_widgets->get<TButton>(g_controlGroup, EWidgetID::ButtonTranslateEast),
SIGNAL(clicked()), SLOT(onTranslateEast()));
}
QWidget* TTranslatorPanel::getWidget(EWidgetID id)
{
return m_widgets->get(id);
}
} // namespace Gui
} //namespace Dixter | 33.411765 | 119 | 0.71275 | alvinahmadov |
9838df6041c667e838fda18969face5723dd9981 | 532 | cpp | C++ | cpp source/gtavchacks/readprocess/main2.cpp | MEGAMINDMK/search-engine | 0e2748a4a3169e7290d8712f3c7bcefc8aec2bc3 | [
"Unlicense"
] | 1 | 2017-12-13T07:30:08.000Z | 2017-12-13T07:30:08.000Z | cpp source/gtavchacks/readprocess/main2.cpp | MEGAMINDMK/Softwares | 0e2748a4a3169e7290d8712f3c7bcefc8aec2bc3 | [
"Unlicense"
] | null | null | null | cpp source/gtavchacks/readprocess/main2.cpp | MEGAMINDMK/Softwares | 0e2748a4a3169e7290d8712f3c7bcefc8aec2bc3 | [
"Unlicense"
] | null | null | null | #include <iostream>
#include <windows.h>
#include <string>
using namespace std;
DWORD pid;
DWORD Health = 0x99A0508;
int MyHealth;
int main()
{
HWND hWnd = FindWindow(0, "GTA: Vice City");
GetWindowThreadProcessId(hWnd, &pid);
HANDLE pHandle = OpenProcess(PROCESS_VM_READ, FALSE, pid);
while (true)
{
ReadProcessMemory(pHandle, (LPVOID)Health, &MyHealth, sizeof(MyHealth), 0);
cout << MyHealth << endl;
Sleep(100);
system("CLS");
}
system("Pause");
}
| 21.28 | 84 | 0.612782 | MEGAMINDMK |
983b36dc11c39bd91ad89176317bdc53f1ec9377 | 780 | cpp | C++ | src/plugins/robots/attabot/real_robot/real_kheperaiv_differential_steering_device.cpp | DiegoD616/argos3-ATTABOT | e909bf1432dbd6649450dbb95e4e9f68f375eefa | [
"MIT"
] | null | null | null | src/plugins/robots/attabot/real_robot/real_kheperaiv_differential_steering_device.cpp | DiegoD616/argos3-ATTABOT | e909bf1432dbd6649450dbb95e4e9f68f375eefa | [
"MIT"
] | null | null | null | src/plugins/robots/attabot/real_robot/real_kheperaiv_differential_steering_device.cpp | DiegoD616/argos3-ATTABOT | e909bf1432dbd6649450dbb95e4e9f68f375eefa | [
"MIT"
] | null | null | null | #include "real_attabot_differential_steering_device.h"
#include <argos3/core/utility/logging/argos_log.h>
#include <memory>
/****************************************/
/****************************************/
CRealAttabotDifferentialSteeringDevice* CRealAttabotDifferentialSteeringDevice::GetInstance() {
static std::unique_ptr<CRealAttabotDifferentialSteeringDevice> pcInstance(
new CRealAttabotDifferentialSteeringDevice());
return pcInstance.get();
}
/****************************************/
/****************************************/
CRealAttabotDifferentialSteeringDevice::CRealAttabotDifferentialSteeringDevice() :
m_fVelocityLeft(0.0),
m_fVelocityRight(0.0) {}
/****************************************/
/****************************************/
| 33.913043 | 95 | 0.548718 | DiegoD616 |
983c75c43839bcd1025b9d261a0e03d29dbb6898 | 2,097 | hpp | C++ | Nacro/SDK/FN_QuestTrackerSubEntry_parameters.hpp | Milxnor/Nacro | eebabf662bbce6d5af41820ea0342d3567a0aecc | [
"BSD-2-Clause"
] | 11 | 2021-08-08T23:25:10.000Z | 2022-02-19T23:07:22.000Z | Nacro/SDK/FN_QuestTrackerSubEntry_parameters.hpp | Milxnor/Nacro | eebabf662bbce6d5af41820ea0342d3567a0aecc | [
"BSD-2-Clause"
] | 1 | 2022-01-01T22:51:59.000Z | 2022-01-08T16:14:15.000Z | Nacro/SDK/FN_QuestTrackerSubEntry_parameters.hpp | Milxnor/Nacro | eebabf662bbce6d5af41820ea0342d3567a0aecc | [
"BSD-2-Clause"
] | 8 | 2021-08-09T13:51:54.000Z | 2022-01-26T20:33:37.000Z | #pragma once
// Fortnite (1.8) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "../SDK.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.GetHeightEstimate
struct UQuestTrackerSubEntry_C_GetHeightEstimate_Params
{
float ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.HandleRemoveFinished
struct UQuestTrackerSubEntry_C_HandleRemoveFinished_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.HideIfEmpty
struct UQuestTrackerSubEntry_C_HideIfEmpty_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.UpdateObjectiveText
struct UQuestTrackerSubEntry_C_UpdateObjectiveText_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.Construct
struct UQuestTrackerSubEntry_C_Construct_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.OnQuestsUpdated
struct UQuestTrackerSubEntry_C_OnQuestsUpdated_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.OnPlayObjectiveCompletedAnimation
struct UQuestTrackerSubEntry_C_OnPlayObjectiveCompletedAnimation_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.OnCompletionFlashFInished
struct UQuestTrackerSubEntry_C_OnCompletionFlashFInished_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.PostCompletionDelay
struct UQuestTrackerSubEntry_C_PostCompletionDelay_Params
{
};
// Function QuestTrackerSubEntry.QuestTrackerSubEntry_C.ExecuteUbergraph_QuestTrackerSubEntry
struct UQuestTrackerSubEntry_C_ExecuteUbergraph_QuestTrackerSubEntry_Params
{
int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| 28.337838 | 173 | 0.722938 | Milxnor |
983cc391df12193ce4341832427ba67d479b983d | 635 | cpp | C++ | oo_design/3/Account.cpp | KevOrr/Classes | e2ebea5e09f742e9120345ba4b08528256a5cfce | [
"PostgreSQL"
] | 1 | 2017-07-10T05:09:27.000Z | 2017-07-10T05:09:27.000Z | oo_design/3/Account.cpp | KevOrr/Classes | e2ebea5e09f742e9120345ba4b08528256a5cfce | [
"PostgreSQL"
] | 3 | 2016-03-24T02:48:19.000Z | 2017-04-11T06:26:27.000Z | oo_design/3/Account.cpp | KevOrr/Classes | e2ebea5e09f742e9120345ba4b08528256a5cfce | [
"PostgreSQL"
] | null | null | null | #include <iostream>
#include "Account.hpp"
using namespace std;
Account::Account(double initial_deposit) {
if (initial_deposit < 0) {
cerr << "Account() called with a negative balance, assuming 0.00 instead" << endl;
balance = 0;
} else {
balance = initial_deposit;
}
}
void Account::credit(double ammount) {
balance += ammount;
}
bool Account::debit(double ammount) {
if (ammount > balance) {
cerr << "Debit ampunt exceeded account balance." << endl;
return false;
}
balance -= ammount;
return true;
}
double Account::getBalance() {
return balance;
}
| 19.242424 | 90 | 0.623622 | KevOrr |
983ce42da7277e132c994239f8fe6ea3e1a15e34 | 2,347 | hpp | C++ | include/socket/base/ev_timer.hpp | chensoft/libxio | 17345e500cca5085641b5392ce8ef7dc65369d69 | [
"MIT"
] | 6 | 2018-07-28T08:03:24.000Z | 2022-03-31T08:56:57.000Z | include/socket/base/ev_timer.hpp | chensoft/libxio | 17345e500cca5085641b5392ce8ef7dc65369d69 | [
"MIT"
] | null | null | null | include/socket/base/ev_timer.hpp | chensoft/libxio | 17345e500cca5085641b5392ce8ef7dc65369d69 | [
"MIT"
] | 2 | 2019-05-21T02:26:36.000Z | 2020-04-13T16:46:20.000Z | /**
* Created by Jian Chen
* @since 2017.02.03
* @author Jian Chen <admin@chensoft.com>
* @link http://chensoft.com
*/
#pragma once
#include "socket/base/ev_base.hpp"
#include <functional>
#include <chrono>
namespace chen
{
class ev_timer: public ev_base
{
public:
enum class Flag {Normal, Future, Repeat};
public:
ev_timer(std::function<void ()> cb = nullptr);
public:
/**
* Invoke callback only once after a period of time
*/
void timeout(const std::chrono::nanoseconds &value);
/**
* Invoke callback only once in a future calendar date
*/
void future(const std::chrono::nanoseconds &value);
void future(const std::chrono::steady_clock::time_point &value);
/**
* Invoke callback repeatedly after a period of time
*/
void interval(const std::chrono::nanoseconds &value);
public:
/**
* Attach callback
*/
void attach(std::function<void ()> cb);
public:
/**
* Timer properties
*/
Flag flag() const
{
return this->_flag;
}
std::chrono::nanoseconds time() const
{
return this->_time;
}
std::chrono::steady_clock::time_point when() const
{
return this->_when;
}
/**
* Calculate init value
*/
void setup(const std::chrono::steady_clock::time_point &now);
/**
* Check if timer expire
*/
bool expire(const std::chrono::steady_clock::time_point &now) const
{
return now >= this->_when;
}
/**
* Update timer value
*/
void update(const std::chrono::steady_clock::time_point &now)
{
if (this->_flag == Flag::Repeat)
this->_when += this->_time;
}
protected:
/**
* At least one event has occurred
*/
virtual void onEvent(int type) override;
private:
Flag _flag = Flag::Normal;
std::chrono::nanoseconds _time; // the interval between two trigger points
std::chrono::steady_clock::time_point _when; // the next trigger point
std::function<void ()> _notify;
};
} | 23.237624 | 83 | 0.532595 | chensoft |
984208815cc54cf2cdf49e6c24a78550ecf64ccc | 10,091 | cpp | C++ | Game15Puzzle.cpp | loiola0/artificial-intelligence-ufc | f356a6a572bdd0b3419b89c93a9c0bd45a669312 | [
"MIT"
] | 2 | 2021-11-08T22:06:06.000Z | 2021-12-17T19:40:01.000Z | Game15Puzzle.cpp | loiola0/artificial-intelligence-ufc | f356a6a572bdd0b3419b89c93a9c0bd45a669312 | [
"MIT"
] | null | null | null | Game15Puzzle.cpp | loiola0/artificial-intelligence-ufc | f356a6a572bdd0b3419b89c93a9c0bd45a669312 | [
"MIT"
] | null | null | null | #include <iostream>
#include <stdio.h>
#include <cstring>
#include <stdlib.h>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <queue>
#include <functional>
#include <locale.h>
#include <unistd.h>
using namespace std;
class Node;
bool idfs();
bool A_estrela();
bool dfs(int k);
bool gulosa();
bool bfs();
void read();
string print(Node *a);
bool temSolucao();
int contaInversoes(int v[]);
int meuSwap(int x);
int Manhattan (Node *x);
// para melhor desempenho em heurísticas
void criaDic();
string meuHash(int v[]);
bool igual(int a[],int b[]);
bool nosIguais(Node *a, Node *b);
void copiar(int a[],int b[]);
int analisaLinha (char* linha);
int obterValor();
//Movimentação necessária
pair<int,int> tr[] = {make_pair(-1, 0),
make_pair( 1, 0),
make_pair( 0, 1),
make_pair( 0,-1)};
int ar_i[16],z_i[2],ar_f[16],z_f[2];
vector<int> posFinal(16);
map<string,int> setx;
int main(){
setlocale(LC_ALL, "Portuguese");
read();
criaDic();
if(!temSolucao()){
printf("Sem solução!\n");
return 0;
}
//Procurando a solução para o puzzle
int start_s=clock();
printf("Procurando solução..\n");
//Escolha qual algoritmo quer rodar e fazer o teste, basta descomentar para executa-lo
bool ok = dfs(15);
// bool ok = bfs();
// bool ok = idfs();
// bool ok = gulosa();
// bool ok = A_estrela();
if(!ok){
//No caso de não possui solução
printf("Sem solução\n");
}
else{
// Fornece informações de tempo e memória gastos para encontrar a solução
int stop_s=clock();
cout << "Tempo: " << (stop_s-start_s)/double(CLOCKS_PER_SEC)*1000 << endl;
printf("Memoria gasta: %dKB\n",obterValor());
}
return 0;
}
/****Classe****/
class Node{
public:
int array[16]; //tamango do puzzle 4x4
int zero[2]; //posicao do zero {i, j}
int profundidade; //profundidade
string caminho; //caminho percorrido após uma movimentação
//descontructor
~Node(){
}
//construtor
Node(int array[],int zero[], int profundidade, string caminho){
copiar(array, this->array);
this->zero[0]=zero[0];
this->zero[1]=zero[1];
this->profundidade = profundidade;
if(profundidade == 0){
this->caminho = print(this);
}
else{
this->caminho = caminho + print(this);
}
}
vector<Node*> make_desc(){
int i,j;
vector<Node*> l;
for(int k=0;k<4;k++){
int c[16],t[2];
//caminho de nós
i=this->zero[0]+tr[k].first;
j=this->zero[1]+tr[k].second;
if(i>=0 && i<4 && j>=0 && j<4){
copiar(this->array,c);
c[this->zero[0]*4+this->zero[1]]=c[i*4+j];
c[i*4+j]=0;
t[0]=i;
t[1]=j;
//verifique se o nó já foi visto, se não foi visto, adicione
//se for visto, mas a profundidade for menor do que a anterior, adicione também
if(setx.find(meuHash(c))==setx.end()){
Node *tt = new Node(c,t,this->profundidade+1,this->caminho);
l.push_back(tt);
}
else if(setx[meuHash(c)]>this->profundidade+1){
setx[meuHash(c)]=this->profundidade+1;
Node *tt = new Node(c,t,this->profundidade+1,this->caminho);
l.push_back(tt);
}
}
}
return l;
}
};
//Algoritmos
//Depth first search(DFS) limited by k (Busca em profunidade com limitação)
bool dfs(int k){
Node *end = new Node(ar_f,z_f,0,"");
Node *start = new Node(ar_i,z_i,0,"");
vector<Node*> l;
vector<Node*> tt;
l.push_back(start);
Node *t;
int flag;
while(l.size()>0){
flag=0;
t = l.back();
l.pop_back();
if(setx.find(meuHash(t->array))==setx.end())
setx.insert(make_pair(meuHash(t->array),t->profundidade));
else if(setx[meuHash(t->array)]>=t->profundidade){
setx[meuHash(t->array)]=t->profundidade;
}
else{
flag=1;
}
if(nosIguais(t,end)){
cout << t->caminho;
printf("Profundidade: %d\n",t->profundidade);
return true;
}
if(t->profundidade<k && !flag){
tt = t->make_desc();
for(int i=0;i<(int)tt.size();i++){
l.push_back(tt[i]);
}
}
delete t;
}
return false;
}
//Breath first search(Busca por largura)
bool bfs(){
Node *end = new Node(ar_f,z_f,0,"");
Node *start = new Node(ar_i,z_i,0,"");
queue<Node*> l;
vector<Node*> tt;
l.push(start);
Node *t;
int flag;
while(l.size()>0){
flag = 0;
t = l.front();
l.pop();
if(setx.find(meuHash(t->array))==setx.end())
setx.insert(make_pair(meuHash(t->array),t->profundidade));
else if(setx[meuHash(t->array)]>=t->profundidade){
setx[meuHash(t->array)]=t->profundidade;
}
else{
flag=1;
}
if(nosIguais(t,end)){
cout << t->caminho;
printf("Profundidade: %d\n",t->profundidade);
return true;
}
if(t->profundidade<80 && !flag){
tt = t->make_desc();
for(int i=0;i<(int)tt.size();i++){
l.push(tt[i]);
}
}
delete t;
}
return false;
}
//Iterative Depth first search(Busca iterativa por profunidade)
bool idfs(){
for(int i=0;i<80;i++){
if(dfs(i)){
return true;
}
setx.clear();
}
return false;
}
struct f{
bool operator()(const pair<int,Node*>& a, pair<int,Node*>& b){
return a.first>b.first;
}
};
//Busca Gulosa Heurística Manhattan
bool gulosa(){
Node *end = new Node(ar_f,z_f,0,"");
Node *start = new Node(ar_i,z_i,0,"");
priority_queue< pair<int,Node*>, vector <pair<int,Node*> > , f > pq;
pq.push (make_pair(0, start));
Node *noAtual;
int flag;
while (!pq.empty()) {
flag = 0;
noAtual = pq.top().second;
pq.pop();
if(setx.find(meuHash(noAtual->array))==setx.end())
setx.insert(make_pair(meuHash(noAtual->array),noAtual->profundidade));
if(setx[meuHash(noAtual->array)]>=noAtual->profundidade){
setx[meuHash(noAtual->array)]=noAtual->profundidade;
}
else{
flag=1;
}
if(nosIguais(noAtual,end)){
cout << noAtual->caminho;
printf("Profundidade: %d\n",noAtual->profundidade);
return true;
}
if(!flag){
vector<Node*> dsc = noAtual->make_desc();
for (int i=0; i<(int)dsc.size();i++) {
pq.push(make_pair(Manhattan(dsc[i]),dsc[i]));
}
}
delete noAtual;
}
return false;
}
//Busca A* com heurística Manhattan
bool A_estrela () {
//inicializa os nós do início e do fim
Node *end = new Node(ar_f,z_f,0,"");
Node *start = new Node(ar_i,z_i,0,"");
//start->cost = 0;
priority_queue< pair<int,Node*>, vector <pair<int,Node*> > , f > pq;
pq.push (make_pair(0, start));
Node *noAtual;
int flag;
while (!pq.empty()) {
flag = 0;
noAtual = pq.top().second;
pq.pop();
if(setx.find(meuHash(noAtual->array))==setx.end())
setx.insert(make_pair(meuHash(noAtual->array),noAtual->profundidade));
if(setx[meuHash(noAtual->array)]>=noAtual->profundidade){
setx[meuHash(noAtual->array)]=noAtual->profundidade;
}
else{
flag=1;
}
if(nosIguais(noAtual,end)){
cout << noAtual->caminho;
printf("Profundidade: %d\n", noAtual->profundidade);
return true;
}
if(!flag){
vector<Node*> dsc = noAtual->make_desc();
for (int i=0; i<(int)dsc.size();i++) {
pq.push(make_pair(Manhattan(dsc[i])*1.1+dsc[i]->profundidade,dsc[i]));
}
}
delete noAtual;
}
return false;
}
//Entrada dos dados
void read(){
int x;
printf("Por favor, digite a configuracao inicial 4x4:\n");
for(int i=0;i<16;i++){
scanf("%d",&x);
if(!x){
z_i[0]=i/4;
z_i[1]=i%4;
}
ar_i[i]=x;
}
printf("Por favor, digite a configuracao final 4x4:\n");
for(int i=0;i<16;i++){
scanf("%d",&x);
if(!x){
z_f[0]=i/4;
z_f[1]=i%4;
}
ar_f[i]=x;
}
}
//Saída dos dados
string print(Node *a){
if(a==NULL){
printf("Sem no\n");
return "";
}
char s[1000];s[0]='\0';
for(int i=0;i<16;i++){
sprintf(s,"%s %2d ",s,a->array[i]);
if(((i+1)%4)==0)
sprintf(s,"%s\n",s);
}
sprintf(s,"%s\n",s);
return string(s);
}
//Funções auxiliares
//verifique se a configuração pode ser resolvida
bool temSolucao(){
Node *end = new Node(ar_f,z_f,0,"");
Node *start = new Node(ar_i,z_i,0,"");
int inv_i,inv_f,br_i,br_f;
inv_i = contaInversoes(start->array);
inv_f = contaInversoes(end->array);
br_i = meuSwap(start->zero[0]);
br_f = meuSwap(end->zero[0]);
if (((inv_i % 2 == 0) == (br_i % 2 == 1)) == ((inv_f % 2 == 0) == (br_f % 2 == 1)))
return true;
return false;
}
//contar o número de inversões
int contaInversoes(int v[]){
int som=0;
for(int i=0;i<16;i++){
for(int j=i+1;j<16;j++){
if(v[i]>v[j] && v[i]!=0 && v[j]!=0)
som+=1;
}
}
return som;
}
//muda x, uma vez que foi contado do fundo, começando em 1, para verificar a solubilidade
int meuSwap(int x){
switch(x){
case 3:return 1;
case 2:return 2;
case 1:return 3;
case 0:return 4;
}
return 0;
}
//cálculo da heurística de distância de manhattan
int Manhattan (Node *x) {
int acc = 0;
for (int i=0; i<16; i++) {
if (x->array[i]!=0) {
int index= posFinal[x->array[i]];
int xf = index/4;
int yf = index%4;
int xa = i/4;
int ya = i%4;
acc+= abs(xf-xa) + abs(yf-ya);
}
}
return acc;
}
// para melhor performance calculando as eurísticas, cria uma espécie de dicionário
// para um dado bloco k, o índice é pos final [k]
void criaDic() {
for (int i=0; i < 16; i++) {
int g = ar_f[i];
posFinal[g]=i;
}
}
//retorna o array como uma string
string meuHash(int v[]){
string s = "";
for(int i =0; i<16; i++)
s += to_string(v[i]);
return s;
}
//verifique se 2 matrizes de configurações são iguais
bool igual(int a[], int b[]){
for(int i = 0; i < 16; i++)
if(a[i] != b[i]) return false;
return true;
}
//verifica se dois nós são iguais
bool nosIguais(Node *a, Node *b){
if(a && b)return igual(a->array, b->array);
return false;
}
//copia o array para o array b
void copiar(int a[], int b[]){
for(int i=0;i<16;i++){
b[i]=a[i];
}
}
int analisaLinha (char* linha){
int i = strlen(linha);
const char* p = linha;
while (*p <'0' || *p > '9') p++;
linha[i-3] = '\0';
i = atoi(p);
return i;
}
int obterValor(){
FILE* file = fopen("/proc/self/status", "r");
int resultado = -1;
char linha[128];
while (fgets(linha, 128, file) != NULL){
if (strncmp(linha, "VmRSS:", 6) == 0){
resultado = analisaLinha(linha);
break;
}
}
fclose(file);
return resultado;
}
| 20.021825 | 89 | 0.603211 | loiola0 |
9845ef29b29a7c347c573a4038c59b9e0f88f328 | 2,464 | cpp | C++ | pwiz/analysis/demux/CubicHermiteSpline.cpp | austinkeller/pwiz | aa8e575cb40fd5e97cc7d922e4d8da44c9277cca | [
"Apache-2.0"
] | null | null | null | pwiz/analysis/demux/CubicHermiteSpline.cpp | austinkeller/pwiz | aa8e575cb40fd5e97cc7d922e4d8da44c9277cca | [
"Apache-2.0"
] | null | null | null | pwiz/analysis/demux/CubicHermiteSpline.cpp | austinkeller/pwiz | aa8e575cb40fd5e97cc7d922e4d8da44c9277cca | [
"Apache-2.0"
] | null | null | null | //
// $Id$
//
//
// Original author: Austin Keller <atkeller .@. uw.edu>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "CubicHermiteSpline.hpp"
#include "CSpline.h"
#include <boost/make_shared.hpp>
using namespace std;
namespace pwiz
{
namespace analysis
{
CubicHermiteSpline::CubicHermiteSpline(const std::vector<double>& points, const std::vector<double>& values) :
cSpline_(new cSpline(points, values))
{
CheckForError();
}
CubicHermiteSpline::CubicHermiteSpline(const Eigen::VectorXd& points, const Eigen::VectorXd& values)
{
vector<double> pointsCopied;
vector<double> valuesCopied;
for (int i = 0; i < points.size(); ++i)
{
pointsCopied.push_back(points[i]);
valuesCopied.push_back(values[i]);
}
cSpline_ = new cSpline(pointsCopied, valuesCopied);
CheckForError();
}
CubicHermiteSpline::~CubicHermiteSpline()
{
if (cSpline_ != nullptr)
delete cSpline_;
}
bool CubicHermiteSpline::IsDifferentiable()
{
return false;
}
bool CubicHermiteSpline::IsIntegrable()
{
return false;
}
double CubicHermiteSpline::Differentiate(double x)
{
throw runtime_error("[CubicHermiteSpline] attempted to differentiate a non-differentiable implementation of IInterpolation.");
}
double CubicHermiteSpline::Integrate(double a, double b)
{
throw runtime_error("[CubicHermiteSpline] attempted to integrate a non-integrable implementation of IInterpolation.");
}
double CubicHermiteSpline::Interpolate(double x)
{
return cSpline_->getY(x);
}
void CubicHermiteSpline::CheckForError() const
{
if (cSpline_->IsError())
throw runtime_error("[CubicHermiteSpline] unusable values were provided to the spline function.");
}
} // namespace analysis
} // namespace pwiz | 28.651163 | 134 | 0.672078 | austinkeller |
98460fc5f88b037a28e453b4e6f7b00863de1b2a | 1,059 | hpp | C++ | include/libp2p/common/literals.hpp | Alexey-N-Chernyshov/cpp-libp2p | 8b52253f9658560a4b1311b3ba327f02284a42a6 | [
"Apache-2.0",
"MIT"
] | null | null | null | include/libp2p/common/literals.hpp | Alexey-N-Chernyshov/cpp-libp2p | 8b52253f9658560a4b1311b3ba327f02284a42a6 | [
"Apache-2.0",
"MIT"
] | null | null | null | include/libp2p/common/literals.hpp | Alexey-N-Chernyshov/cpp-libp2p | 8b52253f9658560a4b1311b3ba327f02284a42a6 | [
"Apache-2.0",
"MIT"
] | null | null | null | /**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef LIBP2P_LITERALS_HPP
#define LIBP2P_LITERALS_HPP
#include <cstdint>
#include <vector>
#include <libp2p/common/types.hpp>
namespace libp2p {
namespace multi {
class Multiaddress;
class Multihash;
} // namespace multi
namespace peer {
class PeerId;
}
namespace common {
/// Only for type casting in tests. No hash is computed
Hash256 operator""_hash256(const char *c, size_t s);
/// Only for type casting in tests. No hash is computed
Hash512 operator""_hash512(const char *c, size_t s);
std::vector<uint8_t> operator""_v(const char *c, size_t s);
std::vector<uint8_t> operator""_unhex(const char *c, size_t s);
multi::Multiaddress operator""_multiaddr(const char *c, size_t s);
multi::Multihash operator""_multihash(const char *c, size_t s);
peer::PeerId operator""_peerid(const char *c, size_t s);
} // namespace common
} // namespace libp2p
#endif // LIBP2P_LITERALS_HPP
| 23.021739 | 70 | 0.694051 | Alexey-N-Chernyshov |
985037a14f29b5ae6859757d7ec7e47d49dc29d7 | 4,800 | cpp | C++ | ogsr_engine/COMMON_AI/PATH/patrol_path_storage.cpp | tiger-vlad/OGSR-Engine | 2b9700d6af4ece2728acc108decb2f34d43a6231 | [
"Apache-2.0"
] | 1 | 2019-06-21T10:33:20.000Z | 2019-06-21T10:33:20.000Z | ogsr_engine/COMMON_AI/PATH/patrol_path_storage.cpp | tiger-vlad/OGSR-Engine | 2b9700d6af4ece2728acc108decb2f34d43a6231 | [
"Apache-2.0"
] | null | null | null | ogsr_engine/COMMON_AI/PATH/patrol_path_storage.cpp | tiger-vlad/OGSR-Engine | 2b9700d6af4ece2728acc108decb2f34d43a6231 | [
"Apache-2.0"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////
// Module : patrol_path_storage.cpp
// Created : 15.06.2004
// Modified : 15.06.2004
// Author : Dmitriy Iassenev
// Description : Patrol path storage
////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "patrol_path_storage.h"
#include "patrol_path.h"
#include "patrol_point.h"
#include "levelgamedef.h"
#include "ai_space.h"
#include "level_graph.h"
#include "game_graph.h"
CPatrolPathStorage::~CPatrolPathStorage ()
{
delete_data (m_registry);
}
void CPatrolPathStorage::load_raw (const CLevelGraph *level_graph, const CGameLevelCrossTable *cross, const CGameGraph *game_graph, IReader &stream)
{
IReader *chunk = stream.open_chunk(WAY_PATROLPATH_CHUNK);
if (!chunk)
return;
u32 chunk_iterator;
for (IReader *sub_chunk = chunk->open_chunk_iterator(chunk_iterator); sub_chunk; sub_chunk = chunk->open_chunk_iterator(chunk_iterator,sub_chunk)) {
R_ASSERT (sub_chunk->find_chunk(WAYOBJECT_CHUNK_VERSION));
R_ASSERT (sub_chunk->r_u16() == WAYOBJECT_VERSION);
R_ASSERT (sub_chunk->find_chunk(WAYOBJECT_CHUNK_NAME));
shared_str patrol_name;
sub_chunk->r_stringZ (patrol_name);
VERIFY3 (m_registry.find(patrol_name) == m_registry.end(),"Duplicated patrol path found",*patrol_name);
m_registry.insert (
std::make_pair(
patrol_name,
&xr_new<CPatrolPath>(
patrol_name
)->load_raw(
level_graph,
cross,
game_graph,
*sub_chunk
)
)
);
}
chunk->close ();
}
void CPatrolPathStorage::append_from_ini(CInifile &way_inifile)
{
PATROL_REGISTRY::value_type pair;
int i = 0;
int r = 0;
for (const auto &it : way_inifile.sections())
{
const shared_str patrol_name = it.first;
if (m_registry.erase(patrol_name))
{
r++;
}
m_registry.insert(
std::make_pair(
patrol_name,
&xr_new<CPatrolPath>(
patrol_name
)->load_ini(
*it.second
)
)
);
i++;
}
Msg("Loaded %d items from custom_waypoints, %d from all.spawn was replaced!", i, r);
}
void CPatrolPathStorage::load (IReader &stream)
{
IReader *chunk;
chunk = stream.open_chunk(0);
u32 size = chunk->r_u32();
chunk->close ();
m_registry.clear ();
PATROL_REGISTRY::value_type pair;
chunk = stream.open_chunk(1);
for (u32 i=0; i<size; ++i) {
IReader *chunk1;
chunk1 = chunk->open_chunk(i);
IReader *chunk2;
chunk2 = chunk1->open_chunk(0);
load_data (pair.first,*chunk2);
chunk2->close ();
chunk2 = chunk1->open_chunk(1);
load_data (pair.second,*chunk2);
chunk2->close ();
chunk1->close ();
VERIFY3(m_registry.find(pair.first) == m_registry.end(),"Duplicated patrol path found ",*pair.first);
#ifdef DEBUG
pair.second->name (pair.first);
#endif
m_registry.insert (pair);
}
chunk->close ();
}
void CPatrolPathStorage::save (IWriter &stream)
{
stream.open_chunk (0);
stream.w_u32 (m_registry.size());
stream.close_chunk ();
stream.open_chunk (1);
PATROL_REGISTRY::iterator I = m_registry.begin();
PATROL_REGISTRY::iterator E = m_registry.end();
for (int i=0; I != E; ++I, ++i) {
stream.open_chunk (i);
stream.open_chunk (0);
save_data ((*I).first,stream);
stream.close_chunk ();
stream.open_chunk (1);
save_data ((*I).second,stream);
stream.close_chunk ();
stream.close_chunk ();
}
stream.close_chunk ();
}
void CPatrolPathStorage::remove_path( shared_str patrol_name ) {
m_registry.erase( patrol_name );
}
void CPatrolPathStorage::add_path( shared_str patrol_name, CPatrolPath *path ) {
remove_path( patrol_name );
m_registry.insert( std::make_pair( patrol_name, path ) );
}
const CPatrolPath* CPatrolPathStorage::safe_path( shared_str patrol_name, bool no_assert, bool on_level ) const {
auto it = m_registry.find( patrol_name );
if ( it == m_registry.end() )
return path( patrol_name, no_assert );
for ( auto& it2 : (*it).second->vertices() ) {
auto& pp = it2.second->data();
if ( on_level || ( ai().game_graph().valid_vertex_id( pp.m_game_vertex_id ) && ai().game_graph().vertex( pp.m_game_vertex_id )->level_id() == ai().level_graph().level_id() ) ) {
if ( !ai().level_graph().valid_vertex_id( pp.m_level_vertex_id ) ) {
u32 prev_vertex_id = pp.m_level_vertex_id;
pp.m_level_vertex_id = ai().level_graph().vertex( pp.m_position );
Msg( "* [%s]: path[%s] pp[%s] level_vertex_id[%u] -> %u", __FUNCTION__, patrol_name.c_str(), pp.m_name.c_str(), prev_vertex_id, pp.m_level_vertex_id );
}
}
else
return path( patrol_name, no_assert );
}
return path( patrol_name, no_assert );
}
| 25.531915 | 181 | 0.641875 | tiger-vlad |
9852e6ce0c07b1308e383043a1504518586acdfe | 777 | cpp | C++ | src/main/cpp/autonomous/AutoBaseLine.cpp | Team3512/Robot-2017 | 1e5f3c1dcd78464d0c967aa17ca0e479775f7ed3 | [
"BSD-3-Clause"
] | null | null | null | src/main/cpp/autonomous/AutoBaseLine.cpp | Team3512/Robot-2017 | 1e5f3c1dcd78464d0c967aa17ca0e479775f7ed3 | [
"BSD-3-Clause"
] | null | null | null | src/main/cpp/autonomous/AutoBaseLine.cpp | Team3512/Robot-2017 | 1e5f3c1dcd78464d0c967aa17ca0e479775f7ed3 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2016-2021 FRC Team 3512. All Rights Reserved.
#include "Robot.hpp"
constexpr double kSafetyInches = 10.0;
// Drives forward until passing white line 120 inches away from start
void Robot::AutoBaseLine() {
robotDrive.StartClosedLoop();
shifter.Set(false); // false = high gear
gearPunch.Set(frc::DoubleSolenoid::kForward);
// Move forward
robotDrive.ResetEncoders();
robotDrive.ResetGyro();
shifter.Set(true); // low gear
robotDrive.SetPositionReference(kRobotLength + 120.0 + kSafetyInches);
robotDrive.SetAngleReference(0);
while (!robotDrive.PosAtReference()) {
m_autonChooser.YieldToMain();
if (!IsAutonomousEnabled()) {
return;
}
}
robotDrive.StopClosedLoop();
}
| 25.9 | 74 | 0.675676 | Team3512 |
9854dcd3f85accb23319273309e326e9826e31ac | 9,837 | cpp | C++ | 3rdParty/V8/v5.7.492.77/third_party/icu/source/samples/layout/GDIFontInstance.cpp | sita1999/arangodb | 6a4f462fa209010cd064f99e63d85ce1d432c500 | [
"Apache-2.0"
] | 2 | 2019-12-07T11:29:58.000Z | 2021-06-26T12:48:10.000Z | 3rdParty/V8/v5.7.492.77/third_party/icu/source/samples/layout/GDIFontInstance.cpp | lipper/arangodb | 66ea1fd4946668192e3f0d1060f0844f324ad7b8 | [
"Apache-2.0"
] | null | null | null | 3rdParty/V8/v5.7.492.77/third_party/icu/source/samples/layout/GDIFontInstance.cpp | lipper/arangodb | 66ea1fd4946668192e3f0d1060f0844f324ad7b8 | [
"Apache-2.0"
] | 1 | 2018-12-05T04:56:16.000Z | 2018-12-05T04:56:16.000Z | /*
*******************************************************************************
*
* Copyright (C) 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html#License
*
*******************************************************************************
*******************************************************************************
*
* Copyright (C) 1999-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: GDIFontInstance.cpp
*
* created on: 08/09/2000
* created by: Eric R. Mader
*/
#include <windows.h>
#include "layout/LETypes.h"
#include "layout/LESwaps.h"
#include "layout/LEFontInstance.h"
#include "GDIFontInstance.h"
#include "sfnt.h"
#include "cmaps.h"
GDISurface::GDISurface(HDC theHDC)
: fHdc(theHDC), fCurrentFont(NULL)
{
// nothing else to do
}
GDISurface::~GDISurface()
{
// nothing to do
}
void GDISurface::setHDC(HDC theHDC)
{
fHdc = theHDC;
fCurrentFont = NULL;
}
void GDISurface::setFont(const GDIFontInstance *font)
{
#if 0
if (fCurrentFont != font) {
fCurrentFont = font;
SelectObject(fHdc, font->getFont());
}
#else
SelectObject(fHdc, font->getFont());
#endif
}
void GDISurface::drawGlyphs(const LEFontInstance *font, const LEGlyphID *glyphs, le_int32 count, const float *positions,
le_int32 x, le_int32 y, le_int32 width, le_int32 height)
{
TTGlyphID *ttGlyphs = LE_NEW_ARRAY(TTGlyphID, count);
le_int32 *dx = LE_NEW_ARRAY(le_int32, count);
float *ps = LE_NEW_ARRAY(float, count * 2 + 2);
le_int32 out = 0;
RECT clip;
clip.top = 0;
clip.left = 0;
clip.bottom = height;
clip.right = width;
for (le_int32 g = 0; g < count; g += 1) {
TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyphs[g]);
if (ttGlyph < 0xFFFE) {
ttGlyphs[out] = ttGlyph;
dx[out] = (le_int32) (positions[g * 2 + 2] - positions[g * 2]);
ps[out * 2] = positions[g * 2];
ps[out * 2 + 1] = positions[g * 2 + 1];
out += 1;
}
}
le_int32 dyStart, dyEnd;
setFont((GDIFontInstance *) font);
dyStart = dyEnd = 0;
while (dyEnd < out) {
float yOffset = ps[dyStart * 2 + 1];
float xOffset = ps[dyStart * 2];
while (dyEnd < out && yOffset == ps[dyEnd * 2 + 1]) {
dyEnd += 1;
}
ExtTextOut(fHdc, x + (le_int32) xOffset, y + (le_int32) yOffset - font->getAscent(), ETO_CLIPPED | ETO_GLYPH_INDEX, &clip,
(LPCWSTR) &ttGlyphs[dyStart], dyEnd - dyStart, (INT *) &dx[dyStart]);
dyStart = dyEnd;
}
LE_DELETE_ARRAY(ps);
LE_DELETE_ARRAY(dx);
LE_DELETE_ARRAY(ttGlyphs);
}
GDIFontInstance::GDIFontInstance(GDISurface *surface, TCHAR *faceName, le_int16 pointSize, LEErrorCode &status)
: FontTableCache(), fSurface(surface), fFont(NULL),
fPointSize(pointSize), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0),
fDeviceScaleX(1), fDeviceScaleY(1), fMapper(NULL)
{
LOGFONT lf;
FLOAT dpiX, dpiY;
POINT pt;
OUTLINETEXTMETRIC otm;
HDC hdc = surface->getHDC();
if (LE_FAILURE(status)) {
return;
}
SaveDC(hdc);
SetGraphicsMode(hdc, GM_ADVANCED);
ModifyWorldTransform(hdc, NULL, MWT_IDENTITY);
SetViewportOrgEx(hdc, 0, 0, NULL);
SetWindowOrgEx(hdc, 0, 0, NULL);
dpiX = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSX);
dpiY = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSY);
#if 1
pt.x = (int) (pointSize * dpiX / 72);
pt.y = (int) (pointSize * dpiY / 72);
DPtoLP(hdc, &pt, 1);
#else
pt.x = pt.y = pointSize;
#endif
lf.lfHeight = - pt.y;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = 0;
lf.lfItalic = 0;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = 0;
lf.lfClipPrecision = 0;
lf.lfQuality = 0;
lf.lfPitchAndFamily = 0;
lstrcpy(lf.lfFaceName, faceName);
fFont = CreateFontIndirect(&lf);
if (fFont == NULL) {
status = LE_FONT_FILE_NOT_FOUND_ERROR;
return;
}
SelectObject(hdc, fFont);
UINT ret = GetOutlineTextMetrics(hdc, sizeof otm, &otm);
if (ret == 0) {
status = LE_MISSING_FONT_TABLE_ERROR;
goto restore;
}
fUnitsPerEM = otm.otmEMSquare;
fAscent = otm.otmTextMetrics.tmAscent;
fDescent = otm.otmTextMetrics.tmDescent;
fLeading = otm.otmTextMetrics.tmExternalLeading;
status = initMapper();
if (LE_FAILURE(status)) {
goto restore;
}
#if 0
status = initFontTableCache();
#endif
restore:
RestoreDC(hdc, -1);
}
GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_int16 pointSize, LEErrorCode &status)
: FontTableCache(), fSurface(surface), fFont(NULL),
fPointSize(pointSize), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0),
fDeviceScaleX(1), fDeviceScaleY(1), fMapper(NULL)
{
LOGFONTA lf;
FLOAT dpiX, dpiY;
POINT pt;
OUTLINETEXTMETRIC otm;
HDC hdc = surface->getHDC();
if (LE_FAILURE(status)) {
return;
}
SaveDC(hdc);
SetGraphicsMode(hdc, GM_ADVANCED);
ModifyWorldTransform(hdc, NULL, MWT_IDENTITY);
SetViewportOrgEx(hdc, 0, 0, NULL);
SetWindowOrgEx(hdc, 0, 0, NULL);
dpiX = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSX);
dpiY = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSY);
fDeviceScaleX = dpiX / 72;
fDeviceScaleY = dpiY / 72;
#if 1
pt.x = (int) (pointSize * fDeviceScaleX);
pt.y = (int) (pointSize * fDeviceScaleY);
DPtoLP(hdc, &pt, 1);
#else
pt.x = pt.y = pointSize;
#endif
lf.lfHeight = - pt.y;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = 0;
lf.lfItalic = 0;
lf.lfUnderline = 0;
lf.lfStrikeOut = 0;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = 0;
lf.lfClipPrecision = 0;
lf.lfQuality = 0;
lf.lfPitchAndFamily = 0;
strcpy(lf.lfFaceName, faceName);
fFont = CreateFontIndirectA(&lf);
if (fFont == NULL) {
status = LE_FONT_FILE_NOT_FOUND_ERROR;
return;
}
SelectObject(hdc, fFont);
UINT ret = GetOutlineTextMetrics(hdc, sizeof otm, &otm);
if (ret != 0) {
fUnitsPerEM = otm.otmEMSquare;
fAscent = otm.otmTextMetrics.tmAscent;
fDescent = otm.otmTextMetrics.tmDescent;
fLeading = otm.otmTextMetrics.tmExternalLeading;
} else {
const HEADTable *headTable = NULL;
const HHEATable *hheaTable = NULL;
// read unitsPerEm from 'head' table
headTable = (const HEADTable *) readFontTable(LE_HEAD_TABLE_TAG);
if (headTable == NULL) {
status = LE_MISSING_FONT_TABLE_ERROR;
goto restore;
}
fUnitsPerEM = SWAPW(headTable->unitsPerEm);
freeFontTable((const void *)headTable);
hheaTable = (HHEATable *) readFontTable(LE_HHEA_TABLE_TAG);
if (hheaTable == NULL) {
status = LE_MISSING_FONT_TABLE_ERROR;
goto restore;
}
fAscent = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->ascent));
fDescent = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->descent));
fLeading = (le_int32) yUnitsToPoints((float) SWAPW(hheaTable->lineGap));
freeFontTable((const void *) hheaTable);
}
status = initMapper();
if (LE_FAILURE(status)) {
goto restore;
}
#if 0
status = initFontTableCache();
#endif
restore:
RestoreDC(hdc, -1);
}
GDIFontInstance::~GDIFontInstance()
{
#if 0
flushFontTableCache();
delete[] fTableCache;
#endif
if (fFont != NULL) {
// FIXME: call RemoveObject first?
DeleteObject(fFont);
}
delete fMapper;
fMapper = NULL;
}
LEErrorCode GDIFontInstance::initMapper()
{
LETag cmapTag = LE_CMAP_TABLE_TAG;
const CMAPTable *cmap = (const CMAPTable *) readFontTable(cmapTag);
if (cmap == NULL) {
return LE_MISSING_FONT_TABLE_ERROR;
}
fMapper = CMAPMapper::createUnicodeMapper(cmap);
if (fMapper == NULL) {
return LE_MISSING_FONT_TABLE_ERROR;
}
return LE_NO_ERROR;
}
const void *GDIFontInstance::getFontTable(LETag tableTag) const
{
return FontTableCache::find(tableTag);
}
const void *GDIFontInstance::readFontTable(LETag tableTag) const
{
fSurface->setFont(this);
HDC hdc = fSurface->getHDC();
DWORD stag = SWAPL(tableTag);
DWORD len = GetFontData(hdc, stag, 0, NULL, 0);
void *result = NULL;
if (len != GDI_ERROR) {
result = LE_NEW_ARRAY(char, len);
GetFontData(hdc, stag, 0, result, len);
}
return result;
}
void GDIFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
{
advance.fX = 0;
advance.fY = 0;
if (glyph == 0xFFFE || glyph == 0xFFFF) {
return;
}
GLYPHMETRICS metrics;
DWORD result;
MAT2 identity = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
HDC hdc = fSurface->getHDC();
fSurface->setFont(this);
result = GetGlyphOutline(hdc, glyph, GGO_GLYPH_INDEX | GGO_METRICS, &metrics, 0, NULL, &identity);
if (result == GDI_ERROR) {
return;
}
advance.fX = metrics.gmCellIncX;
return;
}
le_bool GDIFontInstance::getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const
{
#if 0
hsFixedPoint2 pt;
le_bool result;
result = fFontInstance->getGlyphPoint(glyph, pointNumber, pt);
if (result) {
point.fX = xUnitsToPoints(pt.fX);
point.fY = yUnitsToPoints(pt.fY);
}
return result;
#else
return FALSE;
#endif
}
| 24.051345 | 130 | 0.601301 | sita1999 |
9855218d27807b581da5d1f58a4e439ff444e345 | 304 | cpp | C++ | core/xnet/env.cpp | forrestsong/fpay_demo | 7b254a1389b011c799497ad7d08bb8d8d349e557 | [
"MIT"
] | 1 | 2018-08-12T15:08:49.000Z | 2018-08-12T15:08:49.000Z | core/xnet/env.cpp | forrestsong/fpay_demo | 7b254a1389b011c799497ad7d08bb8d8d349e557 | [
"MIT"
] | null | null | null | core/xnet/env.cpp | forrestsong/fpay_demo | 7b254a1389b011c799497ad7d08bb8d8d349e557 | [
"MIT"
] | null | null | null | #include <iostream>
#include "IOLoop.h"
#include "SignalHandler.h"
#include "env.h"
int env::SocketErrorLogLevel = 0;
time_t env::now = time(NULL);
std::string env::strTime = "";
unsigned int env::msec = 0;
uint64_t env::usec = 0;
IOLoop* env::_loop = NULL;
SignalHandler* env::_signalHandler = NULL;
| 21.714286 | 42 | 0.700658 | forrestsong |
98584478b33f710ff0dcf9e1d47f94a6a614f5b6 | 765 | cpp | C++ | cc/split_ref_to_reads.cpp | HKU-BAL/MegaPath | b81796024f864af5fd44deb5812f34704c570160 | [
"BSD-3-Clause"
] | 6 | 2021-10-06T07:47:04.000Z | 2022-01-25T05:09:08.000Z | cc/split_ref_to_reads.cpp | edwwlui/MegaPath | b81796024f864af5fd44deb5812f34704c570160 | [
"BSD-3-Clause"
] | null | null | null | cc/split_ref_to_reads.cpp | edwwlui/MegaPath | b81796024f864af5fd44deb5812f34704c570160 | [
"BSD-3-Clause"
] | null | null | null | #include "kxseq.h"
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
using namespace kx;
int main(int argc, char **argv) {
if (argc < 3) {
fprintf(stderr, "Usage: %s <read_len> <overlap> < ref.fa > reads.fa\n", argv[0]);
return 1;
}
kxseq<int> seq(fileno(stdin));
int read_len = atoi(argv[1]);
int overlap = atoi(argv[2]);
while (seq.read() >= 0) {
for (unsigned i = 0; ; i += overlap) {
if (i + read_len > seq.seq().length()) {
i = max(0, (int)seq.seq().length() - read_len);
}
printf(">%s_%d\n%s\n", seq.name().c_str(), i, seq.seq().substr(i, min(read_len, (int)seq.seq().length())).c_str());
if (i + read_len >= seq.seq().length()) break;
}
}
return 0;
} | 25.5 | 121 | 0.55817 | HKU-BAL |
985a0b9d65797ab47cdf40363ae2fd2855d88c2d | 416 | cpp | C++ | Kawakawa/Excalibur/Core/Object/System/CameraSystem.cpp | JiaqiJin/KawaiiDesune | e5c3031898f96f1ec5370b41371b2c1cf22c3586 | [
"MIT"
] | null | null | null | Kawakawa/Excalibur/Core/Object/System/CameraSystem.cpp | JiaqiJin/KawaiiDesune | e5c3031898f96f1ec5370b41371b2c1cf22c3586 | [
"MIT"
] | null | null | null | Kawakawa/Excalibur/Core/Object/System/CameraSystem.cpp | JiaqiJin/KawaiiDesune | e5c3031898f96f1ec5370b41371b2c1cf22c3586 | [
"MIT"
] | null | null | null | #include "CameraSystem.h"
namespace Excalibur
{
CameraSystem::CameraSystem(World* world) :
m_World(world)
{
}
int CameraSystem::Initialize()
{
return 0;
}
void CameraSystem::Finalize()
{
m_MainCamera = nullptr;
}
std::shared_ptr<Entity> CameraSystem::GetMainCamera()
{
return m_MainCamera;
}
void CameraSystem::SetMainCamera(std::shared_ptr<Entity> camera)
{
m_MainCamera = camera;
}
} | 13.866667 | 65 | 0.704327 | JiaqiJin |
985c7580f09279333a49b64f260e36cbda9522cd | 730 | cpp | C++ | Contests/Codeforces/CF1011/A.cpp | SYCstudio/OI | 6e9bfc17dbd4b43467af9b19aa2aed41e28972fa | [
"MIT"
] | 4 | 2017-10-31T14:25:18.000Z | 2018-06-10T16:10:17.000Z | Contests/Codeforces/CF1011/A.cpp | SYCstudio/OI | 6e9bfc17dbd4b43467af9b19aa2aed41e28972fa | [
"MIT"
] | null | null | null | Contests/Codeforces/CF1011/A.cpp | SYCstudio/OI | 6e9bfc17dbd4b43467af9b19aa2aed41e28972fa | [
"MIT"
] | null | null | null | #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define mem(Arr,x) memset(Arr,x,sizeof(Arr))
const int maxN=51;
const int inf=2147483647;
const int meminf=1061109567;
char str[maxN];
int n,K;
int F[maxN][maxN];
int main()
{
scanf("%d%d",&n,&K);
scanf("%s",str+1);
sort(&str[1],&str[n+1]);
n=unique(&str[1],&str[n+1])-str-1;
mem(F,63);
F[0][0]=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=K;j++)
for (int k=0;k<i;k++)
if (str[i]-str[k]>=2)
F[i][j]=min(F[i][j],F[k][j-1]+str[i]-'a'+1);
int Ans=meminf;
for (int i=1;i<=n;i++) Ans=min(Ans,F[i][K]);
if (Ans==meminf) printf("-1\n");
else printf("%d\n",Ans);
return 0;
}
| 18.25 | 49 | 0.591781 | SYCstudio |
985eb7be388d30e5a22ea2a1476c73eefc86cabd | 10,253 | cpp | C++ | xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp | f100cleveland/external_pdfium | 12eec9c70519554387f199aa1eef42ed15478d02 | [
"BSD-3-Clause"
] | 1 | 2018-01-12T03:24:59.000Z | 2018-01-12T03:24:59.000Z | xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp | f100cleveland/external_pdfium | 12eec9c70519554387f199aa1eef42ed15478d02 | [
"BSD-3-Clause"
] | null | null | null | xfa/src/fxbarcode/datamatrix/BC_SymbolInfo.cpp | f100cleveland/external_pdfium | 12eec9c70519554387f199aa1eef42ed15478d02 | [
"BSD-3-Clause"
] | 1 | 2020-07-30T12:07:00.000Z | 2020-07-30T12:07:00.000Z | // Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
// Original code is licensed as follows:
/*
* Copyright 2006 Jeremias Maerki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "xfa/src/fxbarcode/barcode.h"
#include "xfa/src/fxbarcode/BC_Dimension.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h"
#include "BC_Encoder.h"
#include "BC_SymbolShapeHint.h"
#include "BC_SymbolInfo.h"
#include "BC_DataMatrixSymbolInfo144.h"
#define SYMBOLS_COUNT 30
CBC_SymbolInfo* CBC_SymbolInfo::m_PROD_SYMBOLS[30] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
CBC_SymbolInfo* CBC_SymbolInfo::m_symbols[30] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
void CBC_SymbolInfo::Initialize() {
m_PROD_SYMBOLS[0] = new CBC_SymbolInfo(FALSE, 3, 5, 8, 8, 1);
m_PROD_SYMBOLS[1] = new CBC_SymbolInfo(FALSE, 5, 7, 10, 10, 1);
m_PROD_SYMBOLS[2] = new CBC_SymbolInfo(TRUE, 5, 7, 16, 6, 1);
m_PROD_SYMBOLS[3] = new CBC_SymbolInfo(FALSE, 8, 10, 12, 12, 1);
m_PROD_SYMBOLS[4] = new CBC_SymbolInfo(TRUE, 10, 11, 14, 6, 2);
m_PROD_SYMBOLS[5] = new CBC_SymbolInfo(FALSE, 12, 12, 14, 14, 1);
m_PROD_SYMBOLS[6] = new CBC_SymbolInfo(TRUE, 16, 14, 24, 10, 1);
m_PROD_SYMBOLS[7] = new CBC_SymbolInfo(FALSE, 18, 14, 16, 16, 1);
m_PROD_SYMBOLS[8] = new CBC_SymbolInfo(FALSE, 22, 18, 18, 18, 1);
m_PROD_SYMBOLS[9] = new CBC_SymbolInfo(TRUE, 22, 18, 16, 10, 2);
m_PROD_SYMBOLS[10] = new CBC_SymbolInfo(FALSE, 30, 20, 20, 20, 1);
m_PROD_SYMBOLS[11] = new CBC_SymbolInfo(TRUE, 32, 24, 16, 14, 2);
m_PROD_SYMBOLS[12] = new CBC_SymbolInfo(FALSE, 36, 24, 22, 22, 1);
m_PROD_SYMBOLS[13] = new CBC_SymbolInfo(FALSE, 44, 28, 24, 24, 1);
m_PROD_SYMBOLS[14] = new CBC_SymbolInfo(TRUE, 49, 28, 22, 14, 2);
m_PROD_SYMBOLS[15] = new CBC_SymbolInfo(FALSE, 62, 36, 14, 14, 4);
m_PROD_SYMBOLS[16] = new CBC_SymbolInfo(FALSE, 86, 42, 16, 16, 4);
m_PROD_SYMBOLS[17] = new CBC_SymbolInfo(FALSE, 114, 48, 18, 18, 4);
m_PROD_SYMBOLS[18] = new CBC_SymbolInfo(FALSE, 144, 56, 20, 20, 4);
m_PROD_SYMBOLS[19] = new CBC_SymbolInfo(FALSE, 174, 68, 22, 22, 4);
m_PROD_SYMBOLS[20] = new CBC_SymbolInfo(FALSE, 204, 84, 24, 24, 4, 102, 42);
m_PROD_SYMBOLS[21] = new CBC_SymbolInfo(FALSE, 280, 112, 14, 14, 16, 140, 56);
m_PROD_SYMBOLS[22] = new CBC_SymbolInfo(FALSE, 368, 144, 16, 16, 16, 92, 36);
m_PROD_SYMBOLS[23] = new CBC_SymbolInfo(FALSE, 456, 192, 18, 18, 16, 114, 48);
m_PROD_SYMBOLS[24] = new CBC_SymbolInfo(FALSE, 576, 224, 20, 20, 16, 144, 56);
m_PROD_SYMBOLS[25] = new CBC_SymbolInfo(FALSE, 696, 272, 22, 22, 16, 174, 68);
m_PROD_SYMBOLS[26] = new CBC_SymbolInfo(FALSE, 816, 336, 24, 24, 16, 136, 56);
m_PROD_SYMBOLS[27] =
new CBC_SymbolInfo(FALSE, 1050, 408, 18, 18, 36, 175, 68);
m_PROD_SYMBOLS[28] =
new CBC_SymbolInfo(FALSE, 1304, 496, 20, 20, 36, 163, 62);
m_PROD_SYMBOLS[29] = new CBC_DataMatrixSymbolInfo144();
for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
m_symbols[i] = m_PROD_SYMBOLS[i];
}
}
void CBC_SymbolInfo::Finalize() {
for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
delete m_PROD_SYMBOLS[i];
m_PROD_SYMBOLS[i] = NULL;
m_symbols[i] = NULL;
}
}
CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular,
int32_t dataCapacity,
int32_t errorCodewords,
int32_t matrixWidth,
int32_t matrixHeight,
int32_t dataRegions) {
m_rectangular = rectangular;
m_dataCapacity = dataCapacity;
m_errorCodewords = errorCodewords;
m_matrixWidth = matrixWidth;
m_matrixHeight = matrixHeight;
m_dataRegions = dataRegions;
m_rsBlockData = dataCapacity;
m_rsBlockError = errorCodewords;
}
CBC_SymbolInfo::CBC_SymbolInfo(FX_BOOL rectangular,
int32_t dataCapacity,
int32_t errorCodewords,
int32_t matrixWidth,
int32_t matrixHeight,
int32_t dataRegions,
int32_t rsBlockData,
int32_t rsBlockError) {
m_rectangular = rectangular;
m_dataCapacity = dataCapacity;
m_errorCodewords = errorCodewords;
m_matrixWidth = matrixWidth;
m_matrixHeight = matrixHeight;
m_dataRegions = dataRegions;
m_rsBlockData = rsBlockData;
m_rsBlockError = rsBlockError;
}
CBC_SymbolInfo::~CBC_SymbolInfo() {}
CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords, int32_t& e) {
return lookup(dataCodewords, FORCE_NONE, TRUE, e);
}
CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
SymbolShapeHint shape,
int32_t& e) {
return lookup(dataCodewords, shape, TRUE, e);
}
CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
FX_BOOL allowRectangular,
FX_BOOL fail,
int32_t& e) {
SymbolShapeHint shape = allowRectangular ? FORCE_NONE : FORCE_SQUARE;
return lookup(dataCodewords, shape, fail, e);
}
CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
SymbolShapeHint shape,
FX_BOOL fail,
int32_t& e) {
return lookup(dataCodewords, shape, NULL, NULL, fail, e);
}
CBC_SymbolInfo* CBC_SymbolInfo::lookup(int32_t dataCodewords,
SymbolShapeHint shape,
CBC_Dimension* minSize,
CBC_Dimension* maxSize,
FX_BOOL fail,
int32_t& e) {
for (int32_t i = 0; i < SYMBOLS_COUNT; i++) {
CBC_SymbolInfo* symbol = m_symbols[i];
if (shape == FORCE_SQUARE && symbol->m_rectangular) {
continue;
}
if (shape == FORCE_RECTANGLE && !symbol->m_rectangular) {
continue;
}
if (minSize != NULL &&
(symbol->getSymbolWidth(e) < minSize->getWidth() ||
symbol->getSymbolHeight(e) < minSize->getHeight())) {
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
continue;
}
if (maxSize != NULL &&
(symbol->getSymbolWidth(e) > maxSize->getWidth() ||
symbol->getSymbolHeight(e) > maxSize->getHeight())) {
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
continue;
}
if (dataCodewords <= symbol->m_dataCapacity) {
return symbol;
}
}
if (fail) {
e = BCExceptionIllegalDataCodewords;
return NULL;
}
return NULL;
}
int32_t CBC_SymbolInfo::getHorizontalDataRegions(int32_t& e) {
switch (m_dataRegions) {
case 1:
return 1;
case 2:
return 2;
case 4:
return 2;
case 16:
return 4;
case 36:
return 6;
default:
e = BCExceptionCannotHandleThisNumberOfDataRegions;
return 0;
}
}
int32_t CBC_SymbolInfo::getVerticalDataRegions(int32_t& e) {
switch (m_dataRegions) {
case 1:
return 1;
case 2:
return 1;
case 4:
return 2;
case 16:
return 4;
case 36:
return 6;
default:
e = BCExceptionCannotHandleThisNumberOfDataRegions;
return 0;
}
}
int32_t CBC_SymbolInfo::getSymbolDataWidth(int32_t& e) {
return getHorizontalDataRegions(e) * m_matrixWidth;
}
int32_t CBC_SymbolInfo::getSymbolDataHeight(int32_t& e) {
return getVerticalDataRegions(e) * m_matrixHeight;
}
int32_t CBC_SymbolInfo::getSymbolWidth(int32_t& e) {
return getSymbolDataWidth(e) + (getHorizontalDataRegions(e) * 2);
}
int32_t CBC_SymbolInfo::getSymbolHeight(int32_t& e) {
return getSymbolDataHeight(e) + (getVerticalDataRegions(e) * 2);
}
int32_t CBC_SymbolInfo::getCodewordCount() {
return m_dataCapacity + m_errorCodewords;
}
int32_t CBC_SymbolInfo::getInterleavedBlockCount() {
return m_dataCapacity / m_rsBlockData;
}
int32_t CBC_SymbolInfo::getDataLengthForInterleavedBlock(int32_t index) {
return m_rsBlockData;
}
int32_t CBC_SymbolInfo::getErrorLengthForInterleavedBlock(int32_t index) {
return m_rsBlockError;
}
CFX_WideString CBC_SymbolInfo::toString(int32_t& e) {
CFX_WideString sb;
sb += (FX_WCHAR*)(m_rectangular ? "Rectangular Symbol:" : "Square Symbol:");
sb += (FX_WCHAR*)" data region ";
sb += m_matrixWidth;
sb += (FX_WCHAR)'x';
sb += m_matrixHeight;
sb += (FX_WCHAR*)", symbol size ";
sb += getSymbolWidth(e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
sb += (FX_WCHAR)'x';
sb += getSymbolHeight(e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
sb += (FX_WCHAR*)", symbol data size ";
sb += getSymbolDataWidth(e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
sb += (FX_WCHAR)'x';
sb += getSymbolDataHeight(e);
BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR*)"");
sb += (FX_WCHAR*)", codewords ";
sb += m_dataCapacity;
sb += (FX_WCHAR)'+';
sb += m_errorCodewords;
return sb;
}
| 39.894942 | 81 | 0.627329 | f100cleveland |
9862551214aa4d28d9d1ccd3872b85e1f097a981 | 3,752 | cpp | C++ | main.cpp | vega1986/wcalc_expression_parser | e9645a5fa8086c4108ce4dc1f3ad7da3cead6480 | [
"MIT"
] | null | null | null | main.cpp | vega1986/wcalc_expression_parser | e9645a5fa8086c4108ce4dc1f3ad7da3cead6480 | [
"MIT"
] | null | null | null | main.cpp | vega1986/wcalc_expression_parser | e9645a5fa8086c4108ce4dc1f3ad7da3cead6480 | [
"MIT"
] | null | null | null | #include <cstdlib>
#include <sstream>
#include <iostream>
#include <queue>
// #include "kernel.h"
#include "ctexpression/ctkernel.h"
// #define use_string_interpreter 0
int main(int argc, char *argv[])
{
using namespace std;
using namespace compile_time_expression_structure;
#if 0
// istringstream ist {"7*(2+4*(1+2*(3+6)))"};
// istringstream ist {"7*(2+5)"};
double real_expression_result = +7*(2+2*(1+3*(2+5))) - 30*3;
istringstream ist {"+7*{2+2*(1+3*(2+5))} - 30*3"};
// istringstream ist {"7*46 - 30*3"};
// istringstream ist {"5*4 - 4*3"};
// istringstream ist {"(-5)*4-4*3"};
calculator::WExpression expr(ist);
double val {expr.result()};
cout << "res wcalc: " << val << endl;
cout << "res cpp: " << real_expression_result << endl;
bool exit_instruction_received {false};
while (cin)
{
cout << calculator::command_prompt_symbol << ' ';
std::queue<string> queue_str;
while (cin)
{
char sym {0};
cin >> sym;
while (cin && sym==calculator::command_stop_expression) cin >> sym;
if (sym == calculator::command_quit_instruction) {
exit_instruction_received = true;
break;
}
else cin.unget();
string str;
while (cin)
{
cin >> sym;
if (sym == calculator::command_stop_expression) break;
str += sym;
}
queue_str.emplace(std::move(str));
// istringstream ist{str};
// try
// {
// calculator::WExpression expr(ist);
// double val {expr.result()};
// cout << " = " << val << endl;
// }
// catch(exception& e)
// {
// cout << " = " << "...failed - " << e.what() << endl;
// }
}
}
#endif
#if 0
while (cin)
{
char sym {0};
cin >> sym;
while (cin && sym==calculator::command_stop_expression) cin >> sym;
if (sym == calculator::command_quit_instruction) break;
else cin.unget();
string str;
while (cin)
{
cin >> sym;
if (sym == calculator::command_stop_expression) break;
str += sym;
}
istringstream ist{str};
try
{
std::map<std::string, double> vars {{"x", 3.1},
{"y", 4.2},
{"r", 6.3}};
calculator::WExpression expr(ist, vars);
double val {expr.result()};
cout << " = " << val << endl;
}
catch(exception& e)
{
cout << " = " << "...failed - " << e.what() << endl;
}
}
#else
while (cin)
{
char sym {0};
cin >> sym;
while (cin && sym==command_stop_expression) cin >> sym;
if (sym == command_quit_instruction) break;
else cin.unget();
string str;
while (cin)
{
cin >> sym;
if (sym == command_stop_expression) break;
str += sym;
}
istringstream ist{str};
try
{
CTExpression cte(ist);
cte.set_variable(variableId::x, 3.1);
cte.set_variable(variableId::y, 4.2);
cte.set_variable(variableId::r, 6.3);
double val {cte.value()};
cout << " = " << val << endl;
}
catch(exception& e)
{
cout << " = " << "...failed: '" << e.what() << "'" << endl;
}
}
#endif
return EXIT_SUCCESS;
}
| 25.875862 | 79 | 0.452292 | vega1986 |
98645832e64b85d2cc2cb874c6be52d9743b3dde | 9,706 | cpp | C++ | OpenSees/SRC/domain/pattern/drm/GeometricBrickDecorator.cpp | kuanshi/ductile-fracture | ccb350564df54f5c5ec3a079100effe261b46650 | [
"MIT"
] | 8 | 2019-03-05T16:25:10.000Z | 2020-04-17T14:12:03.000Z | SRC/domain/pattern/drm/GeometricBrickDecorator.cpp | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | null | null | null | SRC/domain/pattern/drm/GeometricBrickDecorator.cpp | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | 3 | 2019-09-21T03:11:11.000Z | 2020-01-19T07:29:37.000Z | #include <cstdlib>
#include "GeometricBrickDecorator.h"
GeometricBrickDecorator::GeometricBrickDecorator()
{
this->myBrick = NULL;
this->myDomain = NULL;
}
GeometricBrickDecorator::~GeometricBrickDecorator()
{ }
void
GeometricBrickDecorator::setBrick(Element* elem)
{
this->myBrick = elem;
}
void
GeometricBrickDecorator::setDomain(Domain * theDomain)
{
this->myDomain = theDomain;
}
void
GeometricBrickDecorator::clearBrick()
{
this->myBrick = NULL;
}
void
GeometricBrickDecorator::clearDomain()
{
this->myDomain = NULL;
}
void
GeometricBrickDecorator::clearAll()
{
this->clearBrick();
this->clearDomain();
}
bool
GeometricBrickDecorator::isClear()
{
return ( (this->myBrick == NULL) && (this->myDomain == NULL) );
}
bool
GeometricBrickDecorator::isEmpty()
{
return ( (this->myBrick == NULL) || (this->myDomain == NULL) );
}
bool
GeometricBrickDecorator::isPointInVolume(const Vector &pP)
{
if ( (this->isClear()) || (this->isEmpty()) ) {
return false;
}
const ID extNodes = this->myBrick->getExternalNodes();
int numExtNodes = this->myBrick->getNumExternalNodes();
if ( numExtNodes != 8) {
return false;
}
// Calculate signed volumes for point and four faces of brick
// in order for the point to be included they must all be
// of negative sign given the orientations used
// also global X+ is 1-4
// global Y+ is 2-3
// global Z+ is 1-5
// implicit is the assupmtion that element is created
// as such that lower left node is node 1, total = 8
// bottom plane is nodes : 1-2-3-4
// top plane is nodes : 5-6-7-8
// and this is the order by which the element is
// defined
// must be less than 0
double bFSV = this->evalSignedVol(
this->myDomain->getNode(extNodes(0))->getCrds(),
this->myDomain->getNode(extNodes(1))->getCrds(),
this->myDomain->getNode(extNodes(2))->getCrds(),
pP);
// must be less than 0
double tFSV = this->evalSignedVol(
this->myDomain->getNode(extNodes(6))->getCrds(),
this->myDomain->getNode(extNodes(5))->getCrds(),
this->myDomain->getNode(extNodes(4))->getCrds(),
pP);
// must be less than 0
double lFSV = this->evalSignedVol(
this->myDomain->getNode(extNodes(3))->getCrds(),
this->myDomain->getNode(extNodes(7))->getCrds(),
this->myDomain->getNode(extNodes(4))->getCrds(),
pP);
// must be less than 0
double rFSV = this->evalSignedVol(
this->myDomain->getNode(extNodes(2))->getCrds(),
this->myDomain->getNode(extNodes(1))->getCrds(),
this->myDomain->getNode(extNodes(5))->getCrds(),
pP);
if ( (bFSV < 0) && (tFSV < 0) && (lFSV < 0)
&& (rFSV < 0)) {
return true;
}
return false;
}
double
GeometricBrickDecorator::evalSignedVol(const Vector &pA,
const Vector &pB,
const Vector &pC,
const Vector &pP)
{
return (1.0/6.0*(
- this->eval3OrderDet(pB, pC, pP)
+ this->eval3OrderDet(pA, pC, pP)
- this->eval3OrderDet(pA, pB, pP)
+ this->eval3OrderDet(pA, pB, pC)
));
}
double
GeometricBrickDecorator::eval3OrderDet(const Vector &pA,
const Vector &pB,
const Vector &pC)
{
return (
pA(0)*pB(1)*pC(2) +
pA(1)*pB(2)*pC(0) +
pA(2)*pB(0)*pC(1) -
pA(0)*pB(2)*pC(1) -
pA(1)*pB(0)*pC(2) -
pA(2)*pB(1)*pC(0) );
}
void
GeometricBrickDecorator::getFace(int which, ID &face, ID& faceID)
{
const ID extNodes = this->myBrick->getExternalNodes();
/*
which == 1 -> bottom
which == 2 -> top
which == 3 -> left
which == 4 -> right
which == 5 -> front
which == 6 -> rear
*/
switch (which) {
case 1:
face(0) = extNodes(0);
face(1) = extNodes(1);
face(2) = extNodes(2);
face(3) = extNodes(3);
faceID(0) = 0;
faceID(1) = 1;
faceID(2) = 2;
faceID(3) = 3;
break;
case 2:
face(0) = extNodes(4);
face(1) = extNodes(5);
face(2) = extNodes(6);
face(3) = extNodes(7);
faceID(0) = 4;
faceID(1) = 5;
faceID(2) = 6;
faceID(3) = 7;
break;
case 3:
face(0) = extNodes(3);
face(1) = extNodes(0);
face(2) = extNodes(4);
face(3) = extNodes(7);
faceID(0) = 3;
faceID(1) = 0;
faceID(2) = 4;
faceID(3) = 7;
break;
case 4:
face(0) = extNodes(2);
face(1) = extNodes(1);
face(2) = extNodes(5);
face(3) = extNodes(6);
faceID(0) = 2;
faceID(1) = 1;
faceID(2) = 5;
faceID(3) = 6;
break;
case 5:
face(0) = extNodes(0);
face(1) = extNodes(1);
face(2) = extNodes(5);
face(3) = extNodes(4);
faceID(0) = 0;
faceID(1) = 1;
faceID(2) = 5;
faceID(3) = 4;
break;
case 6:
face(0) = extNodes(3);
face(1) = extNodes(2);
face(2) = extNodes(6);
face(3) = extNodes(7);
faceID(0) = 3;
faceID(1) = 2;
faceID(2) = 6;
faceID(3) = 7;
break;
default:
face(0) = -1;
face(1) = -1;
face(2) = -1;
face(3) = -1;
faceID(0) = -1;
faceID(1) = -1;
faceID(2) = -1;
faceID(3) = -1;
std::cerr << " ERROR in GeometricBrickDecorator L.233 \n";
break;
}
}
double
GeometricBrickDecorator::getMinMaxCrds(int which, int whichtoret)
{
/*
which goes from 1-> 3
*/
double ret;
Node** nodes = this->myBrick->getNodePtrs();
double maxX = ((Vector&) nodes[1]->getCrds())(0);
double minX = ((Vector&) nodes[0]->getCrds())(0);
double maxY = ((Vector&) nodes[2]->getCrds())(1);
double minY = ((Vector&) nodes[0]->getCrds())(1);
double maxZ = ((Vector&) nodes[4]->getCrds())(2);
double minZ = ((Vector&) nodes[0]->getCrds())(2);
switch(which) {
case 1:
if (whichtoret<=0) {
ret=minX;
}
else {
ret = maxX;
}
break;
case 2:
if (whichtoret<=0) {
ret=minY;
}
else {
ret = maxY;
}
break;
case 3:
if (whichtoret<=0) {
ret=minZ;
}
else {
ret = maxZ;
}
break;
default:
std::cout << " ERROR ERROR ERROR in geometric brick decorator L.252 \n";
ret = 0.0;
}
return ret;
}
bool
GeometricBrickDecorator::compareFaceToFace(int which, ID &faceOther)
{
ID faceID(4);
ID myFace(4);
this->getFace(which, myFace, faceID);
return ( (myFace(0) == faceOther(0)) &&
(myFace(1) == faceOther(1)) &&
(myFace(2) == faceOther(2)) &&
(myFace(3) == faceOther(3))
);
}
bool
GeometricBrickDecorator::isFaceinPlane(int which, const Vector &pP)
{
/*
general form to be implemented in the future
*/
return false;
}
bool
GeometricBrickDecorator::isFaceinVertPlane(int which, double xy, double zmin, double zmax, int whichCrd)
{
/*
which -> which face : look at ::getFace(...)
whichCrd -> 3 for Z
2 for Y
1 for X
*/
int crd = 2;
if ( (which == 1) || (which == 2) ) {
crd = 3;
}
if ( (which == 3) || (which == 4) ) {
crd = 1;
}
ID face(4);
ID faceID(4);
getFace(which, face, faceID);
double maxE = getMinMaxCrds(whichCrd, 1);
double minE = getMinMaxCrds(whichCrd, -1);
Node** nodes = this->myBrick->getNodePtrs();
Node* ndptr;
double d0 = 0.0;
ndptr = nodes[faceID(0)];
if (ndptr == 0 )
opserr << " severe error NULL node ptr GeomDec L.294 \n" ;
d0 = (ndptr->getCrds())(crd-1);
double d1 = 0.0;
ndptr = nodes[faceID(1)];
if (ndptr == 0 )
opserr << " severe error NULL node ptr GeomDec L.299 \n" ;
d1 = (ndptr->getCrds())(crd-1);
double d2 = 0.0;
ndptr = nodes[faceID(2)];
if (ndptr == 0 )
opserr << " severe error NULL node ptr GeomDec L.304 \n" ;
d2 = (ndptr->getCrds())(crd-1);
double d3 = 0.0;
ndptr = nodes[faceID(3)];
if (ndptr == 0 )
opserr << " severe error NULL node ptr GeomDec L.294 \n" ;
d3 = (ndptr->getCrds())(crd-1);
return (( d0== xy) && (d1 == xy) && ( d2 == xy) && (d3 == xy) &&
(maxE <= zmax) &&
(minE >= zmin)
);
}
/*
Private methods used for the publc methods to identify the
DRM boundary layer elements
*/
bool
GeometricBrickDecorator::isLeftBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
return (
isFaceinVertPlane(3, xMin, zMin, zMax, 3) &&
isFaceinVertPlane(3, xMin, yMin, yMax, 2)
);
}
bool
GeometricBrickDecorator::isRightBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
return (
isFaceinVertPlane(4, xMax, zMin, zMax, 3) &&
isFaceinVertPlane(4, xMax, yMin, yMax, 2)
);
}
bool
GeometricBrickDecorator::isFrontBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
return (
isFaceinVertPlane(5, yMin, zMin, zMax, 3) &&
isFaceinVertPlane(5, yMin, xMin, xMax, 1)
);
}
bool
GeometricBrickDecorator::isRearBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
return (
isFaceinVertPlane(6, yMax, zMin, zMax, 3) &&
isFaceinVertPlane(6, yMax, xMin, xMax, 1)
);
}
bool
GeometricBrickDecorator::isBottomBoundary(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
return (
isFaceinVertPlane(1, zMin, xMin, xMax, 1) &&
isFaceinVertPlane(1, zMin, yMin, yMax, 2)
);
}
bool
GeometricBrickDecorator::isBoundaryLayerEle(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
{
if ( isLeftBoundary(xMin, xMax, yMin, yMax, zMin, zMax) ||
isRightBoundary(xMin, xMax, yMin, yMax, zMin, zMax) ||
isFrontBoundary(xMin, xMax, yMin, yMax, zMin, zMax) ||
isRearBoundary(xMin, xMax, yMin, yMax, zMin, zMax) ||
isBottomBoundary(xMin, xMax, yMin, yMax, zMin, zMax)
)
{
return true;
}
return false;
}
| 22.364055 | 121 | 0.594169 | kuanshi |
98647a9fd20bb76d081f2cb841782bcd9340933e | 3,107 | cpp | C++ | test/PAGSmokeTest.cpp | cy-j/libpag | 9b1636a0a67ad5e009d60c6c348034790d247692 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | 2 | 2022-02-26T16:10:30.000Z | 2022-03-18T01:28:40.000Z | test/PAGSmokeTest.cpp | cy-j/libpag | 9b1636a0a67ad5e009d60c6c348034790d247692 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | null | null | null | test/PAGSmokeTest.cpp | cy-j/libpag | 9b1636a0a67ad5e009d60c6c348034790d247692 | [
"BSL-1.0",
"CC0-1.0",
"MIT"
] | null | null | null | /////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tencent is pleased to support the open source community by making libpag available.
//
// Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// unless required by applicable law or agreed to in writing, software distributed under the
// license is distributed on an "as is" basis, without warranties or conditions of any kind,
// either express or implied. see the license for the specific language governing permissions
// and limitations under the license.
//
/////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef SMOKE_TEST
#include <fstream>
#include <vector>
#include "TestUtils.h"
#include "base/utils/TimeUtil.h"
#include "framework/pag_test.h"
#include "framework/utils/Baseline.h"
#include "framework/utils/PAGTestUtils.h"
namespace pag {
/**
* 用例描述: smoke文件夹下文件是否渲染正常
*/
PAG_TEST(PAGSmokeTest, RenderFrames) {
std::vector<std::string> files;
GetAllPAGFiles("../resources/smoke", files);
int size = static_cast<int>(files.size());
for (int i = 0; i < size; i++) {
auto fileName = files[i].substr(files[i].rfind("/") + 1, files[i].size());
auto pagFile = PAGFile::Load(files[i]);
auto width = pagFile->width();
auto height = pagFile->height();
if (std::min(width, height) > 360) {
if (width > height) {
width = static_cast<int>(
ceilf(static_cast<float>(width) * 360.0f / static_cast<float>(height)));
height = 360;
} else {
height = static_cast<int>(
ceilf(static_cast<float>(height) * 360.0f / static_cast<float>(width)));
width = 360;
}
}
ASSERT_NE(pagFile, nullptr);
auto pagSurface = PAGSurface::MakeOffscreen(width, height);
ASSERT_NE(pagSurface, nullptr);
auto pagPlayer = std::make_shared<PAGPlayer>();
pagPlayer->setSurface(pagSurface);
pagPlayer->setComposition(pagFile);
Frame totalFrames = TimeToFrame(pagFile->duration(), pagFile->frameRate());
Frame currentFrame = 0;
std::string errorMsg = "";
while (currentFrame < totalFrames) {
// 添加0.1帧目的是保证progress不会由于精度问题帧数计算错误,frame应该使用totalFrames作为总体帧数。因为对于
// file来说总时长为[0,totalFrames],对应于[0,1],因此归一化时,分母应该为totalFrames
pagPlayer->setProgress((static_cast<float>(currentFrame) + 0.1) * 1.0 /
static_cast<float>(totalFrames));
pagPlayer->flush();
auto snapshot = MakeSnapshot(pagSurface);
auto result =
Baseline::Compare(snapshot, "PAGSmokeTest/" + std::to_string(currentFrame) + "");
if (!result) {
errorMsg += (std::to_string(currentFrame) + ";");
}
currentFrame++;
}
EXPECT_EQ(errorMsg, "") << fileName << " frame fail";
}
}
} // namespace pag
#endif
| 36.988095 | 97 | 0.619569 | cy-j |
986c3bac652a073dced6ab0e9d68ce41b4f61914 | 3,326 | cpp | C++ | src/lava_lib/reader_bgeo/test/test_sphere_grid.cpp | cinepost/Falcor | f70bd1d97c064d6f91a017d4409aa2037fd6903a | [
"BSD-3-Clause"
] | 7 | 2018-09-25T23:45:52.000Z | 2021-07-07T04:08:01.000Z | src/lava_lib/reader_bgeo/test/test_sphere_grid.cpp | cinepost/Falcor | f70bd1d97c064d6f91a017d4409aa2037fd6903a | [
"BSD-3-Clause"
] | 2 | 2021-03-02T10:16:06.000Z | 2021-08-13T10:10:21.000Z | src/lava_lib/reader_bgeo/test/test_sphere_grid.cpp | cinepost/Lava | f70bd1d97c064d6f91a017d4409aa2037fd6903a | [
"BSD-3-Clause"
] | 3 | 2020-06-07T05:47:48.000Z | 2020-10-03T12:34:54.000Z | /*
* Copyright 2018 Laika, LLC. Authored by Peter Stuart
*
* Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
* http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
* http://opensource.org/licenses/MIT>, at your option. This file may not be
* copied, modified, or distributed except according to those terms.
*/
#include <hboost/test/unit_test.hpp>
#include "bgeo/Bgeo.h"
#include "bgeo/Poly.h"
#include "bgeo/Sphere.h"
namespace ika
{
namespace bgeo
{
namespace test_sphere_grid
{
HBOOST_AUTO_TEST_CASE(test_sphere_grid)
{
Bgeo bgeo("geo/sphere_grid.geo");
HBOOST_CHECK_EQUAL(5, bgeo.getPointCount());
HBOOST_CHECK_EQUAL(5, bgeo.getTotalVertexCount());
HBOOST_CHECK_EQUAL(2, bgeo.getPrimitiveCount());
auto primitive = bgeo.getPrimitive(0);
HBOOST_CHECK(primitive);
HBOOST_CHECK(primitive->isType<Sphere>());
const Sphere* sphere = primitive->cast<Sphere>();
HBOOST_CHECK(sphere);
double expected_sphere_P[] = {
4, 0, 0
};
double Pd[3];
sphere->getTranslate(Pd);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_sphere_P[0],
&expected_sphere_P[3],
&Pd[0], &Pd[3]);
double expected_sphere_xform[] = {
0.800000011921, 0, 0, 0,
0, 0, -0.800000011921, 0,
0, 0.800000011921, 0, 0,
0, 0, 0, 1
};
double matrix[16];
sphere->getExtraTransform(matrix);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_sphere_xform[0],
&expected_sphere_xform[16],
&matrix[0], &matrix[16]);
int32_t expected_grid_vertices[] = {
1, 2, 4, 3
};
int32_t expected_grid_start[] = {
0, 4
};
auto gridPrimitive = bgeo.getPrimitive(1);
HBOOST_CHECK(gridPrimitive);
HBOOST_CHECK(gridPrimitive->isType<Poly>());
auto grid = gridPrimitive->cast<Poly>();
HBOOST_CHECK(grid);
HBOOST_CHECK_EQUAL(4, grid->getVertexCount());
HBOOST_CHECK_EQUAL(1, grid->getFaceCount());
std::vector<int32_t> vertices;
grid->getVertexList(vertices);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_grid_vertices[0], &expected_grid_vertices[4],
vertices.begin(), vertices.end());
std::vector<int32_t> startIndices;
grid->getStartIndices(startIndices);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_grid_start[0], &expected_grid_start[2],
startIndices.begin(), startIndices.end());
float expected_grid_P[] = {
4, 0, 0,
-0.5, 0, -0.5,
0.5, 0, -0.5,
-0.5, 0, 0.5,
0.5, 0, 0.5
};
float expected_grid_uv[] = {
0.84905654192, 0.5,
0, 0.1875,
0.188679233193, 0.1875,
0.188679233193, 0.8125,
0, 0.8125
};
std::vector<float> P;
bgeo.getP(P);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_grid_P[0], &expected_grid_P[15],
P.begin(), P.end());
std::vector<float> uv;
bgeo.getVertexUV(uv);
HBOOST_CHECK_EQUAL_COLLECTIONS(&expected_grid_uv[0], &expected_grid_uv[10],
uv.begin(), uv.end());
}
} // namespace test_sphere_grid
} // namespace bgeo
} // namespace ika
| 27.262295 | 90 | 0.605232 | cinepost |
986cf9d18eb8becd9ea2150c7940ec2db9eada36 | 2,607 | cpp | C++ | core/src/view/TileView.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | 2 | 2020-10-16T10:15:37.000Z | 2021-01-21T13:06:00.000Z | core/src/view/TileView.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | null | null | null | core/src/view/TileView.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | 1 | 2021-01-28T01:19:54.000Z | 2021-01-28T01:19:54.000Z | /*
* TileView.cpp
*
* Copyright (C) 2010 by VISUS (Universitaet Stuttgart).
* Alle Rechte vorbehalten.
*/
#include "stdafx.h"
#include "mmcore/view/TileView.h"
#include "vislib/memutils.h"
using namespace megamol::core;
using vislib::graphics::CameraParameters;
/*
* view::TileView::TileView
*/
view::TileView::TileView(void) : AbstractTileView(), firstFrame(false), outCtrl(NULL) {
}
/*
* view::TileView::~TileView
*/
view::TileView::~TileView(void) {
this->Release();
}
/*
* view::TileView::Render
*/
void view::TileView::Render(const mmcRenderViewContext& context) {
view::CallRenderView *crv = this->getCallRenderView();
if (crv == NULL) return; // false ?
if (this->firstFrame) {
this->initTileViewParameters();
this->firstFrame = false;
}
this->checkParameters();
crv->ResetAll();
crv->SetTime(static_cast<float>(context.Time));
crv->SetInstanceTime(context.InstanceTime);
crv->SetProjection(this->getProjType(), this->getEye());
crv->SetGpuAffinity(context.GpuAffinity);
if ((this->getVirtWidth() != 0) && (this->getVirtHeight() != 0)
&& (this->getTileW() != 0) && (this->getTileH() != 0)) {
crv->SetTile(this->getVirtWidth(), this->getVirtHeight(),
this->getTileX(), this->getTileY(), this->getTileW(), this->getTileH());
}
if (this->outCtrl == NULL) {
crv->SetOutputBuffer(GL_BACK, this->getViewportWidth(), this->getViewportHeight()); // TODO: Fix me!
} else {
crv->SetOutputBuffer(*this->outCtrl);
}
(*crv)(view::CallRenderView::CALL_RENDER);
}
/*
* view::TileView::create
*/
bool view::TileView::create(void) {
this->firstFrame = true;
return true;
}
/*
* view::TileView::release
*/
void view::TileView::release(void) {
// intentionally empty
}
/*
* view::TileView::OnRenderView
*/
bool view::TileView::OnRenderView(Call& call) {
view::CallRenderView *crv = dynamic_cast<view::CallRenderView *>(&call);
if (crv == NULL) return false;
this->outCtrl = crv;
mmcRenderViewContext c;
::ZeroMemory(&c, sizeof(mmcRenderViewContext));
c.Size = sizeof(mmcRenderViewContext);
c.Time = crv->Time();
if (c.Time < 0.0f) c.Time = this->DefaultTime(crv->InstanceTime());
c.InstanceTime = crv->InstanceTime();
// TODO: Affinity
this->Render(c);
// TODO: Fix me!
this->outCtrl = NULL;
return true;
}
/*
* view::TileView::unpackMouseCoordinates
*/
void view::TileView::unpackMouseCoordinates(float &x, float &y) {
x *= this->getTileW();
y *= this->getTileH();
}
| 23.070796 | 108 | 0.632528 | voei |
986de253998848da15157e3b571e0ea914336a35 | 4,668 | cpp | C++ | src/moore.cpp | poluyan/MultiDimFloodFill | 388b38a4bfb643b708524d04ab296a40e4d3e087 | [
"Apache-2.0"
] | null | null | null | src/moore.cpp | poluyan/MultiDimFloodFill | 388b38a4bfb643b708524d04ab296a40e4d3e087 | [
"Apache-2.0"
] | null | null | null | src/moore.cpp | poluyan/MultiDimFloodFill | 388b38a4bfb643b708524d04ab296a40e4d3e087 | [
"Apache-2.0"
] | null | null | null | #include "moore.h"
#include "pdf.h"
void FloodFill_MultipleGrids_Moore(const std::vector<std::vector<double>> &grids,
std::vector<std::vector<int>> &points,
std::set<std::vector<int>> &visited,
std::vector<std::vector<double>> &samples,
const std::vector<double> &dx,
size_t &counter,
size_t &fe_count,
bool outside_bounds)
{
/// generate all permutations
std::vector<std::vector<int>> variable_values(grids.size(), std::vector<int>(3));
for(size_t i = 0; i != variable_values.size(); i++)
{
variable_values[i][0] = -1;
variable_values[i][1] = 0;
variable_values[i][2] = 1;
}
std::vector<std::vector<int>> permut = iterate(variable_values);
while(!points.empty())
{
auto t = points.back();
points.pop_back();
auto it = visited.find(t);
if(!(it == visited.end()))
{
counter++;
continue;
}
visited.insert(t);
std::vector<double> dot(t.size());
for(size_t i = 0; i != dot.size(); i++)
{
dot[i] = grids[i][t[i]] + dx[i];
}
bool val = pdf(dot);
fe_count++;
if(val)
{
std::vector<int> point = t;
samples.push_back(dot);
// n-dimensional Moore distance with r = 1
for(size_t i = 0; i != permut.size(); i++)
{
point = t;
if(outside_bounds)
{
for(size_t j = 0; j != point.size(); j++)
{
point[j] = point[j] + permut[i][j];
if(point[j] < 0)
{
point[j] = grids[j].size() - 1;
}
if(point[j] > static_cast<int>(grids[j].size() - 1))
{
point[j] = 0;
}
}
}
else
{
bool flag = true;
for(size_t j = 0; j != point.size(); j++)
{
point[j] = point[j] + permut[i][j];
if(point[j] < 0 || point[j] > static_cast<int>(grids[j].size() - 1))
{
flag = false;
break;
}
}
if(!flag)
continue;
}
points.push_back(point);
}
}
}
}
void b4MultipleGrids_Moore(const std::vector<double> &init_point, size_t grid_sizes, bool outside_bounds)
{
size_t dim = init_point.size();
std::vector<double> grid(dim, grid_sizes);
std::vector<std::vector<double>> grids(grid.size());
std::vector<double> dx(grid.size());
double lb = -3, ub = 3;
for(size_t i = 0; i != grids.size(); i++)
{
size_t num_points = grid[i];
std::vector<double> onegrid(num_points);
double startp = lb;
double endp = ub;
double es = endp - startp;
for(size_t j = 0; j != onegrid.size(); j++)
{
onegrid[j] = startp + j*es/(num_points);
}
grids[i] = onegrid;
dx[i] = es/(num_points*2);
}
// finding start dot over created grid
std::vector<int> startdot(init_point.size());
for(size_t i = 0; i != startdot.size(); i++)
{
std::vector<double> val(grids[i].size());
for(size_t j = 0; j != val.size(); j++)
{
val[j] = grids[i][j] + dx[i];
}
auto pos1 = std::lower_bound(val.begin(), val.end(), init_point[i]);
startdot[i] = std::distance(val.begin(), pos1) - 1;
}
std::vector<std::vector<int>> points;
std::vector<std::vector<int>> boundary;
points.push_back(startdot);
std::set<std::vector<int>> visited;
std::vector<std::vector<double> > samples;
size_t counter = 0;
size_t fe_count = 0;
FloodFill_MultipleGrids_Moore(grids, points, visited, samples, dx, counter, fe_count, outside_bounds);
std::cout << counter << std::endl;
std::cout << "fe count: " << fe_count << std::endl;
std::cout << "samples: " << samples.size() << std::endl;
std::cout << samples.size()/double(fe_count) << std::endl;
//print2file2d("maps/sample2d.dat", samples);
}
| 31.328859 | 106 | 0.442588 | poluyan |
9874b9330495feffcc5fe589e999cb7eeaeefdcc | 6,542 | cpp | C++ | qt-creator-opensource-src-4.6.1/tests/unit/unittest/diagnostic-test.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 5 | 2018-12-22T14:49:13.000Z | 2022-01-13T07:21:46.000Z | qt-creator-opensource-src-4.6.1/tests/unit/unittest/diagnostic-test.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | null | null | null | qt-creator-opensource-src-4.6.1/tests/unit/unittest/diagnostic-test.cpp | kevinlq/Qt-Creator-Opensource-Study | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | [
"MIT"
] | 8 | 2018-07-17T03:55:48.000Z | 2021-12-22T06:37:53.000Z | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "googletest.h"
#include "diagnosticcontainer-matcher.h"
#include "rundocumentparse-utility.h"
#include "testenvironment.h"
#include <diagnostic.h>
#include <diagnosticcontainer.h>
#include <diagnosticset.h>
#include <fixitcontainer.h>
#include <projectpart.h>
#include <clangdocument.h>
#include <clangdocuments.h>
#include <clangtranslationunit.h>
#include <projects.h>
#include <unsavedfiles.h>
#include <sourcelocation.h>
#include <sourcerange.h>
#include <clang-c/Index.h>
using ::testing::Contains;
using ::testing::Not;
using ::testing::PrintToString;
using ClangBackEnd::DiagnosticSet;
using ClangBackEnd::DiagnosticContainer;
using ClangBackEnd::Document;
using ClangBackEnd::Documents;
using ClangBackEnd::ProjectPart;
using ClangBackEnd::UnsavedFiles;
using ClangBackEnd::Diagnostic;
using ClangBackEnd::SourceLocation;
using ClangBackEnd::DiagnosticSeverity;
using ClangBackEnd::FixItContainer;
using ClangBackEnd::SourceLocationContainer;
namespace {
MATCHER_P4(IsSourceLocation, filePath, line, column, offset,
std::string(negation ? "isn't" : "is")
+ " source location with file path "+ PrintToString(filePath)
+ ", line " + PrintToString(line)
+ ", column " + PrintToString(column)
+ " and offset " + PrintToString(offset)
)
{
if (!arg.filePath().endsWith(filePath)
|| arg.line() != line
|| arg.column() != column
|| arg.offset() != offset)
return false;
return true;
}
class Diagnostic : public ::testing::Test
{
protected:
enum ChildMode { WithChild, WithoutChild };
DiagnosticContainer expectedDiagnostic(ChildMode childMode) const;
protected:
ProjectPart projectPart{Utf8StringLiteral("projectPartId"),
TestEnvironment::addPlatformArguments({Utf8StringLiteral("-std=c++11")})};
ClangBackEnd::ProjectParts projects;
ClangBackEnd::UnsavedFiles unsavedFiles;
ClangBackEnd::Documents documents{projects, unsavedFiles};
Document document{Utf8StringLiteral(TESTDATA_DIR"/diagnostic_diagnostic.cpp"),
projectPart,
Utf8StringVector(),
documents};
UnitTest::RunDocumentParse _1{document};
DiagnosticSet diagnosticSet{document.translationUnit().diagnostics()};
::Diagnostic diagnostic{diagnosticSet.front()};
};
using DiagnosticSlowTest = Diagnostic;
TEST_F(DiagnosticSlowTest, MoveContructor)
{
const auto diagnostic2 = std::move(diagnostic);
ASSERT_TRUE(diagnostic.isNull());
ASSERT_FALSE(diagnostic2.isNull());
}
TEST_F(DiagnosticSlowTest, MoveAssigment)
{
auto diagnostic2 = std::move(diagnostic);
diagnostic = std::move(diagnostic2);
ASSERT_TRUE(diagnostic2.isNull());
ASSERT_FALSE(diagnostic.isNull());
}
TEST_F(DiagnosticSlowTest, MoveSelfAssigment)
{
diagnostic = std::move(diagnostic);
ASSERT_FALSE(diagnostic.isNull());
}
TEST_F(DiagnosticSlowTest, Text)
{
ASSERT_THAT(diagnostic.text(), Utf8StringLiteral("warning: control reaches end of non-void function"));
}
TEST_F(DiagnosticSlowTest, Category)
{
ASSERT_THAT(diagnostic.category(), Utf8StringLiteral("Semantic Issue"));
}
TEST_F(DiagnosticSlowTest, EnableOption)
{
ASSERT_THAT(diagnostic.options().first, Utf8StringLiteral("-Wreturn-type"));
}
TEST_F(DiagnosticSlowTest, DisableOption)
{
ASSERT_THAT(diagnostic.options().second, Utf8StringLiteral("-Wno-return-type"));
}
TEST_F(DiagnosticSlowTest, Severity)
{
ASSERT_THAT(diagnostic.severity(), DiagnosticSeverity::Warning);
}
TEST_F(DiagnosticSlowTest, ChildDiagnosticsSize)
{
auto diagnostic = diagnosticSet.back();
ASSERT_THAT(diagnostic.childDiagnostics().size(), 1);
}
TEST_F(DiagnosticSlowTest, ChildDiagnosticsText)
{
auto childDiagnostic = diagnosticSet.back().childDiagnostics().front();
ASSERT_THAT(childDiagnostic.text(), Utf8StringLiteral("note: candidate function not viable: requires 1 argument, but 0 were provided"));
}
TEST_F(DiagnosticSlowTest, toDiagnosticContainerLetChildrenThroughByDefault)
{
const auto diagnosticWithChild = expectedDiagnostic(WithChild);
const auto diagnostic = diagnosticSet.back().toDiagnosticContainer();
ASSERT_THAT(diagnostic, IsDiagnosticContainer(diagnosticWithChild));
}
DiagnosticContainer Diagnostic::expectedDiagnostic(Diagnostic::ChildMode childMode) const
{
QVector<DiagnosticContainer> children;
if (childMode == WithChild) {
const auto child = DiagnosticContainer(
Utf8StringLiteral("note: candidate function not viable: requires 1 argument, but 0 were provided"),
Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Note,
SourceLocationContainer(document.filePath(), 5, 6),
{},
{},
{}
);
children.append(child);
}
return
DiagnosticContainer(
Utf8StringLiteral("error: no matching function for call to 'f'"),
Utf8StringLiteral("Semantic Issue"),
{Utf8String(), Utf8String()},
ClangBackEnd::DiagnosticSeverity::Error,
SourceLocationContainer(document.filePath(), 7, 5),
{},
{},
children
);
}
}
| 31.301435 | 140 | 0.694283 | kevinlq |
987b5047e513fc893fa90e342c6c2422d33d0512 | 1,371 | cpp | C++ | hard/23_merge_k_sorted_lists.cpp | pdu/leetcode_cpp | c487df7561f92562b20a31317957f47e0a20c485 | [
"Apache-2.0"
] | 4 | 2019-07-22T03:53:23.000Z | 2019-10-17T01:37:41.000Z | hard/23_merge_k_sorted_lists.cpp | pdu/leetcode_cpp | c487df7561f92562b20a31317957f47e0a20c485 | [
"Apache-2.0"
] | null | null | null | hard/23_merge_k_sorted_lists.cpp | pdu/leetcode_cpp | c487df7561f92562b20a31317957f47e0a20c485 | [
"Apache-2.0"
] | 2 | 2020-03-10T03:30:41.000Z | 2020-11-10T06:51:34.000Z | // step 1: clarify
//
// quite straightforward
//
// step 2: solutions
//
// set the pointer to each of the list head, put all the values into the priority_queue
// pop the minimum value one and move the related pointer to the next position
// time complexity: O(n * logk), n is the total number
// space complexity: O(k)
//
// step 3: coding
//
// can put a soldier to make the code easier
//
// step 4: testing
#include <vector>
#include <queue>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode* mergeKLists(vector<ListNode*>& lists) {
priority_queue<pair<int, int>, vector<pair<int, int>> ,greater<pair<int, int>>> min_heap;
for (int i = 0; i < lists.size(); ++i)
if (lists[i] != nullptr)
min_heap.emplace(lists[i]->val, i);
ListNode head(0);
ListNode* curr = &head;
while (!min_heap.empty()) {
auto top = min_heap.top();
min_heap.pop();
curr->next = lists[top.second];
curr = curr->next;
lists[top.second] = lists[top.second]->next;
if (lists[top.second] != nullptr)
min_heap.emplace(lists[top.second]->val, top.second);
}
curr->next = nullptr;
return head.next;
}
};
| 26.882353 | 97 | 0.585704 | pdu |
987c13da8e127766ca6345d5ddce03632607dd2a | 7,692 | cpp | C++ | saber/funcs/impl/cuda/vender_permute_power.cpp | pangge/Anakin | f327267d1ee2038d92d8c704ec9f1a03cb800fc8 | [
"Apache-2.0"
] | 533 | 2018-05-18T06:14:04.000Z | 2022-03-23T11:46:30.000Z | saber/funcs/impl/cuda/vender_permute_power.cpp | pangge/Anakin | f327267d1ee2038d92d8c704ec9f1a03cb800fc8 | [
"Apache-2.0"
] | 100 | 2018-05-26T08:32:48.000Z | 2022-03-17T03:26:25.000Z | saber/funcs/impl/cuda/vender_permute_power.cpp | pangge/Anakin | f327267d1ee2038d92d8c704ec9f1a03cb800fc8 | [
"Apache-2.0"
] | 167 | 2018-05-18T06:14:35.000Z | 2022-02-14T01:44:20.000Z |
#include "saber/funcs/impl/cuda/vender_permute_power.h"
namespace anakin{
namespace saber{
template class VenderPermutePower<NV, AK_FLOAT>;
template <>
SaberStatus VenderPermutePower<NV, AK_FLOAT>::\
create(const std::vector<Tensor<NV>*>&inputs,
std::vector<Tensor<NV>*>& outputs,
PermutePowerParam<NV> ¶m, Context<NV> &ctx) {
if (!(&ctx == this->_ctx)) {
if (_handle != NULL) {
CUDNN_CHECK(cudnnDestroy(_handle));
}
this->_ctx = &ctx;
cudaStream_t cuda_stream;
cuda_stream = ctx.get_compute_stream();
CUDNN_CHECK(cudnnCreate(&_handle));
CUDNN_CHECK(cudnnSetStream(_handle, cuda_stream));
}
int input_num = inputs[0]->num();
int input_channel = inputs[0]->channel();
int input_height = inputs[0]->height();
int input_width = inputs[0]->width();
bool is_nhwc_to_nchw = param.permute_param.order == std::vector<int>({0, 3, 1, 2});
bool is_nchw_to_nhwc = param.permute_param.order == std::vector<int>({0, 2, 3, 1});
if (inputs[0]->shape() == inputs[0]->valid_shape()) {
if (is_nhwc_to_nchw) {
cudnn::setTensor4dDesc<float>(&_input_descs, CUDNN_TENSOR_NHWC,
input_num, input_width, input_channel, input_height);
cudnn::setTensor4dDesc<float>(&_output_descs, CUDNN_TENSOR_NCHW,
input_num, input_width, input_channel, input_height);
} else if (is_nchw_to_nhwc){
cudnn::setTensor4dDesc<float>(&_input_descs, CUDNN_TENSOR_NCHW,
input_num, input_channel, input_height, input_width);
cudnn::setTensor4dDesc<float>(&_output_descs, CUDNN_TENSOR_NHWC,
input_num, input_channel, input_height, input_width);
} else {
//we only support nchw <----> nhwc({0, 3, 1, 2} and {0, 2, 3, 1})
return SaberUnImplError;
}
} else {
Shape input_stride = inputs[0]->get_stride();
Shape output_stride = outputs[0]->get_stride();
int in_num = inputs[0]->num();
int in_channel = inputs[0]->channel();
int in_height = inputs[0]->height();
int in_width = inputs[0]->width();
int out_num = outputs[0]->num();
int out_channel = outputs[0]->channel();
int out_height = outputs[0]->height();
int out_width = outputs[0]->width();
int num_index = inputs[0]->num_index();
int channel_index = inputs[0]->channel_index();
int height_index = inputs[0]->height_index();
int width_index = inputs[0]->width_index();
if (is_nhwc_to_nchw) {
cudnn::setTensor4dDescEx<float>(&_input_descs,
in_num, in_width, in_channel, in_height,
input_stride[num_index],
input_stride[width_index],
input_stride[channel_index],
input_stride[height_index]
);
cudnn::setTensor4dDescEx<float>(&_output_descs,
out_num, out_channel, out_height, out_width,
output_stride[num_index],
output_stride[channel_index],
output_stride[height_index],
output_stride[width_index]
);
} else if (is_nchw_to_nhwc) {
cudnn::setTensor4dDescEx<float>(&_input_descs,
in_num, in_channel, in_height, in_width,
input_stride[num_index],
input_stride[channel_index],
input_stride[height_index],
input_stride[width_index]
);
cudnn::setTensor4dDescEx<float>(&_output_descs,
out_num, out_width, out_channel, out_height,
output_stride[num_index],
output_stride[width_index],
output_stride[channel_index],
output_stride[height_index]
);
} else {
//we only support nchw <----> nhwc({0, 3, 1, 2} and {0, 2, 3, 1})
return SaberUnImplError;
}
}
return SaberSuccess;
}
template <>
SaberStatus VenderPermutePower<NV, AK_FLOAT>::\
init(const std::vector<Tensor<NV> *>& inputs,
std::vector<Tensor<NV> *>& outputs,
PermutePowerParam<NV> ¶m, \
Context<NV> &ctx) {
this->_ctx = &ctx;
// ---- get cuda resources ----
cudaStream_t cuda_stream;
cuda_stream = ctx.get_compute_stream();
CUDNN_CHECK(cudnnCreate(&_handle));
CUDNN_CHECK(cudnnSetStream(_handle, cuda_stream));
// ---- create cudnn Descs ----
cudnn::createTensorDesc<float>(&_input_descs);
cudnn::createTensorDesc<float>(&_output_descs);
return create(inputs, outputs, param, ctx);
}
//call cudnnConvolutionForward here
template <>
SaberStatus VenderPermutePower<NV, AK_FLOAT>::\
dispatch(const std::vector<Tensor<NV>*>& inputs,
std::vector<Tensor<NV>*>& outputs,
PermutePowerParam<NV> ¶m) {
const float* input_data = (const float*)inputs[0]->data();
float* output_data = (float*)outputs[0]->mutable_data();
float scale = param.power_param.scale;
float shift = param.power_param.shift;
float power = param.power_param.power;
bool is_nhwc_to_nchw = param.permute_param.order == std::vector<int>({0, 3, 1, 2});
bool is_nchw_to_nhwc = param.permute_param.order == std::vector<int>({0, 2, 3, 1});
if (shift != 0.f || power != 1.f ) {
LOG(ERROR) << "cudnn permute does not support shift and power";
return SaberUnImplError;
} else {
//we only support nchw<->nhwc({0, 3, 1, 2} and {0, 2, 3, 1})
if (!(is_nhwc_to_nchw || is_nchw_to_nhwc)){
LOG(ERROR) << "cudnn permute does not support this layout";
return SaberUnImplError;
}
CUDNN_CHECK(cudnnTransformTensor(_handle,
(void*)(&scale),
_input_descs, input_data,
cudnn::cudnnTypeWrapper<float>::kZero(),
_output_descs, output_data));
}
return SaberSuccess;
}
DEFINE_OP_TEMPLATE(VenderPermutePower, PermutePowerParam, NV, AK_HALF);
DEFINE_OP_TEMPLATE(VenderPermutePower, PermutePowerParam, NV, AK_INT8);
} //namespace saber
} //namespace anakin
| 47.190184 | 99 | 0.49103 | pangge |
987e0f569b3a20a8ca5190c5c042bae92e760ecd | 2,637 | hh | C++ | tce/src/applibs/wxToolkit/GUIOptions/ToolbarButton.hh | kanishkan/tce | 430e764b4d43f46bd1dc754aeb1d5632fc742110 | [
"MIT"
] | 74 | 2015-10-22T15:34:10.000Z | 2022-03-25T07:57:23.000Z | tce/src/applibs/wxToolkit/GUIOptions/ToolbarButton.hh | kanishkan/tce | 430e764b4d43f46bd1dc754aeb1d5632fc742110 | [
"MIT"
] | 79 | 2015-11-19T09:23:08.000Z | 2022-01-12T14:15:16.000Z | tce/src/applibs/wxToolkit/GUIOptions/ToolbarButton.hh | kanishkan/tce | 430e764b4d43f46bd1dc754aeb1d5632fc742110 | [
"MIT"
] | 38 | 2015-11-17T10:12:23.000Z | 2022-03-25T07:57:24.000Z | /*
Copyright (c) 2002-2009 Tampere University.
This file is part of TTA-Based Codesign Environment (TCE).
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/**
* @file ToolbarButton.hh
*
* Declaration of ToolbarButton class.
*
* @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
* @note rating: red
*/
#ifndef TTA_TOOLBAR_BUTTON_HH
#define TTA_TOOLBAR_BUTTON_HH
#include <string>
#include "Serializable.hh"
#include "Exception.hh"
/**
* This class repsesents a toolbar button. It contains information
* which action is performed by the button and where the button is
* placed in the toolbar. This class implements the Serializable
* interface because toolbar button configurations are serialized in the
* configuration file.
*/
class ToolbarButton : public Serializable {
public:
/// ObjectState name for ToolbarButton.
static const std::string OSNAME_TOOLBAR_BUTTON;
/// ObjectState attribute key for slot position.
static const std::string OSKEY_SLOT;
/// ObjectState attribute key for action name.
static const std::string OSKEY_ACTION;
ToolbarButton(int slot, const std::string& action);
ToolbarButton(const ObjectState* state);
ToolbarButton(const ToolbarButton& old);
virtual ~ToolbarButton();
std::string action() const;
int slot() const;
void loadState(const ObjectState* state);
ObjectState* saveState() const;
private:
/// Number of the slot in which this toolbar button is.
int slot_;
/// Name of the action performed by this toolbar button.
std::string action_;
};
#endif
| 34.697368 | 78 | 0.738718 | kanishkan |
987fd977e4e261af31b0736f215f562fb8f784a3 | 7,443 | cpp | C++ | Source/System/CacheManager.cpp | gunstarpl/Game-Engine-12-2013 | bfc53f5c998311c17e97c1b4d65792d615c51d36 | [
"MIT",
"Unlicense"
] | 6 | 2017-12-31T17:28:40.000Z | 2021-12-04T06:11:34.000Z | Source/System/CacheManager.cpp | gunstarpl/Game-Engine-12-2013 | bfc53f5c998311c17e97c1b4d65792d615c51d36 | [
"MIT",
"Unlicense"
] | null | null | null | Source/System/CacheManager.cpp | gunstarpl/Game-Engine-12-2013 | bfc53f5c998311c17e97c1b4d65792d615c51d36 | [
"MIT",
"Unlicense"
] | null | null | null | #include "Precompiled.hpp"
#include "CacheManager.hpp"
#include "MainGlobal.hpp"
namespace
{
// Log error messages.
#define LogInitializeError() "Failed to initialize the cache manager! "
#define LogRecreateCacheError() "Failed to recreate the cache! "
// Cache registry filename.
const char* CacheRegistryFile = "d39bf4ad-b0b4-4807-99a5-75941ce8a997";
// Cache registry format type (also the header's magic word).
const char* FormatType = "CacheRegistry";
// Cache registry version. Increasing it will cause upgrade of the cache, if not available it will be recreated.
unsigned int RegistryVersion = 1;
// Cache integrity version. Increasing it will force the whole cache to recreate.
unsigned int IntegrityVersion = 1;
}
CacheManager::CacheManager() :
m_initialized(false)
{
}
CacheManager::~CacheManager()
{
Cleanup();
}
bool CacheManager::Initialize()
{
Cleanup();
// Emergency cleanup call on failure.
auto EmergenyCleanup = MakeScopeGuard([&]()
{
// Cleanup if initialization failed.
if(!m_initialized)
{
Cleanup();
}
});
// Load the cache.
if(!LoadCache())
{
Log() << "Recreating the cache...";
// Recreate the cache if it doesn't exist or it can't be used for some reason.
if(!RecreateCache())
{
Log() << LogInitializeError() << "Couldn't recreate the cache!";
return false;
}
}
// Success!
m_initialized = true;
return true;
}
void CacheManager::Cleanup()
{
// Save cache registry.
SaveCache();
// Cleanup members.
ClearContainer(m_registry);
m_initialized = false;
}
std::string CacheManager::Lookup(std::string filename)
{
// Find an existing entry.
auto it = m_registry.find(filename);
if(it != m_registry.end())
{
std::string identifier = boost::uuids::to_string(it->second);
return identifier;
}
// Create a new identifier.
boost::uuids::uuid uuid;
std::string identifier;
do
{
uuid = boost::uuids::random_generator()();
identifier = boost::uuids::to_string(uuid);
}
while(boost::filesystem::exists(Main::GetCacheDir() + identifier));
// Add a new cache entry.
m_registry.insert(std::make_pair(filename, uuid));
return identifier;
}
bool CacheManager::LoadCache()
{
// Open the cache registry.
std::ifstream registryFile(Main::GetCacheDir() + CacheRegistryFile);
if(!registryFile.is_open())
{
Log() << "Can't open the cache registry!";
return false;
}
// Read the file header.
std::string formatType;
unsigned int registryVersion;
unsigned int integrityVersion;
registryFile >> formatType;
registryFile >> registryVersion;
registryFile >> integrityVersion;
if(!registryFile.good())
{
Log() << "Can't read the cache registry header!";
return false;
}
// Validate the header.
if(formatType != FormatType)
{
Log() << "Invalid cache registry header!";
return false;
}
if(registryVersion != registryVersion)
{
Log() << "Invalid cache registry version.";
return false;
}
if(integrityVersion != IntegrityVersion)
{
Log() << "Cache integrity version mismatch.";
return false;
}
// Move to next line after reading the header.
registryFile >> std::ws;
// Setup scope guard to clear registry entries we could've added past this point.
auto clearRegistryEntires = MakeScopeGuard([&]()
{
ClearContainer(m_registry);
});
// Read the cache registry.
std::string line;
while(!registryFile.eof())
{
// Read the line.
std::getline(registryFile, line);
if(line.empty())
continue;
// Create the tokenizer.
boost::escaped_list_separator<char> separator('\\', ' ', '\"');
boost::tokenizer<boost::escaped_list_separator<char>> tokens(line, separator);
// Next token read function.
auto token = tokens.begin();
auto ReadNextToken = [&](std::string& output) -> bool
{
if(token != tokens.end())
{
output = *token++;
return true;
}
return false;
};
// Read the registry entry tokens.
std::string identifier;
std::string filename;
if(!ReadNextToken(identifier) || !ReadNextToken(filename))
{
Log() << "Can't read a cache registry entry!";
return false;
}
// Check if cache file is valid.
if(!ValidateCache(identifier))
{
Log() << "Discarded an invalid cache registry entry.";
continue;
}
// Convert identifier to UUID structure.
boost::uuids::uuid uuid = boost::uuids::string_generator()(identifier);
// Add a cache registry entry.
m_registry.insert(std::make_pair(filename, uuid));
}
// Disable scope guard.
clearRegistryEntires.Disable();
return true;
}
bool CacheManager::RecreateCache()
{
boost::system::error_code error;
// Remove the cache directory and it's content.
boost::filesystem::remove_all(Main::GetCacheDir(), error);
if(error)
{
Log() << LogRecreateCacheError() << "Can't remove the cache directory.";
return false;
}
// Create an empty cache directory.
boost::filesystem::create_directory(Main::GetCacheDir(), error);
if(error)
{
Log() << LogRecreateCacheError() << "Can't create the cache directory.";
return false;
}
// Create the cache registry.
std::ofstream registryFile(Main::GetCacheDir() + CacheRegistryFile);
if(!registryFile.is_open())
{
Log() << LogRecreateCacheError() << "Can't create the cache registry.";
return false;
}
registryFile.flush();
registryFile.close();
return true;
}
bool CacheManager::SaveCache()
{
if(!m_initialized)
return false;
// Open the cache registry.
std::ofstream registryFile(Main::GetCacheDir() + CacheRegistryFile);
if(!registryFile.is_open())
{
Log() << "Can't open the cache registry.";
return false;
}
// Write the file header.
registryFile << FormatType << ' ';
registryFile << RegistryVersion << ' ';
registryFile << IntegrityVersion << '\n';
// Write the cache entries.
for(auto it = m_registry.begin(); it != m_registry.end(); ++it)
{
std::string identifier = boost::uuids::to_string(it->second);
// Check if cache file is valid.
if(!ValidateCache(identifier))
{
Log() << "Tried to write an invalid cache entry.";
continue;
}
// Write a cache entry.
registryFile << it->second << ' ';
registryFile << '"' << it->first << '"' << '\n';
}
return true;
}
bool CacheManager::ValidateCache(std::string identifier)
{
std::string file = Main::GetCacheDir() + identifier;
// Make sure the cache exists.
if(!boost::filesystem::exists(file))
{
return false;
}
// Make sure it's not empty.
if(boost::filesystem::file_size(file) == 0)
{
return false;
}
return true;
}
| 23.703822 | 116 | 0.593847 | gunstarpl |
9880b1c76cf919d2e52f8cfc208134f59555b22b | 8,810 | hpp | C++ | scripting/src/SceneGraph/LuaSceneBuilder.hpp | hhsaez/crimild | e3efee09489939338df55e8af9a1f9ddc01301f7 | [
"BSD-3-Clause"
] | 36 | 2015-03-12T10:42:36.000Z | 2022-01-12T04:20:40.000Z | scripting/src/SceneGraph/LuaSceneBuilder.hpp | hhsaez/crimild | e3efee09489939338df55e8af9a1f9ddc01301f7 | [
"BSD-3-Clause"
] | 1 | 2015-12-17T00:25:43.000Z | 2016-02-20T12:00:57.000Z | scripting/src/SceneGraph/LuaSceneBuilder.hpp | hhsaez/crimild | e3efee09489939338df55e8af9a1f9ddc01301f7 | [
"BSD-3-Clause"
] | 6 | 2017-06-17T07:57:53.000Z | 2019-04-09T21:11:24.000Z | /*
* Copyright (c) 2013, Hernan Saez
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CRIMILD_SCRIPTING_SCENE_BUILDER_LUA_
#define CRIMILD_SCRIPTING_SCENE_BUILDER_LUA_
#include "Foundation/Scripted.hpp"
#include <Streaming/SceneBuilder.hpp>
namespace crimild {
class Node;
class Group;
class NodeComponent;
namespace scripting {
/**
\deprecated Use LuaObjectBuilderRegistry instead
*/
class LuaNodeBuilderRegistry : public StaticSingleton< LuaNodeBuilderRegistry > {
public:
using NodeBuilderFunction = std::function< SharedPointer< Node > ( crimild::scripting::ScriptEvaluator & ) >;
public:
LuaNodeBuilderRegistry( void );
virtual ~LuaNodeBuilderRegistry( void );
template< typename T >
void registerNodeBuilder( std::string type )
{
_nodeBuilders[ type ] = []( crimild::scripting::ScriptEvaluator &eval ) {
auto node = crimild::alloc< T >();
node->load( eval );
return node;
};
}
void registerCustomNodeBuilder( std::string type, NodeBuilderFunction builder )
{
_nodeBuilders[ type ] = builder;
}
NodeBuilderFunction getBuilder( std::string type ) { return _nodeBuilders[ type ]; }
public:
template< class T >
class RegistrationHelper {
public:
RegistrationHelper( const char *name )
{
LuaNodeBuilderRegistry::getInstance()->registerNodeBuilder< T >( name );
}
~RegistrationHelper( void )
{
}
};
public:
void flush( void );
private:
std::map< std::string, NodeBuilderFunction > _nodeBuilders;
};
#define CRIMILD_SCRIPTING_REGISTER_NODE_BUILDER( X ) \
static crimild::scripting::LuaNodeBuilderRegistry::RegistrationHelper< X > __nodeRegistrationHelper( #X );
/**
\deprecated Use LuaObjectBuilderRegistry instead
*/
class LuaComponentBuilderRegistry : public StaticSingleton< LuaComponentBuilderRegistry > {
public:
using ComponentBuilderFunction = std::function< SharedPointer< NodeComponent > ( crimild::scripting::ScriptEvaluator & ) >;
public:
LuaComponentBuilderRegistry( void );
virtual ~LuaComponentBuilderRegistry( void );
template< typename T >
void registerComponentBuilder( std::string type )
{
_componentBuilders[ type ] = []( crimild::scripting::ScriptEvaluator &eval ) {
return crimild::alloc< T >( eval );
};
}
void registerCustomComponentBuilder( std::string type, ComponentBuilderFunction builder )
{
_componentBuilders[ type ] = builder;
}
ComponentBuilderFunction getBuilder( std::string type ) { return _componentBuilders[ type ]; }
public:
template< class T >
class RegistrationHelper {
public:
RegistrationHelper( const char *name )
{
LuaComponentBuilderRegistry::getInstance()->registerComponentBuilder< T >( name );
}
~RegistrationHelper( void )
{
}
};
public:
void flush( void );
private:
std::map< std::string, ComponentBuilderFunction > _componentBuilders;
};
#define CRIMILD_SCRIPTING_REGISTER_COMPONENT_BUILDER( X ) \
static crimild::scripting::LuaComponentBuilderRegistry::RegistrationHelper< X > __componentRegistrationHelper( #X );
class LuaObjectBuilderRegistry : public StaticSingleton< LuaObjectBuilderRegistry > {
public:
using BuilderFunction = std::function< SharedPointer< SharedObject > ( crimild::scripting::ScriptEvaluator & ) >;
public:
LuaObjectBuilderRegistry( void );
virtual ~LuaObjectBuilderRegistry( void );
template< typename T >
void registerBuilder( std::string type )
{
_builders[ type ] = []( crimild::scripting::ScriptEvaluator &eval ) {
return crimild::alloc< T >( eval );
};
}
void registerCustomBuilder( std::string type, BuilderFunction builder )
{
_builders[ type ] = builder;
}
BuilderFunction getBuilder( std::string type ) { return _builders[ type ]; }
public:
void flush( void );
private:
std::map< std::string, BuilderFunction > _builders;
};
#define CRIMILD_SCRIPTING_REGISTER_BUILDER( X ) \
crimild::scripting::LuaObjectBuilderRegistry::getInstance()->registerBuilder< X >( #X );
#define CRIMILD_SCRIPTING_REGISTER_CUSTOM_BUILDER( X, BUILDER_FUNC ) \
crimild::scripting::LuaObjectBuilderRegistry::getInstance()->registerCustomBuilder( #X, BUILDER_FUNC );
class LuaSceneBuilder :
public crimild::scripting::Scripted,
public crimild::SceneBuilder {
private:
using NodeBuilderFunction = std::function< SharedPointer< Node > ( crimild::scripting::ScriptEvaluator & ) >;
using ComponentBuilderFunction = std::function< SharedPointer< NodeComponent > ( crimild::scripting::ScriptEvaluator & ) >;
public:
LuaSceneBuilder( std::string rootNodeName = "scene" );
virtual ~LuaSceneBuilder( void );
virtual void reset( void ) override;
virtual SharedPointer< Node > fromFile( const std::string &filename ) override;
public:
template< typename T >
void generateNodeBuilder( std::string type )
{
_nodeBuilders[ type ] = []( crimild::scripting::ScriptEvaluator &eval ) {
auto node = crimild::alloc< T >();
node->load( eval );
return node;
};
}
template< typename T >
void registerComponent( void )
{
registerComponentBuilder< T >( []( crimild::scripting::ScriptEvaluator &eval ) {
return crimild::alloc< T >( eval );
});
}
template< typename T >
void registerComponentBuilder( ComponentBuilderFunction builder )
{
_componentBuilders[ T::_COMPONENT_NAME() ] = builder;
}
private:
SharedPointer< Node > buildNode( ScriptEvaluator &eval, Group *parent );
void setTransformation( ScriptEvaluator &eval, SharedPointer< Node > const &node );
void buildNodeComponents( ScriptEvaluator &eval, SharedPointer< Node > const &node );
private:
std::string _rootNodeName;
std::map< std::string, NodeBuilderFunction > _nodeBuilders;
std::map< std::string, ComponentBuilderFunction > _componentBuilders;
};
}
}
#endif
| 36.106557 | 135 | 0.605221 | hhsaez |
9882c8ace1f7470eb207ba3eccd0a20d351c4e5f | 2,860 | cpp | C++ | src/dawn/IIR/AccessToNameMapper.cpp | Kayjukh/dawn | 431a59ceeff062beb8390056c6bbd5b5d6d808d3 | [
"MIT"
] | null | null | null | src/dawn/IIR/AccessToNameMapper.cpp | Kayjukh/dawn | 431a59ceeff062beb8390056c6bbd5b5d6d808d3 | [
"MIT"
] | null | null | null | src/dawn/IIR/AccessToNameMapper.cpp | Kayjukh/dawn | 431a59ceeff062beb8390056c6bbd5b5d6d808d3 | [
"MIT"
] | null | null | null | //===--------------------------------------------------------------------------------*- C++ -*-===//
// _
// | |
// __| | __ ___ ___ ___
// / _` |/ _` \ \ /\ / / '_ |
// | (_| | (_| |\ V V /| | | |
// \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain
//
//
// This file is distributed under the MIT License (MIT).
// See LICENSE.txt for details.
//
//===------------------------------------------------------------------------------------------===//
#include "dawn/IIR/AccessToNameMapper.h"
#include "dawn/IIR/StencilFunctionInstantiation.h"
#include "dawn/IIR/StencilMetaInformation.h"
namespace dawn {
namespace iir {
void AccessToNameMapper::visit(const std::shared_ptr<VarDeclStmt>& stmt) {
insertAccessInfo(stmt);
ASTVisitorForwarding::visit(stmt);
}
void AccessToNameMapper::visit(const std::shared_ptr<StencilFunCallExpr>& expr) {
if(!curFunctionInstantiation_.empty()) {
auto* stencilFunctionInstantiation =
curFunctionInstantiation_.top()->getStencilFunctionInstantiation(expr).get();
curFunctionInstantiation_.push(stencilFunctionInstantiation);
} else {
auto* stencilFunctionInstantiation = metaData_.getStencilFunctionInstantiation(expr).get();
curFunctionInstantiation_.push(stencilFunctionInstantiation);
}
curFunctionInstantiation_.top()->getAST()->accept(*this);
curFunctionInstantiation_.pop();
ASTVisitorForwarding::visit(expr);
}
void AccessToNameMapper::insertAccessInfo(const std::shared_ptr<Expr>& expr) {
int accessID = (curFunctionInstantiation_.empty())
? metaData_.getAccessIDFromExpr(expr)
: curFunctionInstantiation_.top()->getAccessIDFromExpr(expr);
std::string name = (curFunctionInstantiation_.empty())
? metaData_.getNameFromAccessID(accessID)
: curFunctionInstantiation_.top()->getNameFromAccessID(accessID);
accessIDToName_.emplace(accessID, name);
}
void AccessToNameMapper::insertAccessInfo(const std::shared_ptr<Stmt>& stmt) {
int accessID = (curFunctionInstantiation_.empty())
? metaData_.getAccessIDFromStmt(stmt)
: curFunctionInstantiation_.top()->getAccessIDFromStmt(stmt);
std::string name = (curFunctionInstantiation_.empty())
? metaData_.getNameFromAccessID(accessID)
: curFunctionInstantiation_.top()->getNameFromAccessID(accessID);
accessIDToName_.emplace(accessID, name);
}
void AccessToNameMapper::visit(const std::shared_ptr<VarAccessExpr>& expr) {
insertAccessInfo(expr);
}
void AccessToNameMapper::visit(const std::shared_ptr<FieldAccessExpr>& expr) {
insertAccessInfo(expr);
}
} // namespace iir
} // namespace dawn
| 39.178082 | 100 | 0.615035 | Kayjukh |
98830ee90e34373b77453559e1a5a1c2170bb82e | 4,623 | cpp | C++ | src/model/searchlistmodel.cpp | sailfish-os-apps/harbour-sailseries | df8fb67b720e4ba9f8c4644ebc03cf90bb745e3c | [
"MIT"
] | null | null | null | src/model/searchlistmodel.cpp | sailfish-os-apps/harbour-sailseries | df8fb67b720e4ba9f8c4644ebc03cf90bb745e3c | [
"MIT"
] | null | null | null | src/model/searchlistmodel.cpp | sailfish-os-apps/harbour-sailseries | df8fb67b720e4ba9f8c4644ebc03cf90bb745e3c | [
"MIT"
] | null | null | null | #include "searchlistmodel.h"
SearchListModel::SearchListModel(QObject *parent, DatabaseManager *dbmanager, Api *api) :
QObject(parent)
{
m_dbmanager = dbmanager;
m_api = api;
connect(m_api,
SIGNAL(readyToPopulateSeries(QList<QVariantMap>)),
this,
SLOT(searchFinished(QList<QVariantMap>)));
connect(m_api,
SIGNAL(readyToStoreSeries(QList<QVariantMap>, QList<QVariantMap>, QList<QVariantMap>)),
this,
SLOT(getAllFinished(QList<QVariantMap>, QList<QVariantMap>, QList<QVariantMap>)));
m_loading = false;
m_added = false;
}
SearchListModel::~SearchListModel()
{
for (auto series : m_searchListModel) {
delete series;
series = 0;
}
}
QQmlListProperty<SeriesData> SearchListModel::getSearchModel()
{
return QQmlListProperty<SeriesData>(this, &m_searchListModel, &SearchListModel::searchListCount, &SearchListModel::searchListAt);
}
// List handling methods
void SearchListModel::searchListAppend(QQmlListProperty<SeriesData>* prop, SeriesData* val)
{
SearchListModel* searchModel = qobject_cast<SearchListModel*>(prop->object);
searchModel->m_searchListModel.append(val);
}
SeriesData* SearchListModel::searchListAt(QQmlListProperty<SeriesData>* prop, int index)
{
return (qobject_cast<SearchListModel*>(prop->object))->m_searchListModel.at(index);
}
int SearchListModel::searchListCount(QQmlListProperty<SeriesData>* prop)
{
return qobject_cast<SearchListModel*>(prop->object)->m_searchListModel.size();
}
void SearchListModel::searchListClear(QQmlListProperty<SeriesData>* prop)
{
qobject_cast<SearchListModel*>(prop->object)->m_searchListModel.clear();
}
void SearchListModel::searchFinished(QList<QVariantMap> series)
{
populateSearchModel(series);
}
void SearchListModel::getAllFinished(QList<QVariantMap> series, QList<QVariantMap> episodes, QList<QVariantMap> banners)
{
storeSeries(series);
storeEpisodes(episodes);
storeBanners(banners);
setLoading(false);
emit updateModels();
}
void SearchListModel::populateSearchModel(QList<QVariantMap> foundSeries)
{
if (!foundSeries.empty()) {
for (auto series : foundSeries) {
SeriesData* seriesData = new SeriesData(this, series);
m_searchListModel.append(seriesData);
}
emit searchModelChanged();
setLoading(false);
}
}
void SearchListModel::searchSeries(QString text)
{
setLoading(true);
m_searchListModel.clear();
m_series.clear();
emit searchModelChanged();
m_api->searchSeries(text);
}
void SearchListModel::selectSeries(int index)
{
m_info = m_searchListModel.at(index);
}
void SearchListModel::getFullSeriesRecord(QString id)
{
m_api->getAll(id, "full");
setLoading(true);
}
void SearchListModel::storeSeries(QList<QVariantMap> series)
{
if (!series.isEmpty()) {
m_dbmanager->insertSeries(series.first());
}
}
void SearchListModel::storeEpisodes(QList<QVariantMap> episodes)
{
auto seriesId = m_info->getID().toInt();
m_dbmanager->insertEpisodes(episodes, seriesId);
setAdded(true);
}
void SearchListModel::storeBanners(QList<QVariantMap> banners)
{
auto seriesId = m_info->getID().toInt();
m_dbmanager->insertBanners(banners, seriesId);
}
QString SearchListModel::getID() { return m_info->getID(); }
QString SearchListModel::getLanguage() { return m_info->getLanguage(); }
QString SearchListModel::getSeriesName() { return m_info->getSeriesName(); }
QString SearchListModel::getAliasNames() { return m_info->getAliasNames(); }
QString SearchListModel::getBanner() { return m_info->getBanner(); }
QString SearchListModel::getOverview() { return m_info->getOverview(); }
QString SearchListModel::getFirstAired() { return m_info->getFirstAired(); }
QString SearchListModel::getIMDB_ID() { return m_info->getIMDB_ID(); }
QString SearchListModel::getZap2it_ID() { return m_info->getZap2it_ID(); }
QString SearchListModel::getNetwork() { return m_info->getNetwork(); }
bool SearchListModel::getLoading() { return m_loading; }
void SearchListModel::setLoading(bool state)
{
m_loading = state;
emit loadingChanged();
}
bool SearchListModel::getAdded() { return m_added; }
void SearchListModel::setAdded(bool cond)
{
if (m_added != cond) {
m_added = cond;
emit addedChanged();
}
}
void SearchListModel::clearList()
{
m_searchListModel.clear();
emit searchModelChanged();
}
void SearchListModel::checkIfAdded(QString id, QString name)
{
setAdded(m_dbmanager->isAlreadyAdded(id.toInt(), name));
}
| 26.722543 | 133 | 0.718797 | sailfish-os-apps |
9887816891913384f92ed443f1518d4f74bd709f | 18,089 | cpp | C++ | src/xtd.core.native.win32/src/xtd/native/win32/socket.cpp | gammasoft71/xtd | 09e589a9dd2cb292d1e54c9c4f803c2b3ad22102 | [
"MIT"
] | 251 | 2019-04-20T02:02:24.000Z | 2022-03-31T09:52:08.000Z | src/xtd.core.native.win32/src/xtd/native/win32/socket.cpp | gammasoft71/xtd | 09e589a9dd2cb292d1e54c9c4f803c2b3ad22102 | [
"MIT"
] | 29 | 2021-01-07T12:52:12.000Z | 2022-03-29T08:42:14.000Z | src/xtd.core.native.win32/src/xtd/native/win32/socket.cpp | gammasoft71/xtd | 09e589a9dd2cb292d1e54c9c4f803c2b3ad22102 | [
"MIT"
] | 27 | 2019-11-21T02:37:44.000Z | 2022-03-30T22:59:14.000Z | #define __XTD_CORE_NATIVE_LIBRARY__
#include <xtd/native/socket.h>
#include <xtd/native/address_family_constants.h>
#include <xtd/native/protocol_type_constants.h>
#include <xtd/native/select_mode_constants.h>
#include <xtd/native/socket_option_name_constants.h>
#include <xtd/native/socket_option_level_constants.h>
#include <xtd/native/socket_shutdown_constants.h>
#include <xtd/native/socket_type_constants.h>
#undef __XTD_CORE_NATIVE_LIBRARY__
#include <map>
#include <Winsock2.h>
#include <Windows.h>
using namespace std;
using namespace xtd::native;
namespace {
static int32_t protocol_type_to_native(int32_t protocol_type) {
static map<int32_t, int32_t> protocol_types = {{PROTOCOL_TYPE_UNKNOWN, IPPROTO_IP}, {PROTOCOL_TYPE_IP, IPPROTO_IP}, {PROTOCOL_TYPE_ICMP, IPPROTO_ICMP}, {PROTOCOL_TYPE_IGMP, IPPROTO_IGMP}, {PROTOCOL_TYPE_GGP, IPPROTO_GGP}, {PROTOCOL_TYPE_IP_V4, IPPROTO_IPV4}, {PROTOCOL_TYPE_IP_V6, IPPROTO_IPV6}, {PROTOCOL_TYPE_TCP, IPPROTO_TCP}, {PROTOCOL_TYPE_PUP, IPPROTO_PUP}, {PROTOCOL_TYPE_UDP, IPPROTO_UDP}, {PROTOCOL_TYPE_IDP, IPPROTO_IDP}, {PROTOCOL_TYPE_IP_V6, IPPROTO_IPV6}, {PROTOCOL_TYPE_IP_V6_ROUTING_HEADER, IPPROTO_ROUTING}, {PROTOCOL_TYPE_IP_V6_FRAGMENT_HEADER, IPPROTO_FRAGMENT}, {PROTOCOL_TYPE_IP_SEC_ENCAPSULATING_SECURITY_PAYLOAD, IPPROTO_ESP}, {PROTOCOL_TYPE_IP_SEC_AUTHENTICATION_HEADER, IPPROTO_AH}, {PROTOCOL_TYPE_ICMP_V6, IPPROTO_ICMPV6}, {PROTOCOL_TYPE_IP_V6_NO_NEXT_HEADER, IPPROTO_NONE}, {PROTOCOL_TYPE_IP_V6_DESTINATION_OPTIONS, IPPROTO_DSTOPTS}, {PROTOCOL_TYPE_ND, IPPROTO_ND}, {PROTOCOL_TYPE_RAW, IPPROTO_RAW}, {PROTOCOL_TYPE_SPX, IPPROTO_IP}, {PROTOCOL_TYPE_SPX_2, IPPROTO_IP}};
auto it = protocol_types.find(protocol_type);
if (it == protocol_types.end()) return IPPROTO_IP;
return it->second;
}
static int32_t socket_option_name_to_native(int32_t socket_option_name) {
static map<int32_t, int32_t> socket_option_names = {{SOCKET_OPTION_NAME_DEBUG, SO_DEBUG}, {SOCKET_OPTION_NAME_ACCEPT_CONNECTION, SO_ACCEPTCONN}, {SOCKET_OPTION_NAME_REUSE_ADDRESS, SO_REUSEADDR}, {SOCKET_OPTION_NAME_KEEP_ALIVE, SO_KEEPALIVE}, {SOCKET_OPTION_NAME_DONT_ROUTE, SO_DONTROUTE}, {SOCKET_OPTION_NAME_BROADCAST, SO_BROADCAST}, {SOCKET_OPTION_NAME_USE_LOOPBACK, SO_USELOOPBACK}, {SOCKET_OPTION_NAME_LINGER, SO_LINGER}, {SOCKET_OPTION_NAME_OUT_OF_BAND_INLINE, SO_OOBINLINE}, {SOCKET_OPTION_NAME_SEND_BUFFER, SO_SNDBUF}, {SOCKET_OPTION_NAME_RECEIVE_BUFFER, SO_RCVBUF}, {SOCKET_OPTION_NAME_SEND_LOW_WATER, SO_SNDLOWAT}, {SOCKET_OPTION_NAME_RECEIVE_LOW_WATER, SO_RCVLOWAT}, {SOCKET_OPTION_NAME_SEND_TIMEOUT, SO_SNDTIMEO}, {SOCKET_OPTION_NAME_RECEIVE_TIMEOUT, SO_RCVTIMEO}, {SOCKET_OPTION_NAME_ERROR, SO_ERROR}, {SOCKET_OPTION_NAME_TYPE, SO_TYPE}};
auto it = socket_option_names.find(socket_option_name);
if (it == socket_option_names.end()) return socket_option_name;
return it->second;
}
static int32_t socket_option_level_to_native(int32_t socket_option_level) {
static map<int32_t, int32_t> socket_option_levels = {{SOCKET_OPTION_LEVEL_SOCKET, SOL_SOCKET}, {SOCKET_OPTION_LEVEL_IP, IPPROTO_IP}, {SOCKET_OPTION_LEVEL_IP_V6, IPPROTO_IPV6}, {SOCKET_OPTION_LEVEL_TCP, IPPROTO_TCP}, {SOCKET_OPTION_LEVEL_UDP, IPPROTO_UDP}};
auto it = socket_option_levels.find(socket_option_level);
if (it == socket_option_levels.end()) return SOL_SOCKET;
return it->second;
}
static int32_t socket_type_to_native(int32_t socket_type) {
static map<int32_t, int32_t> socket_types = {{SOCKET_TYPE_UNKNOWN, SOCK_STREAM}, {SOCKET_TYPE_STREAM, SOCK_STREAM}, {SOCKET_TYPE_DGRAM, SOCK_DGRAM}, {SOCKET_TYPE_RAW, SOCK_RAW}, {SOCKET_TYPE_RDM, SOCK_RDM}, {SOCKET_TYPE_SEQPACKET, SOCK_SEQPACKET}};
auto it = socket_types.find(socket_type);
if (it == socket_types.end()) return SOCK_STREAM;
return it->second;
}
}
int32_t socket::address_family_to_native(int32_t address_family) {
static map<int32_t, int32_t> address_families = {{ADDRESS_FAMILY_UNIX, AF_UNIX}, {ADDRESS_FAMILY_INTER_NETWORK, AF_INET}, {ADDRESS_FAMILY_IMP_LINK, AF_IMPLINK}, {ADDRESS_FAMILY_PUP, AF_PUP}, {ADDRESS_FAMILY_CHAOS, AF_CHAOS}, {ADDRESS_FAMILY_NS, AF_NS}, {ADDRESS_FAMILY_ISO, AF_ISO}, {ADDRESS_FAMILY_ECMA, AF_ECMA}, {ADDRESS_FAMILY_DATA_KIT, AF_DATAKIT}, {ADDRESS_FAMILY_CCITT, AF_CCITT}, {ADDRESS_FAMILY_SNA, AF_SNA}, {ADDRESS_FAMILY_DEC_NET, AF_DECnet}, {ADDRESS_FAMILY_DATA_LINK, AF_DLI}, {ADDRESS_FAMILY_LAT, AF_LAT}, {ADDRESS_FAMILY_HYPER_CHANNEL, AF_HYLINK}, {ADDRESS_FAMILY_APPLE_TALK, AF_APPLETALK}, {ADDRESS_FAMILY_NET_BIOS, AF_NETBIOS}, {ADDRESS_FAMILY_VOICE_VIEW, AF_VOICEVIEW}, {ADDRESS_FAMILY_FIRE_FOX, AF_FIREFOX}, {ADDRESS_FAMILY_BANYAN, AF_BAN}, {ADDRESS_FAMILY_ATM, AF_ATM}, {ADDRESS_FAMILY_INTER_NETWORK_V6, AF_INET6}, {ADDRESS_FAMILY_CLUSTER, AF_CLUSTER}, {ADDRESS_FAMILY_IEEE12844, AF_12844}, {ADDRESS_FAMILY_IRDA, AF_IRDA}, {ADDRESS_FAMILY_NETWORK_DESIGNERS, AF_NETDES}, {ADDRESS_FAMILY_MAX, AF_MAX}};
auto it = address_families.find(address_family);
if (it == address_families.end()) return AF_UNSPEC;
return it->second;
}
int32_t socket::native_to_address_family(int32_t address_family) {
static map<int32_t, int32_t> address_families = {{AF_UNIX, ADDRESS_FAMILY_UNIX}, {AF_INET, ADDRESS_FAMILY_INTER_NETWORK}, {AF_IMPLINK, ADDRESS_FAMILY_IMP_LINK}, {AF_PUP, ADDRESS_FAMILY_PUP}, {AF_CHAOS, ADDRESS_FAMILY_CHAOS}, {AF_NS, ADDRESS_FAMILY_NS}, {AF_ISO, ADDRESS_FAMILY_ISO}, {AF_ECMA, ADDRESS_FAMILY_ECMA}, {AF_DATAKIT, ADDRESS_FAMILY_DATA_KIT}, {AF_CCITT, ADDRESS_FAMILY_CCITT}, {AF_SNA, ADDRESS_FAMILY_SNA}, {AF_DECnet, ADDRESS_FAMILY_DEC_NET}, {AF_DLI, ADDRESS_FAMILY_DATA_LINK}, {AF_LAT, ADDRESS_FAMILY_LAT}, {AF_HYLINK, ADDRESS_FAMILY_HYPER_CHANNEL}, {AF_APPLETALK, ADDRESS_FAMILY_APPLE_TALK}, {AF_NETBIOS, ADDRESS_FAMILY_NET_BIOS}, {AF_VOICEVIEW, ADDRESS_FAMILY_VOICE_VIEW}, {AF_FIREFOX, ADDRESS_FAMILY_FIRE_FOX}, {AF_BAN, ADDRESS_FAMILY_BANYAN}, {AF_ATM, ADDRESS_FAMILY_ATM}, {AF_INET6, ADDRESS_FAMILY_INTER_NETWORK_V6}, {AF_CLUSTER, ADDRESS_FAMILY_CLUSTER}, {AF_12844, ADDRESS_FAMILY_IEEE12844}, {AF_IRDA, ADDRESS_FAMILY_IRDA}, {AF_NETDES, ADDRESS_FAMILY_NETWORK_DESIGNERS}, {AF_MAX, ADDRESS_FAMILY_MAX}};
auto it = address_families.find(address_family);
if (it == address_families.end()) return ADDRESS_FAMILY_UNSPECIFIED;
return it->second;
}
intptr_t socket::accept(intptr_t handle, vector<uint8_t>& socket_address) {
int32_t address_length = static_cast<int32_t>(socket_address.size());
intptr_t socket = static_cast<intptr_t>(::accept(static_cast<SOCKET>(handle), reinterpret_cast<SOCKADDR*>(socket_address.data()), &address_length));
if (socket_address.size() != static_cast<size_t>(address_length)) socket_address.resize(static_cast<size_t>(address_length));
return socket;
}
int32_t socket::bind(intptr_t handle, const vector<uint8_t>& socket_address) {
return ::bind(static_cast<SOCKET>(handle), reinterpret_cast<const SOCKADDR*>(socket_address.data()), static_cast<int32_t>(socket_address.size()));
}
void socket::cleanup() {
WSACleanup();
}
int32_t socket::connect(intptr_t handle, const vector<uint8_t>& socket_address) {
return ::connect(static_cast<SOCKET>(handle), reinterpret_cast<const SOCKADDR*>(socket_address.data()), static_cast<int32_t>(socket_address.size()));
}
intptr_t socket::create(int32_t address_family, int32_t socket_type, int32_t protocol_type) {
return static_cast<intptr_t>(::socket(address_family_to_native(address_family), socket_type_to_native(socket_type), protocol_type_to_native(protocol_type)));
}
int32_t socket::destroy(intptr_t handle) {
return ::closesocket(static_cast<SOCKET>(handle));
}
size_t socket::get_available(intptr_t handle) {
u_long nbr_bytes_available = 0;
if (::ioctlsocket(static_cast<SOCKET>(handle), FIONREAD, &nbr_bytes_available) != 0) return static_cast<size_t>(-1);
return static_cast<size_t>(nbr_bytes_available);
}
int32_t socket::get_last_error() {
return WSAGetLastError();
}
bool socket::get_os_supports_ip_v4() noexcept {
SOCKET s = ::socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
if (s == INVALID_SOCKET) return false;
closesocket(s);
return true;
}
bool socket::get_os_supports_ip_v6() noexcept {
SOCKET s = ::socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
if (s == INVALID_SOCKET) return false;
closesocket(s);
return true;
}
int32_t socket::get_raw_socket_option(intptr_t handle, int32_t socket_option_level, int32_t socket_option_name, intptr_t option, size_t& option_length) {
return ::getsockopt(static_cast<SOCKET>(handle), socket_option_level, socket_option_name, reinterpret_cast<char*>(option), reinterpret_cast<int32_t*>(&option_length));
}
int32_t socket::get_socket_option(intptr_t handle, int32_t socket_option_level, int32_t socket_option_name, intptr_t option, size_t& option_length) {
return ::getsockopt(static_cast<SOCKET>(handle), socket_option_level_to_native(socket_option_level), socket_option_name_to_native(socket_option_name), reinterpret_cast<char*>(option), reinterpret_cast<int32_t*>(&option_length));
}
int32_t socket::get_socket_linger_option(intptr_t handle, bool& enabled, uint32_t& linger_time) {
LINGER l {static_cast<u_short>(enabled), static_cast<u_short>(linger_time)};
size_t linger_size = sizeof(LINGER);
int32_t result = ::getsockopt(static_cast<SOCKET>(handle), SOL_SOCKET, SO_LINGER, reinterpret_cast<char*>(&l), reinterpret_cast<int32_t*>(&linger_size));
if (result == 0) {
enabled = static_cast<bool>(l.l_onoff);
linger_time = static_cast<uint32_t>(l.l_linger);
}
return result;
}
int32_t socket::get_socket_multicast_option(intptr_t handle, int32_t socket_option_name, uint32_t& multicast_address, uint32_t& interface_index) {
struct multicast {
uint32_t multicast_address;
uint32_t interface_index;
} m;
size_t multicast_size = sizeof(multicast);
int32_t result = getsockopt(static_cast<SOCKET>(handle), IPPROTO_IP, socket_option_name_to_native(socket_option_name), reinterpret_cast<char*>(&m), reinterpret_cast<int32_t*>(&multicast_size));
if (result == 0) {
multicast_address = m.multicast_address;
interface_index = m.interface_index;
}
return result;
}
int32_t socket::get_socket_ip_v6_multicast_option(intptr_t handle, int32_t socket_option_name, vector<uint8_t>& multicast_address, uint32_t& interface_index) {
struct multicast {
uint8_t multicast_address[16];
uint32_t interface_index;
} m;
size_t multicast_size = sizeof(multicast);
int32_t result = getsockopt(static_cast<SOCKET>(handle), IPPROTO_IP, socket_option_name_to_native(socket_option_name), reinterpret_cast<char*>(&m), reinterpret_cast<int32_t*>(&multicast_size));
if (result == 0) {
for (auto index = 0U; index < multicast_address.size(); ++index)
multicast_address[index] = m.multicast_address[index];
interface_index = m.interface_index;
}
return result;
}
int32_t socket::io_control(intptr_t handle, int32_t io_control, vector<uint8_t>& option_in_value, vector<uint8_t>& option_out_value) {
size_t option_out_value_size = 0;
int32_t result = WSAIoctl(static_cast<SOCKET>(handle), io_control, option_in_value.data(), static_cast<int32_t>(option_in_value.size()), option_out_value.data(), static_cast<int32_t>(option_out_value.size()), reinterpret_cast<LPDWORD>(&option_out_value_size), nullptr, nullptr);
if (option_out_value.size() != option_out_value_size) option_out_value.resize(option_out_value_size);
return result;
}
int32_t socket::listen(intptr_t handle, size_t backlog) {
int32_t backlog_value = backlog != static_cast<size_t>(-1) ? static_cast<int32_t>(backlog) : SOMAXCONN;
return ::listen(static_cast<SOCKET>(handle), backlog_value);
}
int32_t socket::poll(intptr_t handle, int32_t microseconds, int32_t mode) {
if (handle == 0 || microseconds < 0) return -1;
timeval timeout = {microseconds / 1000000, microseconds % 1000000};
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(static_cast<SOCKET>(handle), &fdset);
switch (mode) {
case SELECT_MODE_READ: return ::select(0, &fdset, nullptr, nullptr, microseconds == -1 ? nullptr : &timeout);
case SELECT_MODE_WRITE: return ::select(0, nullptr, &fdset, nullptr, microseconds == -1 ? nullptr : &timeout);
case SELECT_MODE_ERROR: return ::select(0, nullptr, nullptr, &fdset, microseconds == -1 ? nullptr : &timeout);
default: return -1;
}
}
int32_t socket::receive(intptr_t handle, vector<uint8_t>& buffer, size_t offset, size_t size, int32_t flags) {
return static_cast<int32_t>(::recv(static_cast<SOCKET>(handle), reinterpret_cast<char*>(&buffer.data()[offset]), static_cast<int32_t>(size), flags));
}
int32_t socket::receive_from(intptr_t handle, vector<uint8_t>& buffer, size_t offset, size_t size, int32_t flags, vector<uint8_t>& socket_address) {
int32_t address_length = static_cast<int32_t>(socket_address.size());
int32_t result = static_cast<int32_t>(::recvfrom(static_cast<SOCKET>(handle), reinterpret_cast<char*>(&buffer.data()[offset]), static_cast<int32_t>(size), flags, reinterpret_cast<SOCKADDR*>(socket_address.data()), &address_length));
if (socket_address.size() != static_cast<size_t>(address_length)) socket_address.resize(static_cast<size_t>(address_length));
return result;
}
int32_t socket::select(vector<intptr_t>& check_read, vector<intptr_t>& check_write, vector<intptr_t>& check_error, int32_t microseconds) {
size_t nfds = 0;
fd_set read_fds;
FD_ZERO(&read_fds);
for (auto i = 0U; i < check_read.size() && i < FD_SETSIZE; i++)
FD_SET(static_cast<SOCKET>(check_read[i]), &read_fds);
if (check_read.size() > nfds) nfds = check_read.size();
fd_set write_fds;
FD_ZERO(&write_fds);
for (auto i = 0U; i < check_write.size() && i < FD_SETSIZE; i++)
FD_SET(static_cast<SOCKET>(check_write[i]), &write_fds);
if (check_write.size() > nfds) nfds = check_write.size();
fd_set error_fds;
FD_ZERO(&error_fds);
for (auto i = 0U; i < check_error.size() && i < FD_SETSIZE; i++)
FD_SET(static_cast<SOCKET>(check_error[i]), &error_fds);
if (check_error.size() > nfds) nfds = check_error.size();
timeval tv;
if (microseconds != -1) {
tv.tv_sec = microseconds / 1000000;
tv.tv_usec = microseconds % 1000000;
}
int32_t result = ::select(static_cast<int32_t>(nfds + 1), &read_fds, &write_fds, &error_fds, &tv);
for (auto i = 0U; i < check_read.size(); i++) {
FD_CLR(static_cast<SOCKET>(check_read[i]), &read_fds);
if (FD_ISSET(static_cast<SOCKET>(check_read[i]), &read_fds) == 0) check_read[i] = 0;
}
for (auto i = 0U; i < check_write.size(); i++) {
FD_CLR(static_cast<SOCKET>(check_write[i]), &write_fds);
if (FD_ISSET(static_cast<SOCKET>(check_write[i]), &write_fds) == 0) check_write[i] = 0;
}
for (auto i = 0U; i < check_error.size(); i++) {
FD_CLR(static_cast<SOCKET>(check_error[i]), &error_fds);
if (FD_ISSET(static_cast<SOCKET>(check_error[i]), &error_fds) == 0) check_error[i] = 0;
}
return result;
}
int32_t socket::send(intptr_t handle, const vector<uint8_t>& buffer, size_t offset, size_t size, int32_t flags) {
return static_cast<int32_t>(::send(static_cast<SOCKET>(handle), reinterpret_cast<const char*>(&buffer.data()[offset]), static_cast<int32_t>(size), flags));
}
int32_t socket::send_to(intptr_t handle, const vector<uint8_t>& buffer, size_t offset, size_t size, int32_t flags, const vector<uint8_t>& socket_address) {
return static_cast<int32_t>(::sendto(static_cast<SOCKET>(handle), reinterpret_cast<const char*>(&buffer.data()[offset]), static_cast<int32_t>(size), flags, reinterpret_cast<const SOCKADDR*>(socket_address.data()), static_cast<int32_t>(socket_address.size())));
}
int32_t socket::set_blocking(intptr_t handle, bool blocking) {
u_long mode = blocking ? 0 : 1;
return ioctlsocket(static_cast<SOCKET>(handle), FIONBIO, &mode);
}
int32_t socket::set_raw_socket_option(intptr_t handle, int32_t socket_option_level, int32_t socket_option_name, intptr_t option, size_t option_length) {
return setsockopt(static_cast<SOCKET>(handle), socket_option_level, socket_option_name, reinterpret_cast<const char*>(option), static_cast<int32_t>(option_length));
}
int32_t socket::set_socket_option(intptr_t handle, int32_t socket_option_level, int32_t socket_option_name, intptr_t option, size_t option_length) {
return setsockopt(static_cast<SOCKET>(handle), socket_option_level_to_native(socket_option_level), socket_option_name_to_native(socket_option_name), reinterpret_cast<const char*>(option), static_cast<int32_t>(option_length));
}
int32_t socket::set_socket_linger_option(intptr_t handle, bool enabled, uint32_t linger_time) {
LINGER l {static_cast<u_short>(enabled), static_cast<u_short>(linger_time)};
return setsockopt(static_cast<SOCKET>(handle), SOL_SOCKET, SO_LINGER, reinterpret_cast<const char*>(&l), static_cast<int32_t>(sizeof(LINGER)));
}
int32_t socket::set_socket_multicast_option(intptr_t handle, int32_t socket_option_name, uint32_t multicast_address, uint32_t interface_index) {
struct multicast {
uint32_t multicast_address;
uint32_t interface_index;
} m {multicast_address, interface_index};
return setsockopt(static_cast<SOCKET>(handle), IPPROTO_TCP, socket_option_name_to_native(socket_option_name), reinterpret_cast<const char*>(&m), static_cast<int32_t>(sizeof(multicast)));
}
int32_t socket::set_socket_ip_v6_multicast_option(intptr_t handle, int32_t socket_option_name, const vector<uint8_t>& multicast_address, uint32_t interface_index) {
struct multicast {
uint8_t multicast_address[16];
uint32_t interface_index;
} m;
for (auto index = 0U; index < multicast_address.size(); ++index)
m.multicast_address[index] = multicast_address[index];
m.interface_index = interface_index;
return setsockopt(static_cast<SOCKET>(handle), IPPROTO_TCP, socket_option_name_to_native(socket_option_name), reinterpret_cast<const char*>(&m), static_cast<int32_t>(sizeof(multicast)));
}
int32_t socket::shutdown(intptr_t handle, int32_t how) {
return ::shutdown(static_cast<SOCKET>(handle), how);
}
void socket::startup() {
static WORD version_requested = MAKEWORD(2, 2);
static WSADATA wsa_data = {0};
WSAStartup(version_requested, &wsa_data);
}
| 60.498328 | 1,023 | 0.779535 | gammasoft71 |
9889c6f9277040707bed82dfc5ce1110184f66d5 | 2,104 | cpp | C++ | GUICheckbox.cpp | Magtheridon96/Unfinished-RPG | f002a7e19684f31e6158ca78e24bdd514932d72c | [
"MIT"
] | 1 | 2015-09-14T13:19:16.000Z | 2015-09-14T13:19:16.000Z | GUICheckbox.cpp | Magtheridon96/Unfinished-RPG | f002a7e19684f31e6158ca78e24bdd514932d72c | [
"MIT"
] | null | null | null | GUICheckbox.cpp | Magtheridon96/Unfinished-RPG | f002a7e19684f31e6158ca78e24bdd514932d72c | [
"MIT"
] | null | null | null | #include "GUICheckbox.h"
#include "Context.h"
gui::check_box::check_box(const std::string& p_label, int p_x, int p_y, int p_size)
: state(false)
, label(p_label)
, size(p_size)
{
set_callback([this] { state = !state; });
set_x(p_x);
set_y(p_y);
if (label != "") {
const sf::Font& text_font = resource_cache::get_font(resource_directory::get("font"));
auto text_dimensions = find_text_dimensions(label, text_font, size);
set_width(size + static_cast<unsigned int>(text_dimensions.x) + 4);
} else {
set_width(size);
}
set_height(size);
}
gui::check_box::~check_box() {
}
bool gui::check_box::handle_event(context& context) {
bool handled = gui::callbackable::handle_event(context);
return handled;
}
void gui::check_box::draw(context& context) {
const sf::Texture& button_texture = resource_cache::get_texture(resource_directory::get("editor_button"));
sf::Texture& tick_texture = resource_cache::get_texture(resource_directory::get("tick"));
const sf::Font& text_font = resource_cache::get_font(resource_directory::get("font"));
tick_texture.setSmooth(true);
// Draw checkbox
sf::Sprite checkbox(button_texture);
checkbox.scale(size / checkbox.getLocalBounds().width, size / checkbox.getLocalBounds().height);
checkbox.setPosition(static_cast<float>(x), static_cast<float>(y));
context.window.draw(checkbox);
if (state) {
// Draw tick if its on.
sf::Sprite tick(tick_texture);
tick.setScale(size / 24.0f, size / 24.0f);
tick.setPosition(math::floor(x + checkbox.getGlobalBounds().width/2 - tick.getGlobalBounds().width/2),
math::floor(y + checkbox.getGlobalBounds().height/2 - tick.getGlobalBounds().height/2));
context.window.draw(tick);
}
if (label != "") {
sf::Text text(label, text_font, height);
text.setColor(colors::white);
text.setPosition(static_cast<float>(x + size) + 4.0f, static_cast<float>(y));
context.window.draw(text);
}
}
| 33.935484 | 113 | 0.647814 | Magtheridon96 |
988c4200da0ddfdd9902759e819c734fb996dee2 | 468 | hpp | C++ | src/chp13/employee.hpp | gianscarpe/cpp_primer | f09c645449d9b79e7c77dde13381513dee25519a | [
"MIT"
] | null | null | null | src/chp13/employee.hpp | gianscarpe/cpp_primer | f09c645449d9b79e7c77dde13381513dee25519a | [
"MIT"
] | null | null | null | src/chp13/employee.hpp | gianscarpe/cpp_primer | f09c645449d9b79e7c77dde13381513dee25519a | [
"MIT"
] | null | null | null | #ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>
class Employee{
public:
static int counter;
Employee(std::string _name) : name(_name) {
id = counter++;
}
Employee(const Employee& e){
name = e.name;
id = counter++;
}
Employee& operator=(const Employee& e){
name = e.name;
id = counter++;
return *this;
}
friend void print(const Employee&);
private:
int id;
std::string name;
};
int Employee::counter = 0;
#endif
| 16.137931 | 45 | 0.630342 | gianscarpe |
988c7809c5520bacc7fcffcab5196747afdde658 | 1,428 | cpp | C++ | BUPT 2021 Winter Training #10/k.cpp | rakty/2022-spring-training | db36ad3838945d2bb3a951f9ccd8dfa6f0916d0d | [
"MIT"
] | 1 | 2022-03-04T15:11:33.000Z | 2022-03-04T15:11:33.000Z | BUPT 2021 Winter Training #10/k.cpp | rakty/2022-spring-training | db36ad3838945d2bb3a951f9ccd8dfa6f0916d0d | [
"MIT"
] | null | null | null | BUPT 2021 Winter Training #10/k.cpp | rakty/2022-spring-training | db36ad3838945d2bb3a951f9ccd8dfa6f0916d0d | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
//const int inf=0x7fffffff;
const int inf = 0x3f3f3f3f;
int t, n, a, b, k, f;
void solve()
{
cin >> n >> a >> b >> k >> f;
vector<pair<string, string>>s(n);
map<pair<string, string>, int> mp;
int ans = a, temp;
for (int i = 0; i < n; i++)
{
cin >> s[i].first >> s[i].second;
}
vector<pair<string, string>>resss = s;
if (resss[0].first > resss[0].second) swap(resss[0].first, resss[0].second);
mp[resss[0]] += ans;
for (int i = 1; i < n; i++)
{
temp = ans;
if (s[i].first == s[i - 1].second) ans += b;
else ans += a;
if (resss[i].first > resss[i].second) swap(resss[i].first, resss[i].second);
mp[resss[i]] += ans - temp;
}
int flag = 0;
vector<int>ress;
for (auto x : mp)
{
ress.push_back(x.second);
//cout<<x.first.first<<" "<<x.first.second<<" "<<x.second<<endl;
}
sort(ress.begin(), ress.end());
for (int i = ress.size() - 1; i >= 0; i--)
{
if (flag == k) break;
if (ress[i] <= f) break;
ans -= ress[i];
ans += f;
flag++;
if (flag == k) break;
}
cout << ans << endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
t = 1;
while (t--)
{
solve();
}
return 0;
} | 24.20339 | 84 | 0.487395 | rakty |
988d16a1b6109387658cb907cfdd735f06c4d575 | 5,835 | cpp | C++ | src/shout/shout_cmd/shout_cmd.cpp | all-in-one-of/CopperFX | 9a50b69a57ebd6aa578d12456e34d792a7c51916 | [
"Unlicense"
] | 2 | 2019-06-25T23:36:55.000Z | 2022-03-07T04:15:50.000Z | src/shout/shout_cmd/shout_cmd.cpp | all-in-one-of/CopperFX | 9a50b69a57ebd6aa578d12456e34d792a7c51916 | [
"Unlicense"
] | null | null | null | src/shout/shout_cmd/shout_cmd.cpp | all-in-one-of/CopperFX | 9a50b69a57ebd6aa578d12456e34d792a7c51916 | [
"Unlicense"
] | 1 | 2019-08-22T08:23:37.000Z | 2019-08-22T08:23:37.000Z | #include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/join.hpp>
namespace po = boost::program_options;
#include <fstream>
#include <istream>
#include <iostream>
#include <string>
#include <csignal>
#include <cstdlib>
//#include "antlr4-runtime.h"
//#include "IFDLexer.h"
//#include "IFDParser.h"
#include "shout/shout_lib/SCN/SCN_IORegistry.h"
#include "shout/shout_lib/SCN/SCN_IFDTranslator.h"
#include "shout/shout_lib/SCN/SCN_Scene.h"
#include "shout/shout_lib/renderer.h"
#include "shout/shout_lib/renderer_opengl.h"
namespace logging = boost::log;
using namespace std;
//using namespace antlr4;
void signalHandler( int signum ){
std::cerr << "Interrupt signal (" << signum << ") received." << std::endl;
// cleanup and close up stuff here
// terminate program
exit(signum);
}
// A helper function to simplify the main part.
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
copy(v.begin(), v.end(), ostream_iterator<T>(os, " "));
return os;
}
int main(int argc, char **argv) {
logging::core::get()->set_filter(
logging::trivial::severity >= logging::trivial::debug
);
signal(SIGTERM, signalHandler);
signal(SIGABRT, signalHandler);
try {
int opt;
string config_file;
// Declare a group of options that will be allowed only on command line
namespace po = boost::program_options;
po::options_description generic("Options");
generic.add_options()
("help,h", "Print help messages")
("version,v", "Shout version information")
;
// Declare a group of options that will be allowed both on command line and in config file
po::options_description config("Configuration");
config.add_options()
("optimization", po::value<int>(&opt)->default_value(10),
"optimization level")
("include-path,I",
po::value< vector<string> >()->composing(),
"include path")
;
// Hidden options, will be allowed both on command line and in config file, but will not be shown to the user.
po::options_description hidden("Hidden options");
hidden.add_options()
("input-file", po::value< vector<string> >(), "input file")
;
po::options_description cmdline_options;
cmdline_options.add(generic).add(config).add(hidden);
po::options_description config_file_options;
config_file_options.add(config).add(hidden);
po::options_description visible("Allowed options");
visible.add(generic).add(config);
po::positional_options_description p;
p.add("input-file", -1);
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).
options(cmdline_options).positional(p).run(), vm); // can throw
po::notify(vm); // throws on error, so do after help in case there are any problems
/** --help option
*/
if ( vm.count("help") ) {
cout << "Basic Command Line Parameter App\n" << generic << endl;
exit(EXIT_SUCCESS);
}
if (vm.count("version")) {
cout << "Shout, version 0.0\n";
exit(EXIT_SUCCESS);
}
// Handle config file
ifstream ifs(config_file.c_str());
if (!ifs) {
BOOST_LOG_TRIVIAL(debug) << "No config file provided but that's totally fine." << config_file << "\n";
} else {
store(parse_config_file(ifs, config_file_options), vm);
notify(vm);
}
// Populate IO_Registry with internal and external scene translators
SCN_IORegistry::getInstance().addIOTranslator(
SCN_IFDTranslatorFactory::myExtensions,
SCN_IFDTranslatorFactory::myConstructor
);
SCN_Scene scene;
SCN_IOTranslator *translator = 0;
Renderer *renderer = 0;
renderer = new RendererOpenGL();
if (vm.count("input-file")) {
// loading provided files
vector<string> files = vm["input-file"].as< vector<string> >();
BOOST_LOG_TRIVIAL(debug) << "Input scene files are: "<< boost::algorithm::join(files, " ") << "\n";
for (vector<string>::const_iterator fi = files.begin(); fi != files.end(); ++fi) {
std::ifstream in_file(*fi, std::ifstream::binary);
if ( in_file ) {
string file_extension = boost::filesystem::extension(*fi);
BOOST_LOG_TRIVIAL(debug) << "ext " << file_extension;
translator = SCN_IORegistry::getInstance().getTranslatorByExt(file_extension);
BOOST_LOG_TRIVIAL(debug) << "translator";
//BOOST_LOG_TRIVIAL(debug) << "Reading "<< *fi << " scene file with " << translator->formatName() << " translator";
if (!translator->fileLoad(scene, in_file, false)) {
// error loading scene from file
BOOST_LOG_TRIVIAL(error) << "Error loading scene from file " << *fi;
}
} else {
// error opening scene file
std::cerr << "Unable to open file " << *fi << " ! aborting..." << std::endl;
}
}
} else {
// loading from stdin
BOOST_LOG_TRIVIAL(debug) << "Reading scene from stdin ...\n";
translator = SCN_IORegistry::getInstance().getTranslatorByExt(".ifd"); // default format for reading stdin is ".ifd"
if (!translator->fileLoad(scene, std::cin, false)) {
// error loading scene from stdin
BOOST_LOG_TRIVIAL(error) << "Error loading scene from stdin !";
}
}
if(translator)delete translator;
renderer->render(0);
if(renderer)delete renderer;
}
catch(exception& e)
{
// Unhandled exception reached top of main
BOOST_LOG_TRIVIAL(error) << "Unhandled Exception: " << e.what();
exit(EXIT_FAILURE);
}
BOOST_LOG_TRIVIAL(info) << "All done! Bye ;)";
exit(EXIT_SUCCESS);
} | 32.06044 | 125 | 0.644387 | all-in-one-of |
988d5eac7597f9afb82ce4b9f1cbd3584664ad20 | 2,692 | hpp | C++ | src/cpunit_TestTreeNode.hpp | offa/CPUnit | 03ba7e0502196ad66b215fbc6150039a97acea92 | [
"BSD-3-Clause"
] | 1 | 2016-06-06T07:21:11.000Z | 2016-06-06T07:21:11.000Z | src/cpunit_TestTreeNode.hpp | offa/CPUnit | 03ba7e0502196ad66b215fbc6150039a97acea92 | [
"BSD-3-Clause"
] | null | null | null | src/cpunit_TestTreeNode.hpp | offa/CPUnit | 03ba7e0502196ad66b215fbc6150039a97acea92 | [
"BSD-3-Clause"
] | null | null | null | /*
Copyright (c) 2011 Daniel Bakkelund.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CPUNIT_TESTTREENODE_HPP
#define CPUNIT_TESTTREENODE_HPP
#include "cpunit_Callable.hpp"
#include "cpunit_GlobMatcher.hpp"
#include "cpunit_TestUnit.hpp"
#include "cpunit_StringFlyweightStore.hpp"
#include <map>
#include <string>
#include <vector>
namespace cpunit {
class TestTreeNode {
typedef std::map<std::string, Callable*> TestMap;
typedef std::map<std::string, TestTreeNode*> ChildMap;
TestMap tests;
ChildMap children;
Callable *setUp, *tearDown;
TestTreeNode const *parent;
const std::string *local_name;
const StringFlyweightStoreUsage counter;
public:
TestTreeNode(const std::string &loc_name);
virtual ~TestTreeNode();
std::string get_local_name() const;
std::string get_path() const;
void register_set_up(Callable *s);
void register_tear_down(Callable *t);
void add_test(Callable *test);
void add_child(TestTreeNode *child);
std::map<std::string, TestTreeNode*> get_children();
void extract_matches(std::vector<TestUnit>& result, const GlobMatcher& m);
};
}
#endif // CPUNIT_TESTTREENODE_HPP
| 33.65 | 78 | 0.749257 | offa |