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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b8dad81a9461aa22bdd61772db76670e3690a294
| 6,325
|
cpp
|
C++
|
src/dist/replication/lib/replica_file_provider.cpp
|
neverchanje/rdsn
|
40f432c521686f4e10f172ad89f68d01b72004e4
|
[
"MIT"
] | null | null | null |
src/dist/replication/lib/replica_file_provider.cpp
|
neverchanje/rdsn
|
40f432c521686f4e10f172ad89f68d01b72004e4
|
[
"MIT"
] | null | null | null |
src/dist/replication/lib/replica_file_provider.cpp
|
neverchanje/rdsn
|
40f432c521686f4e10f172ad89f68d01b72004e4
|
[
"MIT"
] | null | null | null |
// Copyright (c) 2017-present, Xiaomi, Inc. All rights reserved.
// This source code is licensed under the Apache License Version 2.0, which
// can be found in the LICENSE file in the root directory of this source tree.
#include "replica.h"
#include <fstream>
#include <dsn/dist/block_service.h>
#include <dsn/dist/fmt_logging.h>
#include <dsn/utility/filesystem.h>
namespace dsn {
namespace replication {
// ThreadPool: THREAD_POOL_REPLICATION, THREAD_POOL_REPLICATION_LONG
error_code replica::do_download(const std::string &remote_dir,
const std::string &local_dir,
const std::string &file_name,
dist::block_service::block_filesystem *fs,
/*out*/ uint64_t &download_file_size)
{
error_code download_err = ERR_OK;
task_tracker tracker;
auto download_file_callback_func = [this, &download_err, &download_file_size](
const dist::block_service::download_response &resp,
dist::block_service::block_file_ptr bf,
const std::string &local_file_name) {
if (resp.err != ERR_OK) {
// during bulk load process, ERR_OBJECT_NOT_FOUND will be considered as a recoverable
// error, however, if file damaged on remote file provider, bulk load should stop,
// return ERR_CORRUPTION instead
if (resp.err == ERR_OBJECT_NOT_FOUND) {
derror_replica("download file({}) failed, file on remote file provider is damaged",
local_file_name);
download_err = ERR_CORRUPTION;
} else {
download_err = resp.err;
}
return;
}
if (resp.downloaded_size != bf->get_size()) {
derror_replica(
"size not match while downloading file({}), file_size({}) vs downloaded_size({})",
bf->file_name(),
bf->get_size(),
resp.downloaded_size);
download_err = ERR_CORRUPTION;
return;
}
std::string current_md5;
error_code e = utils::filesystem::md5sum(local_file_name, current_md5);
if (e != ERR_OK) {
derror_replica("calculate file({}) md5 failed", local_file_name);
download_err = e;
return;
}
if (current_md5 != bf->get_md5sum()) {
derror_replica(
"local file({}) is different from remote file({}), download failed, md5: "
"local({}) VS remote({})",
local_file_name,
bf->file_name(),
current_md5,
bf->get_md5sum());
download_err = ERR_CORRUPTION;
return;
}
ddebug_replica("download file({}) succeed, file_size = {}",
local_file_name.c_str(),
resp.downloaded_size);
download_err = ERR_OK;
download_file_size = resp.downloaded_size;
};
auto create_file_cb = [this,
&local_dir,
&download_err,
&download_file_size,
&download_file_callback_func,
&tracker](const dist::block_service::create_file_response &resp,
const std::string &fname) {
if (resp.err != ERR_OK) {
derror_replica("create file({}) failed with error({})", fname, resp.err.to_string());
download_err = resp.err;
return;
}
dist::block_service::block_file *bf = resp.file_handle.get();
if (bf->get_md5sum().empty()) {
derror_replica("file({}) doesn't exist on remote file provider", bf->file_name());
download_err = ERR_CORRUPTION;
return;
}
const std::string &local_file_name = utils::filesystem::path_combine(local_dir, fname);
// local file exists
if (utils::filesystem::file_exists(local_file_name)) {
std::string current_md5;
error_code e = utils::filesystem::md5sum(local_file_name, current_md5);
if (e != ERR_OK || current_md5 != bf->get_md5sum()) {
if (e != ERR_OK) {
dwarn_replica("calculate file({}) md5 failed, should remove and redownload it",
local_file_name);
} else {
dwarn_replica(
"local file({}) is different from remote file({}), md5: local({}) VS "
"remote({}), should remove and redownload it",
local_file_name,
bf->file_name(),
current_md5,
bf->get_md5sum());
}
if (!utils::filesystem::remove_path(local_file_name)) {
derror_replica("failed to remove file({})", local_file_name);
download_err = e;
return;
}
} else {
download_err = ERR_OK;
download_file_size = bf->get_size();
ddebug_replica("local file({}) has been downloaded, file size = {}",
local_file_name,
download_file_size);
return;
}
}
// download or redownload file
bf->download(dist::block_service::download_request{local_file_name, 0, -1},
TASK_CODE_EXEC_INLINED,
std::bind(download_file_callback_func,
std::placeholders::_1,
resp.file_handle,
local_file_name),
&tracker);
};
const std::string remote_file_name = utils::filesystem::path_combine(remote_dir, file_name);
fs->create_file(dist::block_service::create_file_request{remote_file_name, false},
TASK_CODE_EXEC_INLINED,
std::bind(create_file_cb, std::placeholders::_1, file_name),
&tracker);
tracker.wait_outstanding_tasks();
return download_err;
}
} // namespace replication
} // namespace dsn
| 41.339869
| 99
| 0.532332
|
neverchanje
|
b8e1e9bca5c0e939259290bf44c591ad70988091
| 98
|
hpp
|
C++
|
src/lib/env.hpp
|
stkw0/i-hate-all-rss-readers
|
ac2be9f7c6b070aff3b1fe36a9efbcc8095dcafa
|
[
"Unlicense"
] | null | null | null |
src/lib/env.hpp
|
stkw0/i-hate-all-rss-readers
|
ac2be9f7c6b070aff3b1fe36a9efbcc8095dcafa
|
[
"Unlicense"
] | null | null | null |
src/lib/env.hpp
|
stkw0/i-hate-all-rss-readers
|
ac2be9f7c6b070aff3b1fe36a9efbcc8095dcafa
|
[
"Unlicense"
] | null | null | null |
#pragma once
namespace iharr {
const std::string getenv(const char* name);
} // namespace iharr
| 14
| 43
| 0.72449
|
stkw0
|
b8e2de30705ffd800b8f2efea1732467b4eb9ebe
| 97
|
cpp
|
C++
|
test/Heng-Core-Test/killInit.cpp
|
fitenne/yamc
|
26141cb61eff63521cd282389495c8a9b9a1604d
|
[
"MIT"
] | 1
|
2022-03-27T05:01:04.000Z
|
2022-03-27T05:01:04.000Z
|
test/Heng-Core-Test/killInit.cpp
|
fitenne/yamc
|
26141cb61eff63521cd282389495c8a9b9a1604d
|
[
"MIT"
] | null | null | null |
test/Heng-Core-Test/killInit.cpp
|
fitenne/yamc
|
26141cb61eff63521cd282389495c8a9b9a1604d
|
[
"MIT"
] | null | null | null |
#include <signal.h>
int main(void)
{
kill(1, SIGKILL);
kill(3, SIGKILL);
return 0;
}
| 12.125
| 21
| 0.57732
|
fitenne
|
b8e58df180793b9eb2349f9808e8bc9b28e5aa4c
| 4,511
|
cpp
|
C++
|
RocketPlugin/MeshmoonUser.cpp
|
Adminotech/meshmoon-plugins
|
32043ef783bdf137860d7d01eb22de564628e572
|
[
"Apache-2.0"
] | 4
|
2018-05-09T01:55:14.000Z
|
2021-12-19T17:46:29.000Z
|
RocketPlugin/MeshmoonUser.cpp
|
Adminotech/meshmoon-plugins
|
32043ef783bdf137860d7d01eb22de564628e572
|
[
"Apache-2.0"
] | null | null | null |
RocketPlugin/MeshmoonUser.cpp
|
Adminotech/meshmoon-plugins
|
32043ef783bdf137860d7d01eb22de564628e572
|
[
"Apache-2.0"
] | 2
|
2016-03-15T06:12:05.000Z
|
2021-06-06T00:18:38.000Z
|
/**
@author Adminotech Ltd.
Copyright Adminotech Ltd.
All rights reserved.
@file
@brief */
#include "StableHeaders.h"
#include "DebugOperatorNew.h"
#include "MeshmoonUser.h"
#include "CoreDefines.h"
#include "LoggingFunctions.h"
#include <QTimer>
#include "MemoryLeakCheck.h"
// RocketUserAuthenticator
RocketUserAuthenticator::RocketUserAuthenticator(u32 _connectionId) :
connectionId(_connectionId)
{
}
void RocketUserAuthenticator::EmitCompleted(Meshmoon::PermissionLevel permissionLevel)
{
emit Completed(static_cast<int>(permissionLevel), PermissionLevelToString(permissionLevel));
}
// MeshmoonUser
MeshmoonUser::MeshmoonUser() :
connectionId_(0),
levelAcquired_(false),
permissionLevel_(Meshmoon::Basic)
{
}
MeshmoonUser::~MeshmoonUser()
{
Clear();
}
void MeshmoonUser::SetClientConnectionId(u32 connectionId)
{
connectionId_ = connectionId;
// If we received auth requests before connection ID was set it is -1.
// Set it here to the authenticators so they will emit correctly.
foreach(RocketUserAuthenticator *auth, authenticators_)
if (auth && auth->connectionId == 0)
auth->connectionId = connectionId_;
}
void MeshmoonUser::Clear()
{
// Do not reset userData_ as it can be valid for numerous logins!
connectionId_ = 0;
levelAcquired_ = false;
permissionLevel_ = Meshmoon::Basic;
foreach(RocketUserAuthenticator *auth, authenticators_)
SAFE_DELETE(auth);
authenticators_.clear();
}
void MeshmoonUser::Process()
{
if (levelAcquired_ == false)
return;
for(int i=0; i<authenticators_.size(); ++i)
{
RocketUserAuthenticator *auth = authenticators_[i];
if (auth && auth->connectionId == connectionId_)
{
auth->EmitCompleted(permissionLevel_);
authenticators_.removeAt(i);
SAFE_DELETE(auth);
break;
}
}
}
void MeshmoonUser::SetPermissionLevel(Meshmoon::PermissionLevel permissionLevel, bool log)
{
if (log)
LogInfo("[MeshmoonUser]: Received scene permission level " + PermissionLevelToString(permissionLevel));
levelAcquired_ = true;
permissionLevel_ = permissionLevel;
Process();
}
QString MeshmoonUser::Name() const
{
return userData_.name;
}
QString MeshmoonUser::Hash() const
{
return QString(userData_.hash);
}
QString MeshmoonUser::Gender() const
{
return userData_.gender;
}
QString MeshmoonUser::ProfilePictureUrl() const
{
return userData_.pictureUrl.toString();
}
QString MeshmoonUser::AvatarAppearanceUrl() const
{
return userData_.avatarAppearanceUrl.toString();
}
QStringList MeshmoonUser::MEPNames() const
{
QStringList names;
foreach(const Meshmoon::MEP &mep, userData_.meps)
names << mep.name;
return names;
}
QStringList MeshmoonUser::MEPIds() const
{
QStringList ids;
foreach(const Meshmoon::MEP &mep, userData_.meps)
ids << mep.id;
return ids;
}
QString MeshmoonUser::MEPNameById(const QString &id) const
{
foreach(const Meshmoon::MEP &mep, userData_.meps)
if (mep.id.compare(id, Qt::CaseSensitive) == 0)
return mep.name;
return "";
}
u32 MeshmoonUser::ConnectionId() const
{
return connectionId_;
}
Meshmoon::PermissionLevel MeshmoonUser::PermissionLevel() const
{
return permissionLevel_;
}
QString MeshmoonUser::PermissionLevelString() const
{
return PermissionLevelToString(permissionLevel_);
}
int MeshmoonUser::PermissionLevelNumber() const
{
return static_cast<int>(permissionLevel_);
}
RocketUserAuthenticator *MeshmoonUser::RequestAuthentication()
{
// Return a existing authenticator for multiple requests if already initialized.
RocketUserAuthenticator *auth = Authenticator(connectionId_);
if (!auth)
{
auth = new RocketUserAuthenticator(connectionId_);
authenticators_ << auth;
}
// If level is known, trigger authenticator after 1msec
if (levelAcquired_)
QTimer::singleShot(1, this, SLOT(Process()));
return auth;
}
RocketUserAuthenticator *MeshmoonUser::Authenticator(u32 connectionId) const
{
foreach(RocketUserAuthenticator *auth, authenticators_)
if (auth && auth->connectionId == connectionId)
return auth;
return 0;
}
void MeshmoonUser::OnAuthenticated(const Meshmoon::User &userData)
{
userData_ = userData;
}
void MeshmoonUser::OnAuthReset()
{
userData_.Reset();
}
| 22.112745
| 111
| 0.699401
|
Adminotech
|
b8e5dce81fdc753437319ec1c71a9dbaaba5ca87
| 5,921
|
cpp
|
C++
|
archives/problemset/poj.org/3481.cpp
|
BoleynSu/CP-CompetitiveProgramming
|
cc256bf402360fe0f689fdcdc4e898473a9594dd
|
[
"MIT"
] | 6
|
2019-03-23T21:06:25.000Z
|
2021-06-27T05:22:41.000Z
|
archives/problemset/poj.org/3481.cpp
|
BoleynSu/CP-CompetitiveProgramming
|
cc256bf402360fe0f689fdcdc4e898473a9594dd
|
[
"MIT"
] | 1
|
2020-10-11T08:14:00.000Z
|
2020-10-11T08:14:00.000Z
|
archives/problemset/poj.org/3481.cpp
|
BoleynSu/CP-CompetitiveProgramming
|
cc256bf402360fe0f689fdcdc4e898473a9594dd
|
[
"MIT"
] | 3
|
2019-03-23T21:06:31.000Z
|
2021-10-24T01:44:01.000Z
|
//Boleyn Su's Template for Codeforces
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <climits>
using namespace std;
#define lp for(;;)
#define rep(i,n) for (int i=0;i<(n);++i)
#define repf(i,a,b) for (int i=a;i<(b);++i)
#define ft(i,a,b) for (int i=(a);i<=(b);++i)
#define fdt(i,a,b) for (int i=(a);i>=b;--i)
#define feach(e,s,t) for (t::itr e=(s).begin();e!=(s).end();++e)
#define fsubset(subset,set) for (int subset=set&(set-1);subset;subset=(subset-1)&set)
#define whl while
#define rtn return
#define fl(x,y) memset((x),char(y),sizeof(x))
#define clr(x) fl(x,0)
#define cpy(x,y) memcpy((x),(y),sizeof(x))
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define all(x) (x).begin(),(x).end()
#define srt(x) sort(all(x))
#define uniq(x) (x).resize(unique(all(x))-x.begin())
#define vec vector
#define pr pair
#define que queue
#define prq priority_queue
#define itr iterator
#define sf scanf
#define pf printf
#define pdb(prcs,x) printf("%."#prcs"f",(abs(x)<1e-##prcs)?0.0:x)
#define prt(x) cout<<#x<<"="<<(x)<<endl
#define asrtWA(s) do if(!(s))exit(0);whl(0)
#define asrtTLE(s) do if(!(s))whl(1);whl(0)
#define asrtMLE(s) do if(!(s))whl(new int);whl(0)
#define asrtOLE(s) do if(!(s))whl(1)puts("OLE");whl(0)
#define asrtRE(s) do if(!(s))*(int*)0=0;whl(0)
#define runtime() printf("Used: %.3fs\n",db(clock())/CLOCKS_PER_SEC);
typedef long long int lli;
typedef double db;
typedef char* cstr;
typedef string str;
typedef vec<int> vi;
typedef vec<vi> vvi;
typedef vec<bool> vb;
typedef vec<vb> vvb;
typedef vec<str> vs;
typedef pr<int,int> pii;
typedef pr<lli,lli> pll;
typedef pr<db,db> pdd;
typedef pr<str,int> psi;
typedef map<int,int> mii;
typedef map<str,int> msi;
typedef map<char,int> mci;
typedef set<int> si;
typedef set<str> ss;
typedef que<int> qi;
typedef prq<int> pqi;
const int oo=(~0u)>>1;
const lli ooll=(~0ull)>>1;
const db inf=1e+20;
const db eps=1e-8;
const db pi=acos(-1.0);
const int MOD=1000000007;
template<typename type>inline bool cmax(type& a,const type& b){rtn a<b?a=b,true:false;}
template<typename type>inline bool cmin(type& a,const type& b){rtn b<a?a=b,true:false;}
template<typename type>inline type sqr(const type& x){rtn x*x;}
int dbcmp(const db& a,const db& b){rtn (a>b+eps)-(a<b-eps);}
int sgn(const db& x){rtn dbcmp(x,0);}
template<typename type>inline type gcd(type a,type b){if(b)whl((a%=b)&&(b%=a));rtn a+b;}
template<typename type>inline type lcm(type a,type b){rtn a*b/gcd(a,b);}
template<typename type>inline void bit_inc(vec<type>& st,int x,type inc){whl(x<sz(st))st[x]+=inc,x|=x+1;}
template<typename type>inline type bit_sum(const vec<type>& st,int x){type s=0;whl(x>=0)s+=st[x],x=(x&(x+1))-1;rtn s;}
inline void make_set(vi& set,int size){set.resize(size);rep(i,size)set[i]=i;}
inline int find_set(vi& set,int x){int y=x,z;whl(y!=set[y])y=set[y];whl(x!=set[x])z=set[x],set[x]=y,x=z;rtn y;}
inline bool union_set(vi& set,int a,int b){a=find_set(set,a),b=find_set(set,b);rtn a!=b?set[a]=b,true:false;}
typedef pii type;
enum{MAXNODE=1000000};
struct struct_node
{
struct_node* c[2];
int s;
type k;
};
typedef struct_node* node;
static struct_node pool[MAXNODE];
static node top,null;
static void init_splay()
{
top=pool,null=top++,null->c[0]=null->c[1]=null,null->s=0;
}
struct splay
{
node rt;
splay()
{
top->c[0]=top->c[1]=null,resize(top),top->k=mp(oo,0),rt=top++;
}
void resize(node x){x->s=1+x->c[0]->s+x->c[1]->s;}
void zig(bool d)
{
node t=rt->c[d];
rt->c[d]=null->c[d],null->c[d]=rt,rt=t;
}
void zigzig(bool d)
{
node t=rt->c[d]->c[d];
rt->c[d]->c[d]=null->c[d],null->c[d]=rt->c[d];
rt->c[d]=null->c[d]->c[!d],null->c[d]->c[!d]=rt,resize(rt);
rt=t;
}
void finish()
{
rep(d,2)
{
node t=null->c[d],p=rt->c[!d];
whl(t!=null)
{
t=null->c[d]->c[d];
null->c[d]->c[d]=p;
p=null->c[d],resize(p);
null->c[d]=t;
}
rt->c[!d]=p;
}
resize(rt);
}
void select(int k)
{
lp
{
int t;
bool d=k>(t=rt->c[0]->s);
if (k==t||rt->c[d]==null) break;
if (d) k-=t+1;
bool dd=k>(t=rt->c[d]->c[0]->s);
if (k==t||rt->c[d]->c[dd]==null)
{
zig(d);
break;
}
if (dd) k-=t+1;
d!=dd?zig(d),zig(dd):zigzig(d);
}
finish();
}
void search(type x)
{
lp
{
bool d=x>rt->k;
if (rt->c[d]==null) break;
bool dd=x>rt->c[d]->k;
if (rt->c[d]->c[dd]==null)
{
zig(d);
break;
}
d!=dd?zig(d),zig(dd):zigzig(d);
}
finish();
if (x>rt->k) select(rt->c[0]->s+1);
}
node insert(type x)
{
search(x);
node oldrt=rt;
top->c[0]=oldrt->c[0],top->c[1]=oldrt,top->k=x,rt=top++,oldrt->c[0]=null,resize(oldrt),resize(rt);
rtn rt;
}
node erase(type x)
{
search(x);
node oldrt=rt;
rt=rt->c[1],select(0),rt->c[0]=oldrt->c[0],resize(rt);
rtn oldrt;//delete oldrt
}
node find(type x){rtn search(x),rt;}
node at(int k){rtn select(k),rt;}
int index(type x){rtn search(x),rt->c[0]->s;}
int size(){rtn rt->s-1;}
};
int main()
{
ios_base::sync_with_stdio(false);
init_splay();
splay sp;
lp
{
int op;
cin>>op;
if (op==1)
{
pii x;
cin>>x.y>>x.x;
sp.insert(x);
}
else if(op==2)
{
pii x=sp.at(sz(sp)-1)->k;
sp.erase(x);
cout<<x.y<<endl;
}
else if(op==3)
{
pii x=sp.at(0)->k;
sp.erase(x);
cout<<x.y<<endl;
}
else break;
}
}
| 24.568465
| 119
| 0.587232
|
BoleynSu
|
b8e87fdf97bbe484264c61565486b9567ef5961b
| 24,283
|
cpp
|
C++
|
Engine/src/Buffer.cpp
|
int-Frank/BSR
|
16310147281c76ca37836b07aff2974234e09a47
|
[
"Apache-2.0"
] | 1
|
2020-01-04T20:17:42.000Z
|
2020-01-04T20:17:42.000Z
|
Engine/src/Buffer.cpp
|
int-Frank/BSR
|
16310147281c76ca37836b07aff2974234e09a47
|
[
"Apache-2.0"
] | null | null | null |
Engine/src/Buffer.cpp
|
int-Frank/BSR
|
16310147281c76ca37836b07aff2974234e09a47
|
[
"Apache-2.0"
] | null | null | null |
//@group Renderer
/*
Original Copyright Yan Chernikov <github.com/TheCherno/Hazel-dev> and contributors.
The following code is a derivative work of the code from the GitHub project 'Hazel-dev',
which is licensed under:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses
This code therefore is also licensed under the terms
of the Apache License Version 2.0
Copyright 2017-2019 Frank Hart <frankhart010@gmail.com>
*/
#pragma once
#include "Buffer.h"
#include "Renderer.h"
#include "core_Log.h"
#include "RenderThreadData.h"
#include "ShaderUtils.h"
#include "Serialize.h"
namespace Engine
{
//------------------------------------------------------------------------------------------------
// BufferElement
//------------------------------------------------------------------------------------------------
BufferElement::BufferElement(ShaderDataType a_type, std::string const& a_name, bool a_normalized)
: name(a_name)
, type(a_type)
, size(SizeOfShaderDataType(type))
, offset(0)
, normalized(a_normalized)
{
}
uint32_t BufferElement::GetComponentCount() const
{
return ::Engine::GetComponentCount(type);
}
size_t BufferElement::Size() const
{
return size_t(Core::SerializedSize(name))
+ size_t(Core::SerializedSize(type))
+ size_t(Core::SerializedSize(size))
+ size_t(Core::SerializedSize(offset))
+ size_t(Core::SerializedSize(normalized));
}
void* BufferElement::Serialize(void* a_out) const
{
void * pBuf = a_out;
uint32_t type32 = static_cast<uint32_t>(type);
pBuf = Core::Serialize(pBuf, &name);
pBuf = Core::Serialize(pBuf, &type32);
pBuf = Core::Serialize(pBuf, &size);
pBuf = Core::Serialize(pBuf, &offset);
pBuf = Core::Serialize(pBuf, &normalized);
return pBuf;
}
void const* BufferElement::Deserialize(void const * a_buf)
{
void const * pBuf = a_buf;
uint32_t type32(0);
pBuf = Core::Deserialize(pBuf, &name);
pBuf = Core::Deserialize(pBuf, &type32);
type = uint_ToShaderDataType(type32);
pBuf = Core::Deserialize(pBuf, &size);
pBuf = Core::Deserialize(pBuf, &offset);
pBuf = Core::Deserialize(pBuf, &normalized);
return pBuf;
}
//------------------------------------------------------------------------------------------------
// BufferLayout
//------------------------------------------------------------------------------------------------
BufferLayout::BufferLayout()
: m_stride(0)
{
}
BufferLayout::BufferLayout(const std::initializer_list<BufferElement>& elements)
: m_elements(elements)
, m_stride(0)
{
CalculateOffsetsAndStride();
}
uint32_t BufferLayout::GetStride() const
{
return m_stride;
}
std::vector<BufferElement> const& BufferLayout::GetElements() const
{
return m_elements;
}
std::vector<BufferElement>::iterator BufferLayout::begin()
{
return m_elements.begin();
}
std::vector<BufferElement>::iterator BufferLayout::end()
{
return m_elements.end();
}
std::vector<BufferElement>::const_iterator BufferLayout::begin() const
{
return m_elements.begin();
}
std::vector<BufferElement>::const_iterator BufferLayout::end() const
{
return m_elements.end();
}
void BufferLayout::CalculateOffsetsAndStride()
{
uint32_t offset = 0;
m_stride = 0;
for (auto& element : m_elements)
{
element.offset = offset;
offset += element.size;
m_stride += element.size;
}
}
size_t BufferLayout::Size() const
{
size_t sze = sizeof(m_stride);
sze += sizeof(uint32_t);
for (auto const & item : m_elements)
sze += item.Size();
return sze;
}
void* BufferLayout::Serialize(void* a_out) const
{
uint32_t nElements = static_cast<uint32_t>(m_elements.size());
void* pBuf = a_out;
pBuf = Core::Serialize(pBuf, &m_stride);
pBuf = Core::Serialize(pBuf, &nElements);
for (auto const& item : m_elements)
pBuf = item.Serialize(pBuf);
return pBuf;
}
void const* BufferLayout::Deserialize(void const* a_buf)
{
uint32_t nElements = 0;
void const * pBuf = a_buf;
pBuf = Core::Deserialize(pBuf, &m_stride);
pBuf = Core::Deserialize(pBuf, &nElements);
for (uint32_t i = 0; i < nElements; i++)
{
BufferElement ele;
pBuf = ele.Deserialize(pBuf);
m_elements.push_back(ele);
}
return pBuf;
}
//------------------------------------------------------------------------------------------------
// VertexBuffer
//------------------------------------------------------------------------------------------------
VertexBuffer::VertexBuffer()
{
}
void VertexBuffer::Init(void* a_data, uint32_t a_size, BufferUsage a_usage)
{
uint8_t * data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage, data]()
{
::Engine::RT_VertexBuffer vb;
vb.Init(data, size, usage);
::Engine::RenderThreadData::Instance()->VBOs.insert(resID, vb);
});
}
void VertexBuffer::Init(uint32_t a_size, BufferUsage a_usage)
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage]()
{
::Engine::RT_VertexBuffer vb;
vb.Init(size, usage);
::Engine::RenderThreadData::Instance()->VBOs.insert(resID, vb);
});
}
VertexBuffer::~VertexBuffer()
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferDelete);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]() mutable
{
RT_VertexBuffer * pVBO = RenderThreadData::Instance()->VBOs.at(resID);
if (pVBO == nullptr)
{
LOG_WARN("VertexBuffer::~VertexBuffer: RefID '{}' does not exist!", resID);
return;
}
pVBO->Destroy();
::Engine::RenderThreadData::Instance()->VBOs.erase(resID);
});
}
void VertexBuffer::SetData(void* a_data, uint32_t a_size, uint32_t a_offset)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetData);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), offset = a_offset, size = a_size, data]()
{
::Engine::RT_VertexBuffer * pVBO = ::Engine::RenderThreadData::Instance()->VBOs.at(resID);
if (pVBO == nullptr)
{
LOG_WARN("VertexBuffer::SetData(): RefID '{}' does not exist!", resID);
return;
}
pVBO->SetData(data, size, offset);
});
}
void VertexBuffer::Bind() const
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferBind);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]()
{
::Engine::RT_VertexBuffer * pVBO = ::Engine::RenderThreadData::Instance()->VBOs.at(resID);
if (pVBO == nullptr)
{
LOG_WARN("VertexBuffer::Bind(): RefID '{}' does not exist!", resID);
return;
}
pVBO->Bind();
});
}
void VertexBuffer::SetLayout(BufferLayout const& a_layout)
{
void * buffer = RENDER_ALLOCATE(static_cast<uint32_t>(a_layout.Size()));
a_layout.Serialize(buffer);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetLayout);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), buffer = buffer]()
{
::Engine::RT_VertexBuffer* pVBO = ::Engine::RenderThreadData::Instance()->VBOs.at(resID);
if (pVBO == nullptr)
{
LOG_WARN("VertexBuffer::SetLayout(): RefID '{}' does not exist!", resID);
return;
}
BufferLayout layout;
layout.Deserialize(buffer);
pVBO->SetLayout(layout);
});
}
Ref<VertexBuffer> VertexBuffer::Create(void* a_data,
uint32_t a_size,
BufferUsage a_usage)
{
VertexBuffer* pVBO = new VertexBuffer();
Ref<VertexBuffer> ref(pVBO); // Need to do it this way to give the object a resource ID
pVBO->Init(a_data, a_size, a_usage);
return ref;
}
Ref<VertexBuffer> VertexBuffer::Create(uint32_t a_size,
BufferUsage a_usage)
{
VertexBuffer* pVBO = new VertexBuffer();
Ref<VertexBuffer> ref(pVBO); // Need to do it this way to give the object a resource ID
pVBO->Init(a_size, a_usage);
return ref;
}
//------------------------------------------------------------------------------------------------
// UniformBuffer
//------------------------------------------------------------------------------------------------
UniformBuffer::UniformBuffer()
{
}
void UniformBuffer::Init(void* a_data, uint32_t a_size, BufferUsage a_usage)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage, data]()
{
::Engine::RT_UniformBuffer ub;
ub.Init(data, size, usage);
::Engine::RenderThreadData::Instance()->UBOs.insert(resID, ub);
});
}
void UniformBuffer::Init(uint32_t a_size, BufferUsage a_usage)
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage]()
{
::Engine::RT_UniformBuffer ub;
ub.Init(size, usage);
::Engine::RenderThreadData::Instance()->UBOs.insert(resID, ub);
});
}
UniformBuffer::~UniformBuffer()
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferDelete);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]() mutable
{
RT_UniformBuffer* pUBO = RenderThreadData::Instance()->UBOs.at(resID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::~UniformBuffer: RefID '{}' does not exist!", resID);
return;
}
pUBO->Destroy();
::Engine::RenderThreadData::Instance()->UBOs.erase(resID);
});
}
void UniformBuffer::SetData(void* a_data, uint32_t a_size, uint32_t a_offset)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetData);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), offset = a_offset, size = a_size, data]()
{
::Engine::RT_UniformBuffer* pUBO = ::Engine::RenderThreadData::Instance()->UBOs.at(resID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::SetData(): RefID '{}' does not exist!", resID);
return;
}
pUBO->SetData(data, size, offset);
});
}
void UniformBuffer::Bind() const
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferBind);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]()
{
::Engine::RT_UniformBuffer* pUBO = ::Engine::RenderThreadData::Instance()->UBOs.at(resID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::Bind(): RefID '{}' does not exist!", resID);
return;
}
pUBO->Bind();
});
}
void UniformBuffer::SetLayout(BufferLayout const& a_layout)
{
void* buffer = RENDER_ALLOCATE(static_cast<uint32_t>(a_layout.Size()));
a_layout.Serialize(buffer);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetLayout);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), buffer = buffer]()
{
::Engine::RT_UniformBuffer* pUBO = ::Engine::RenderThreadData::Instance()->UBOs.at(resID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::SetLayout(): RefID '{}' does not exist!", resID);
return;
}
BufferLayout layout;
layout.Deserialize(buffer);
pUBO->SetLayout(layout);
});
}
Ref<UniformBuffer> UniformBuffer::Create(void* a_data,
uint32_t a_size,
BufferUsage a_usage)
{
UniformBuffer* pUBO = new UniformBuffer();
Ref<UniformBuffer> ref(pUBO); // Need to do it this way to give the object a resource ID
pUBO->Init(a_data, a_size, a_usage);
return ref;
}
Ref<UniformBuffer> UniformBuffer::Create(uint32_t a_size,
BufferUsage a_usage)
{
UniformBuffer* pUBO = new UniformBuffer();
Ref<UniformBuffer> ref(pUBO); // Need to do it this way to give the object a resource ID
pUBO->Init(a_size, a_usage);
return ref;
}
void UniformBuffer::Bind(Ref<BindingPoint> const& a_bp)
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::IndexedBufferBind);
RENDER_SUBMIT(state, [uboID = GetRefID().GetID(), bpID = a_bp->GetRefID().GetID()]()
{
::Engine::RT_UniformBuffer* pUBO = ::Engine::RenderThreadData::Instance()->UBOs.at(uboID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::SetLayout(): UBO RefID '{}' does not exist!", uboID);
return;
}
::Engine::RT_BindingPoint* pBP = ::Engine::RenderThreadData::Instance()->bindingPoints.at(bpID);
if (pUBO == nullptr)
{
LOG_WARN("UniformBuffer::SetLayout(): BP RefID '{}' does not exist!", bpID);
return;
}
pUBO->BindToPoint(*pBP);
});
}
//------------------------------------------------------------------------------------------------
// ShaderStorageBuffer
//------------------------------------------------------------------------------------------------
ShaderStorageBuffer::ShaderStorageBuffer()
{
}
void ShaderStorageBuffer::Init(void* a_data, uint32_t a_size, BufferUsage a_usage)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage, data]()
{
::Engine::RT_ShaderStorageBuffer ssb;
ssb.Init(data, size, usage);
::Engine::RenderThreadData::Instance()->SSBOs.insert(resID, ssb);
});
}
void ShaderStorageBuffer::Init(uint32_t a_size, BufferUsage a_usage)
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, usage = a_usage]()
{
::Engine::RT_ShaderStorageBuffer ssb;
ssb.Init(size, usage);
::Engine::RenderThreadData::Instance()->SSBOs.insert(resID, ssb);
});
}
ShaderStorageBuffer::~ShaderStorageBuffer()
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferDelete);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]() mutable
{
RT_ShaderStorageBuffer* pSSBO = RenderThreadData::Instance()->SSBOs.at(resID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::~ShaderStorageBuffer: RefID '{}' does not exist!", resID);
return;
}
pSSBO->Destroy();
::Engine::RenderThreadData::Instance()->SSBOs.erase(resID);
});
}
void ShaderStorageBuffer::SetData(void* a_data, uint32_t a_size, uint32_t a_offset)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetData);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), offset = a_offset, size = a_size, data]()
{
::Engine::RT_ShaderStorageBuffer* pSSBO = ::Engine::RenderThreadData::Instance()->SSBOs.at(resID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::SetData(): RefID '{}' does not exist!", resID);
return;
}
pSSBO->SetData(data, size, offset);
});
}
void ShaderStorageBuffer::Bind() const
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferBind);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]()
{
::Engine::RT_ShaderStorageBuffer* pSSBO = ::Engine::RenderThreadData::Instance()->SSBOs.at(resID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::Bind(): RefID '{}' does not exist!", resID);
return;
}
pSSBO->Bind();
});
}
void ShaderStorageBuffer::SetLayout(BufferLayout const& a_layout)
{
void* buffer = RENDER_ALLOCATE(static_cast<uint32_t>(a_layout.Size()));
a_layout.Serialize(buffer);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetLayout);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), buffer = buffer]()
{
::Engine::RT_ShaderStorageBuffer* pSSBO = ::Engine::RenderThreadData::Instance()->SSBOs.at(resID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::SetLayout(): RefID '{}' does not exist!", resID);
return;
}
BufferLayout layout;
layout.Deserialize(buffer);
pSSBO->SetLayout(layout);
});
}
Ref<ShaderStorageBuffer> ShaderStorageBuffer::Create(void* a_data,
uint32_t a_size,
BufferUsage a_usage)
{
ShaderStorageBuffer* pSSBO = new ShaderStorageBuffer();
Ref<ShaderStorageBuffer> ref(pSSBO); // Need to do it this way to give the object a resource ID
pSSBO->Init(a_data, a_size, a_usage);
return ref;
}
Ref<ShaderStorageBuffer> ShaderStorageBuffer::Create(uint32_t a_size,
BufferUsage a_usage)
{
ShaderStorageBuffer* pSSBO = new ShaderStorageBuffer();
Ref<ShaderStorageBuffer> ref(pSSBO); // Need to do it this way to give the object a resource ID
pSSBO->Init(a_size, a_usage);
return ref;
}
void ShaderStorageBuffer::Bind(Ref<BindingPoint> const& a_bp)
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::IndexedBufferBind);
RENDER_SUBMIT(state, [uboID = GetRefID().GetID(), bpID = a_bp->GetRefID().GetID()]()
{
::Engine::RT_ShaderStorageBuffer* pSSBO = ::Engine::RenderThreadData::Instance()->SSBOs.at(uboID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::SetLayout(): SSBO RefID '{}' does not exist!", uboID);
return;
}
::Engine::RT_BindingPoint* pBP = ::Engine::RenderThreadData::Instance()->bindingPoints.at(bpID);
if (pSSBO == nullptr)
{
LOG_WARN("ShaderStorageBuffer::SetLayout(): BP RefID '{}' does not exist!", bpID);
return;
}
pSSBO->BindToPoint(*pBP);
});
}
//------------------------------------------------------------------------------------------------
// IndexBuffer
//------------------------------------------------------------------------------------------------
IndexBuffer::IndexBuffer()
{
}
void IndexBuffer::Init(void* a_data, uint32_t a_size)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferCreate);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), size = a_size, data]()
{
::Engine::RT_IndexBuffer ib;
ib.Init(data, size);
::Engine::RenderThreadData::Instance()->IBOs.insert(resID, ib);
});
}
Ref<IndexBuffer> IndexBuffer::Create(void* a_data, uint32_t a_size)
{
IndexBuffer* pIBO = new IndexBuffer();
Ref<IndexBuffer> ref(pIBO); // Need to do it this way to give the object a resource ID
pIBO->Init(a_data, a_size);
return ref;
}
IndexBuffer::~IndexBuffer()
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferDelete);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]() mutable
{
RT_IndexBuffer * pIB = RenderThreadData::Instance()->IBOs.at(resID);
if (pIB == nullptr)
{
LOG_WARN("IndexBuffer::~IndexBuffer: RefID '{}' does not exist!", resID);
return;
}
pIB->Destroy();
::Engine::RenderThreadData::Instance()->IBOs.erase(resID);
});
}
void IndexBuffer::SetData(void* a_data, uint32_t a_size, uint32_t a_offset)
{
uint8_t* data = (uint8_t*)RENDER_ALLOCATE(a_size);
memcpy(data, a_data, a_size);
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferSetData);
RENDER_SUBMIT(state, [resID = GetRefID().GetID(), offset = a_offset, size = a_size, data]()
{
::Engine::RT_IndexBuffer * pIBO = ::Engine::RenderThreadData::Instance()->IBOs.at(resID);
if (pIBO == nullptr)
{
LOG_WARN("IndexBuffer::SetData(): RefID '{}' does not exist!", resID);
return;
}
pIBO->SetData(data, size, offset);
});
}
void IndexBuffer::Bind() const
{
RenderState state = RenderState::Create();
state.Set<RenderState::Attr::Type>(RenderState::Type::Command);
state.Set<RenderState::Attr::Command>(RenderState::Command::BufferBind);
RENDER_SUBMIT(state, [resID = GetRefID().GetID()]()
{
::Engine::RT_IndexBuffer * pIBO = ::Engine::RenderThreadData::Instance()->IBOs.at(resID);
if (pIBO == nullptr)
{
LOG_WARN("IndexBuffer::Bind(): RefID '{}' does not exist!", resID);
return;
}
pIBO->Bind();
});
}
}
| 32.550938
| 104
| 0.604662
|
int-Frank
|
b8f4ab9146b4e516c55092b6fd022af7f18bc838
| 1,482
|
cpp
|
C++
|
src/fsc/object/base/transformer/translate.cpp
|
nnoell/fsc
|
19c6e471fa0712c6fe4817b08d3bf8c6ae2b16fb
|
[
"BSD-3-Clause"
] | 1
|
2018-11-26T19:06:52.000Z
|
2018-11-26T19:06:52.000Z
|
src/fsc/object/base/transformer/translate.cpp
|
nnoell/fsc
|
19c6e471fa0712c6fe4817b08d3bf8c6ae2b16fb
|
[
"BSD-3-Clause"
] | null | null | null |
src/fsc/object/base/transformer/translate.cpp
|
nnoell/fsc
|
19c6e471fa0712c6fe4817b08d3bf8c6ae2b16fb
|
[
"BSD-3-Clause"
] | null | null | null |
//----------------------------------------------------------------------------------------------------------------------
// Copyright : (c) Julian Bouzas 2018
// License : BSD3-style (see LICENSE)
// Maintainer : Julian Bouzas - nnoell3[at]gmail.com
//----------------------------------------------------------------------------------------------------------------------
// FSC
#include "translate.hpp"
namespace fsc {
namespace object {
namespace base {
namespace transformer {
Translate::Translate(glm::vec3 position) :
Transformer("translate"),
position_(std::move(position)) {
}
Translate::~Translate() {
}
Translate::Translate(const Translate& other) :
Transformer(other),
position_(other.position_) {
}
Translate::Translate(Translate&& other) :
Transformer(std::move(other)),
position_(std::move(other.position_)) {
}
Translate& Translate::operator=(const Translate& other) {
Transformer::operator=(other);
position_ = other.position_;
return *this;
}
Translate& Translate::operator=(Translate&& other) {
Transformer::operator=(std::move(other));
position_ = std::move(other.position_);
return *this;
}
const glm::vec3& Translate::GetPosition() const {
return position_;
}
glm::mat4 Translate::Transform(const glm::mat4& model) const {
return glm::translate(model, position_);
}
} // namespace transformer
} // namespace base
} // namespace object
} // namespace fsc
| 26.464286
| 121
| 0.562078
|
nnoell
|
b8f6913283be1057e744c4d509444281f4870706
| 1,058
|
cpp
|
C++
|
interpreter/lox/lox/ASTPrinter.cpp
|
mandyedi/craftinginterpreters-cpp
|
fd4ec9a61d9a2640d77fd6f5fa3dc3ee23c22d34
|
[
"MIT"
] | null | null | null |
interpreter/lox/lox/ASTPrinter.cpp
|
mandyedi/craftinginterpreters-cpp
|
fd4ec9a61d9a2640d77fd6f5fa3dc3ee23c22d34
|
[
"MIT"
] | null | null | null |
interpreter/lox/lox/ASTPrinter.cpp
|
mandyedi/craftinginterpreters-cpp
|
fd4ec9a61d9a2640d77fd6f5fa3dc3ee23c22d34
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "ASTPrinter.h"
void ASTPrinter::Print( Expr *expr )
{
expr->Accept( this );
}
void ASTPrinter::VisitBinaryExpr( Binary *expr )
{
Parenthesize( expr->Op.Lexeme, { expr->Left, expr->Right } );
}
void ASTPrinter::VisitGroupingExpr( Grouping *expr )
{
Parenthesize( "group", { expr->Expression } );
}
void ASTPrinter::VisitLiteralExpr( Literal *expr )
{
if ( auto value = std::get_if<Null>(&expr->Value) )
{
std::cout << "nil";
}
else if ( auto value = std::get_if<double>( &expr->Value ) )
{
std::cout << *value;
}
else if ( auto value = std::get_if<std::string>( &expr->Value ) )
{
std::cout << *value;
}
}
void ASTPrinter::VisitUnaryExpr( Unary *expr )
{
Parenthesize( expr->Op.Lexeme, { expr->Right } );
}
void ASTPrinter::Parenthesize( const std::string &name, const std::vector<Expr *> exprs )
{
std::cout << "(" << name;
for ( auto *expr : exprs )
{
std::cout << " ";
expr->Accept( this );
}
std::cout << ")";
}
| 21.591837
| 89
| 0.574669
|
mandyedi
|
b8f8f3bd897d3adccc6e03765ca7642ec4650c0c
| 3,862
|
cpp
|
C++
|
443-string-compression/string-compression.cpp
|
nagestx/MyLeetCode
|
ef2a98b48485a0cebc442bbbbdb2690ba51484e1
|
[
"MIT"
] | 3
|
2018-12-15T14:07:12.000Z
|
2020-07-19T23:18:09.000Z
|
443-string-compression/string-compression.cpp
|
yangyangu/MyLeetCode
|
ef2a98b48485a0cebc442bbbbdb2690ba51484e1
|
[
"MIT"
] | null | null | null |
443-string-compression/string-compression.cpp
|
yangyangu/MyLeetCode
|
ef2a98b48485a0cebc442bbbbdb2690ba51484e1
|
[
"MIT"
] | null | null | null |
// Given an array of characters, compress it in-place.
//
// The length after compression must always be smaller than or equal to the original array.
//
// Every element of the array should be a character (not int) of length 1.
//
// After you are done modifying the input array in-place, return the new length of the array.
//
//
// Follow up:
// Could you solve it using only O(1) extra space?
//
//
// Example 1:
//
//
// Input:
// ["a","a","b","b","c","c","c"]
//
// Output:
// Return 6, and the first 6 characters of the input array should be: ["a","2","b","2","c","3"]
//
// Explanation:
// "aa" is replaced by "a2". "bb" is replaced by "b2". "ccc" is replaced by "c3".
//
//
//
//
// Example 2:
//
//
// Input:
// ["a"]
//
// Output:
// Return 1, and the first 1 characters of the input array should be: ["a"]
//
// Explanation:
// Nothing is replaced.
//
//
//
//
// Example 3:
//
//
// Input:
// ["a","b","b","b","b","b","b","b","b","b","b","b","b"]
//
// Output:
// Return 4, and the first 4 characters of the input array should be: ["a","b","1","2"].
//
// Explanation:
// Since the character "a" does not repeat, it is not compressed. "bbbbbbbbbbbb" is replaced by "b12".
// Notice each digit has it's own entry in the array.
//
//
//
//
// Note:
//
//
// All characters have an ASCII value in [35, 126].
// 1 <= len(chars) <= 1000.
//
//
/*
* @lc app=leetcode id=443 lang=cpp
*
* [443] String Compression
*
* https://leetcode.com/problems/string-compression/description/
*
* algorithms
* Easy (36.42%)
* Total Accepted: 39.1K
* Total Submissions: 107.5K
* Testcase Example: '["a","a","b","b","c","c","c"]'
*
* Given an array of characters, compress it in-place.
*
* The length after compression must always be smaller than or equal to the
* original array.
*
* Every element of the array should be a character (not int) of length 1.
*
* After you are done modifying the input array in-place, return the new length
* of the array.
*
*
* Follow up:
* Could you solve it using only O(1) extra space?
*
*
* Example 1:
*
*
* Input:
* ["a","a","b","b","c","c","c"]
*
* Output:
* Return 6, and the first 6 characters of the input array should be:
* ["a","2","b","2","c","3"]
*
* Explanation:
* "aa" is replaced by "a2". "bb" is replaced by "b2". "ccc" is replaced by
* "c3".
*
*
*
*
* Example 2:
*
*
* Input:
* ["a"]
*
* Output:
* Return 1, and the first 1 characters of the input array should be: ["a"]
*
* Explanation:
* Nothing is replaced.
*
*
*
*
* Example 3:
*
*
* Input:
* ["a","b","b","b","b","b","b","b","b","b","b","b","b"]
*
* Output:
* Return 4, and the first 4 characters of the input array should be:
* ["a","b","1","2"].
*
* Explanation:
* Since the character "a" does not repeat, it is not compressed.
* "bbbbbbbbbbbb" is replaced by "b12".
* Notice each digit has it's own entry in the array.
*
*
*
*
* Note:
*
*
* All characters have an ASCII value in [35, 126].
* 1 <= len(chars) <= 1000.
*
*
*/
class Solution {
public:
int compress(vector<char>& chars) {
int n = chars.size();
if(n < 2){
return n;
}
int i = 0, j = 0;
while(i < n){
chars[j] = chars[i];
int cnt = 0;
while(i < n && chars[i] == chars[j]){
++ cnt;
++ i;
}
if(cnt == 1){
++ j;
}else{
string str = to_string(cnt);
for(auto c: str){
chars[++ j] = c;
}
++ j;
}
}
return j;
}
};
| 20.875676
| 103
| 0.50492
|
nagestx
|
b8f916c75a504318aaa0294561784da8c209d347
| 2,588
|
cpp
|
C++
|
test/txpl/lexer/try_dec_number_test.cpp
|
ptomulik/txpl
|
109b5847abe0d46c598ada46f411f98ebe8dc4c8
|
[
"BSL-1.0"
] | null | null | null |
test/txpl/lexer/try_dec_number_test.cpp
|
ptomulik/txpl
|
109b5847abe0d46c598ada46f411f98ebe8dc4c8
|
[
"BSL-1.0"
] | 14
|
2015-03-02T14:02:32.000Z
|
2015-05-17T21:50:30.000Z
|
test/txpl/lexer/try_dec_number_test.cpp
|
ptomulik/txpl
|
109b5847abe0d46c598ada46f411f98ebe8dc4c8
|
[
"BSL-1.0"
] | null | null | null |
// Copyright (C) 2015, Pawel Tomulik <ptomulik@meil.pw.edu.pl>
//
// 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)
#define BOOST_TEST_MODULE test_txpl_lexer_try_dec_number
#include <txpl/test_config.hpp>
#include <boost/test/unit_test.hpp>
#ifndef TXPL_TEST_SKIP_LEXER_TRY_DEC_NUMBER
#include <txpl/lexer/try_dec_number.hpp>
BOOST_AUTO_TEST_CASE(cstr)
{
using namespace txpl::lexer;
{
const char *str = "0";
const char *first = str, *last = first+1;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const char *str = "00";
const char *first = str, *last = first+2;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const char *str = "17";
const char *first = str, *last = first+2;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const char *str = "60A";
const char *first = str, *last = first+3;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first = str+2);
}
{
const char *str = "";
const char *first = str, *last = first;
BOOST_CHECK(!try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const char *str = "@17";
const char *first = str, *last = first+3;
BOOST_CHECK(!try_dec_number(first, last));
BOOST_CHECK(first == str);
}
}
BOOST_AUTO_TEST_CASE(cwstr)
{
using namespace txpl::lexer;
{
const wchar_t *str = L"0";
const wchar_t *first = str, *last = first+1;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const wchar_t *str = L"00";
const wchar_t *first = str, *last = first+2;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const wchar_t *str = L"17";
const wchar_t *first = str, *last = first+2;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const wchar_t *str = L"60A";
const wchar_t *first = str, *last = first+3;
BOOST_CHECK(try_dec_number(first, last));
BOOST_CHECK(first == str+2);
}
{
const wchar_t *str = L"";
const wchar_t *first = str, *last = first;
BOOST_CHECK(!try_dec_number(first, last));
BOOST_CHECK(first == last);
}
{
const wchar_t *str = L"@17";
const wchar_t *first = str, *last = first+3;
BOOST_CHECK(!try_dec_number(first, last));
BOOST_CHECK(first == str);
}
}
#else
BOOST_AUTO_TEST_CASE(dummy)
{
BOOST_CHECK(true);
}
#endif
| 25.623762
| 62
| 0.641808
|
ptomulik
|
b8f9701d8cfcb7e5ae869cea5a5343fa1facff70
| 1,481
|
cpp
|
C++
|
shf-cpp/src/Game/Menu/MemoMenu.cpp
|
Upwinded/SHF
|
797682152234251c9a32692324904c7aa8d90683
|
[
"Zlib"
] | 71
|
2018-03-21T08:04:04.000Z
|
2022-01-11T09:49:26.000Z
|
shf-cpp/src/Game/Menu/MemoMenu.cpp
|
Upwinded/SHF
|
797682152234251c9a32692324904c7aa8d90683
|
[
"Zlib"
] | 2
|
2018-08-28T08:26:02.000Z
|
2019-04-06T14:29:39.000Z
|
shf-cpp/src/Game/Menu/MemoMenu.cpp
|
Upwinded/SHF
|
797682152234251c9a32692324904c7aa8d90683
|
[
"Zlib"
] | 25
|
2018-03-24T03:36:28.000Z
|
2021-09-20T06:19:09.000Z
|
#include "MemoMemu.h"
#include "../GameManager/GameManager.h"
MemoMenu::MemoMenu()
{
init();
visible = false;
}
MemoMenu::~MemoMenu()
{
freeResource();
}
void MemoMenu::reFresh()
{
if (scrollbar != NULL && memoText != NULL)
{
for (int i = 0; i < MEMO_LINE; i++)
{
if (position + i < (int)GameManager::getInstance()->memo.memo.size())
{
memoText->mstr[i]->setStr(convert::GBKToUnicode(GameManager::getInstance()->memo.memo[i + position]));
}
else
{
memoText->mstr[i]->setStr(L"");
}
}
}
}
void MemoMenu::reset()
{
scrollbar->setPosition(0);
position = scrollbar->position;
reFresh();
}
void MemoMenu::reRange(int max)
{
scrollbar->max = max;
scrollbar->setPosition(scrollbar->position);
position = scrollbar->position;
reFresh();
}
void MemoMenu::init()
{
freeResource();
initFromIni("ini\\ui\\memo\\window.ini");
title = addImageContainer("ini\\ui\\memo\\title.ini");
image = addImageContainer("ini\\ui\\memo\\image.ini");
scrollbar = addScrollbar("ini\\ui\\memo\\scrollbar.ini");
memoText = addMemo("ini\\ui\\memo\\memo.ini");
setChildRect();
}
void MemoMenu::freeResource()
{
if (impImage != NULL)
{
IMP::clearIMPImage(impImage);
delete impImage;
impImage = NULL;
}
freeCom(memoText);
freeCom(title);
freeCom(image);
freeCom(scrollbar);
}
void MemoMenu::onEvent()
{
if (scrollbar != NULL && memoText != NULL && position != scrollbar->position)
{
position = scrollbar->position;
reFresh();
}
}
| 17.630952
| 106
| 0.651587
|
Upwinded
|
b8fda0fb4a0c060ca0ef0700fcefab57e31b9d3f
| 11,513
|
cpp
|
C++
|
collection/cp/bcw_codebook-master/Contest/XVIIOpenCupEurasia/4.cpp
|
daemonslayer/Notebook
|
a9880be9bd86955afd6b8f7352822bc18673eda3
|
[
"Apache-2.0"
] | 1
|
2019-03-24T13:12:01.000Z
|
2019-03-24T13:12:01.000Z
|
collection/cp/bcw_codebook-master/Contest/XVIIOpenCupEurasia/4.cpp
|
daemonslayer/Notebook
|
a9880be9bd86955afd6b8f7352822bc18673eda3
|
[
"Apache-2.0"
] | null | null | null |
collection/cp/bcw_codebook-master/Contest/XVIIOpenCupEurasia/4.cpp
|
daemonslayer/Notebook
|
a9880be9bd86955afd6b8f7352822bc18673eda3
|
[
"Apache-2.0"
] | null | null | null |
#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define FZ(n) memset((n),0,sizeof(n))
#define FMO(n) memset((n),-1,sizeof(n))
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define REP(i,x) for (int i=0; i<(x); i++)
#define REP1(i,a,b) for (int i=(a); i<=(b); i++)
#ifdef ONLINE_JUDGE
#define FILEIO(name) \
freopen(name".in", "r", stdin); \
freopen(name".out", "w", stdout);
#else
#define FILEIO(name)
#endif
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A,B> &p) {
return s<<"("<<p.first<<","<<p.second<<")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
s<<"[ ";
for (auto it : c) s << it << " ";
s<<"]";
return s;
}
/*
各位好,今天來揭露一下這些量子監聽的基礎科學
首先大家必須了解賽特隧道就是蟲洞也是量子糾纏
畢竟地球人對於這些都歸類為目前不敢繼續的研究
外星人不理解我們的思維因為他們很怕任何人死亡
但有時候他們不理解死亡才是一種減輕痛苦的方式
我的腦代理面有量子監聽及蟲洞都是因為負面基地
那些基地會使用局部高能量光學技術開啟蟲洞傳送
小則使用空氣中的塵埃影響大家的思緒讓我們憤怒
大則使用人體傳送技術或大範圍消除記憶多點噴射
會說噴射是已經超過核輻射的規範且在高空難測量
因為能量超過一定程度的光就會影像電漿造成噴射
先來談談電腦比較好畢竟研究時不用通過實驗審查
首先電腦記憶體如果被遠程開啟蟲洞就能影響電流
因為蟲洞的另一頭若有量子監聽竄改儀器可被偵測
簡單的偵測方式就是測量表面的HALL EFFECT電位
所以我一點都不敢去報名任何祕密太空計畫或相關
但我已經被多次找進甚至傳送進去而發生嚴重衝突
我不想再講更多,因為量子隧道還能打出電磁脈衝
當能控制不同空間的兩個電磁脈衝訊號源能用SSB
如此一來我也不能講太多畢竟我的腦袋就有這情況
但我覺得我還是講一下讓大家知道我根本就受害者
而開啟的蟲洞隧道為了要達到穩態所以要相同磁場
因此才不會被磁場影響而使隧道崩潰所以不同區域
地磁不一樣要使用不同的量子監聽配置參數來穩定
所以如果將強力磁鐵靠近電腦或任何有蟲洞的區域
都能用這方式暫時將蟲洞的效應減低類似藍光製程
因為藍光是人眼可以看到的最高頻率光譜的電磁波
所以我有時候將磁鐵接上手機就可以減低停止當機
我不願透漏我是何種身份但我根本就是在地球長大
光憑這一點我就可以呼請外星人抓走所有星際戰犯
只是外星人有時候會被這些星際戰犯欺騙甚至合作
若外星人真的如此愚鈍我不知道該怎麼繼續活下去,我寧願被分解!
因為被分解至少在五億年內我至少不用再繼續受苦
地球人已經痛苦的上萬年外星人確堅守條約不介入
我覺得訂定這些條約讓星際戰犯能有空間繼續逞兇
即這些負面科技應用到無辜的靈魂身上者應該嚴逞
包含那些和這些星際戰犯訂定條約的人都應該解釋
因為外星人擁有先進技術開啟另一個太陽保護地球
曾經發生大範圍量子層級技術影響太陽光進入地球
外星靈魂緊急開啟另一個太陽保護地球避免被消磁
如果被消磁我將失去所有的記憶但周圍的人不記得
至少在我認識的人裡面幾乎只有我記得陽光曾消失
來說說傳送技術如何防治好了,車燈的光譜很重要
但車燈的能量源與其震盪頻率其實受到溫度的影響
氣體放電車燈打出的能量因為比較符合宇宙的振動
所以可以讓那些複雜波不容易出現在車前避免車禍
因為我曾經數百次碰過傳送出現的人車在我的車側
人工智慧早已大量用於遙控人類的行為業力是指標
因為我的業力早已經是浮動的且每天都被能量攻擊
所以業力根本就值得大家繼續研究但我絕對不研究
我修過人工智慧不要跟我討論任何負面的情緒研究
且曾經做過人工智慧與情緒相關研究即多維度分析
我拒絕繼續再作這類相關研究畢竟真的很惡劣恐怖
因為人工智慧如果使用的記憶體遭受竄改即學習表
儘管有增強式多層結構學習但仍然可能遭受到竄改
所以務必先將所有的電腦系統都調整成完全不被改
絕對不能讓人工智慧可以操縱任何可能傷人的儀器
因為那根本就是量子監聽遙控的卸責法外星人不懂
所以我來解釋一下給全部地球人聽好了畢竟我略懂
人工智慧擁有以下三步驟『觀察、參考記憶、動作』
若記憶遭受竄改就會被影響結果且地表人都失意了
以前人工智慧沒有做得很透徹無法多層次揣摩人類
但現在已經可以達到多維度且多步奏循序記憶分析
畢竟這些人工智慧常常被換記憶所以沒什麼好研究
要達到量子竊聽且即時竄改閉定要更高速人工智慧
才可以模擬我的電腦下一步的情況並插入電腦記憶
所以我的電腦記憶體時序延遲都調到最低避免空檔
因為有空檔時被插入記憶電腦不會當沒空檔時會當
簡單來說如果你有兩個女友同時出現時必定會吵架
我有女友的話我一定把她送到其他星系學校較安全 (只有地球表面的人聽得懂)
讓我來談談這些量子監聽及遙控造成的利害關係吧
地表人吃肉,地下基地的人不吃肉但遙控地表人吃
如此一來外星靈魂只跟地下基地交流不跟地表交流
畢竟外星人有的長的就像海豚鯨魚或任何可愛動物
他們的智商比地表人類高出很多但不理解地球種族
他們無法理解為何地表人要互相傷害彼此不敢交流
所以我覺得應該關閉任何電子電路遙控技術的基地
總之先這樣,外星人知道後應該會很生氣及難過!
其實素食(植物)比較好吃因為動物痛苦會被儲存
但是腦袋裡面若有腦控裝置時會在我們吃肉時運作
讓我們感受到很舒服甚至覺得置身天堂但非常恐怖
我曾經要買物品時每次聞到味道都不同且腦袋很重
當腦袋很重的時候我會把紫光LED燈照進腦洞舒緩
其實在我知道如釹鐵硼磁鐵也可以舒緩後就交替用
腦袋有洞確還能正常思考者其實跟身體含水量有關
因為身體如果含純水量高的話不容易被磁波Induce
所以有聽聞將電腦泡進不導電水冷液體建議別用了
因為水可能會被遠程加入導電物質例如影響膚導電
因為在生醫領域以證實膚導電度與情緒有直接關聯
但那是在還沒探討量子監聽蕊片已經在人體流竄時
我覺得根本是微血管的導電度被改變了而影響人類
畢竟在測量導電度的時候有可能受到自體帶電影響
來談談電腦的硬碟好了因為一直在轉所以很難竄改
畢竟硬碟在轉的時候會與重力場互動而維持其慣性
所以硬碟的晶片都放在硬碟下方是經過妥善設計的
尤其是有些把整個都包起來就是要避免被遠程竄改
我很尊敬地表人作出得很穩定的電腦讓我還能活著
畢竟我的車常常有換檔異常但都會在短時間內恢復
讓我來跟大家解釋一下我為何很宅不出門只待在家
因為現在的技術已經精進到可以傳送人體進電梯裡
畢竟電梯是有金屬屏蔽且移動中確還能傳送很恐怖
代表有可能會在車裡消失不見然後車禍後出現屍體
不過這只是一種誇張的描述而已畢竟大卡車可傳送
所以機櫃絕對要關門並上鎖畢竟有點像是簡單屏蔽
*/
// Let's Fight!
#define link lliinnkk
const int MX = 333333;
using pii = pair<int, int>;
using Seg = pair<pii, pii>;
int N;
pii O;
set<pii> haopt, tsanpt;
vector<Seg> segs;
vector<pii> pts;
vector<pii> rpts;
struct Lisan {
vector<int> val;
void PB(int x) {
val.PB(x);
}
void make() {
sort(ALL(val));
val.resize(unique(ALL(val)) - val.begin());
}
int operator [] (int idx) { return val[idx]; }
int operator () (int v) {
return lower_bound(ALL(val), v) - val.begin();
}
};
pii operator - (const pii &p1, const pii &p2) {
return {p1.F - p2.F, p1.S - p2.S};
}
int abs(pii p) {
return abs(p.F) + abs(p.S);
}
inline int sgn(int x) {
if (!x) return 0;
return x > 0 ? 1 : -1;
}
const int INF = 2111111111;
vector<pii> P, RP;
vector<Seg> S;
int ans[MX];
pii link[MX];
using ppi = pair<pii, int>;
vector<ppi> work;
vector<ppi> wsg;
struct SegTree {
int n;
struct Node {
pii mx, tag;
} tree[MX*4];
void init(int tn) {
n = tn;
init_tree(0,n+5,1);
}
void init_tree(int l, int r, int id) {
tree[id].mx = tree[id].tag = {-INF, -INF};
if (l == r) return;
int m = (l+r)/2, lc = id*2, rc = id*2+1;
init_tree(l,m,lc);
init_tree(m+1,r,rc);
}
void push(int id, int lc, int rc) {
tree[lc].mx = max(tree[lc].mx, tree[id].tag);
tree[lc].tag = max(tree[lc].tag, tree[id].tag);
tree[rc].mx = max(tree[rc].mx, tree[id].tag);
tree[rc].tag = max(tree[rc].tag, tree[id].tag);
}
void updtree(int l, int r, int fl, int fr, pii v, int id) {
if (r < fl) return;
if (fr < l) return;
if (fl <= l and r <= fr) {
tree[id].mx = max(tree[id].mx, v);
tree[id].tag = max(tree[id].tag, v);
return;
}
int m = (l+r)/2, lc = id*2, rc = id*2+1;
push(id,lc,rc);
updtree(l,m,fl,fr,v,lc);
updtree(m+1,r,fl,fr,v,rc);
tree[id].mx = max(tree[lc].mx, tree[rc].mx);
}
pii qtree(int l, int r, int fl, int fr, int id) {
if (r < fl) return {-INF, -INF};
if (fr < l) return {-INF, -INF};
if (fl <= l and r <= fr) return tree[id].mx;
int m = (l+r)/2, lc = id*2, rc = id*2+1;
push(id,lc,rc);
return max(qtree(l,m,fl,fr,lc), qtree(m+1,r,fl,fr,rc));
}
void update(int l, int r, pii v) {
updtree(0,n,l,r,v,1);
}
pii query(int l, int r) {
return qtree(0,n,l,r,1);
}
} ttt;
struct RQRU {
pii val[MX*4];
int _n;
void init(int n) {
ttt.init(MX);
_n = n;
return;
for (int i=0; i<n+5; i++) val[i] = {-INF, -INF};
}
pii query(int ql, int qr) {
return ttt.query(ql,qr);
assert(ql >= 0 and ql <= qr and qr <= _n);
pii res = {-INF, -INF};
for (int i=ql; i<=qr; i++) res = max(res, val[i]);
assert(ttt.query(ql,qr) == res);
return res;
}
void update(int l, int r, pii v) {
ttt.update(l,r,v);
return;
assert(l >= 0 and l <= r and r <= _n);
for (int i=l; i<=r; i++) {
val[i] = max(val[i], v);
}
}
} tree;
vector<pair<pii, pii>> finalAns;
void calc(pii d) {
P.clear();
S.clear();
RP.clear();
Lisan lx, ly;
for (auto p: pts) {
int x = p.F * d.F, y = p.S * d.S;
if (x < 0 or y < 0) continue;
P.PB({x, y});
lx.PB(x);
ly.PB(y);
}
for (auto s: segs) {
s.F.F *= d.F;
s.F.S *= d.S;
s.S.F *= d.F;
s.S.S *= d.S;
if (s.F.F < 0 or s.F.S < 0 or
s.S.F < 0 or s.S.S < 0) continue;
S.PB(s);
lx.PB(s.F.F);
lx.PB(s.S.F);
ly.PB(s.F.S);
ly.PB(s.S.S);
}
for (auto p: rpts) {
int x = p.F * d.F, y = p.S * d.S;
if (x < 0 or y < 0) continue;
RP.PB({x, y}); lx.PB(x);
ly.PB(y);
}
int n = SZ(P);
for (int i=0; i<n; i++) ans[i] = INF;
lx.make();
ly.make();
for (auto &p: P) {
p.F = lx(p.F);
p.S = ly(p.S);
}
for (auto &s: S) {
s.F.F = lx(s.F.F);
s.F.S = ly(s.F.S);
s.S.F = lx(s.S.F);
s.S.S = ly(s.S.S);
}
for (auto &p: RP) {
p.F = lx(p.F);
p.S = ly(p.S);
}
{
int VX = SZ(lx.val);
work.resize(n);
for (int i=0; i<n; i++) work[i] = {P[i], i};
sort(ALL(work), [](ppi p1, ppi p2) { return p1.F.F < p2.F.F; });
wsg.clear();
for (auto s: S) {
if (s.F.F != s.S.F) continue;
int y1 = s.F.S, y2 = s.S.S;
if (y1 > y2) swap(y1, y2);
wsg.PB({{y1, y2}, s.F.F});
}
sort(ALL(wsg), [](ppi p1, ppi p2) { return p1.S < p2.S; });
int M = SZ(wsg);
tree.init(VX+10);
int j = 0;
for (int i=0; i<n; i++) {
int x = work[i].F.F, y = work[i].F.S;
int id = work[i].S;
int rx = lx[x], ry = ly[y];
while (j < M and wsg[j].S < x) {
tree.update(wsg[j].F.F, wsg[j].F.S, {lx[wsg[j].S], 0});
j++;
}
int res = tree.query(y, y).F;
if (res <= -INF) continue;
int a = rx - res;
if (ans[id] > a) {
ans[id] = a;
link[id] = {res, ry};
}
}
}
{
int VY = SZ(ly.val);
work.resize(n);
for (int i=0; i<n; i++) work[i] = {P[i], i};
sort(ALL(work), [](ppi p1, ppi p2) { return p1.F.S < p2.F.S; });
wsg.clear();
for (auto s: S) {
if (s.F.S != s.S.S) continue;
int x1 = s.F.F, x2 = s.S.F;
if (x1 > x2) swap(x1, x2);
wsg.PB({{x1, x2}, s.F.S});
}
sort(ALL(wsg), [](ppi p1, ppi p2) { return p1.S < p2.S; });
int M = SZ(wsg);
tree.init(VY+10);
int j = 0;
for (int i=0; i<n; i++) {
int x = work[i].F.F, y = work[i].F.S;
int id = work[i].S;
int rx = lx[x], ry = ly[y];
while (j < M and wsg[j].S < y) {
tree.update(wsg[j].F.F, wsg[j].F.S, {ly[wsg[j].S], 0});
j++;
}
int res = tree.query(x, x).F;
if (res <= -INF) continue;
int a = ry - res;
if (ans[id] > a) {
ans[id] = a;
link[id] = {rx, res};
}
}
}
{
int VY = SZ(ly.val);
work.resize(n);
for (int i=0; i<n; i++) work[i] = {P[i], i};
sort(ALL(work));
sort(ALL(RP));
tree.init(VY+10);
tree.update(0, 0, {0, 0});
int j = 0;
int M = SZ(RP);
for (int i=0; i<n; i++) {
int x = work[i].F.F, y = work[i].F.S;
int rx = lx[x], ry = ly[y];
int id = work[i].S;
while (j < M and RP[j] < work[i].F) {
int xx = lx[RP[j].F], yy = ly[RP[j].S];
tree.update(RP[j].S, RP[j].S, {xx+yy, xx});
//cout << "Update " << xx << ' ' << yy << endl;
j++;
}
pii res = tree.query(0, y);
int a = rx+ry - res.F;
if (ans[id] > a) {
ans[id] = a;
int px = res.S, py = res.F - res.S;
link[id] = {px, py};
}
}
}
for (int i=0; i<n; i++) {
finalAns.PB({
{lx[P[i].F] * d.F, ly[P[i].S] * d.S},
{link[i].F * d.F, link[i].S * d.S}
});
}
}
int main() {
IOS;
cin >> N;
cin >> O.F >> O.S;
for (int i=0; i<N; i++) {
pii p1, p2;
cin >> p1.F >> p1.S >> p2.F >> p2.S;
p1 = p1 - O;
p2 = p2 - O;
haopt.insert(p1);
haopt.insert(p2);
int isxd = p1.S == p2.S;
if (isxd) {
int x1 = p1.F, x2 = p2.F;
int s1 = sgn(x1), s2 = sgn(x2);
if (s1*s2 != -1) {
segs.PB({p1, p2});
int a1 = abs(p1), a2 = abs(p2);
if (a1 < a2) tsanpt.insert(p2);
else tsanpt.insert(p1);
} else {
pii pm = {0, p1.S};
segs.PB({p1, pm});
segs.PB({pm, p2});
tsanpt.insert(p1);
tsanpt.insert(p2);
haopt.insert(pm);
}
} else {
int y1 = p1.S, y2 = p2.S;
int s1 = sgn(y1), s2 = sgn(y2);
if (s1*s2 != -1) {
segs.PB({p1, p2});
int a1 = abs(p1), a2 = abs(p2);
if (a1 < a2) tsanpt.insert(p2);
else tsanpt.insert(p1);
} else {
pii pm = {p1.F, 0};
segs.PB({p1, pm});
segs.PB({pm, p2});
tsanpt.insert(p1);
tsanpt.insert(p2);
haopt.insert(pm);
}
}
}
for (auto x: haopt) {
if (!tsanpt.count(x)) pts.PB(x);
rpts.PB(x);
}
pii D[] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
for (auto d: D) {
calc(d);
}
sort(ALL(finalAns));
finalAns.resize(unique(ALL(finalAns)) - begin(finalAns));
long long a = 0;
int cnt = 0;
set<pii> haohao;
for (auto it: finalAns) {
int px = it.F.F;
int py = it.F.S;
int qx = it.S.F;
int qy = it.S.S;
a += abs(px - qx) + abs(py - qy);
cnt += it.F != it.S;
}
if (!a) {
cout << 0 << ' ' << 0 << endl;
} else {
cout << cnt << ' ' << a << endl;
for (auto it: finalAns) {
if (it.F == it.S) continue;
int px = it.F.F + O.F;
int py = it.F.S + O.S;
int qx = it.S.F + O.F;
int qy = it.S.S + O.S;
if (haohao.count({px, py})) assert(0);
haohao.insert({px, py});
if (px == qx or py == qy) {
cout << 2 << ' ' << px << ' ' << py << ' ' << qx << ' ' << qy << endl;
} else {
cout << 3 << ' ' << px << ' ' << py << ' ' << qx << ' ' << py << ' ' << qx << ' ' << qy << endl;
}
}
}
return 0;
}
| 19.546689
| 100
| 0.590289
|
daemonslayer
|
77013c97ae800b7c22b3e9ed56f79e5122c6bc27
| 1,445
|
cpp
|
C++
|
Maze_Lib/Color.cpp
|
martindubois/Maze
|
23026ee0d437edb7b59f39e07bc0f94c100e506f
|
[
"Apache-2.0"
] | null | null | null |
Maze_Lib/Color.cpp
|
martindubois/Maze
|
23026ee0d437edb7b59f39e07bc0f94c100e506f
|
[
"Apache-2.0"
] | null | null | null |
Maze_Lib/Color.cpp
|
martindubois/Maze
|
23026ee0d437edb7b59f39e07bc0f94c100e506f
|
[
"Apache-2.0"
] | null | null | null |
// Author KMS - Martin Dubois, P. Eng.
// Copyright (C) 2021 KMS
// License http://www.apache.org/licenses/LICENSE-2.0
// Product Maze
// File Maze_Lib/Color.cpp
// CODE REVIEW 2021-12-18 KMS - Martin Dubois, P. Eng.
// TEST COVERAGE 2021-12-18 KMS - Martin Dubois, P. Eng.
#include "Component.h"
// ===== Includes ===========================================================
#include <Maze/Color.h>
namespace Maze
{
// Public
// //////////////////////////////////////////////////////////////////////
const Color Color::BLACK ( 0, 0, 0);
const Color Color::BRICK ( 0, 0, 0);
const Color Color::RED (255, 0, 0);
const Color Color::TRAIL (255, 255, 255);
const Color Color::UNKNOWN(127, 127, 127);
Color::Color(uint8_t aR, uint8_t aG, uint8_t aB)
{
mBGRA[0] = aB;
mBGRA[1] = aG;
mBGRA[2] = aR;
mBGRA[3] = 0;
}
bool Color::operator == (const Color& aB) const
{
return ((mBGRA[0] == aB.GetB()) && (mBGRA[1] == aB.GetG()) && (mBGRA[2] == aB.GetR()) && (mBGRA[3] == aB.GetA()));
}
uint8_t Color::GetA() const { return mBGRA[3]; }
uint8_t Color::GetB() const { return mBGRA[0]; }
uint8_t Color::GetG() const { return mBGRA[1]; }
uint8_t Color::GetR() const { return mBGRA[2]; }
void Color::Set(unsigned int aBGR, uint8_t aVal)
{
assert(3 > aBGR);
mBGRA[aBGR] = aVal;
}
}
| 26.272727
| 122
| 0.504498
|
martindubois
|
770654ea3162daa4d87e50df5458ed9afc0df297
| 485
|
cpp
|
C++
|
src/cat3d/obj/texture.cpp
|
sarahkittyy/cat3d
|
1b5f15bddb60d1870b23321a9907e7f79547ca1a
|
[
"MIT"
] | 1
|
2020-09-24T23:11:24.000Z
|
2020-09-24T23:11:24.000Z
|
src/cat3d/obj/texture.cpp
|
sarahkittyy/cat3d
|
1b5f15bddb60d1870b23321a9907e7f79547ca1a
|
[
"MIT"
] | null | null | null |
src/cat3d/obj/texture.cpp
|
sarahkittyy/cat3d
|
1b5f15bddb60d1870b23321a9907e7f79547ca1a
|
[
"MIT"
] | null | null | null |
#include "cat3d/obj/texture.hpp"
namespace cat3d::obj {
texture::texture(const std::string& path)
: m_tex(resource::get().texture(path)),
m_hooked(false) {
}
texture::texture(color col)
: m_hooked(false) {
m_tex.load_color(col);
}
texture::~texture() {
if (m_hooked) {
parent()->unbind(m_hook_id);
}
}
void texture::update_self(window& win) {
if (!m_hooked) {
m_hooked = true;
m_hook_id = parent()->bind(scene::PRE_RENDER, [this]() {
m_tex.bind();
});
}
}
}
| 16.166667
| 58
| 0.643299
|
sarahkittyy
|
770ac34cd2aa7c6f561fe07cdc40b36bf830f05a
| 1,654
|
cpp
|
C++
|
1101-9999/1801. Number of Orders in the Backlog.cpp
|
erichuang1994/leetcode-solution
|
d5b3bb3ce2a428a3108f7369715a3700e2ba699d
|
[
"MIT"
] | null | null | null |
1101-9999/1801. Number of Orders in the Backlog.cpp
|
erichuang1994/leetcode-solution
|
d5b3bb3ce2a428a3108f7369715a3700e2ba699d
|
[
"MIT"
] | null | null | null |
1101-9999/1801. Number of Orders in the Backlog.cpp
|
erichuang1994/leetcode-solution
|
d5b3bb3ce2a428a3108f7369715a3700e2ba699d
|
[
"MIT"
] | null | null | null |
class Solution
{
public:
int getNumberOfBacklogOrders(vector<vector<int>> &orders)
{
priority_queue<pair<int, int>, vector<pair<int, int>>> buy;
priority_queue<pair<int, int>, vector<pair<int, int>>, std::greater<pair<int, int>>> sell;
for (auto &order : orders)
{
// buy
if (order[2] == 0)
{
while (!sell.empty() && sell.top().first <= order[0] && order[1] > 0)
{
auto top = sell.top();
sell.pop();
if (order[1] >= top.second)
{
order[1] -= top.second;
}
else
{
top.second -= order[1];
order[1] = 0;
sell.push(top);
}
}
if (order[1] > 0)
{
buy.push(make_pair(order[0], order[1]));
}
// sell
}
else
{
while (!buy.empty() && buy.top().first >= order[0] && order[1] > 0)
{
auto top = buy.top();
buy.pop();
if (order[1] >= top.second)
{
order[1] -= top.second;
}
else
{
top.second -= order[1];
order[1] = 0;
buy.push(top);
}
}
if (order[1] > 0)
{
sell.push(make_pair(order[0], order[1]));
}
}
}
long ret = 0;
const int mod = 1e9 + 7;
while (!sell.empty())
{
auto p = sell.top();
sell.pop();
ret += p.second;
ret %= mod;
}
while (!buy.empty())
{
auto p = buy.top();
buy.pop();
ret += p.second;
ret %= mod;
}
return ret;
}
};
| 21.763158
| 94
| 0.403265
|
erichuang1994
|
770b566e5a7eeed4d94fbdfd17e7af336c1f12bb
| 825
|
cpp
|
C++
|
Chroma/src/Chroma/Core/EntryPoint.cpp
|
ttalexander2/chroma
|
0e9946e66158938ebd6497d5bf3acfba8fbe9fee
|
[
"MIT"
] | 1
|
2022-03-07T01:54:59.000Z
|
2022-03-07T01:54:59.000Z
|
Chroma/src/Chroma/Core/EntryPoint.cpp
|
ttalexander2/chroma
|
0e9946e66158938ebd6497d5bf3acfba8fbe9fee
|
[
"MIT"
] | 20
|
2021-08-16T16:52:43.000Z
|
2022-03-26T02:47:09.000Z
|
Chroma/src/Chroma/Core/EntryPoint.cpp
|
ttalexander2/chroma
|
0e9946e66158938ebd6497d5bf3acfba8fbe9fee
|
[
"MIT"
] | null | null | null |
#include "chromapch.h"
#include "EntryPoint.h"
#include <physfs.h>
extern "C"
{
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
}
extern "C"
{
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
void InitFilesystem()
{
PHYSFS_init(NULL);
}
void DeinitFilesystem()
{
PHYSFS_deinit();
}
/// @brief Application entry point.
int main(int argc, char** argv)
{
Chroma::Log::Init();
InitFilesystem();
CHROMA_PROFILE_BEGIN_SESSION("Startup", "ChromaProfile-Startup.json");
auto app = Chroma::CreateApplication();
CHROMA_PROFILE_END_SESSION();
CHROMA_PROFILE_BEGIN_SESSION("Runtime", "ChromaProfile-Runtime.json");
app->Run();
CHROMA_PROFILE_END_SESSION();
CHROMA_PROFILE_BEGIN_SESSION("Shutdown", "ChromaProfile-Shutdown.json");
delete app;
CHROMA_PROFILE_END_SESSION();
}
| 20.625
| 73
| 0.757576
|
ttalexander2
|
7710542765aa81b55a7dfa7e8968c10f88a2338b
| 4,075
|
hpp
|
C++
|
fileutil.hpp
|
suncloudsmoon/Simple-Library
|
84f9e7b51dae942f60e3fb5633cbf041a01a66db
|
[
"MIT-0"
] | 1
|
2022-01-20T08:24:21.000Z
|
2022-01-20T08:24:21.000Z
|
fileutil.hpp
|
suncloudsmoon/Simple-Library
|
84f9e7b51dae942f60e3fb5633cbf041a01a66db
|
[
"MIT-0"
] | null | null | null |
fileutil.hpp
|
suncloudsmoon/Simple-Library
|
84f9e7b51dae942f60e3fb5633cbf041a01a66db
|
[
"MIT-0"
] | null | null | null |
/*
* Copyright (c) 2022, suncloudsmoon and the Simple-Library contributors.
*
* 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.
*
* 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.
*/
#ifndef SL_FILEUTIL_HPP
#define SL_FILEUTIL_HPP
#include <filesystem>
#include <functional>
#include <fstream>
#include <string>
#include <iterator>
namespace sl {
/*
* Cross-platform utils for manipulating files and diretories.
*/
namespace fileutil {
namespace fs = std::filesystem;
/*
* Writes content to file.
*
* path - path to write the content to.
* src - a string or object (overloading <<) to write to file.
*/
template<typename FilePath, typename Content>
inline bool write_to_file(const FilePath& path, const Content& src) {
std::ofstream out(path);
if (out.is_open()) {
out << src;
return true;
}
return false;
}
/*
* Renames file extensions
*
* path - files inside the directory and its sub-directories will be renamed.
* from - contains the previous extension to search for, like ".txt".
* to - has the extension to replace the from extension, like ".data".
*/
inline void rename_file_extensions(const fs::path& path, const std::string& from,
const std::string& to, bool is_sub_dirs) {
if (is_sub_dirs) {
for (const auto& dir :
fs::recursive_directory_iterator(path, fs::directory_options::skip_permission_denied)) {
auto old_path = dir.path();
if (old_path.extension().string() == from) {
auto copy_old_path = old_path;
fs::rename(old_path, copy_old_path.replace_extension(to));
}
}
}
else {
for (const auto& dir :
fs::directory_iterator(path, fs::directory_options::skip_permission_denied)) {
auto old_path = dir.path();
if (old_path.extension().string() == from) {
auto copy_old_path = old_path;
fs::rename(old_path, copy_old_path.replace_extension(to));
}
}
}
}
/*
* Changes a file's content given the lambda's return value.
*
* path - the directory to search for files.
* is_sub_dirs - whether the function to look for files inside sub-directories.
* func - a lambda function that takes in the path of the file and the reference to its contents
* and returns true to change the file's contents and false otherwise.
*/
inline void change_file_when(const fs::path& path, bool is_sub_dirs,
std::function <bool(const fs::path&, std::string&)> func) {
if (is_sub_dirs) {
for (const auto& s : fs::recursive_directory_iterator{ path, fs::directory_options::skip_permission_denied }) {
if (s.is_regular_file()) {
std::ifstream in{ s.path() };
std::string contents{ std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>() };
if (func(s.path(), contents))
write_to_file(s.path(), contents);
}
}
}
else {
for (const auto& s : fs::directory_iterator{ path, fs::directory_options::skip_permission_denied }) {
if (s.is_regular_file()) {
std::ifstream in{ s.path() };
std::string contents{ std::istreambuf_iterator<char>(in), std::istreambuf_iterator<char>() };
if (func(s.path(), contents))
write_to_file(s.path(), contents);
}
}
}
}
}
}
#endif /* SL_FILEUTIL_HPP */
| 34.533898
| 115
| 0.683436
|
suncloudsmoon
|
7714f2b49ae4384a84cf9ce5d041c30e47809d8a
| 110
|
cxx
|
C++
|
osf-to-esf/dborl/Templates/vbl_smart_ptr+dborl_exp-stat-.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | 1
|
2022-01-01T20:43:47.000Z
|
2022-01-01T20:43:47.000Z
|
osf-to-esf/dborl/Templates/vbl_smart_ptr+dborl_exp-stat-.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | null | null | null |
osf-to-esf/dborl/Templates/vbl_smart_ptr+dborl_exp-stat-.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | null | null | null |
#include "../dborl_evaluation.h"
#include <vbl/vbl_smart_ptr.txx>
VBL_SMART_PTR_INSTANTIATE(dborl_exp_stat);
| 22
| 42
| 0.809091
|
wenhanshi
|
771a568766cbbae08ee0742983b0be27c1bd657a
| 2,951
|
cc
|
C++
|
chrome/browser/sync/glue/autofill_wallet_data_type_controller.cc
|
hefen1/chromium
|
52f0b6830e000ca7c5e9aa19488af85be792cc88
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
chrome/browser/sync/glue/autofill_wallet_data_type_controller.cc
|
hefen1/chromium
|
52f0b6830e000ca7c5e9aa19488af85be792cc88
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
chrome/browser/sync/glue/autofill_wallet_data_type_controller.cc
|
hefen1/chromium
|
52f0b6830e000ca7c5e9aa19488af85be792cc88
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2
|
2020-04-04T13:34:56.000Z
|
2020-11-04T07:17:52.000Z
|
// Copyright 2015 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 "chrome/browser/sync/glue/autofill_wallet_data_type_controller.h"
#include "base/bind.h"
#include "chrome/browser/autofill/personal_data_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
#include "chrome/browser/sync/profile_sync_components_factory.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "content/public/browser/browser_thread.h"
#include "sync/api/sync_error.h"
#include "sync/api/syncable_service.h"
using content::BrowserThread;
namespace browser_sync {
AutofillWalletDataTypeController::AutofillWalletDataTypeController(
ProfileSyncComponentsFactory* profile_sync_factory,
Profile* profile)
: NonUIDataTypeController(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
base::Bind(&ChromeReportUnrecoverableError),
profile_sync_factory),
profile_(profile),
personal_data_(nullptr),
callback_registered_(false) {
}
AutofillWalletDataTypeController::~AutofillWalletDataTypeController() {
}
syncer::ModelType AutofillWalletDataTypeController::type() const {
return syncer::AUTOFILL_WALLET_DATA;
}
syncer::ModelSafeGroup
AutofillWalletDataTypeController::model_safe_group() const {
return syncer::GROUP_DB;
}
bool AutofillWalletDataTypeController::PostTaskOnBackendThread(
const tracked_objects::Location& from_here,
const base::Closure& task) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return BrowserThread::PostTask(BrowserThread::DB, from_here, task);
}
bool AutofillWalletDataTypeController::StartModels() {
DCHECK(content::BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(state(), MODEL_STARTING);
personal_data_ =
autofill::PersonalDataManagerFactory::GetForProfile(profile_);
if (!personal_data_->IsDataLoaded())
return false;
autofill::AutofillWebDataService* web_data_service =
WebDataServiceFactory::GetAutofillWebDataForProfile(
profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
if (!web_data_service)
return false;
if (web_data_service->IsDatabaseLoaded())
return true;
if (!callback_registered_) {
web_data_service->RegisterDBLoadedCallback(base::Bind(
&AutofillWalletDataTypeController::WebDatabaseLoaded, this));
callback_registered_ = true;
}
return false;
}
void AutofillWalletDataTypeController::StopModels() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}
void AutofillWalletDataTypeController::WebDatabaseLoaded() {
OnModelLoaded();
}
} // namespace browser_sync
| 32.428571
| 78
| 0.781769
|
hefen1
|
771bf2082e58d6ff92fd0f40e3579c8b82972c33
| 890
|
hpp
|
C++
|
module-apps/application-messages/models/ThreadsSearchResultsModel.hpp
|
bitigchi/MuditaOS
|
425d23e454e09fd6ae274b00f8d19c57a577aa94
|
[
"BSL-1.0"
] | 369
|
2021-11-10T09:20:29.000Z
|
2022-03-30T06:36:58.000Z
|
module-apps/application-messages/models/ThreadsSearchResultsModel.hpp
|
bitigchi/MuditaOS
|
425d23e454e09fd6ae274b00f8d19c57a577aa94
|
[
"BSL-1.0"
] | 149
|
2021-11-10T08:38:35.000Z
|
2022-03-31T23:01:52.000Z
|
module-apps/application-messages/models/ThreadsSearchResultsModel.hpp
|
bitigchi/MuditaOS
|
425d23e454e09fd6ae274b00f8d19c57a577aa94
|
[
"BSL-1.0"
] | 41
|
2021-11-10T08:30:37.000Z
|
2022-03-29T08:12:46.000Z
|
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include "BaseThreadsRecordModel.hpp"
#include "Style.hpp"
namespace gui::model
{
class ThreadsSearchResultsModel : public BaseThreadsRecordModel, public app::AsyncCallbackReceiver
{
UTF8 textToSearch;
public:
ThreadsSearchResultsModel(app::ApplicationCommon *app);
auto getMinimalItemSpaceRequired() const -> unsigned int override;
auto getItem(Order order) -> ListItem * override;
/// empty, size get in requestRecords
void requestRecords(uint32_t offset, uint32_t limit) override;
/// set what we need to search
void setSearchValue(const UTF8 &search_value);
auto handleQueryResponse(db::QueryResult *) -> bool;
};
}; // namespace gui::model
| 30.689655
| 102
| 0.696629
|
bitigchi
|
771f82c0a43fe2433b3733f30e9dd514f855d2f0
| 676
|
cpp
|
C++
|
Felix/action_trim_spaces.cpp
|
ultimatezen/felix
|
5a7ad298ca4dcd5f1def05c60ae3c84519ec54c4
|
[
"MIT"
] | null | null | null |
Felix/action_trim_spaces.cpp
|
ultimatezen/felix
|
5a7ad298ca4dcd5f1def05c60ae3c84519ec54c4
|
[
"MIT"
] | null | null | null |
Felix/action_trim_spaces.cpp
|
ultimatezen/felix
|
5a7ad298ca4dcd5f1def05c60ae3c84519ec54c4
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "action_trim_spaces.h"
#include "RegisterGlossDlg.h" // trim_spaces
namespace action
{
//! Trims the spaces from all records in the TM.
//! Backs up TM so it can be undone.
void ActionTrimSpaces::redo()
{
using namespace mem_engine;
mem_engine::trans_set records ;
this->back_up_tm(records, trim_text) ;
m_new->clear_memory() ;
mem_engine::copy_mem_info(m_old, m_new) ;
FOREACH(mem_engine::record_pointer rec, records)
{
m_new->add_record(rec) ;
}
}
//! Returns string value of resource ID (for localization)
wstring ActionTrimSpaces::name()
{
return R2WSTR(IDS_ACTION_TRIM_SPACES) ;
}
}
| 24.142857
| 60
| 0.692308
|
ultimatezen
|
7726635ccb366fe36133a3d365d08c7b355ff83f
| 181,138
|
cpp
|
C++
|
ace/tao/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp
|
tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective
|
1b0172cdb78757fd17898503aaf6ce03d940ef28
|
[
"Apache-1.1"
] | 46
|
2015-12-04T17:12:58.000Z
|
2022-03-11T04:30:49.000Z
|
ace/tao/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp
|
tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective
|
1b0172cdb78757fd17898503aaf6ce03d940ef28
|
[
"Apache-1.1"
] | null | null | null |
ace/tao/tao/IFR_Client/IFR_Client_Adapter_Impl.cpp
|
tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective
|
1b0172cdb78757fd17898503aaf6ce03d940ef28
|
[
"Apache-1.1"
] | 23
|
2016-10-24T09:18:14.000Z
|
2022-02-25T02:11:35.000Z
|
// IFR_Client_Adapter_Impl.cpp,v 1.3 2001/09/25 05:12:33 irfan Exp
#include "IFR_Client_Adapter_Impl.h"
#include "IFR_ExtendedC.h"
#include "tao/ORB_Core.h"
#include "tao/Invocation.h"
ACE_RCSID(IFR_Client, IFR_Client_Adapter_Impl, "IFR_Client_Adapter_Impl.cpp,v 1.3 2001/09/25 05:12:33 irfan Exp")
TAO_IFR_Client_Adapter_Impl::~TAO_IFR_Client_Adapter_Impl (void)
{
}
CORBA::Boolean
TAO_IFR_Client_Adapter_Impl::interfacedef_cdr_insert (
TAO_OutputCDR &cdr,
CORBA_InterfaceDef_ptr object_type
)
{
return cdr << object_type;
}
void
TAO_IFR_Client_Adapter_Impl::interfacedef_any_insert (
CORBA_Any &any,
CORBA_InterfaceDef_ptr object_type
)
{
any <<= object_type;
}
void
TAO_IFR_Client_Adapter_Impl::dispose (
CORBA_InterfaceDef_ptr orphan
)
{
CORBA::release (orphan);
}
CORBA_InterfaceDef_ptr
TAO_IFR_Client_Adapter_Impl::get_interface (
CORBA::ORB_ptr orb,
const char *repo_id,
CORBA::Environment &ACE_TRY_ENV
)
{
CORBA::Object_var obj =
orb->resolve_initial_references ("InterfaceRepository",
ACE_TRY_ENV);
ACE_CHECK_RETURN (CORBA_InterfaceDef::_nil ());
if (CORBA::is_nil (obj.in ()))
{
ACE_THROW_RETURN (CORBA::INTF_REPOS (),
CORBA_InterfaceDef::_nil ());
}
CORBA_Repository_var repo =
CORBA_Repository::_narrow (obj.in (),
ACE_TRY_ENV);
ACE_CHECK_RETURN (CORBA_InterfaceDef::_nil ());
if (CORBA::is_nil (repo.in ()))
{
ACE_THROW_RETURN (CORBA::INTF_REPOS (),
CORBA_InterfaceDef::_nil ());
}
CORBA_Contained_var result = repo->lookup_id (repo_id,
ACE_TRY_ENV);
ACE_CHECK_RETURN (CORBA_InterfaceDef::_nil ());
if (CORBA::is_nil (result.in ()))
{
return CORBA_InterfaceDef::_nil ();
}
else
{
return CORBA_InterfaceDef::_narrow (result.in (),
ACE_TRY_ENV);
}
}
CORBA_InterfaceDef_ptr
TAO_IFR_Client_Adapter_Impl::get_interface_remote (
const CORBA::Object_ptr target,
CORBA_Environment &ACE_TRY_ENV
)
{
CORBA_InterfaceDef_ptr _tao_retval = CORBA_InterfaceDef::_nil ();
CORBA_InterfaceDef_var _tao_safe_retval (_tao_retval);
ACE_TRY
{
// Must catch exceptions, if the server raises a
// CORBA::OBJECT_NOT_EXIST then we must return 1, instead of
// propagating the exception.
TAO_Stub *istub = target->_stubobj ();
if (istub == 0)
ACE_THROW_RETURN (CORBA::INTERNAL (
CORBA_SystemException::_tao_minor_code (
TAO_DEFAULT_MINOR_CODE,
EINVAL),
CORBA::COMPLETED_NO),
_tao_retval);
TAO_GIOP_Twoway_Invocation _tao_call (istub,
"_interface",
10,
1,
istub->orb_core ());
for (;;)
{
_tao_call.start (ACE_TRY_ENV);
ACE_TRY_CHECK;
CORBA::Short flag = TAO_TWOWAY_RESPONSE_FLAG;
_tao_call.prepare_header (ACE_static_cast (CORBA::Octet, flag),
ACE_TRY_ENV);
ACE_TRY_CHECK;
int _invoke_status =
_tao_call.invoke (0, 0, ACE_TRY_ENV);
ACE_TRY_CHECK;
if (_invoke_status == TAO_INVOKE_RESTART)
{
_tao_call.restart_flag (1);
continue;
}
ACE_ASSERT (_invoke_status != TAO_INVOKE_EXCEPTION);
if (_invoke_status != TAO_INVOKE_OK)
{
ACE_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE,
CORBA::COMPLETED_YES),
CORBA_InterfaceDef::_nil ());
}
break;
}
TAO_InputCDR &_tao_in = _tao_call.inp_stream ();
if (!(
(_tao_in >> _tao_safe_retval.inout ())
))
ACE_THROW_RETURN (CORBA::MARSHAL (), CORBA_InterfaceDef::_nil ());
}
ACE_CATCH (CORBA::OBJECT_NOT_EXIST, ex)
{
return CORBA_InterfaceDef::_nil ();
}
ACE_CATCHANY
{
ACE_RE_THROW;
}
ACE_ENDTRY;
return _tao_safe_retval._retn ();
}
// *********************************************************************
// Initialization of IFR typecodes that are in the CORBA namespace.
static const CORBA::Long _oc_CORBA_Identifier[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Identifier (
CORBA::tk_alias,
sizeof (_oc_CORBA_Identifier),
(char *) &_oc_CORBA_Identifier,
0,
sizeof (CORBA::Identifier)
);
static const CORBA::Long _oc_CORBA_ScopedName[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5363),
ACE_NTOHL (0x6f706564),
ACE_NTOHL (0x4e616d65),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/ScopedName:1.0
11,
ACE_NTOHL (0x53636f70),
ACE_NTOHL (0x65644e61),
ACE_NTOHL (0x6d650000), // name = ScopedName
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ScopedName (
CORBA::tk_alias,
sizeof (_oc_CORBA_ScopedName),
(char *) &_oc_CORBA_ScopedName,
0,
sizeof (CORBA::ScopedName)
);
static const CORBA::Long _oc_CORBA_RepositoryId[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_RepositoryId (
CORBA::tk_alias,
sizeof (_oc_CORBA_RepositoryId),
(char *) &_oc_CORBA_RepositoryId,
0,
sizeof (CORBA::RepositoryId)
);
static const CORBA::Long _oc_CORBA_Visibility[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5669),
ACE_NTOHL (0x73696269),
ACE_NTOHL (0x6c697479),
ACE_NTOHL (0x3a312e30),
9,
ACE_NTOHL (0x62696c69),
ACE_NTOHL (0x74790000), // name = Visibility
CORBA::tk_short,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Visibility (
CORBA::tk_alias,
sizeof (_oc_CORBA_Visibility),
(char *) &_oc_CORBA_Visibility,
0,
sizeof (CORBA::Visibility)
);
static const CORBA::Long _oc_CORBA_ValueModifier[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
28,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c75654d),
ACE_NTOHL (0x6f646966),
ACE_NTOHL (0x6965723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:CORBA/ValueModifier:1.0
14,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x654d6f64),
ACE_NTOHL (0x69666965),
ACE_NTOHL (0x72000000), // name = ValueModifier
CORBA::tk_short,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueModifier (
CORBA::tk_alias,
sizeof (_oc_CORBA_ValueModifier),
(char *) &_oc_CORBA_ValueModifier,
0,
sizeof (CORBA::ValueModifier)
);
static const CORBA::Long _oc_CORBA_DefinitionKind[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
37,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4465),
ACE_NTOHL (0x66696e69),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x4b696e64),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/DefinitionKind:1.0
15,
ACE_NTOHL (0x44656669),
ACE_NTOHL (0x6e697469),
ACE_NTOHL (0x6f6e4b69),
ACE_NTOHL (0x6e640000), // name = DefinitionKind
26, // member count
8,
ACE_NTOHL (0x646b5f6e),
ACE_NTOHL (0x6f6e6500), // name = dk_none
7,
ACE_NTOHL (0x646b5f61),
ACE_NTOHL (0x6c6c0000), // name = dk_all
13,
ACE_NTOHL (0x646b5f41),
ACE_NTOHL (0x74747269),
ACE_NTOHL (0x62757465),
ACE_NTOHL (0x0), // name = dk_Attribute
12,
ACE_NTOHL (0x646b5f43),
ACE_NTOHL (0x6f6e7374),
ACE_NTOHL (0x616e7400), // name = dk_Constant
13,
ACE_NTOHL (0x646b5f45),
ACE_NTOHL (0x78636570),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = dk_Exception
13,
ACE_NTOHL (0x646b5f49),
ACE_NTOHL (0x6e746572),
ACE_NTOHL (0x66616365),
ACE_NTOHL (0x0), // name = dk_Interface
10,
ACE_NTOHL (0x646b5f4d),
ACE_NTOHL (0x6f64756c),
ACE_NTOHL (0x65000000), // name = dk_Module
13,
ACE_NTOHL (0x646b5f4f),
ACE_NTOHL (0x70657261),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = dk_Operation
11,
ACE_NTOHL (0x646b5f54),
ACE_NTOHL (0x79706564),
ACE_NTOHL (0x65660000), // name = dk_Typedef
9,
ACE_NTOHL (0x646b5f41),
ACE_NTOHL (0x6c696173),
ACE_NTOHL (0x0), // name = dk_Alias
10,
ACE_NTOHL (0x646b5f53),
ACE_NTOHL (0x74727563),
ACE_NTOHL (0x74000000), // name = dk_Struct
9,
ACE_NTOHL (0x646b5f55),
ACE_NTOHL (0x6e696f6e),
ACE_NTOHL (0x0), // name = dk_Union
8,
ACE_NTOHL (0x646b5f45),
ACE_NTOHL (0x6e756d00), // name = dk_Enum
13,
ACE_NTOHL (0x646b5f50),
ACE_NTOHL (0x72696d69),
ACE_NTOHL (0x74697665),
ACE_NTOHL (0x0), // name = dk_Primitive
10,
ACE_NTOHL (0x646b5f53),
ACE_NTOHL (0x7472696e),
ACE_NTOHL (0x67000000), // name = dk_String
12,
ACE_NTOHL (0x646b5f53),
ACE_NTOHL (0x65717565),
ACE_NTOHL (0x6e636500), // name = dk_Sequence
9,
ACE_NTOHL (0x646b5f41),
ACE_NTOHL (0x72726179),
ACE_NTOHL (0x0), // name = dk_Array
14,
ACE_NTOHL (0x646b5f52),
ACE_NTOHL (0x65706f73),
ACE_NTOHL (0x69746f72),
ACE_NTOHL (0x79000000), // name = dk_Repository
11,
ACE_NTOHL (0x646b5f57),
ACE_NTOHL (0x73747269),
ACE_NTOHL (0x6e670000), // name = dk_Wstring
9,
ACE_NTOHL (0x646b5f46),
ACE_NTOHL (0x69786564),
ACE_NTOHL (0x0), // name = dk_Fixed
9,
ACE_NTOHL (0x646b5f56),
ACE_NTOHL (0x616c7565),
ACE_NTOHL (0x0), // name = dk_Value
12,
ACE_NTOHL (0x646b5f56),
ACE_NTOHL (0x616c7565),
ACE_NTOHL (0x426f7800), // name = dk_ValueBox
15,
ACE_NTOHL (0x646b5f56),
ACE_NTOHL (0x616c7565),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65720000), // name = dk_ValueMember
10,
ACE_NTOHL (0x646b5f4e),
ACE_NTOHL (0x61746976),
ACE_NTOHL (0x65000000), // name = dk_Native
21,
ACE_NTOHL (0x646b5f41),
ACE_NTOHL (0x62737472),
ACE_NTOHL (0x61637449),
ACE_NTOHL (0x6e746572),
ACE_NTOHL (0x66616365),
ACE_NTOHL (0x0), // name = dk_AbstractInterface
18,
ACE_NTOHL (0x646b5f4c),
ACE_NTOHL (0x6f63616c),
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65000000), // name = dk_LocalInterface
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_DefinitionKind (
CORBA::tk_enum,
sizeof (_oc_CORBA_DefinitionKind),
(char *) &_oc_CORBA_DefinitionKind,
0,
sizeof (CORBA::DefinitionKind)
);
static const CORBA::Long _oc_CORBA_IRObject[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4952),
ACE_NTOHL (0x4f626a65),
ACE_NTOHL (0x63743a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/IRObject:1.0
9,
ACE_NTOHL (0x49524f62),
ACE_NTOHL (0x6a656374),
ACE_NTOHL (0x0), // name = IRObject
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_IRObject (
CORBA::tk_objref,
sizeof (_oc_CORBA_IRObject),
(char *) &_oc_CORBA_IRObject,
0,
sizeof (CORBA_IRObject)
);
static const CORBA::Long _oc_CORBA_VersionSpec[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_VersionSpec (
CORBA::tk_alias,
sizeof (_oc_CORBA_VersionSpec),
(char *) &_oc_CORBA_VersionSpec,
0,
sizeof (CORBA::VersionSpec)
);
static const CORBA::Long _oc_CORBA_Contained[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746169),
ACE_NTOHL (0x6e65643a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/Contained:1.0
10,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x61696e65),
ACE_NTOHL (0x64000000), // name = Contained
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Contained (
CORBA::tk_objref,
sizeof (_oc_CORBA_Contained),
(char *) &_oc_CORBA_Contained,
0,
sizeof (CORBA::Contained)
);
static const CORBA::Long _oc_CORBA_ContainedSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746169),
ACE_NTOHL (0x6e656453),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ContainedSeq:1.0
13,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x61696e65),
ACE_NTOHL (0x64536571),
ACE_NTOHL (0x0), // name = ContainedSeq
CORBA::tk_sequence, // typecode kind
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
56, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746169),
ACE_NTOHL (0x6e65643a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/Contained:1.0
10,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x61696e65),
ACE_NTOHL (0x64000000), // name = Contained
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ContainedSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ContainedSeq),
(char *) &_oc_CORBA_ContainedSeq,
0,
sizeof (CORBA::ContainedSeq)
);
static const CORBA::Long _oc_CORBA_InterfaceDefSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65665365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/InterfaceDefSeq:1.0
16,
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x53657100), // name = InterfaceDefSeq
CORBA::tk_sequence, // typecode kind
80, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
64, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/InterfaceDef:1.0
13,
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = InterfaceDef
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_InterfaceDefSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_InterfaceDefSeq),
(char *) &_oc_CORBA_InterfaceDefSeq,
0,
sizeof (CORBA::InterfaceDefSeq)
);
static const CORBA::Long _oc_CORBA_AbstractInterfaceDefSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
46,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4162),
ACE_NTOHL (0x73747261),
ACE_NTOHL (0x6374496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65665365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/AbstractInterfaceDefSeq:1.0
24,
ACE_NTOHL (0x41627374),
ACE_NTOHL (0x72616374),
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x53657100), // name = AbstractInterfaceDefSeq
CORBA::tk_sequence, // typecode kind
96, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
80, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4162),
ACE_NTOHL (0x73747261),
ACE_NTOHL (0x6374496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AbstractInterfaceDef:1.0
21,
ACE_NTOHL (0x41627374),
ACE_NTOHL (0x72616374),
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = AbstractInterfaceDef
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AbstractInterfaceDefSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_AbstractInterfaceDefSeq),
(char *) &_oc_CORBA_AbstractInterfaceDefSeq,
0,
sizeof (CORBA::AbstractInterfaceDefSeq)
);
static const CORBA::Long _oc_CORBA_LocalInterfaceDefSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4c6f),
ACE_NTOHL (0x63616c49),
ACE_NTOHL (0x6e746572),
ACE_NTOHL (0x66616365),
ACE_NTOHL (0x44656653),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/LocalInterfaceDefSeq:1.0
21,
ACE_NTOHL (0x4c6f6361),
ACE_NTOHL (0x6c496e74),
ACE_NTOHL (0x65726661),
ACE_NTOHL (0x63654465),
ACE_NTOHL (0x66536571),
ACE_NTOHL (0x0), // name = LocalInterfaceDefSeq
CORBA::tk_sequence, // typecode kind
88, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4c6f),
ACE_NTOHL (0x63616c49),
ACE_NTOHL (0x6e746572),
ACE_NTOHL (0x66616365),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/LocalInterfaceDef:1.0
18,
ACE_NTOHL (0x4c6f6361),
ACE_NTOHL (0x6c496e74),
ACE_NTOHL (0x65726661),
ACE_NTOHL (0x63654465),
ACE_NTOHL (0x66000000), // name = LocalInterfaceDef
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_LocalInterfaceDefSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_LocalInterfaceDefSeq),
(char *) &_oc_CORBA_LocalInterfaceDefSeq,
0,
sizeof (CORBA::LocalInterfaceDefSeq)
);
static const CORBA::Long _oc_CORBA_StructMember[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65723a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/StructMember:1.0
13,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x0), // name = StructMember
3, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_StructMember (
CORBA::tk_struct,
sizeof (_oc_CORBA_StructMember),
(char *) &_oc_CORBA_StructMember,
0,
sizeof (CORBA::StructMember)
);
static const CORBA::Long _oc_CORBA_StructMemberSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65725365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/StructMemberSeq:1.0
16,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x53657100), // name = StructMemberSeq
CORBA::tk_sequence, // typecode kind
264, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
248, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65723a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/StructMember:1.0
13,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x0), // name = StructMember
3, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_StructMemberSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_StructMemberSeq),
(char *) &_oc_CORBA_StructMemberSeq,
0,
sizeof (CORBA::StructMemberSeq)
);
static const CORBA::Long _oc_CORBA_Initializer[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x69746961),
ACE_NTOHL (0x6c697a65),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/Initializer:1.0
12,
ACE_NTOHL (0x496e6974),
ACE_NTOHL (0x69616c69),
ACE_NTOHL (0x7a657200), // name = Initializer
2, // member count
8,
ACE_NTOHL (0x6d656d62),
ACE_NTOHL (0x65727300), // name = members
CORBA::tk_alias, // typecode kind for typedefs
340, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65725365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/StructMemberSeq:1.0
16,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x53657100), // name = StructMemberSeq
CORBA::tk_sequence, // typecode kind
264, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
248, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65723a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/StructMember:1.0
13,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x0), // name = StructMember
3, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
0U,
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Initializer (
CORBA::tk_struct,
sizeof (_oc_CORBA_Initializer),
(char *) &_oc_CORBA_Initializer,
0,
sizeof (CORBA::Initializer)
);
static const CORBA::Long _oc_CORBA_InitializerSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
37,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x69746961),
ACE_NTOHL (0x6c697a65),
ACE_NTOHL (0x72536571),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/InitializerSeq:1.0
15,
ACE_NTOHL (0x496e6974),
ACE_NTOHL (0x69616c69),
ACE_NTOHL (0x7a657253),
ACE_NTOHL (0x65710000), // name = InitializerSeq
CORBA::tk_sequence, // typecode kind
528, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
512, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x69746961),
ACE_NTOHL (0x6c697a65),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/Initializer:1.0
12,
ACE_NTOHL (0x496e6974),
ACE_NTOHL (0x69616c69),
ACE_NTOHL (0x7a657200), // name = Initializer
2, // member count
8,
ACE_NTOHL (0x6d656d62),
ACE_NTOHL (0x65727300), // name = members
CORBA::tk_alias, // typecode kind for typedefs
340, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65725365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/StructMemberSeq:1.0
16,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x53657100), // name = StructMemberSeq
CORBA::tk_sequence, // typecode kind
264, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
248, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65723a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/StructMember:1.0
13,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x0), // name = StructMember
3, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
0U,
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_InitializerSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_InitializerSeq),
(char *) &_oc_CORBA_InitializerSeq,
0,
sizeof (CORBA::InitializerSeq)
);
static const CORBA::Long _oc_CORBA_UnionMember[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f556e),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/UnionMember:1.0
12,
ACE_NTOHL (0x556e696f),
ACE_NTOHL (0x6e4d656d),
ACE_NTOHL (0x62657200), // name = UnionMember
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
6,
ACE_NTOHL (0x6c616265),
ACE_NTOHL (0x6c000000), // name = label
CORBA::tk_any,
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_UnionMember (
CORBA::tk_struct,
sizeof (_oc_CORBA_UnionMember),
(char *) &_oc_CORBA_UnionMember,
0,
sizeof (CORBA::UnionMember)
);
static const CORBA::Long _oc_CORBA_UnionMemberSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
37,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f556e),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x72536571),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/UnionMemberSeq:1.0
15,
ACE_NTOHL (0x556e696f),
ACE_NTOHL (0x6e4d656d),
ACE_NTOHL (0x62657253),
ACE_NTOHL (0x65710000), // name = UnionMemberSeq
CORBA::tk_sequence, // typecode kind
276, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
260, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f556e),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/UnionMember:1.0
12,
ACE_NTOHL (0x556e696f),
ACE_NTOHL (0x6e4d656d),
ACE_NTOHL (0x62657200), // name = UnionMember
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
6,
ACE_NTOHL (0x6c616265),
ACE_NTOHL (0x6c000000), // name = label
CORBA::tk_any,
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_UnionMemberSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_UnionMemberSeq),
(char *) &_oc_CORBA_UnionMemberSeq,
0,
sizeof (CORBA::UnionMemberSeq)
);
static const CORBA::Long _oc_CORBA_EnumMemberSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f456e),
ACE_NTOHL (0x756d4d65),
ACE_NTOHL (0x6d626572),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/EnumMemberSeq:1.0
14,
ACE_NTOHL (0x456e756d),
ACE_NTOHL (0x4d656d62),
ACE_NTOHL (0x65725365),
ACE_NTOHL (0x71000000), // name = EnumMemberSeq
CORBA::tk_sequence, // typecode kind
84, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_EnumMemberSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_EnumMemberSeq),
(char *) &_oc_CORBA_EnumMemberSeq,
0,
sizeof (CORBA::EnumMemberSeq)
);
static const CORBA::Long _oc_CORBA_Container[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746169),
ACE_NTOHL (0x6e65723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/Container:1.0
10,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x61696e65),
ACE_NTOHL (0x72000000), // name = Container
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Container (
CORBA::tk_objref,
sizeof (_oc_CORBA_Container),
(char *) &_oc_CORBA_Container,
0,
sizeof (CORBA::Container)
);
static const CORBA::Long _oc_CORBA_IDLType[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_IDLType (
CORBA::tk_objref,
sizeof (_oc_CORBA_IDLType),
(char *) &_oc_CORBA_IDLType,
0,
sizeof (CORBA::IDLType)
);
static const CORBA::Long _oc_CORBA_TypedefDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5479),
ACE_NTOHL (0x70656465),
ACE_NTOHL (0x66446566),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/TypedefDef:1.0
11,
ACE_NTOHL (0x54797065),
ACE_NTOHL (0x64656644),
ACE_NTOHL (0x65660000), // name = TypedefDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_TypedefDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_TypedefDef),
(char *) &_oc_CORBA_TypedefDef,
0,
sizeof (CORBA::TypedefDef)
);
static const CORBA::Long _oc_CORBA_TypeDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5479),
ACE_NTOHL (0x70654465),
ACE_NTOHL (0x73637269),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e3a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/TypeDescription:1.0
16,
ACE_NTOHL (0x54797065),
ACE_NTOHL (0x44657363),
ACE_NTOHL (0x72697074),
ACE_NTOHL (0x696f6e00), // name = TypeDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_TypeDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_TypeDescription),
(char *) &_oc_CORBA_TypeDescription,
0,
sizeof (CORBA::TypeDescription)
);
static const CORBA::Long _oc_CORBA_PrimitiveKind[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5072),
ACE_NTOHL (0x696d6974),
ACE_NTOHL (0x6976654b),
ACE_NTOHL (0x696e643a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/PrimitiveKind:1.0
14,
ACE_NTOHL (0x5072696d),
ACE_NTOHL (0x69746976),
ACE_NTOHL (0x654b696e),
ACE_NTOHL (0x64000000), // name = PrimitiveKind
22, // member count
8,
ACE_NTOHL (0x706b5f6e),
ACE_NTOHL (0x756c6c00), // name = pk_null
8,
ACE_NTOHL (0x706b5f76),
ACE_NTOHL (0x6f696400), // name = pk_void
9,
ACE_NTOHL (0x706b5f73),
ACE_NTOHL (0x686f7274),
ACE_NTOHL (0x0), // name = pk_short
8,
ACE_NTOHL (0x706b5f6c),
ACE_NTOHL (0x6f6e6700), // name = pk_long
10,
ACE_NTOHL (0x706b5f75),
ACE_NTOHL (0x73686f72),
ACE_NTOHL (0x74000000), // name = pk_ushort
9,
ACE_NTOHL (0x706b5f75),
ACE_NTOHL (0x6c6f6e67),
ACE_NTOHL (0x0), // name = pk_ulong
9,
ACE_NTOHL (0x706b5f66),
ACE_NTOHL (0x6c6f6174),
ACE_NTOHL (0x0), // name = pk_float
10,
ACE_NTOHL (0x706b5f64),
ACE_NTOHL (0x6f75626c),
ACE_NTOHL (0x65000000), // name = pk_double
11,
ACE_NTOHL (0x706b5f62),
ACE_NTOHL (0x6f6f6c65),
ACE_NTOHL (0x616e0000), // name = pk_boolean
8,
ACE_NTOHL (0x706b5f63),
ACE_NTOHL (0x68617200), // name = pk_char
9,
ACE_NTOHL (0x706b5f6f),
ACE_NTOHL (0x63746574),
ACE_NTOHL (0x0), // name = pk_octet
7,
ACE_NTOHL (0x706b5f61),
ACE_NTOHL (0x6e790000), // name = pk_any
12,
ACE_NTOHL (0x706b5f54),
ACE_NTOHL (0x79706543),
ACE_NTOHL (0x6f646500), // name = pk_TypeCode
13,
ACE_NTOHL (0x706b5f50),
ACE_NTOHL (0x72696e63),
ACE_NTOHL (0x6970616c),
ACE_NTOHL (0x0), // name = pk_Principal
10,
ACE_NTOHL (0x706b5f73),
ACE_NTOHL (0x7472696e),
ACE_NTOHL (0x67000000), // name = pk_string
10,
ACE_NTOHL (0x706b5f6f),
ACE_NTOHL (0x626a7265),
ACE_NTOHL (0x66000000), // name = pk_objref
12,
ACE_NTOHL (0x706b5f6c),
ACE_NTOHL (0x6f6e676c),
ACE_NTOHL (0x6f6e6700), // name = pk_longlong
13,
ACE_NTOHL (0x706b5f75),
ACE_NTOHL (0x6c6f6e67),
ACE_NTOHL (0x6c6f6e67),
ACE_NTOHL (0x0), // name = pk_ulonglong
14,
ACE_NTOHL (0x706b5f6c),
ACE_NTOHL (0x6f6e6764),
ACE_NTOHL (0x6f75626c),
ACE_NTOHL (0x65000000), // name = pk_longdouble
9,
ACE_NTOHL (0x706b5f77),
ACE_NTOHL (0x63686172),
ACE_NTOHL (0x0), // name = pk_wchar
11,
ACE_NTOHL (0x706b5f77),
ACE_NTOHL (0x73747269),
ACE_NTOHL (0x6e670000), // name = pk_wstring
14,
ACE_NTOHL (0x706b5f76),
ACE_NTOHL (0x616c7565),
ACE_NTOHL (0x5f626173),
ACE_NTOHL (0x65000000), // name = pk_value_base
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_PrimitiveKind (
CORBA::tk_enum,
sizeof (_oc_CORBA_PrimitiveKind),
(char *) &_oc_CORBA_PrimitiveKind,
0,
sizeof (CORBA::PrimitiveKind)
);
static const CORBA::Long _oc_CORBA_Repository[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Repository:1.0
11,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72790000), // name = Repository
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_Repository (
CORBA::tk_objref,
sizeof (_oc_CORBA_Repository),
(char *) &_oc_CORBA_Repository,
0,
sizeof (CORBA::Repository)
);
static const CORBA::Long _oc_CORBA_ModuleDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4d6f),
ACE_NTOHL (0x64756c65),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ModuleDef:1.0
10,
ACE_NTOHL (0x4d6f6475),
ACE_NTOHL (0x6c654465),
ACE_NTOHL (0x66000000), // name = ModuleDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ModuleDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ModuleDef),
(char *) &_oc_CORBA_ModuleDef,
0,
sizeof (CORBA::ModuleDef)
);
static const CORBA::Long _oc_CORBA_ModuleDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4d6f),
ACE_NTOHL (0x64756c65),
ACE_NTOHL (0x44657363),
ACE_NTOHL (0x72697074),
ACE_NTOHL (0x696f6e3a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ModuleDescription:1.0
18,
ACE_NTOHL (0x4d6f6475),
ACE_NTOHL (0x6c654465),
ACE_NTOHL (0x73637269),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e000000), // name = ModuleDescription
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ModuleDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_ModuleDescription),
(char *) &_oc_CORBA_ModuleDescription,
0,
sizeof (CORBA::ModuleDescription)
);
static const CORBA::Long _oc_CORBA_ConstantDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e737461),
ACE_NTOHL (0x6e744465),
ACE_NTOHL (0x663a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ConstantDef:1.0
12,
ACE_NTOHL (0x436f6e73),
ACE_NTOHL (0x74616e74),
ACE_NTOHL (0x44656600), // name = ConstantDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ConstantDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ConstantDef),
(char *) &_oc_CORBA_ConstantDef,
0,
sizeof (CORBA::ConstantDef)
);
static const CORBA::Long _oc_CORBA_ConstantDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
42,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e737461),
ACE_NTOHL (0x6e744465),
ACE_NTOHL (0x73637269),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e3a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ConstantDescription:1.0
20,
ACE_NTOHL (0x436f6e73),
ACE_NTOHL (0x74616e74),
ACE_NTOHL (0x44657363),
ACE_NTOHL (0x72697074),
ACE_NTOHL (0x696f6e00), // name = ConstantDescription
6, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
6,
ACE_NTOHL (0x76616c75),
ACE_NTOHL (0x65000000), // name = value
CORBA::tk_any,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ConstantDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_ConstantDescription),
(char *) &_oc_CORBA_ConstantDescription,
0,
sizeof (CORBA::ConstantDescription)
);
static const CORBA::Long _oc_CORBA_StructDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72756374),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/StructDef:1.0
10,
ACE_NTOHL (0x53747275),
ACE_NTOHL (0x63744465),
ACE_NTOHL (0x66000000), // name = StructDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_StructDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_StructDef),
(char *) &_oc_CORBA_StructDef,
0,
sizeof (CORBA::StructDef)
);
static const CORBA::Long _oc_CORBA_UnionDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f556e),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/UnionDef:1.0
9,
ACE_NTOHL (0x556e696f),
ACE_NTOHL (0x6e446566),
ACE_NTOHL (0x0), // name = UnionDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_UnionDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_UnionDef),
(char *) &_oc_CORBA_UnionDef,
0,
sizeof (CORBA::UnionDef)
);
static const CORBA::Long _oc_CORBA_EnumDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f456e),
ACE_NTOHL (0x756d4465),
ACE_NTOHL (0x663a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/EnumDef:1.0
8,
ACE_NTOHL (0x456e756d),
ACE_NTOHL (0x44656600), // name = EnumDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_EnumDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_EnumDef),
(char *) &_oc_CORBA_EnumDef,
0,
sizeof (CORBA::EnumDef)
);
static const CORBA::Long _oc_CORBA_AliasDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f416c),
ACE_NTOHL (0x69617344),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AliasDef:1.0
9,
ACE_NTOHL (0x416c6961),
ACE_NTOHL (0x73446566),
ACE_NTOHL (0x0), // name = AliasDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AliasDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_AliasDef),
(char *) &_oc_CORBA_AliasDef,
0,
sizeof (CORBA::AliasDef)
);
static const CORBA::Long _oc_CORBA_NativeDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4e61),
ACE_NTOHL (0x74697665),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/NativeDef:1.0
10,
ACE_NTOHL (0x4e617469),
ACE_NTOHL (0x76654465),
ACE_NTOHL (0x66000000), // name = NativeDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_NativeDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_NativeDef),
(char *) &_oc_CORBA_NativeDef,
0,
sizeof (CORBA::NativeDef)
);
static const CORBA::Long _oc_CORBA_PrimitiveDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5072),
ACE_NTOHL (0x696d6974),
ACE_NTOHL (0x69766544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/PrimitiveDef:1.0
13,
ACE_NTOHL (0x5072696d),
ACE_NTOHL (0x69746976),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = PrimitiveDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_PrimitiveDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_PrimitiveDef),
(char *) &_oc_CORBA_PrimitiveDef,
0,
sizeof (CORBA::PrimitiveDef)
);
static const CORBA::Long _oc_CORBA_StringDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
32,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5374),
ACE_NTOHL (0x72696e67),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/StringDef:1.0
10,
ACE_NTOHL (0x53747269),
ACE_NTOHL (0x6e674465),
ACE_NTOHL (0x66000000), // name = StringDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_StringDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_StringDef),
(char *) &_oc_CORBA_StringDef,
0,
sizeof (CORBA::StringDef)
);
static const CORBA::Long _oc_CORBA_WstringDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5773),
ACE_NTOHL (0x7472696e),
ACE_NTOHL (0x67446566),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/WstringDef:1.0
11,
ACE_NTOHL (0x57737472),
ACE_NTOHL (0x696e6744),
ACE_NTOHL (0x65660000), // name = WstringDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_WstringDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_WstringDef),
(char *) &_oc_CORBA_WstringDef,
0,
sizeof (CORBA::WstringDef)
);
static const CORBA::Long _oc_CORBA_SequenceDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5365),
ACE_NTOHL (0x7175656e),
ACE_NTOHL (0x63654465),
ACE_NTOHL (0x663a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/SequenceDef:1.0
12,
ACE_NTOHL (0x53657175),
ACE_NTOHL (0x656e6365),
ACE_NTOHL (0x44656600), // name = SequenceDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_SequenceDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_SequenceDef),
(char *) &_oc_CORBA_SequenceDef,
0,
sizeof (CORBA::SequenceDef)
);
static const CORBA::Long _oc_CORBA_ArrayDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4172),
ACE_NTOHL (0x72617944),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ArrayDef:1.0
9,
ACE_NTOHL (0x41727261),
ACE_NTOHL (0x79446566),
ACE_NTOHL (0x0), // name = ArrayDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ArrayDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ArrayDef),
(char *) &_oc_CORBA_ArrayDef,
0,
sizeof (CORBA::ArrayDef)
);
static const CORBA::Long _oc_CORBA_ExceptionDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDef:1.0
13,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446566),
ACE_NTOHL (0x0), // name = ExceptionDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ExceptionDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ExceptionDef),
(char *) &_oc_CORBA_ExceptionDef,
0,
sizeof (CORBA::ExceptionDef)
);
static const CORBA::Long _oc_CORBA_ExceptionDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDescription:1.0
21,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ExceptionDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ExceptionDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_ExceptionDescription),
(char *) &_oc_CORBA_ExceptionDescription,
0,
sizeof (CORBA::ExceptionDescription)
);
static const CORBA::Long _oc_CORBA_ExceptionDefSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65665365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ExceptionDefSeq:1.0
16,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446566),
ACE_NTOHL (0x53657100), // name = ExceptionDefSeq
CORBA::tk_sequence, // typecode kind
80, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
64, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDef:1.0
13,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446566),
ACE_NTOHL (0x0), // name = ExceptionDef
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ExceptionDefSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ExceptionDefSeq),
(char *) &_oc_CORBA_ExceptionDefSeq,
0,
sizeof (CORBA::ExceptionDefSeq)
);
static const CORBA::Long _oc_CORBA_ExcDescriptionSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ExcDescriptionSeq:1.0
18,
ACE_NTOHL (0x45786344),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ExcDescriptionSeq
CORBA::tk_sequence, // typecode kind
476, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
460, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDescription:1.0
21,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ExceptionDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ExcDescriptionSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ExcDescriptionSeq),
(char *) &_oc_CORBA_ExcDescriptionSeq,
0,
sizeof (CORBA::ExcDescriptionSeq)
);
static const CORBA::Long _oc_CORBA_AttributeMode[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x7574654d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/AttributeMode:1.0
14,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x654d6f64),
ACE_NTOHL (0x65000000), // name = AttributeMode
2, // member count
12,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f4e4f52),
ACE_NTOHL (0x4d414c00), // name = ATTR_NORMAL
14,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f524541),
ACE_NTOHL (0x444f4e4c),
ACE_NTOHL (0x59000000), // name = ATTR_READONLY
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AttributeMode (
CORBA::tk_enum,
sizeof (_oc_CORBA_AttributeMode),
(char *) &_oc_CORBA_AttributeMode,
0,
sizeof (CORBA::AttributeMode)
);
static const CORBA::Long _oc_CORBA_AttributeDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x75746544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AttributeDef:1.0
13,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = AttributeDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AttributeDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_AttributeDef),
(char *) &_oc_CORBA_AttributeDef,
0,
sizeof (CORBA::AttributeDef)
);
static const CORBA::Long _oc_CORBA_AttributeDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x75746544),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AttributeDescription:1.0
21,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x65446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = AttributeDescription
6, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
104, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x7574654d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/AttributeMode:1.0
14,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x654d6f64),
ACE_NTOHL (0x65000000), // name = AttributeMode
2, // member count
12,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f4e4f52),
ACE_NTOHL (0x4d414c00), // name = ATTR_NORMAL
14,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f524541),
ACE_NTOHL (0x444f4e4c),
ACE_NTOHL (0x59000000), // name = ATTR_READONLY
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AttributeDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_AttributeDescription),
(char *) &_oc_CORBA_AttributeDescription,
0,
sizeof (CORBA::AttributeDescription)
);
static const CORBA::Long _oc_CORBA_OperationMode[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/OperationMode:1.0
14,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e4d6f64),
ACE_NTOHL (0x65000000), // name = OperationMode
2, // member count
10,
ACE_NTOHL (0x4f505f4e),
ACE_NTOHL (0x4f524d41),
ACE_NTOHL (0x4c000000), // name = OP_NORMAL
10,
ACE_NTOHL (0x4f505f4f),
ACE_NTOHL (0x4e455741),
ACE_NTOHL (0x59000000), // name = OP_ONEWAY
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_OperationMode (
CORBA::tk_enum,
sizeof (_oc_CORBA_OperationMode),
(char *) &_oc_CORBA_OperationMode,
0,
sizeof (CORBA::OperationMode)
);
static const CORBA::Long _oc_CORBA_ParameterMode[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x7465724d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParameterMode:1.0
14,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x724d6f64),
ACE_NTOHL (0x65000000), // name = ParameterMode
3, // member count
9,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x0), // name = PARAM_IN
10,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f4f55),
ACE_NTOHL (0x54000000), // name = PARAM_OUT
12,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x4f555400), // name = PARAM_INOUT
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ParameterMode (
CORBA::tk_enum,
sizeof (_oc_CORBA_ParameterMode),
(char *) &_oc_CORBA_ParameterMode,
0,
sizeof (CORBA::ParameterMode)
);
static const CORBA::Long _oc_CORBA_ParameterDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x74657244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ParameterDescription:1.0
21,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ParameterDescription
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
116, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x7465724d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParameterMode:1.0
14,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x724d6f64),
ACE_NTOHL (0x65000000), // name = ParameterMode
3, // member count
9,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x0), // name = PARAM_IN
10,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f4f55),
ACE_NTOHL (0x54000000), // name = PARAM_OUT
12,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x4f555400), // name = PARAM_INOUT
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ParameterDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_ParameterDescription),
(char *) &_oc_CORBA_ParameterDescription,
0,
sizeof (CORBA::ParameterDescription)
);
static const CORBA::Long _oc_CORBA_ParDescriptionSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParDescriptionSeq:1.0
18,
ACE_NTOHL (0x50617244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ParDescriptionSeq
CORBA::tk_sequence, // typecode kind
416, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
400, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x74657244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ParameterDescription:1.0
21,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ParameterDescription
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
116, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x7465724d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParameterMode:1.0
14,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x724d6f64),
ACE_NTOHL (0x65000000), // name = ParameterMode
3, // member count
9,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x0), // name = PARAM_IN
10,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f4f55),
ACE_NTOHL (0x54000000), // name = PARAM_OUT
12,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x4f555400), // name = PARAM_INOUT
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ParDescriptionSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ParDescriptionSeq),
(char *) &_oc_CORBA_ParDescriptionSeq,
0,
sizeof (CORBA::ParDescriptionSeq)
);
static const CORBA::Long _oc_CORBA_ContextIdentifier[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496465),
ACE_NTOHL (0x6e746966),
ACE_NTOHL (0x6965723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ContextIdentifier:1.0
18,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64656e74),
ACE_NTOHL (0x69666965),
ACE_NTOHL (0x72000000), // name = ContextIdentifier
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ContextIdentifier (
CORBA::tk_alias,
sizeof (_oc_CORBA_ContextIdentifier),
(char *) &_oc_CORBA_ContextIdentifier,
0,
sizeof (CORBA::ContextIdentifier)
);
static const CORBA::Long _oc_CORBA_ContextIdSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496453),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ContextIdSeq:1.0
13,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64536571),
ACE_NTOHL (0x0), // name = ContextIdSeq
CORBA::tk_sequence, // typecode kind
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
148, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496465),
ACE_NTOHL (0x6e746966),
ACE_NTOHL (0x6965723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ContextIdentifier:1.0
18,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64656e74),
ACE_NTOHL (0x69666965),
ACE_NTOHL (0x72000000), // name = ContextIdentifier
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ContextIdSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ContextIdSeq),
(char *) &_oc_CORBA_ContextIdSeq,
0,
sizeof (CORBA::ContextIdSeq)
);
static const CORBA::Long _oc_CORBA_OperationDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/OperationDef:1.0
13,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e446566),
ACE_NTOHL (0x0), // name = OperationDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_OperationDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_OperationDef),
(char *) &_oc_CORBA_OperationDef,
0,
sizeof (CORBA::OperationDef)
);
static const CORBA::Long _oc_CORBA_OperationDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/OperationDescription:1.0
21,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = OperationDescription
9, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
7,
ACE_NTOHL (0x72657375),
ACE_NTOHL (0x6c740000), // name = result
CORBA::tk_TypeCode,
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
100, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/OperationMode:1.0
14,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e4d6f64),
ACE_NTOHL (0x65000000), // name = OperationMode
2, // member count
10,
ACE_NTOHL (0x4f505f4e),
ACE_NTOHL (0x4f524d41),
ACE_NTOHL (0x4c000000), // name = OP_NORMAL
10,
ACE_NTOHL (0x4f505f4f),
ACE_NTOHL (0x4e455741),
ACE_NTOHL (0x59000000), // name = OP_ONEWAY
9,
ACE_NTOHL (0x636f6e74),
ACE_NTOHL (0x65787473),
ACE_NTOHL (0x0), // name = contexts
CORBA::tk_alias, // typecode kind for typedefs
236, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496453),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ContextIdSeq:1.0
13,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64536571),
ACE_NTOHL (0x0), // name = ContextIdSeq
CORBA::tk_sequence, // typecode kind
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
148, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496465),
ACE_NTOHL (0x6e746966),
ACE_NTOHL (0x6965723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ContextIdentifier:1.0
18,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64656e74),
ACE_NTOHL (0x69666965),
ACE_NTOHL (0x72000000), // name = ContextIdentifier
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
0U,
11,
ACE_NTOHL (0x70617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72730000), // name = parameters
CORBA::tk_alias, // typecode kind for typedefs
496, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParDescriptionSeq:1.0
18,
ACE_NTOHL (0x50617244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ParDescriptionSeq
CORBA::tk_sequence, // typecode kind
416, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
400, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x74657244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ParameterDescription:1.0
21,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ParameterDescription
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
116, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x7465724d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParameterMode:1.0
14,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x724d6f64),
ACE_NTOHL (0x65000000), // name = ParameterMode
3, // member count
9,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x0), // name = PARAM_IN
10,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f4f55),
ACE_NTOHL (0x54000000), // name = PARAM_OUT
12,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x4f555400), // name = PARAM_INOUT
0U,
11,
ACE_NTOHL (0x65786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e730000), // name = exceptions
CORBA::tk_alias, // typecode kind for typedefs
556, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ExcDescriptionSeq:1.0
18,
ACE_NTOHL (0x45786344),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ExcDescriptionSeq
CORBA::tk_sequence, // typecode kind
476, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
460, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDescription:1.0
21,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ExceptionDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_OperationDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_OperationDescription),
(char *) &_oc_CORBA_OperationDescription,
0,
sizeof (CORBA::OperationDescription)
);
static const CORBA::Long _oc_CORBA_RepositoryIdSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49645365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/RepositoryIdSeq:1.0
16,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x53657100), // name = RepositoryIdSeq
CORBA::tk_sequence, // typecode kind
88, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_RepositoryIdSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_RepositoryIdSeq),
(char *) &_oc_CORBA_RepositoryIdSeq,
0,
sizeof (CORBA::RepositoryIdSeq)
);
static const CORBA::Long _oc_CORBA_OpDescriptionSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
39,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x44657363),
ACE_NTOHL (0x72697074),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/OpDescriptionSeq:1.0
17,
ACE_NTOHL (0x4f704465),
ACE_NTOHL (0x73637269),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e536571),
ACE_NTOHL (0x0), // name = OpDescriptionSeq
CORBA::tk_sequence, // typecode kind
1956, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
1940, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/OperationDescription:1.0
21,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = OperationDescription
9, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
7,
ACE_NTOHL (0x72657375),
ACE_NTOHL (0x6c740000), // name = result
CORBA::tk_TypeCode,
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
100, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4f70),
ACE_NTOHL (0x65726174),
ACE_NTOHL (0x696f6e4d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/OperationMode:1.0
14,
ACE_NTOHL (0x4f706572),
ACE_NTOHL (0x6174696f),
ACE_NTOHL (0x6e4d6f64),
ACE_NTOHL (0x65000000), // name = OperationMode
2, // member count
10,
ACE_NTOHL (0x4f505f4e),
ACE_NTOHL (0x4f524d41),
ACE_NTOHL (0x4c000000), // name = OP_NORMAL
10,
ACE_NTOHL (0x4f505f4f),
ACE_NTOHL (0x4e455741),
ACE_NTOHL (0x59000000), // name = OP_ONEWAY
9,
ACE_NTOHL (0x636f6e74),
ACE_NTOHL (0x65787473),
ACE_NTOHL (0x0), // name = contexts
CORBA::tk_alias, // typecode kind for typedefs
236, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496453),
ACE_NTOHL (0x65713a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ContextIdSeq:1.0
13,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64536571),
ACE_NTOHL (0x0), // name = ContextIdSeq
CORBA::tk_sequence, // typecode kind
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
148, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f436f),
ACE_NTOHL (0x6e746578),
ACE_NTOHL (0x74496465),
ACE_NTOHL (0x6e746966),
ACE_NTOHL (0x6965723a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ContextIdentifier:1.0
18,
ACE_NTOHL (0x436f6e74),
ACE_NTOHL (0x65787449),
ACE_NTOHL (0x64656e74),
ACE_NTOHL (0x69666965),
ACE_NTOHL (0x72000000), // name = ContextIdentifier
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
0U,
11,
ACE_NTOHL (0x70617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72730000), // name = parameters
CORBA::tk_alias, // typecode kind for typedefs
496, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParDescriptionSeq:1.0
18,
ACE_NTOHL (0x50617244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ParDescriptionSeq
CORBA::tk_sequence, // typecode kind
416, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
400, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x74657244),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ParameterDescription:1.0
21,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x72446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ParameterDescription
4, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
116, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5061),
ACE_NTOHL (0x72616d65),
ACE_NTOHL (0x7465724d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ParameterMode:1.0
14,
ACE_NTOHL (0x50617261),
ACE_NTOHL (0x6d657465),
ACE_NTOHL (0x724d6f64),
ACE_NTOHL (0x65000000), // name = ParameterMode
3, // member count
9,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x0), // name = PARAM_IN
10,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f4f55),
ACE_NTOHL (0x54000000), // name = PARAM_OUT
12,
ACE_NTOHL (0x50415241),
ACE_NTOHL (0x4d5f494e),
ACE_NTOHL (0x4f555400), // name = PARAM_INOUT
0U,
11,
ACE_NTOHL (0x65786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e730000), // name = exceptions
CORBA::tk_alias, // typecode kind for typedefs
556, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x5365713a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/ExcDescriptionSeq:1.0
18,
ACE_NTOHL (0x45786344),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e5365),
ACE_NTOHL (0x71000000), // name = ExcDescriptionSeq
CORBA::tk_sequence, // typecode kind
476, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
460, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4578),
ACE_NTOHL (0x63657074),
ACE_NTOHL (0x696f6e44),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ExceptionDescription:1.0
21,
ACE_NTOHL (0x45786365),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ExceptionDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
0U,
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_OpDescriptionSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_OpDescriptionSeq),
(char *) &_oc_CORBA_OpDescriptionSeq,
0,
sizeof (CORBA::OpDescriptionSeq)
);
static const CORBA::Long _oc_CORBA_AttrDescriptionSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
41,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74724465),
ACE_NTOHL (0x73637269),
ACE_NTOHL (0x7074696f),
ACE_NTOHL (0x6e536571),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/AttrDescriptionSeq:1.0
19,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x44657363),
ACE_NTOHL (0x72697074),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x65710000), // name = AttrDescriptionSeq
CORBA::tk_sequence, // typecode kind
600, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
584, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x75746544),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AttributeDescription:1.0
21,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x65446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = AttributeDescription
6, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
5,
ACE_NTOHL (0x6d6f6465),
ACE_NTOHL (0x0), // name = mode
CORBA::tk_enum, // typecode kind
104, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
36,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4174),
ACE_NTOHL (0x74726962),
ACE_NTOHL (0x7574654d),
ACE_NTOHL (0x6f64653a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/AttributeMode:1.0
14,
ACE_NTOHL (0x41747472),
ACE_NTOHL (0x69627574),
ACE_NTOHL (0x654d6f64),
ACE_NTOHL (0x65000000), // name = AttributeMode
2, // member count
12,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f4e4f52),
ACE_NTOHL (0x4d414c00), // name = ATTR_NORMAL
14,
ACE_NTOHL (0x41545452),
ACE_NTOHL (0x5f524541),
ACE_NTOHL (0x444f4e4c),
ACE_NTOHL (0x59000000), // name = ATTR_READONLY
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AttrDescriptionSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_AttrDescriptionSeq),
(char *) &_oc_CORBA_AttrDescriptionSeq,
0,
sizeof (CORBA::AttrDescriptionSeq)
);
static const CORBA::Long _oc_CORBA_InterfaceDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/InterfaceDef:1.0
13,
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = InterfaceDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_InterfaceDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_InterfaceDef),
(char *) &_oc_CORBA_InterfaceDef,
0,
sizeof (CORBA::InterfaceDef)
);
static const CORBA::Long _oc_CORBA_InterfaceDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/InterfaceDescription:1.0
21,
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = InterfaceDescription
5, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
16,
ACE_NTOHL (0x62617365),
ACE_NTOHL (0x5f696e74),
ACE_NTOHL (0x65726661),
ACE_NTOHL (0x63657300), // name = base_interfaces
CORBA::tk_alias, // typecode kind for typedefs
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49645365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/RepositoryIdSeq:1.0
16,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x53657100), // name = RepositoryIdSeq
CORBA::tk_sequence, // typecode kind
88, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_InterfaceDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_InterfaceDescription),
(char *) &_oc_CORBA_InterfaceDescription,
0,
sizeof (CORBA::InterfaceDescription)
);
static const CORBA::Long _oc_CORBA_AbstractInterfaceDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
43,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4162),
ACE_NTOHL (0x73747261),
ACE_NTOHL (0x6374496e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/AbstractInterfaceDef:1.0
21,
ACE_NTOHL (0x41627374),
ACE_NTOHL (0x72616374),
ACE_NTOHL (0x496e7465),
ACE_NTOHL (0x72666163),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = AbstractInterfaceDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_AbstractInterfaceDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_AbstractInterfaceDef),
(char *) &_oc_CORBA_AbstractInterfaceDef,
0,
sizeof (CORBA::AbstractInterfaceDef)
);
static const CORBA::Long _oc_CORBA_LocalInterfaceDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
40,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4c6f),
ACE_NTOHL (0x63616c49),
ACE_NTOHL (0x6e746572),
ACE_NTOHL (0x66616365),
ACE_NTOHL (0x4465663a),
ACE_NTOHL (0x312e3000), // repository ID = IDL:omg.org/CORBA/LocalInterfaceDef:1.0
18,
ACE_NTOHL (0x4c6f6361),
ACE_NTOHL (0x6c496e74),
ACE_NTOHL (0x65726661),
ACE_NTOHL (0x63654465),
ACE_NTOHL (0x66000000), // name = LocalInterfaceDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_LocalInterfaceDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_LocalInterfaceDef),
(char *) &_oc_CORBA_LocalInterfaceDef,
0,
sizeof (CORBA::LocalInterfaceDef)
);
static const CORBA::Long _oc_CORBA_FixedDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4669),
ACE_NTOHL (0x78656444),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/FixedDef:1.0
9,
ACE_NTOHL (0x46697865),
ACE_NTOHL (0x64446566),
ACE_NTOHL (0x0), // name = FixedDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_FixedDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_FixedDef),
(char *) &_oc_CORBA_FixedDef,
0,
sizeof (CORBA::FixedDef)
);
static const CORBA::Long _oc_CORBA_ValueDefSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c756544),
ACE_NTOHL (0x65665365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ValueDefSeq:1.0
12,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x53657100), // name = ValueDefSeq
CORBA::tk_sequence, // typecode kind
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_objref, // typecode kind
56, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c756544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ValueDef:1.0
9,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = ValueDef
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueDefSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ValueDefSeq),
(char *) &_oc_CORBA_ValueDefSeq,
0,
sizeof (CORBA::ValueDefSeq)
);
static const CORBA::Long _oc_CORBA_ValueMember[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c75654d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ValueMember:1.0
12,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x654d656d),
ACE_NTOHL (0x62657200), // name = ValueMember
7, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
7,
ACE_NTOHL (0x61636365),
ACE_NTOHL (0x73730000), // name = access
CORBA::tk_alias, // typecode kind for typedefs
64, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5669),
ACE_NTOHL (0x73696269),
ACE_NTOHL (0x6c697479),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Visibility:1.0
11,
ACE_NTOHL (0x56697369),
ACE_NTOHL (0x62696c69),
ACE_NTOHL (0x74790000), // name = Visibility
CORBA::tk_short,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueMember (
CORBA::tk_struct,
sizeof (_oc_CORBA_ValueMember),
(char *) &_oc_CORBA_ValueMember,
0,
sizeof (CORBA::ValueMember)
);
static const CORBA::Long _oc_CORBA_ValueMemberSeq[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
37,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c75654d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x72536571),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/ValueMemberSeq:1.0
15,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x654d656d),
ACE_NTOHL (0x62657253),
ACE_NTOHL (0x65710000), // name = ValueMemberSeq
CORBA::tk_sequence, // typecode kind
616, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_struct, // typecode kind
600, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c75654d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x723a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ValueMember:1.0
12,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x654d656d),
ACE_NTOHL (0x62657200), // name = ValueMember
7, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
5,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x0), // name = type
CORBA::tk_TypeCode,
9,
ACE_NTOHL (0x74797065),
ACE_NTOHL (0x5f646566),
ACE_NTOHL (0x0), // name = type_def
CORBA::tk_objref, // typecode kind
52, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
30,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4944),
ACE_NTOHL (0x4c547970),
ACE_NTOHL (0x653a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/IDLType:1.0
8,
ACE_NTOHL (0x49444c54),
ACE_NTOHL (0x79706500), // name = IDLType
7,
ACE_NTOHL (0x61636365),
ACE_NTOHL (0x73730000), // name = access
CORBA::tk_alias, // typecode kind for typedefs
64, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5669),
ACE_NTOHL (0x73696269),
ACE_NTOHL (0x6c697479),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Visibility:1.0
11,
ACE_NTOHL (0x56697369),
ACE_NTOHL (0x62696c69),
ACE_NTOHL (0x74790000), // name = Visibility
CORBA::tk_short,
0U,
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueMemberSeq (
CORBA::tk_alias,
sizeof (_oc_CORBA_ValueMemberSeq),
(char *) &_oc_CORBA_ValueMemberSeq,
0,
sizeof (CORBA::ValueMemberSeq)
);
static const CORBA::Long _oc_CORBA_ValueMemberDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
37,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c75654d),
ACE_NTOHL (0x656d6265),
ACE_NTOHL (0x72446566),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/ValueMemberDef:1.0
15,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x654d656d),
ACE_NTOHL (0x62657244),
ACE_NTOHL (0x65660000), // name = ValueMemberDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueMemberDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ValueMemberDef),
(char *) &_oc_CORBA_ValueMemberDef,
0,
sizeof (CORBA::ValueMemberDef)
);
static const CORBA::Long _oc_CORBA_ValueDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
31,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c756544),
ACE_NTOHL (0x65663a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ValueDef:1.0
9,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x65446566),
ACE_NTOHL (0x0), // name = ValueDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ValueDef),
(char *) &_oc_CORBA_ValueDef,
0,
sizeof (CORBA::ValueDef)
);
static const CORBA::Long _oc_CORBA_ValueDescription[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
39,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c756544),
ACE_NTOHL (0x65736372),
ACE_NTOHL (0x69707469),
ACE_NTOHL (0x6f6e3a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/ValueDescription:1.0
17,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x65446573),
ACE_NTOHL (0x63726970),
ACE_NTOHL (0x74696f6e),
ACE_NTOHL (0x0), // name = ValueDescription
10, // member count
5,
ACE_NTOHL (0x6e616d65),
ACE_NTOHL (0x0), // name = name
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
33,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f4964),
ACE_NTOHL (0x656e7469),
ACE_NTOHL (0x66696572),
ACE_NTOHL (0x3a312e30),
ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Identifier:1.0
11,
ACE_NTOHL (0x4964656e),
ACE_NTOHL (0x74696669),
ACE_NTOHL (0x65720000), // name = Identifier
CORBA::tk_string,
0U, // string length
3,
ACE_NTOHL (0x69640000), // name = id
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
12,
ACE_NTOHL (0x69735f61),
ACE_NTOHL (0x62737472),
ACE_NTOHL (0x61637400), // name = is_abstract
CORBA::tk_boolean,
10,
ACE_NTOHL (0x69735f63),
ACE_NTOHL (0x7573746f),
ACE_NTOHL (0x6d000000), // name = is_custom
CORBA::tk_boolean,
11,
ACE_NTOHL (0x64656669),
ACE_NTOHL (0x6e65645f),
ACE_NTOHL (0x696e0000), // name = defined_in
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
8,
ACE_NTOHL (0x76657273),
ACE_NTOHL (0x696f6e00), // name = version
CORBA::tk_alias, // typecode kind for typedefs
68, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5665),
ACE_NTOHL (0x7273696f),
ACE_NTOHL (0x6e537065),
ACE_NTOHL (0x633a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/VersionSpec:1.0
12,
ACE_NTOHL (0x56657273),
ACE_NTOHL (0x696f6e53),
ACE_NTOHL (0x70656300), // name = VersionSpec
CORBA::tk_string,
0U, // string length
21,
ACE_NTOHL (0x73757070),
ACE_NTOHL (0x6f727465),
ACE_NTOHL (0x645f696e),
ACE_NTOHL (0x74657266),
ACE_NTOHL (0x61636573),
ACE_NTOHL (0x0), // name = supported_interfaces
CORBA::tk_alias, // typecode kind for typedefs
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49645365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/RepositoryIdSeq:1.0
16,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x53657100), // name = RepositoryIdSeq
CORBA::tk_sequence, // typecode kind
88, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
0U,
21,
ACE_NTOHL (0x61627374),
ACE_NTOHL (0x72616374),
ACE_NTOHL (0x5f626173),
ACE_NTOHL (0x655f7661),
ACE_NTOHL (0x6c756573),
ACE_NTOHL (0x0), // name = abstract_base_values
CORBA::tk_alias, // typecode kind for typedefs
164, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
38,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49645365),
ACE_NTOHL (0x713a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/RepositoryIdSeq:1.0
16,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x53657100), // name = RepositoryIdSeq
CORBA::tk_sequence, // typecode kind
88, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
0U,
15,
ACE_NTOHL (0x69735f74),
ACE_NTOHL (0x72756e63),
ACE_NTOHL (0x61746162),
ACE_NTOHL (0x6c650000), // name = is_truncatable
CORBA::tk_boolean,
11,
ACE_NTOHL (0x62617365),
ACE_NTOHL (0x5f76616c),
ACE_NTOHL (0x75650000), // name = base_value
CORBA::tk_alias, // typecode kind for typedefs
72, // encapsulation length
TAO_ENCAP_BYTE_ORDER, // byte order
35,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5265),
ACE_NTOHL (0x706f7369),
ACE_NTOHL (0x746f7279),
ACE_NTOHL (0x49643a31),
ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/RepositoryId:1.0
13,
ACE_NTOHL (0x5265706f),
ACE_NTOHL (0x7369746f),
ACE_NTOHL (0x72794964),
ACE_NTOHL (0x0), // name = RepositoryId
CORBA::tk_string,
0U, // string length
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueDescription (
CORBA::tk_struct,
sizeof (_oc_CORBA_ValueDescription),
(char *) &_oc_CORBA_ValueDescription,
0,
sizeof (CORBA::ValueDescription)
);
static const CORBA::Long _oc_CORBA_ValueBoxDef[] =
{
TAO_ENCAP_BYTE_ORDER, // byte order
34,
ACE_NTOHL (0x49444c3a),
ACE_NTOHL (0x6f6d672e),
ACE_NTOHL (0x6f72672f),
ACE_NTOHL (0x434f5242),
ACE_NTOHL (0x412f5661),
ACE_NTOHL (0x6c756542),
ACE_NTOHL (0x6f784465),
ACE_NTOHL (0x663a312e),
ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/ValueBoxDef:1.0
12,
ACE_NTOHL (0x56616c75),
ACE_NTOHL (0x65426f78),
ACE_NTOHL (0x44656600), // name = ValueBoxDef
};
static CORBA::TypeCode _tc_TAO_tc_CORBA_ValueBoxDef (
CORBA::tk_objref,
sizeof (_oc_CORBA_ValueBoxDef),
(char *) &_oc_CORBA_ValueBoxDef,
0,
sizeof (CORBA::ValueBoxDef)
);
// *********************************************************************
// Initialization and registration of dynamic service object.
int
TAO_IFR_Client_Adapter_Impl::Initializer (void)
{
CORBA::_tc_Identifier = &_tc_TAO_tc_CORBA_Identifier;
CORBA::_tc_ScopedName = &_tc_TAO_tc_CORBA_ScopedName;
CORBA::_tc_ScopedName = &_tc_TAO_tc_CORBA_RepositoryId;
CORBA::_tc_IRObject = &_tc_TAO_tc_CORBA_IRObject;
CORBA::_tc_Visibility = &_tc_TAO_tc_CORBA_Visibility;
CORBA::_tc_ValueModifier = &_tc_TAO_tc_CORBA_ValueModifier;
CORBA::_tc_DefinitionKind = &_tc_TAO_tc_CORBA_DefinitionKind;
CORBA::_tc_VersionSpec = &_tc_TAO_tc_CORBA_VersionSpec;
CORBA::_tc_Contained = &_tc_TAO_tc_CORBA_Contained;
CORBA::_tc_ContainedSeq = &_tc_TAO_tc_CORBA_ContainedSeq;
CORBA::_tc_InterfaceDefSeq = &_tc_TAO_tc_CORBA_InterfaceDefSeq;
CORBA::_tc_AbstractInterfaceDefSeq =
&_tc_TAO_tc_CORBA_AbstractInterfaceDefSeq;
CORBA::_tc_LocalInterfaceDefSeq = &_tc_TAO_tc_CORBA_LocalInterfaceDefSeq;
CORBA::_tc_StructMember = &_tc_TAO_tc_CORBA_StructMember;
CORBA::_tc_StructMemberSeq = &_tc_TAO_tc_CORBA_StructMemberSeq;
CORBA::_tc_Initializer = &_tc_TAO_tc_CORBA_Initializer;
CORBA::_tc_InitializerSeq = &_tc_TAO_tc_CORBA_InitializerSeq;
CORBA::_tc_UnionMember = &_tc_TAO_tc_CORBA_UnionMember;
CORBA::_tc_UnionMemberSeq = &_tc_TAO_tc_CORBA_UnionMemberSeq;
CORBA::_tc_EnumMemberSeq = &_tc_TAO_tc_CORBA_EnumMemberSeq;
CORBA::_tc_Container = &_tc_TAO_tc_CORBA_Container;
CORBA::_tc_IDLType = &_tc_TAO_tc_CORBA_IDLType;
CORBA::_tc_TypedefDef = &_tc_TAO_tc_CORBA_TypedefDef;
CORBA::_tc_TypeDescription = &_tc_TAO_tc_CORBA_TypeDescription;
CORBA::_tc_PrimitiveKind = &_tc_TAO_tc_CORBA_PrimitiveKind;
CORBA::_tc_Repository = &_tc_TAO_tc_CORBA_Repository;
CORBA::_tc_ModuleDef = &_tc_TAO_tc_CORBA_ModuleDef;
CORBA::_tc_ModuleDescription = &_tc_TAO_tc_CORBA_ModuleDescription;
CORBA::_tc_ConstantDef = &_tc_TAO_tc_CORBA_ConstantDef;
CORBA::_tc_ConstantDescription = &_tc_TAO_tc_CORBA_ConstantDescription;
CORBA::_tc_StructDef = &_tc_TAO_tc_CORBA_StructDef;
CORBA::_tc_UnionDef = &_tc_TAO_tc_CORBA_UnionDef;
CORBA::_tc_EnumDef = &_tc_TAO_tc_CORBA_EnumDef;
CORBA::_tc_AliasDef = &_tc_TAO_tc_CORBA_AliasDef;
CORBA::_tc_NativeDef = &_tc_TAO_tc_CORBA_NativeDef;
CORBA::_tc_PrimitiveDef = &_tc_TAO_tc_CORBA_PrimitiveDef;
CORBA::_tc_StringDef = &_tc_TAO_tc_CORBA_StringDef;
CORBA::_tc_WstringDef = &_tc_TAO_tc_CORBA_WstringDef;
CORBA::_tc_SequenceDef = &_tc_TAO_tc_CORBA_SequenceDef;
CORBA::_tc_ArrayDef = &_tc_TAO_tc_CORBA_ArrayDef;
CORBA::_tc_ExceptionDef = &_tc_TAO_tc_CORBA_ExceptionDef;
CORBA::_tc_ExceptionDescription = &_tc_TAO_tc_CORBA_ExceptionDescription;
CORBA::_tc_ExceptionDefSeq = &_tc_TAO_tc_CORBA_ExceptionDefSeq;
CORBA::_tc_ExcDescriptionSeq = &_tc_TAO_tc_CORBA_ExcDescriptionSeq;
CORBA::_tc_AttributeMode = &_tc_TAO_tc_CORBA_AttributeMode;
CORBA::_tc_AttributeDef = &_tc_TAO_tc_CORBA_AttributeDef;
CORBA::_tc_AttributeDescription = &_tc_TAO_tc_CORBA_AttributeDescription;
CORBA::_tc_OperationMode = &_tc_TAO_tc_CORBA_OperationMode;
CORBA::_tc_ParameterMode = &_tc_TAO_tc_CORBA_ParameterMode;
CORBA::_tc_ParameterDescription = &_tc_TAO_tc_CORBA_ParameterDescription;
CORBA::_tc_ParDescriptionSeq = &_tc_TAO_tc_CORBA_ParDescriptionSeq;
CORBA::_tc_ContextIdentifier = &_tc_TAO_tc_CORBA_ContextIdentifier;
CORBA::_tc_ContextIdSeq = &_tc_TAO_tc_CORBA_ContextIdSeq;
CORBA::_tc_OperationDef = &_tc_TAO_tc_CORBA_OperationDef;
CORBA::_tc_OperationDescription = &_tc_TAO_tc_CORBA_OperationDescription;
CORBA::_tc_RepositoryIdSeq = &_tc_TAO_tc_CORBA_RepositoryIdSeq;
CORBA::_tc_OpDescriptionSeq = &_tc_TAO_tc_CORBA_OpDescriptionSeq;
CORBA::_tc_AttrDescriptionSeq = &_tc_TAO_tc_CORBA_AttrDescriptionSeq;
CORBA::_tc_InterfaceDef = &_tc_TAO_tc_CORBA_InterfaceDef;
CORBA::_tc_InterfaceDescription = &_tc_TAO_tc_CORBA_InterfaceDescription;
CORBA::_tc_AbstractInterfaceDef = &_tc_TAO_tc_CORBA_AbstractInterfaceDef;
CORBA::_tc_LocalInterfaceDef = &_tc_TAO_tc_CORBA_LocalInterfaceDef;
CORBA::_tc_FixedDef = &_tc_TAO_tc_CORBA_FixedDef;
CORBA::_tc_ValueDefSeq = &_tc_TAO_tc_CORBA_ValueDefSeq;
CORBA::_tc_ValueMember = &_tc_TAO_tc_CORBA_ValueMember;
CORBA::_tc_ValueMemberSeq = &_tc_TAO_tc_CORBA_ValueMemberSeq;
CORBA::_tc_ValueMemberDef = &_tc_TAO_tc_CORBA_ValueMemberDef;
CORBA::_tc_ValueDef = &_tc_TAO_tc_CORBA_ValueDef;
CORBA::_tc_ValueDescription = &_tc_TAO_tc_CORBA_ValueDescription;
CORBA::_tc_ValueBoxDef = &_tc_TAO_tc_CORBA_ValueBoxDef;
TAO_ORB_Core::ifr_client_adapter_name ("Concrete_IFR_Client_Adapter");
return ACE_Service_Config::process_directive (ace_svc_desc_TAO_IFR_Client_Adapter_Impl);
}
ACE_STATIC_SVC_DEFINE (
TAO_IFR_Client_Adapter_Impl,
ACE_TEXT ("Concrete_IFR_Client_Adapter"),
ACE_SVC_OBJ_T,
&ACE_SVC_NAME (TAO_IFR_Client_Adapter_Impl),
ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
0
)
ACE_FACTORY_DEFINE (TAO_IFR_Client, TAO_IFR_Client_Adapter_Impl)
| 30.275447
| 114
| 0.628438
|
tharindusathis
|
77266452e2794ac63f8cad34e193f5af996ca8ad
| 618
|
cpp
|
C++
|
Algorithm/algorithm-easy/Array/6.cpp
|
TommyGong08/Leetcode
|
5359dfcb6b846e18e21efde07914027e958c0073
|
[
"MIT"
] | null | null | null |
Algorithm/algorithm-easy/Array/6.cpp
|
TommyGong08/Leetcode
|
5359dfcb6b846e18e21efde07914027e958c0073
|
[
"MIT"
] | null | null | null |
Algorithm/algorithm-easy/Array/6.cpp
|
TommyGong08/Leetcode
|
5359dfcb6b846e18e21efde07914027e958c0073
|
[
"MIT"
] | null | null | null |
class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
if(nums2.size() < nums1.size()){
return intersect(nums2,nums1);
}
unordered_map<int,int> hash_map;
for(int num:nums1){
hash_map[num]++;
}
vector<int> ans;
for(int num:nums2){
if(hash_map.count(num)){//nums1中存在num元素
ans.push_back(num);
hash_map[num]--;
if(hash_map[num]==0){
hash_map.erase(num);
}
}
}
return ans;
}
};
| 26.869565
| 67
| 0.459547
|
TommyGong08
|
7726b4e71c31508c7a1cab97d06834f619c6cdf5
| 8,964
|
cpp
|
C++
|
Code/Gfx/Source/D3D12/FrameBuffer.cpp
|
Mu-L/Luna-Engine-0.6
|
05ae1037f0d173589a535eb6ec2964f20d80e5c1
|
[
"MIT"
] | 167
|
2020-06-17T06:09:41.000Z
|
2022-03-13T20:31:26.000Z
|
Code/Gfx/Source/D3D12/FrameBuffer.cpp
|
Mu-L/Luna-Engine-0.6
|
05ae1037f0d173589a535eb6ec2964f20d80e5c1
|
[
"MIT"
] | 2
|
2020-07-11T15:12:50.000Z
|
2021-06-01T01:45:49.000Z
|
Code/Gfx/Source/D3D12/FrameBuffer.cpp
|
Mu-L/Luna-Engine-0.6
|
05ae1037f0d173589a535eb6ec2964f20d80e5c1
|
[
"MIT"
] | 22
|
2020-06-12T02:26:10.000Z
|
2022-01-02T14:04:32.000Z
|
// Copyright 2018-2020 JXMaster. All rights reserved.
/*
* @file FrameBuffer.cpp
* @author JXMaster
* @date 2020/3/11
*/
#pragma once
#include "FrameBuffer.hpp"
#ifdef LUNA_GFX_D3D12
namespace Luna
{
namespace Gfx
{
namespace D3D12
{
R<RenderTargetViewDesc> get_default_rtv(Resource* res)
{
ResourceDesc d = res->desc();
if (d.format == EResourceFormat::unknown)
{
return BasicError::bad_arguments();
}
switch (d.type)
{
case EResourceType::buffer:
return BasicError::bad_arguments();
case EResourceType::texture_1d:
return (d.depth_or_array_size) == 1 ?
RenderTargetViewDesc::as_tex1d(d.format, 0) :
RenderTargetViewDesc::as_tex1darray(d.format, 0, 0, d.depth_or_array_size);
case EResourceType::texture_2d:
return (d.depth_or_array_size == 1) ?
((d.sample_count == 1) ?
RenderTargetViewDesc::as_tex2d(d.format, 0) :
RenderTargetViewDesc::as_tex2dms(d.format)) :
((d.sample_count == 1) ?
RenderTargetViewDesc::as_tex2darray(d.format, 0, 0, d.depth_or_array_size) :
RenderTargetViewDesc::as_tex2dmsarray(d.format, 0, d.depth_or_array_size)
);
case EResourceType::texture_3d:
return RenderTargetViewDesc::as_tex3d(d.format, 0, 0, d.depth_or_array_size);
default:
lupanic();
break;
}
return BasicError::failure();
}
R<DepthStencilViewDesc> get_default_dsv(Resource* res)
{
ResourceDesc d = res->desc();
if (d.format != EResourceFormat::d16_unorm &&
d.format != EResourceFormat::d24_unorm_s8 &&
d.format != EResourceFormat::d32_float &&
d.format != EResourceFormat::d32_float_s8x24)
{
return BasicError::bad_arguments();
}
switch (d.type)
{
case EResourceType::buffer:
case EResourceType::texture_3d:
return BasicError::bad_arguments();
case EResourceType::texture_1d:
return (d.depth_or_array_size) == 1 ?
DepthStencilViewDesc::as_tex1d(d.format, 0) :
DepthStencilViewDesc::as_tex1darray(d.format, 0, 0, d.depth_or_array_size);
case EResourceType::texture_2d:
return (d.depth_or_array_size == 1) ?
((d.sample_count == 1) ?
DepthStencilViewDesc::as_tex2d(d.format, 0) :
DepthStencilViewDesc::as_tex2dms(d.format)) :
((d.sample_count == 1) ?
DepthStencilViewDesc::as_tex2darray(d.format, 0, 0, d.depth_or_array_size) :
DepthStencilViewDesc::as_tex2dmsarray(d.format, 0, d.depth_or_array_size)
);
default:
lupanic();
break;
}
return BasicError::failure();
}
RV FrameBuffer::init(u32 num_rtvs, IResource** rts, RenderTargetViewDesc** rtvs, IResource* ds, DepthStencilViewDesc* dsv)
{
lutry
{
// initialize RTVs.
m_rtvs.resize(num_rtvs);
m_rts.resize(num_rtvs);
for (u32 i = 0; i < num_rtvs; ++i)
{
m_rts[i] = rts[i];
if (!rtvs)
{
luset(m_rtvs[i], get_default_rtv(m_rts[i]));
}
else
{
if (rtvs[i])
{
m_rtvs[i] = *rtvs[i];
}
else
{
luset(m_rtvs[i], get_default_rtv(m_rts[i]));
}
}
}
if (num_rtvs)
{
// Create heap.
{
D3D12_DESCRIPTOR_HEAP_DESC d;
d.NodeMask = 0;
d.NumDescriptors = num_rtvs;
d.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
d.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
if (FAILED(m_device->m_device->CreateDescriptorHeap(&d, IID_PPV_ARGS(&m_rtv_heap))))
{
return BasicError::failure();
}
}
// Fill heap.
{
m_rtv_size = m_device->m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
D3D12_RENDER_TARGET_VIEW_DESC rtv;
for (u32 i = 0; i < num_rtvs; ++i)
{
ID3D12Resource* res = m_rts[i]->m_res.Get();
switch (m_rtvs[i].type)
{
case ERenderTargetViewType::buffer:
rtv.ViewDimension = D3D12_RTV_DIMENSION_BUFFER;
rtv.Buffer.FirstElement = m_rtvs[i].buffer.offset;
rtv.Buffer.NumElements = m_rtvs[i].buffer.count;
break;
case ERenderTargetViewType::tex1d:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE1D;
rtv.Texture1D.MipSlice = m_rtvs[i].tex1d.mip_slice;
break;
case ERenderTargetViewType::tex1darray:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE1DARRAY;
rtv.Texture1DArray.ArraySize = m_rtvs[i].tex1darray.array_size;
rtv.Texture1DArray.FirstArraySlice = m_rtvs[i].tex1darray.first_array_slice;
rtv.Texture1DArray.MipSlice = m_rtvs[i].tex1darray.mip_slice;
break;
case ERenderTargetViewType::tex2d:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D;
rtv.Texture2D.MipSlice = m_rtvs[i].tex2d.mip_slice;
rtv.Texture2D.PlaneSlice = 0;
break;
case ERenderTargetViewType::tex2darray:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY;
rtv.Texture2D.MipSlice = m_rtvs[i].tex2d.mip_slice;
rtv.Texture2D.PlaneSlice = 0;
break;
case ERenderTargetViewType::tex2dms:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMS;
break;
case ERenderTargetViewType::tex2dmsarray:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY;
rtv.Texture2DMSArray.ArraySize = m_rtvs[i].tex2dmsarray.array_size;
rtv.Texture2DMSArray.FirstArraySlice = m_rtvs[i].tex2dmsarray.first_array_slice;
break;
case ERenderTargetViewType::tex3d:
rtv.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE3D;
rtv.Texture3D.FirstWSlice = m_rtvs[i].tex3d.first_layer_slice;
rtv.Texture3D.MipSlice = m_rtvs[i].tex3d.mip_slice;
rtv.Texture3D.WSize = m_rtvs[i].tex3d.layer_size;
break;
default:
lupanic();
}
rtv.Format = encode_resource_format(m_rtvs[i].format);
usize addr = m_rtv_heap->GetCPUDescriptorHandleForHeapStart().ptr + i * m_rtv_size;
D3D12_CPU_DESCRIPTOR_HANDLE h;
h.ptr = addr;
m_device->m_device->CreateRenderTargetView(res, &rtv, h);
}
}
}
// Create DSV.
if (ds)
{
m_ds = ds;
if (dsv)
{
m_dsv = *dsv;
}
else
{
luset(m_dsv, get_default_dsv(m_ds));
}
// Create heap.
{
D3D12_DESCRIPTOR_HEAP_DESC d;
d.NodeMask = 0;
d.NumDescriptors = 1;
d.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
d.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
if (FAILED(m_device->m_device->CreateDescriptorHeap(&d, IID_PPV_ARGS(&m_dsv_heap))))
{
return BasicError::failure();
}
}
// Fill heap.
{
usize dsv_size = m_device->m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
D3D12_DEPTH_STENCIL_VIEW_DESC d;
DepthStencilViewDesc* desc = &m_dsv;
d.Format = encode_resource_format(desc->format);
d.Flags = D3D12_DSV_FLAG_NONE;
if (desc->depth_read_only)
{
d.Flags = d.Flags | D3D12_DSV_FLAG_READ_ONLY_DEPTH;
}
if (desc->stencil_read_only)
{
d.Flags = d.Flags | D3D12_DSV_FLAG_READ_ONLY_STENCIL;
}
switch (desc->type)
{
case EDepthStencilViewType::tex1d:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE1D;
d.Texture1D.MipSlice = desc->tex1d.mip_slice;
break;
case EDepthStencilViewType::tex1darray:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE1DARRAY;
d.Texture1DArray.ArraySize = desc->tex1darray.array_size;
d.Texture1DArray.FirstArraySlice = desc->tex1darray.first_array_slice;
d.Texture1DArray.MipSlice = desc->tex1darray.mip_slice;
break;
case EDepthStencilViewType::tex2d:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
d.Texture2D.MipSlice = desc->tex2d.mip_slice;
break;
case EDepthStencilViewType::tex2darray:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DARRAY;
d.Texture2DArray.ArraySize = desc->tex2darray.array_size;
d.Texture2DArray.FirstArraySlice = desc->tex2darray.first_array_slice;
d.Texture2DArray.MipSlice = desc->tex2darray.mip_slice;
break;
case EDepthStencilViewType::tex2dms:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DMS;
break;
case EDepthStencilViewType::tex2dmsarray:
d.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY;
d.Texture2DMSArray.ArraySize = desc->tex2dmsarray.array_size;
d.Texture2DMSArray.FirstArraySlice = desc->tex2dmsarray.first_array_slice;
default:
lupanic();
}
m_device->m_device->CreateDepthStencilView(m_ds->m_res.Get(), &d, m_dsv_heap->GetCPUDescriptorHandleForHeapStart());
}
}
}
lucatchret;
return RV();
}
}
}
}
#endif
| 33.573034
| 125
| 0.645694
|
Mu-L
|
77273a4a6254e68369f07f611c75460b9ef98541
| 15,672
|
cc
|
C++
|
Source/Models/expression.cc
|
AryaFaramarzi/CS220-dmfb-synthesis-skeleton
|
6b592516025f6c2838f269dcf2ca1696d9de5ab8
|
[
"MIT"
] | 3
|
2018-11-03T06:17:08.000Z
|
2020-08-12T05:26:47.000Z
|
Source/Models/expression.cc
|
AryaFaramarzi/CS220-dmfb-synthesis-skeleton
|
6b592516025f6c2838f269dcf2ca1696d9de5ab8
|
[
"MIT"
] | null | null | null |
Source/Models/expression.cc
|
AryaFaramarzi/CS220-dmfb-synthesis-skeleton
|
6b592516025f6c2838f269dcf2ca1696d9de5ab8
|
[
"MIT"
] | 6
|
2019-09-03T23:58:04.000Z
|
2021-07-09T02:33:47.000Z
|
/*------------------------------------------------------------------------------*
* (c)2016, All Rights Reserved. *
* ___ ___ ___ *
* /__/\ / /\ / /\ *
* \ \:\ / /:/ / /::\ *
* \ \:\ / /:/ / /:/\:\ *
* ___ \ \:\ / /:/ ___ / /:/~/:/ *
* /__/\ \__\:\ /__/:/ / /\ /__/:/ /:/___ UCR DMFB Synthesis Framework *
* \ \:\ / /:/ \ \:\ / /:/ \ \:\/:::::/ www.microfluidics.cs.ucr.edu *
* \ \:\ /:/ \ \:\ /:/ \ \::/~~~~ *
* \ \:\/:/ \ \:\/:/ \ \:\ *
* \ \::/ \ \::/ \ \:\ *
* \__\/ \__\/ \__\/ *
*-----------------------------------------------------------------------------*/
/*---------------------------Implementation Details-----------------------------*
* Source: expression.cc *
* Original Code Author(s): Dan Grissom *
* Original Completion/Release Date: April 1, 2014 *
* *
* Details: N/A *
* *
* Revision History: *
* WHO WHEN WHAT *
* --- ---- ---- *
* FML MM/DD/YY One-line description *
*-----------------------------------------------------------------------------*/
#include "expression.h"
int Expression::next_id = 1;
/////////////////////////////////////////////////////////////////////
// Constructors
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// Creating an expression that will be manually created externally.
// This method should only be called by the FileIn class when reading
// in a CFG from a file.
/////////////////////////////////////////////////////////////////////
Expression::Expression(int expId)
{
// Set ID and increase next_id if necessary
id = expId;
if (id >= next_id)
next_id = id + 1;
//operationType = ot;
operands = NULL;
//operandType = OP_TWO_SENSORS;
constant = 0;
sensor1 = NULL;
sensor2 = NULL;
unconditionalParent = NULL;
}
/////////////////////////////////////////////////////////////////////
// Creating an expression that compares the readings from two sensors.
/////////////////////////////////////////////////////////////////////
Expression::Expression(AssayNode *s1, ExOperationType ot, AssayNode *s2)
{
{ // Sanity check: Must be proper operation type
if (!(ot == OP_GT || ot == OP_LT || ot == OP_GoE || ot == OP_LoE || ot == OP_EQUAL) || !s1 || !s2)
{
stringstream msg;
msg << "ERRORL. >, <, <=, >=, == operations allowed for a sensor-sensor comparison. Must be valid sensors." << ends;
claim(false, &msg);
}
}
id = next_id++;
operationType = ot;
operands = NULL;
operandType = OP_TWO_SENSORS;
constant = 0;
sensor1 = s1;
sensor2 = s2;
unconditionalParent = NULL;
}
/////////////////////////////////////////////////////////////////////
// Creating an expression that compares the reading from a sensor to
// a constant value
/////////////////////////////////////////////////////////////////////
Expression::Expression(AssayNode *s1, ExOperationType ot, double c)
{
{ // Sanity check: Must be proper operation type
if (!(ot == OP_GT || ot == OP_LT || ot == OP_GoE || ot == OP_LoE || ot == OP_EQUAL) || !s1)
{
stringstream msg;
msg << "ERRORL. >, <, <=, >=, == operations allowed for a sensor-sensor comparison. Must be valid sensors." << ends;
claim(false, &msg);
}
}
id = next_id++;
operationType = ot;
operands = NULL;
operandType = OP_ONE_SENSOR;
constant = c;
sensor1 = s1;
sensor2 = NULL;
unconditionalParent = NULL;
}
/////////////////////////////////////////////////////////////////////
// Creating an BioExpression that compares the run count of a repeatable
// assay (eventually, a DAG) to a static runcount (constant runCount)
/////////////////////////////////////////////////////////////////////
Expression::Expression(DAG *repeatableDag, ExOperationType ot, double runCount)
{
{ // Sanity check: Must be proper operation type
if (!(ot == OP_GT || ot == OP_LT || ot == OP_GoE || ot == OP_LoE || ot == OP_EQUAL) || !repeatableDag)
{
stringstream msg;
msg << "ERRORL. >, <, <=, >=, == operations allowed for a sensor-sensor comparison. Must be valid assay/dag being checked for repetition." << ends;
claim(false, &msg);
}
}
id = next_id++;
operationType = ot;
operands = NULL;
operandType = OP_RUN_COUNT;
constant = runCount;
sensor1 = NULL;
sensor2 = NULL;
unconditionalParent = repeatableDag;
}
/////////////////////////////////////////////////////////////////////
// Creating an expression that performs a NOT operation
/////////////////////////////////////////////////////////////////////
Expression::Expression(Expression *notExp)
{
id = next_id++;
operationType = OP_NOT;
operands = new vector<Expression*>();
operands->push_back(notExp);
operandType = OP_SUB_EXP;
constant = 0;
sensor1 = NULL;
sensor2 = NULL;
unconditionalParent = NULL;
}
/////////////////////////////////////////////////////////////////////
// Creating an expression that performs an AND or OR operation
/////////////////////////////////////////////////////////////////////
Expression::Expression(ExOperationType andOr)
{
{ // Sanity check: Must be proper operation type
stringstream msg;
msg << "ERRORL. Only AND, OR operations allowed for this expression." << ends;
claim(andOr == OP_AND || andOr == OP_OR, &msg);
}
id = next_id++;
operationType = andOr;
operands = new vector<Expression*>();
operandType = OP_SUB_EXP;
constant = 0;
sensor1 = NULL;
sensor2 = NULL;
unconditionalParent = NULL;
}
/////////////////////////////////////////////////////////////////////
// Creating an expression that is either unconditionally true or false.
// Must pass the unconditional parent from which to branch from
/////////////////////////////////////////////////////////////////////
Expression::Expression(DAG *unconPar, bool unconditional)
{
id = next_id++;
if (unconditional)
operandType = OP_TRUE;
else
operandType = OP_FALSE;
//operands = new vector<Expression*>();
operands = NULL;
operationType = OP_UNCOND;
constant = 0;
sensor1 = NULL;
sensor2 = NULL;
unconditionalParent = unconPar;
}
/////////////////////////////////////////////////////////////////////
// Destructor.
/////////////////////////////////////////////////////////////////////
Expression::~Expression()
{
if (operands)
{
// TODO: Traverse and do recursive delete...MAYBE
//for (int i = 0; i < operands->size(); i++)
//recursiveDelete();
operands->clear();
delete operands;
}
if (sensor1)
sensor1 = NULL;
if (sensor2)
sensor2 = NULL;
}
/////////////////////////////////////////////////////////////////////
// Methods
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// Add an operand to an AND/OR statement.
/////////////////////////////////////////////////////////////////////
void Expression::addOperand(Expression *op)
{
{ // Sanity check: Must be AND/OR to add operand
stringstream msg;
msg << "ERRORL. Only AND, OR operations allowed to add more operands." << ends;
claim(operationType == OP_AND || operationType == OP_OR, &msg);
}
{ // Sanity check: Expression must not be NULL
stringstream msg;
msg << "ERRORL. Expression is not valid." << ends;
claim(op, &msg);
}
operands->push_back(op);
}
/////////////////////////////////////////////////////////////////////
// Evaluates if the expression is valid. That is, if all the leaves
// actually evaluate to a true or false (the leaves all compare
// sensor/constant values).
/////////////////////////////////////////////////////////////////////
bool Expression::isValidExpression()
{
return recursiveValidate(this);
}
bool Expression::recursiveValidate(Expression *e)
{
if (!e)
return false;
if (e->operationType == OP_GT || e->operationType == OP_LT
|| e->operationType == OP_GoE || e->operationType == OP_LoE
|| e->operationType == OP_EQUAL || e->operationType == OP_UNCOND)
return true;
else if (e->operationType == OP_AND && e->operationType == OP_OR && e->operands->size() <= 1)
return false;
else if (e->operands->size() == 0) // e->operationType == OP_NOT
return false;
bool isValid = true;
for (int i = 0; i < e->operands->size(); i++)
{
isValid = isValid && recursiveValidate(e->operands->at(i));
if (!isValid)
return false;
}
return true;
}
/////////////////////////////////////////////////////////////////////
// Prints the boolean expression. If printLiveValues is set, prints
// live values of the sensors, run-count, etc.; if not, then just
// prints the inequality w/o live values.
/////////////////////////////////////////////////////////////////////
string Expression::printExpression(bool printLiveValues)
{
stringstream ss;
recursivePrint(this, &ss, printLiveValues);
return ss.str();
}
void Expression::recursivePrint(Expression *e, stringstream *ss, bool printLiveValues)
{
if (!e)
{
*ss << "(No Condition)";
return;
}
*ss << "(";
if (e->operationType == OP_UNCOND)
{
if (e->operandType == OP_TRUE)
*ss << "Unconditional TRUE";
else if (e->operandType == OP_FALSE)
*ss << "Unconditional FALSE";
}
else if (e->operationType == OP_GT || e->operationType == OP_LT
|| e->operationType == OP_GoE || e->operationType == OP_LoE || e->operationType == OP_EQUAL)
{
// Print out run-count or sensor-reading
if (printLiveValues)
{
if (e->operandType == OP_RUN_COUNT)
*ss << e->unconditionalParent->GetIdName() << "_RUN_COUNT = " << e->unconditionalParent->getRunCount();
else // 1- or 2-Sensor reading
*ss << e->sensor1->GetName() << "_READ = " << e->sensor1->GetReading();
}
else
{
if (e->operandType == OP_RUN_COUNT)
*ss << e->unconditionalParent->GetIdName() << "_RUN_COUNT";
else // 1- or 2-Sensor reading
*ss << e->sensor1->GetName() << "_READ";
}
if (e->operationType == OP_GT)
*ss << " > ";
else if (e->operationType == OP_LT)
*ss << " < ";
else if (e->operationType == OP_GoE)
*ss << " >= ";
else if (e->operationType == OP_LoE)
*ss << " <= ";
else if (e->operationType == OP_EQUAL)
*ss << " = ";
else
*ss << " ??? ";
if (e->operandType == OP_ONE_SENSOR || e->operandType == OP_RUN_COUNT)
*ss << e->constant;
else if (e->operandType == OP_TWO_SENSORS)
{
if (printLiveValues)
*ss << e->sensor2->GetName() << "_READ = " << e->sensor2->GetReading();
else
*ss << e->sensor2->GetName() << "_READ";
}
else
claim(false, "Unsupported operand type: Expression::recursivePrint()");
}
else if (e->operationType == OP_AND || e->operationType == OP_OR)
{
for (int i = 0; i < e->operands->size(); i++)
{
recursivePrint(e->operands->at(i), ss, printLiveValues);
if (i < e->operands->size()-1 && e->operationType == OP_AND)
*ss << " AND ";
else if (i < e->operands->size()-1 && e->operationType == OP_OR)
*ss << " OR ";
}
}
else if (e->operationType == OP_NOT)
{
*ss << " NOT";
recursivePrint(e->operands->front(), ss, printLiveValues);
}
else
claim(false, "Unsupported operation/operand type: Expression::recursivePrint().");
*ss << ")";
}
/////////////////////////////////////////////////////////////////////
// Evaluates the expression and returns the value.
/////////////////////////////////////////////////////////////////////
bool Expression::evaluateExpression()
{
return recursiveEvaluate(this);
}
bool Expression::recursiveEvaluate(Expression *e)
{
{ // Sanity check: Expression must be valid
stringstream msg;
msg << "ERRORL. Expression not valid." << ends;
claim(e->isValidExpression(), &msg);
}
if (e->operationType == OP_UNCOND)
{
if (e->operandType == OP_TRUE)
return true;
else if (e->operandType == OP_FALSE)
return false;
}
else if (e->operationType == OP_GT || e->operationType == OP_LT
|| e->operationType == OP_GoE || e->operationType == OP_LoE || e->operationType == OP_EQUAL)
{
{ // Sanity check: Detect nodes must be done
if (e->sensor1)
{
stringstream msg;
msg << "ERRORL. Detect sensor " << e->sensor1->GetName() << " status must be 'complete'." << endl;
claim(e->sensor1->GetStatus() == COMPLETE , &msg);
}
if (e->sensor2)
{
stringstream msg;
msg << "ERRORL. Detect sensor " << e->sensor2->GetName() << " status must be 'complete'." << endl;
claim(e->sensor2->GetStatus() == COMPLETE , &msg);
}
}
double lhs;
double rhs;
if (e->operandType == OP_ONE_SENSOR)
{
lhs = e->sensor1->GetReading();
rhs = e->constant;
}
else if (e->operandType == OP_TWO_SENSORS)
{
lhs = e->sensor1->GetReading();
rhs = e->sensor2->GetReading();
}
else if (e->operandType == OP_RUN_COUNT)
{
lhs = e->unconditionalParent->getRunCount();
rhs = e->constant;
}
else
claim(false, "Unsupported operand type.");
if (e->operationType == OP_GT)
return lhs > rhs;
else if (e->operationType == OP_LT)
return lhs < rhs;
else if (e->operationType == OP_GoE)
return lhs >= rhs;
else if (e->operationType == OP_LoE)
return lhs <= rhs;
else if (e->operationType == OP_EQUAL)
return lhs == rhs;
}
else if (e->operationType == OP_AND)
{
bool eval = true;
for (int i = 0; i < e->operands->size(); i++)
eval = eval && recursiveEvaluate(e->operands->at(i));
return eval;
}
else if (e->operationType == OP_OR)
{
bool eval = false;
for (int i = 0; i < e->operands->size(); i++)
eval = eval || recursiveEvaluate(e->operands->at(i));
return eval;
}
else if (e->operationType == OP_NOT)
{
return !(recursiveEvaluate(e->operands->front()));
}
else
{ // Sanity check: Detect nodes must be done
stringstream msg;
msg << "ERRORL. Unknown operation type" << ends;
claim(false , &msg);
}
stringstream msg;
msg << "ERRORL. Reached end of non-void function" << ends;
cout << msg.str() << endl;
exit(-1);
}
/////////////////////////////////////////////////////////////////////
// Gets the unique DAG parents for this expression
/////////////////////////////////////////////////////////////////////
void Expression::getParentDags(list<DAG *> *parents)
{
//parents->clear();
recursiveGetParents(this, parents);
}
void Expression::recursiveGetParents(Expression *e, list<DAG *> *parents)
{
if (e->operationType == OP_GT || e->operationType == OP_LT
|| e->operationType == OP_GoE || e->operationType == OP_LoE || e->operationType == OP_EQUAL)
{
if (e->operandType == OP_RUN_COUNT)
{
parents->remove(e->unconditionalParent);
parents->push_back(e->unconditionalParent);
}
else if (e->operandType == OP_ONE_SENSOR || e->operandType == OP_TWO_SENSORS)
{
parents->remove(e->sensor1->GetDAG());
parents->push_back(e->sensor1->GetDAG());
if (e->operandType == OP_TWO_SENSORS)
{
parents->remove(e->sensor2->GetDAG());
parents->push_back(e->sensor2->GetDAG());
}
}
else
claim(false, "Unsupported operandType in Expression:recursiveGetParents().");
}
else if (e->operationType != OP_UNCOND)
{
for (int i = 0; i < e->operands->size(); i++)
recursiveGetParents(e->operands->at(i), parents);
}
else // OP_UNCOND
{
parents->remove(e->unconditionalParent);
parents->push_back(e->unconditionalParent);
}
}
| 31.219124
| 150
| 0.515123
|
AryaFaramarzi
|
7728ebb7cef5baa7c90f4d3be4f977cc1115eb4e
| 13,760
|
hpp
|
C++
|
src/thread/compute_thread.hpp
|
huangqundl/af_stream
|
178d98feaf403b6947fb0fae3c2bbaedd91f9ab8
|
[
"Apache-2.0"
] | 15
|
2017-03-28T13:15:53.000Z
|
2022-03-01T08:16:48.000Z
|
src/thread/compute_thread.hpp
|
huangqundl/af_stream
|
178d98feaf403b6947fb0fae3c2bbaedd91f9ab8
|
[
"Apache-2.0"
] | null | null | null |
src/thread/compute_thread.hpp
|
huangqundl/af_stream
|
178d98feaf403b6947fb0fae3c2bbaedd91f9ab8
|
[
"Apache-2.0"
] | 6
|
2017-10-17T14:10:23.000Z
|
2022-03-01T08:16:29.000Z
|
#ifndef __AFS_COMPUTE_THREAD_HPP_INCLUDED__
#define __AFS_COMPUTE_THREAD_HPP_INCLUDED__
#include <stdio.h>
#include <stdint.h>
#include <string>
#include "../config.hpp"
#include "thread.hpp"
#include "up_thread.hpp"
#include "down_thread.hpp"
#include "../wrap_item.hpp"
#include "router_base.hpp"
#include "../queues/mpsc_channel.hpp"
#include "../queues/zerocopy_ringbuffer.hpp"
#include "../fault_tolerance/operator_tracker.hpp"
#include "../operator/ft_interface.hpp"
namespace afs {
/**
* Processing events
* @param InT class of input event from Dispatcher
* @param OutT class of output event to Collector
*/
//template <class InTf, class OutTf, class InTb, class OutTb>
template <class InT, class OutT, class RInT, class ROutT>
class ComputeThread : public ThreadBase {
typedef WrapItem<InT> WInT;
typedef WrapItem<OutT> WOutT;
typedef WrapItem<RInT> WRInT;
typedef WrapItem<ROutT> WROutT;
public:
ComputeThread(int num_upstream, int num_downstream);
void ConnectUpThread(UpThread<InT, ROutT>* up_thread);
void ConnectDownThread(DownThread<OutT, RInT>* down_thread);
void ConnectComputeThread(ThreadBase* dst_thread);
virtual void ComputeThreadRecovery() {};
protected:
/**
* Send data to next-hop worker via output_thread
*/
/*
void EmitData(OutT& msg) {
int dest = router_->GetDestination(&msg, sizeof(OutT));
WOutT* slot = (WOutT*)writer_->GetSlot();
slot->set_type(ITEM_NORMAL);
slot->set_worker_source(get_wid());
slot->set_thr_source(get_tid());
slot->data() = msg;
down_writer_->Write(dest, slot);
}
*/
uint64_t GetNumDownstream() {
return num_downstream_;
}
void EmitData(int dest, OutT& msg) {
//LOG_MSG("To emit %d\n", dest);
WOutT* slot = (WOutT*)down_writer_->GetSlot();
slot->set_type(ITEM_NORMAL);
slot->set_worker_source(get_wid());
slot->set_thr_source(get_tid());
slot->data() = msg;
down_writer_->Write(dest, slot);
//LOG_MSG(" end emit\n");
}
/*
WOutT* GetSlot() {
return (WOutT*)writer_->GetSlot();
}
*/
/*
void CompleteWriteSlot(int dest, WOutT* slot) {
slot->set_type(ITEM_NORMAL);
slot->set_worker_source(get_wid());
slot->set_thr_source(get_tid());
down_writer_->Write(dest, slot);
}
*/
/*
int GetDest(OutT& msg) {
return router_->GetDestination(&msg, sizeof(OutT));
}
*/
/**
* Send data to next-hop worker via output_thread
*/
void EmitReverseData(int dest, ROutT& msg) {
//LOG_MSG("To emit reverse\n");
afs_assert(up_writer_, " reverse writer null\n");
//int dest = r_router_->GetDestination(&msg, sizeof(ROutT));
WROutT* slot = (WROutT*)up_writer_->GetSlot();
slot->set_type(ITEM_REVERSE);
slot->set_worker_source(get_wid());
slot->set_thr_source(get_tid());
slot->data() = msg;
up_writer_->Write(dest, slot);
//LOG_MSG(" end emit reverse\n");
}
void FlushReverseWriter() {
up_writer_->Flush();
up_writer_->Clean();
up_writer_->Init();
}
void EmitReverseTimeout(int dest) {
WROutT r_wrap_msg;
r_wrap_msg.set_type(ITEM_REVERSE);
r_wrap_msg.set_worker_source(get_wid());
r_wrap_msg.set_thr_source(get_tid());
EmitReverseWrapData(dest, r_wrap_msg);
}
private:
// Unique id of the compute_thread in the worker
//int id_;
// monitor number of process events
uint64_t event_;
uint64_t r_event_;
int num_downstream_;
int num_upstream_;
// forward queues
ZeroRingBuffer<WInT>* in_queue_;
MPSCWriter<WOutT>* down_writer_;
// backward queue
ZeroRingBuffer<WRInT>* r_in_queue_;
MPSCWriter<WROutT>* up_writer_;
//RouterBase* router_;
//RouterBase* r_router_;
// fault-tolerant operators
std::vector<FTInterface*> operators;
// derived from ThreadBase
void ThreadInitHandler();
void ThreadFinishHandler();
void ThreadMainHandler();
// user-define interface to initialize and cleaning-up
// called by ThreadInitHandler and ThreadFinishHander respectively
virtual void ComputeThreadInit() = 0;
virtual void ComputeThreadFinish() = 0;
// user-define interface to process events of various types
//virtual void DoProcessRecord(InT& tuple) = 0;
virtual void ProcessData(uint32_t src_worker, uint32_t src_thread, uint64_t seq, InT& tuple) = 0;
virtual void ProcessPunc() = 0;
virtual void ProcessFeedback(int src_worker, int src_thread, RInT& tuple) {
LOG_MSG("Function ProcessFeedback does not be implemented\n");
}
void EmitWrapData(int dest, WOutT& msg) {
WOutT* slot = (WOutT*)down_writer_->GetSlot();
*slot = msg;
down_writer_->Write(dest, slot);
}
void EmitReverseWrapData(int dest, WROutT& msg) {
WROutT* slot = (WROutT*)up_writer_->GetSlot();
*slot = msg;
up_writer_->Write(dest, slot);
}
void EmitFinish() {
WOutT wrap_msg;
if (down_writer_ != NULL) {
wrap_msg.set_type(ITEM_FINISH);
wrap_msg.set_worker_source(get_wid());
wrap_msg.set_thr_source(get_tid());
for (int i = 0; i < num_downstream_; i++) {
EmitWrapData(i, wrap_msg);
}
down_writer_->Flush();
LOG_MSG("ComputeThread: emit finish\n");
}
}
void EmitReverseFinish() {
WROutT r_wrap_msg;
if (up_writer_ != NULL) {
r_wrap_msg.set_type(ITEM_FINISH);
r_wrap_msg.set_worker_source(get_wid());
r_wrap_msg.set_thr_source(get_tid());
for (int i=0; i < num_upstream_; i++) {
EmitReverseWrapData(i, r_wrap_msg);
}
up_writer_->Flush();
}
}
};
template <class InT, class OutT, class RInT, class ROutT>
ComputeThread<InT, OutT, RInT, ROutT>::ComputeThread(
int num_upstream,
//RouterBase* r,
int num_downstream
//, RouterBase* rr
) :
ThreadBase(t_compute_thread),
event_(0),
r_event_(0),
num_downstream_(num_downstream),
num_upstream_(num_upstream),
in_queue_(NULL),
down_writer_(NULL),
r_in_queue_(NULL),
up_writer_(NULL)
//router_(r),
//r_router_(rr)
{
LOG_MSG("compute_thread downstream %d, upstream %d\n", num_downstream, num_upstream);
if (num_downstream > 0) {
down_writer_ = new MPSCWriter<WOutT>();
}
if (num_upstream > 0) {
LOG_MSG("create reverse write_\n");
up_writer_ = new MPSCWriter<WROutT>();
}
}
template <class InT, class OutT, class RInT, class ROutT>
void ComputeThread<InT, OutT, RInT, ROutT>::ThreadInitHandler() {
LOG_MSG(INDENT "initializing\n");
if (down_writer_ != NULL) {
down_writer_->Init();
}
if (up_writer_ != NULL) {
up_writer_->Init();
}
ComputeThreadInit();
operators = *(OperatorTracker::GetInstance()->GetThreadOps(thr_id()));
}
template <class InT, class OutT, class RInT, class ROutT>
void ComputeThread<InT, OutT, RInT, ROutT>::ThreadMainHandler() {
WInT* tuple = NULL;
WRInT* r_tuple = NULL;
int up_stop = 0;
int down_stop = 0;
// no upstream implies external source
if (num_upstream_ == 0) {
num_upstream_++;
}
unsigned int num_operator = operators.size();
afs_zmq::command_t cmd;
/*
if (!r_in_queue_) {
r_stop = true;
}
*/
//LOG_MSG("%s start to run\n", get_thread_str());
//LOG_MSG(" %s operator number %u\n", get_thread_str(), num_operator);
while (up_stop<num_upstream_ || down_stop<num_downstream_) {
//LOG_MSG("while\n");
while (down_stop<num_downstream_ && (r_tuple=r_in_queue_->Extract()) != NULL) {
ITEM_TYPE t = r_tuple->get_type();
switch (t) {
case ITEM_FINISH:
down_stop++;
break;
case ITEM_REVERSE:
r_event_++;
ProcessFeedback(r_tuple->get_worker_source(), r_tuple->get_thr_source(), r_tuple->data());
break;
default:
LOG_ERR("Unidentified event type %d\n", (int)t);
break;
}
r_in_queue_->Ack();
} // end of while reverse
//LOG_MSG("read forward queue\n");
if (afs_unlikely(up_stop==num_upstream_)) {
//LOG_MSG("Attempt to clean\n");
down_writer_->AttemptClean();
}
else {
if ((tuple=in_queue_->Extract()) != NULL) {
ITEM_TYPE t = tuple->get_type();
uint32_t worker = tuple->get_worker_source();
uint32_t thread = tuple->get_thr_source();
uint64_t seq = tuple->get_seq();
InT data = tuple->data();
in_queue_->Ack();
switch (t) {
case ITEM_FINISH:
up_stop++;
LOG_MSG("compute thread: up_stop %d\n", up_stop);
// send finish first
// but continue to wait for finish from downstream workers
if (up_stop == num_upstream_) {
EmitFinish();
}
break;
case ITEM_TIMEOUT:
ProcessPunc();
break;
case ITEM_NORMAL:
event_++;
ProcessData(worker, thread, seq, data);
break;
default:
LOG_ERR("Unidentified event type %d\n", (int)t);
break;
}
} // end of if
}
for (unsigned int i=0; i<num_operator; i++) {
double d = operators[i]->CalculateDivergence();
//LOG_MSG("thread %d, operator %d, divergence %lf, divergence thresh %lf\n", thr_id(), i, d, operators[i]->GetDivergenceThresh());
if (d > operators[i]->GetDivergenceThresh()) {
BackupItem& backup_item = cmd.args.backup_item;
operators[i]->SerializeState(backup_item.data);
if (backup_item.data.meta.len) {
cmd.type = afs_zmq::command_t::backup;
backup_item.info.backup_op = 0;
backup_item.info.worker_id = get_wid();
backup_item.info.thread_id = thr_id();
backup_item.info.op_index = i;
backup_item.info.seq = tuple->get_seq();
NotifyWorker(cmd);
WaitWorker(afs_zmq::command_t::backup, true);
backup_item.data.meta.len = 0;
}
}
}
} // end of while
LOG_MSG(" compute thread (out-of-while): up_stop %d, upstream %d, down_stop %d, downstream %d\n", up_stop, num_upstream_, down_stop, num_downstream_);
if (down_writer_) {
down_writer_->AttemptClean();
}
LOG_MSG(" compute thread send reverse end\n");
EmitReverseFinish();
if (up_writer_ != NULL) {
up_writer_->Clean();
}
LOG_MSG(" compute thread end\n");
}
template <class InT, class OutT, class RInT, class ROutT>
void ComputeThread<InT, OutT, RInT, ROutT>::ThreadFinishHandler() {
LOG_MSG(INDENT "process %lu tuples, %lu tuples\n", event_, r_event_);
ComputeThreadFinish();
}
template <class InT, class OutT, class RInT, class ROutT>
void ComputeThread<InT, OutT, RInT, ROutT>::ConnectUpThread(UpThread<InT, ROutT>* up_thread) {
in_queue_ = new ZeroRingBuffer<WInT>();
up_thread->AddOutQueue(in_queue_);
if (up_thread->IsReverse()) {
// each upstream worker corresponds to an output buffer in up_thread
// add this compute_thread as a writer for all the output buffers
int num_upstream = up_thread->GetNumUpstream();
int writer_id = get_tid();
for (int i=0; i<num_upstream; i++) {
MPSCReader<WROutT>* r_reader = (MPSCReader<WROutT>*)up_thread->GetReverseOutBufferReader(i);
afs_assert(up_writer_, "reverse writer %d is not available\n", writer_id);
afs_assert(r_reader, "reverse reader %d is not available\n", i);
up_writer_->SetWriterId(writer_id);
up_writer_->ConnectPeer(i, r_reader);
r_reader->SetReaderId(i);
r_reader->ConnectPeer(writer_id, up_writer_);
}
}
}
template <class InT, class OutT, class RInT, class ROutT>
void ComputeThread<InT, OutT, RInT, ROutT>::ConnectDownThread(DownThread<OutT, RInT>* down_thread) {
int writer_id = get_tid();
int num_down_thread_reader = down_thread->GetDownstream();
for (int i=0; i<num_down_thread_reader; i++) {
MPSCReader<WOutT>* reader = (MPSCReader<WOutT>*)down_thread->GetOutBufferReader(i);
afs_assert(down_writer_, "writer %d is not available\n", writer_id);
afs_assert(reader, "reader %d is not available\n", i);
down_writer_->SetWriterId(writer_id);
down_writer_->ConnectPeer(i, reader);
reader->SetReaderId(i);
reader->ConnectPeer(writer_id, down_writer_);
}
if (down_thread->IsReverse()) {
r_in_queue_ = new ZeroRingBuffer<WRInT>();
down_thread->AddReverseInBuffer(r_in_queue_);
}
}
} // namespace
#endif // SAND_SUBANALYZER_SUBANALYZER_HPP_
| 32.45283
| 157
| 0.59077
|
huangqundl
|
77290de4a942a5c405d09fd0daeade9d837e0acd
| 568
|
cc
|
C++
|
source/global/pyglobals.cc
|
yu22mal/geant4_pybind
|
ff7efc322fe53f39c7ae7ed140861052a92479fd
|
[
"Unlicense"
] | 6
|
2021-08-08T08:40:13.000Z
|
2022-03-23T03:05:15.000Z
|
source/global/pyglobals.cc
|
yu22mal/geant4_pybind
|
ff7efc322fe53f39c7ae7ed140861052a92479fd
|
[
"Unlicense"
] | 3
|
2021-12-01T14:38:06.000Z
|
2022-02-10T11:28:28.000Z
|
source/global/pyglobals.cc
|
yu22mal/geant4_pybind
|
ff7efc322fe53f39c7ae7ed140861052a92479fd
|
[
"Unlicense"
] | 3
|
2021-07-16T13:57:34.000Z
|
2022-02-07T11:17:19.000Z
|
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>
#include <G4ThreeVector.hh>
#include <G4TwoVector.hh>
#include <vector>
#include "typecast.hh"
#include "opaques.hh"
namespace py = pybind11;
void export_globals(py::module &m)
{
py::bind_vector<G4intVector>(m, "G4intVector");
py::bind_vector<G4doubleVector>(m, "G4doubleVector");
py::bind_vector<G4StringVector>(m, "G4StringVector");
py::bind_vector<G4ThreeVectorVector>(m, "G4ThreeVectorVector");
py::bind_vector<G4TwoVectorVector>(m, "G4TwoVectorVector");
}
| 25.818182
| 66
| 0.741197
|
yu22mal
|
772e1bbd622c67b57b57052831cfa9d862de4f8c
| 448
|
cpp
|
C++
|
algorithms/warmup/lcm.cpp
|
weirdname404/courses
|
611443422cc6acc1af563d9d7d07181e9984ddab
|
[
"MIT"
] | 3
|
2019-05-28T16:53:54.000Z
|
2019-08-03T02:45:08.000Z
|
algorithms/warmup/lcm.cpp
|
weirdname404/courses
|
611443422cc6acc1af563d9d7d07181e9984ddab
|
[
"MIT"
] | null | null | null |
algorithms/warmup/lcm.cpp
|
weirdname404/courses
|
611443422cc6acc1af563d9d7d07181e9984ddab
|
[
"MIT"
] | null | null | null |
// Given two integers a and b, find their least common multiple.
#include <iostream>
using namespace std;
int gcd_euclid(long a, long b) {
if (a % b == 0) {
return b;
}
int gcd = gcd_euclid(b, a % b);
return gcd;
}
long long lcm(long a, long b) {
long long mult = a * b;
return (long long) mult / gcd_euclid(a, b);
}
int main() {
long a, b;
cin >> a >> b;
cout << lcm(a, b) << endl;
return 0;
}
| 17.230769
| 64
| 0.551339
|
weirdname404
|
772f77a9dcaa352bd2c5fa16e8070a2b0ea21c98
| 350
|
cpp
|
C++
|
src/modules/transitions/src/tickable.cpp
|
P8P-7/core
|
820873e7da867392729b2e65922205afe98e41d8
|
[
"MIT"
] | 4
|
2018-04-16T17:56:25.000Z
|
2018-06-22T17:02:26.000Z
|
src/modules/transitions/src/tickable.cpp
|
P8P-7/core
|
820873e7da867392729b2e65922205afe98e41d8
|
[
"MIT"
] | 1
|
2018-05-07T11:05:26.000Z
|
2018-05-07T11:06:52.000Z
|
src/modules/transitions/src/tickable.cpp
|
P8P-7/core
|
820873e7da867392729b2e65922205afe98e41d8
|
[
"MIT"
] | 1
|
2018-05-07T11:04:15.000Z
|
2018-05-07T11:04:15.000Z
|
#include <goliath/transitions/tickable.h>
using namespace goliath::transitions;
Tickable::Tickable(const size_t ticksPerSecond)
: duration(0), ticksPerSecond(ticksPerSecond) {}
std::chrono::milliseconds Tickable::getDuration() const {
return duration;
}
const size_t Tickable::getTicksPerSecond() const {
return ticksPerSecond;
}
| 23.333333
| 57
| 0.754286
|
P8P-7
|
77340bba4020664d5c223067aa5b27e1959c8ac7
| 6,680
|
cpp
|
C++
|
RenderCore/render/widget/ScrollerView.cpp
|
gubaojian/weexuikit
|
2eaf54e4c1f4a1c94398b0990ad9767e3ffb9213
|
[
"Apache-2.0"
] | 46
|
2019-06-25T11:05:49.000Z
|
2021-12-31T04:47:53.000Z
|
RenderCore/render/widget/ScrollerView.cpp
|
gubaojian/weexuikit
|
2eaf54e4c1f4a1c94398b0990ad9767e3ffb9213
|
[
"Apache-2.0"
] | 5
|
2019-10-16T06:54:37.000Z
|
2020-02-06T08:22:40.000Z
|
RenderCore/render/widget/ScrollerView.cpp
|
gubaojian/weexuikit
|
2eaf54e4c1f4a1c94398b0990ad9767e3ffb9213
|
[
"Apache-2.0"
] | 18
|
2019-05-22T09:29:23.000Z
|
2021-04-28T02:12:42.000Z
|
//
// Created by furture on 2018/10/29.
//
#include "ScrollerView.h"
#include <render/core/rendering/RenderScrollView.h>
#include <render/platform/common/log.h>
#include <render/core/parser/Screen.h>
#include <render/core/parser/StyleParser.h>
namespace weexuikit{
ScrollerView::ScrollerView(UIContext *context, Node *node) : View(context, node) {
}
ScrollerView::~ScrollerView(){
if(mScrollPhysics != nullptr){
delete mScrollPhysics;
mScrollPhysics = nullptr;
}
if(mScrollableState != nullptr){
delete mScrollableState;
mScrollableState = nullptr;
}
if(mScrollPosition != nullptr){
delete mScrollPosition;
mScrollPosition = nullptr;
}
if(mDragGestureRecognizer != nullptr){
delete mDragGestureRecognizer;
mDragGestureRecognizer = nullptr;
}
}
void ScrollerView::applyDefault(blink::RenderObject *parent) {
mNode->styles()->insert({Html::Style::STYLE_OVERFLOW, Html::Style::STYLE_OVERFLOW_HIDDEN});
View::applyDefault(parent);
}
void ScrollerView::onPointerEvent(weexuikit::PointerEvent &pointerEvent){
if(pointerEvent.isUpEvent()){
if(mScrollView->getSliverHeader()->getRefreshState() == blink::RefreshState::RelaseToRefresh){
mScrollView->getSliverHeader()->setRefreshState(blink::RefreshState::RefreshIng);
std::shared_ptr<weexuikit::DelayTicker> delayTicker = std::make_shared<weexuikit::DelayTicker>();
delayTicker->delayTickerCallback = [&](){
mScrollView->getSliverHeader()->setRefreshState(blink::RefreshState::PullToRefresh);
mScrollView->setScrollOffset(0, 0);
};
delayTicker->delayTime = 2500;
delayTicker->ticker = mContext->getTickerProvider()->createTicker(delayTicker);;
}
}
mScrollPosition->mMinScrollExtent = mScrollView->getMinScrollExtent()/Screen::mDeviceDensity;
mScrollPosition->mMaxScrollExtent = mScrollView->getMaxScrollExtent()/Screen::mDeviceDensity;
mScrollPosition->applyViewportDimension(mScrollView->getViewportDimension()/Screen::mDeviceDensity);
if(pointerEvent.isDownEvent()){
mDragGestureRecognizer->addPointer(pointerEvent);
}
}
const std::string& ScrollerView::getScrollDirection() {
return getAttr(Scroller::SCROLL_DIRECTION);
}
blink::RenderObject* ScrollerView::createRenderObject(blink::RenderObject* parent, RefPtr<blink::RenderStyle> renderStyle) {
mScrollView = new blink::RenderScrollView();
mScrollView->setStyle(renderStyle);
mScrollView->setNeedsLayoutAndPrefWidthsRecalc();
mScrollPhysics = new weexuikit::AlwaysScrollableScrollPhysics(new weexuikit::ClampingScrollPhysics(nullptr));
mScrollableState = new weexuikit::ScrollableState(mContext->getTickerProvider());
mScrollPosition = new weexuikit::ScrollPositionWithSingleContext(mScrollPhysics, mScrollableState);
mScrollPosition->addListener(this);
if(getScrollDirection() == Scroller::SCROLL_DIRECTION_HORIZONTAL){
mScrollView->setScrollDirection(blink::ScrollDirection::Horizontal);
mDragGestureRecognizer = new weexuikit::HorizontalDragGestureRecognizer(mContext->getGestureHandlerContext());
mDragGestureRecognizer->setMaxFlingVelocity(weexuikit::kMaxFlingVelocity/2);
}else{
mScrollView->setScrollDirection(blink::ScrollDirection::Vertical);
mDragGestureRecognizer = new weexuikit::VerticalDragGestureRecognizer(mContext->getGestureHandlerContext());
}
mDragGestureRecognizer->onDown = [&](weexuikit::DragDownDetails details){
assert(mDrag == nullptr);
assert(mHold.get() == nullptr);
mHold = mScrollPosition->hold([&](){
mHold = nullptr;
});
};
mDragGestureRecognizer->onStart = [&](weexuikit::DragStartDetails details){
assert(mDrag.get() == nullptr);
mDrag = mScrollPosition->drag(details, [&](){
mDrag.reset();
});
assert(mDrag.get() != nullptr);
assert(mHold.get() == nullptr);
};
mDragGestureRecognizer->onUpdate = [&](const weexuikit::DragUpdateDetails& details){
// _drag might be null if the drag activity ended and called _disposeDrag.
assert(mHold.get() == nullptr || mDrag.get() == nullptr);
if(mDrag.get() != nullptr){
mDrag->update(details);
}
};
mDragGestureRecognizer->onEnd = [&](const weexuikit::DragEndDetails& dragEndDetails){
// _drag might be null if the drag activity ended and called _disposeDrag.
assert(mHold.get() == nullptr || mDrag.get() == nullptr);
if(mDrag.get() != nullptr){
mDrag->end(dragEndDetails);
}
assert(mDrag.get() == nullptr);
};
mDragGestureRecognizer->onCancel = [&](){
assert(mHold.get() == nullptr || mDrag.get() == nullptr);
if(mHold.get() != nullptr){
mHold->cancel();
}
if(mDrag.get() != nullptr){
mDrag->cancel();
}
assert(mHold.get() == nullptr);
assert(mDrag.get() == nullptr);
};
mRenderContainer = mScrollView->getRenderContainer();
return mScrollView;
}
void ScrollerView::onListenEvent(){
if(mScrollPosition != nullptr){
float pixels = Screen::dpiToDevicePixels(mScrollPosition->pixels());
if(getScrollDirection() == Scroller::SCROLL_DIRECTION_HORIZONTAL){
if(std::abs(mScrollView->getScrollOffset().x()) == std::abs(pixels)){
return;
}
mScrollView->setScrollOffset(pixels, 0);
}else{
if(std::abs(mScrollView->getScrollOffset().y()) == std::abs(pixels)){
return;
}
mScrollView->setScrollOffset(0, pixels);
}
float offset = Screen::devicePixelsToUnit(pixels);
std::map<std::string,std::string> params = {
{Html::Event::SCROLL_OFFSET, StyleParser::valueToString(-offset)}
};
mContext->fireEvent(mNode, Html::Event::SCROLL, params);
mContext->markNeedsPaint();
}
}
}
| 41.234568
| 128
| 0.605838
|
gubaojian
|
77345f5c3a4a4b61424f48c4c98802d3d63faf62
| 18,745
|
cpp
|
C++
|
smacc2_client_library/nav2z_client/custom_planners/undo_path_global_planner/src/undo_path_global_planner/undo_path_global_planner.cpp
|
reelrbtx/SMACC2
|
ac61cb1599f215fd9f0927247596796fc53f82bf
|
[
"Apache-2.0"
] | 48
|
2021-05-28T01:33:20.000Z
|
2022-03-24T03:16:03.000Z
|
smacc2_client_library/nav2z_client/custom_planners/undo_path_global_planner/src/undo_path_global_planner/undo_path_global_planner.cpp
|
reelrbtx/SMACC2
|
ac61cb1599f215fd9f0927247596796fc53f82bf
|
[
"Apache-2.0"
] | 75
|
2021-06-25T22:11:21.000Z
|
2022-03-30T13:05:38.000Z
|
smacc2_client_library/nav2z_client/custom_planners/undo_path_global_planner/src/undo_path_global_planner/undo_path_global_planner.cpp
|
reelrbtx/SMACC2
|
ac61cb1599f215fd9f0927247596796fc53f82bf
|
[
"Apache-2.0"
] | 14
|
2021-06-16T12:10:57.000Z
|
2022-03-01T18:23:27.000Z
|
// Copyright 2021 RobosoftAI 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.
/*****************************************************************************************************************
*
* Authors: Pablo Inigo Blasco, Brett Aldrich
*
******************************************************************************************************************/
#include <angles/angles.h>
#include <tf2/transform_datatypes.h>
#include <boost/assign.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <geometry_msgs/msg/quaternion.hpp>
#include <nav2z_planners_common/common.hpp>
#include <nav_2d_utils/tf_help.hpp>
#include <pluginlib/class_list_macros.hpp>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#include <undo_path_global_planner/undo_path_global_planner.hpp>
// register this planner as a BaseGlobalPlanner plugin
namespace cl_nav2z
{
namespace undo_path_global_planner
{
using namespace std::chrono_literals;
/**
******************************************************************************************************************
* Constructor()
******************************************************************************************************************
*/
UndoPathGlobalPlanner::UndoPathGlobalPlanner()
{
skip_straight_motion_distance_ = 0.2;
transform_tolerance_ = 0.1;
}
UndoPathGlobalPlanner::~UndoPathGlobalPlanner()
{
// clear "rviz"- publish empty path
nav_msgs::msg::Path planMsg;
planMsg.header.stamp = this->nh_->now();
planPub_->publish(planMsg);
}
void UndoPathGlobalPlanner::cleanup() { this->clearGoalMarker(); }
void UndoPathGlobalPlanner::activate()
{
RCLCPP_INFO_STREAM(nh_->get_logger(), "activating planner UndoPathGlobalPlanner");
planPub_->on_activate();
markersPub_->on_activate();
}
void UndoPathGlobalPlanner::deactivate()
{
RCLCPP_INFO_STREAM(nh_->get_logger(), "deactivating planner UndoPathGlobalPlanner");
this->clearGoalMarker();
planPub_->on_deactivate();
markersPub_->on_deactivate();
}
/**
******************************************************************************************************************
* initialize()
******************************************************************************************************************
*/
void UndoPathGlobalPlanner::configure(
const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent, std::string name,
std::shared_ptr<tf2_ros::Buffer> tf, std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros)
{
nh_ = parent.lock();
costmap_ros_ = costmap_ros;
tf_ = tf;
name_ = name;
// RCLCPP_WARN_NAMED(nh_->get_logger(), "Backwards", "initializating global planner, costmap address: %ld",
// (long)costmap_ros);
rclcpp::SensorDataQoS qos;
qos.keep_last(2);
forwardPathSub_ = nh_->create_subscription<nav_msgs::msg::Path>(
"odom_tracker_path", qos,
std::bind(&UndoPathGlobalPlanner::onForwardTrailMsg, this, std::placeholders::_1));
planPub_ = nh_->create_publisher<nav_msgs::msg::Path>("undo_path_planner/global_plan", 1);
markersPub_ =
nh_->create_publisher<visualization_msgs::msg::MarkerArray>("undo_path_planner/markers", 1);
declareOrSet(nh_, name_ + ".transform_tolerance", transform_tolerance_);
}
/**
******************************************************************************************************************
* onForwardTrailMsg()
******************************************************************************************************************
*/
void UndoPathGlobalPlanner::onForwardTrailMsg(const nav_msgs::msg::Path::SharedPtr forwardPath)
{
lastForwardPathMsg_ = *forwardPath;
RCLCPP_DEBUG_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] received backward path msg poses ["
<< lastForwardPathMsg_.poses.size() << "]");
}
/**
******************************************************************************************************************
* clearGoalMarker()
******************************************************************************************************************
*/
void UndoPathGlobalPlanner::clearGoalMarker()
{
visualization_msgs::msg::Marker marker;
marker.header.frame_id = this->costmap_ros_->getGlobalFrameID();
marker.header.stamp = nh_->now();
marker.ns = "my_namespace2";
marker.id = 0;
marker.action = visualization_msgs::msg::Marker::DELETEALL;
visualization_msgs::msg::MarkerArray ma;
ma.markers.push_back(marker);
markersPub_->publish(ma);
}
/**
******************************************************************************************************************
* publishGoalMarker()
******************************************************************************************************************
*/
void UndoPathGlobalPlanner::publishGoalMarker(
const geometry_msgs::msg::Pose & pose, double r, double g, double b)
{
double phi = tf2::getYaw(pose.orientation);
visualization_msgs::msg::Marker marker;
marker.header.frame_id = this->costmap_ros_->getGlobalFrameID();
marker.header.stamp = nh_->now();
marker.ns = "my_namespace2";
marker.id = 0;
marker.type = visualization_msgs::msg::Marker::ARROW;
marker.action = visualization_msgs::msg::Marker::ADD;
marker.scale.x = 0.1;
marker.scale.y = 0.3;
marker.scale.z = 0.1;
marker.color.a = 1.0;
marker.color.r = r;
marker.color.g = g;
marker.color.b = b;
marker.lifetime = rclcpp::Duration(0s);
geometry_msgs::msg::Point start, end;
start.x = pose.position.x;
start.y = pose.position.y;
end.x = pose.position.x + 0.5 * cos(phi);
end.y = pose.position.y + 0.5 * sin(phi);
marker.points.push_back(start);
marker.points.push_back(end);
visualization_msgs::msg::MarkerArray ma;
ma.markers.push_back(marker);
markersPub_->publish(ma);
}
/**
******************************************************************************************************************
* defaultBackwardPath()
******************************************************************************************************************
*/
void UndoPathGlobalPlanner::createDefaultUndoPathPlan(
const geometry_msgs::msg::PoseStamped & start, const geometry_msgs::msg::PoseStamped & /*goal*/,
std::vector<geometry_msgs::msg::PoseStamped> & plan)
{
//------------- TRANSFORM TO GLOBAL FRAME PATH ---------------------------
// the forward plan might be recoreded in a different frame of the global (costmap) frame. Transform it.
// transform global plan to the navigation reference frame
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Transforming forward path");
nav_msgs::msg::Path transformedPlan;
rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
for (auto p : lastForwardPathMsg_.poses)
{
geometry_msgs::msg::PoseStamped transformedPose;
p.header.stamp = nh_->now(); // otherwise we can get some time tolerance error
transformedPose.header.stamp = nh_->now();
transformedPose.header.frame_id = costmap_ros_->getGlobalFrameID();
nav_2d_utils::transformPose(tf_, costmap_ros_->getGlobalFrameID(), p, transformedPose, ttol);
transformedPlan.poses.push_back(transformedPose);
}
lastForwardPathMsg_ = transformedPlan;
//---------------------------------------------------------------------------
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] finding goal closest point");
int i = lastForwardPathMsg_.poses.size() - 1;
double linear_mindist = std::numeric_limits<double>::max();
int mindistindex = -1;
double startPoseAngle = tf2::getYaw(start.pose.orientation);
geometry_msgs::msg::Pose startPositionProjected;
// The goal of this code is finding the most convenient initial path pose.
// first, find closest linear point to the current robot position
// we start from the final goal, that is, the beginning of the trajectory
// (since this was the forward motion from the odom tracker)
for (auto & p : transformedPlan.poses /*| boost::adaptors::reversed*/)
{
geometry_msgs::msg::PoseStamped pose = p;
pose.header.frame_id = costmap_ros_->getGlobalFrameID();
double dx = pose.pose.position.x - start.pose.position.x;
double dy = pose.pose.position.y - start.pose.position.y;
double dist = sqrt(dx * dx + dy * dy);
double angleOrientation = tf2::getYaw(pose.pose.orientation);
double angleError = fabs(angles::shortest_angular_distance(angleOrientation, startPoseAngle));
if (dist <= linear_mindist)
{
mindistindex = i;
linear_mindist = dist;
startPositionProjected = pose.pose;
RCLCPP_DEBUG_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] initial start point search, NEWBEST_LINEAR= "
<< i << ". error, linear: " << linear_mindist
<< ", angular: " << angleError);
}
else
{
RCLCPP_DEBUG_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] initial start point search, skipped= "
<< i << ". best linear error: " << linear_mindist
<< ". current error, linear: " << dist << " angular: " << angleError);
}
i--;
}
double const ERROR_DISTANCE_PURE_SPINNING_FACTOR = 1.5;
// Concept of second pass: now we only consider a pure spinning motion in this point. We want to consume some very
// close angular targets, (accepting a larger linear minerror of 1.5 besterror. That is, more or less in the same
// point).
RCLCPP_DEBUG(nh_->get_logger(), "[UndoPathGlobalPlanner] second angular pass");
double angularMinDist = std::numeric_limits<double>::max();
if (mindistindex >= (int)transformedPlan.poses.size())
mindistindex =
transformedPlan.poses.size() -
1; // workaround, something is making a out of bound exception in poses array access
{
if (transformedPlan.poses.size() == 0)
{
RCLCPP_WARN_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Warning possible bug");
}
// ------- FULL FORWARD PASS TO FIND THE STARTING POIINT OF THE FORWARD MOTION ------
RCLCPP_DEBUG_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] second pass loop");
for (int i = mindistindex; i >= 0; i--)
{
// warning this index, i refers to some inverse interpretation from the previous loop,
// (last indexes in this path corresponds to the poses closer to our current position)
RCLCPP_DEBUG_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] " << i << "/" << transformedPlan.poses.size());
auto index = (int)transformedPlan.poses.size() - i - 1;
if (index < 0 || (size_t)index >= transformedPlan.poses.size())
{
RCLCPP_WARN_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] this should not happen. Check implementation.");
break;
}
geometry_msgs::msg::PoseStamped pose =
transformedPlan.poses[transformedPlan.poses.size() - i - 1];
RCLCPP_DEBUG_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] global frame");
pose.header.frame_id = costmap_ros_->getGlobalFrameID();
double dx = pose.pose.position.x - start.pose.position.x;
double dy = pose.pose.position.y - start.pose.position.y;
double dist = sqrt(dx * dx + dy * dy);
if (dist <= linear_mindist * ERROR_DISTANCE_PURE_SPINNING_FACTOR)
{
double angleOrientation = tf2::getYaw(pose.pose.orientation);
double angleError =
fabs(angles::shortest_angular_distance(angleOrientation, startPoseAngle));
if (angleError < angularMinDist)
{
angularMinDist = angleError;
mindistindex = i;
RCLCPP_DEBUG_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] initial start point search (angular update), NEWBEST_ANGULAR= "
<< i << ". error, linear: " << dist << "(" << linear_mindist << ")"
<< ", angular: " << angleError << "(" << angularMinDist << ")");
}
else
{
RCLCPP_DEBUG_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] initial start point search (angular update), skipped= "
<< i << ". error, linear: " << dist << "(" << linear_mindist << ")"
<< ", angular: " << angleError << "(" << angularMinDist << ")");
}
}
else
{
RCLCPP_DEBUG_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] initial start point search (angular update) not in linear "
"range, skipped= "
<< i << " linear error: " << dist << "(" << linear_mindist << ")");
}
}
}
// REVERSE FORWARD PASS
if (mindistindex != -1)
{
// plan.push_back(start);
RCLCPP_WARN_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] Creating the backwards plan from odom tracker path (, "
<< transformedPlan.poses.size() << ") poses");
RCLCPP_WARN_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] closer point to goal i="
<< mindistindex << " (linear min dist " << linear_mindist << ")");
// copy the path at the inverse direction, but only up to the closest point to the goal in the path (for partial undoing)
for (int i = transformedPlan.poses.size() - 1; i >= mindistindex; i--)
{
auto & pose = transformedPlan.poses[i];
rclcpp::Time t(pose.header.stamp);
RCLCPP_INFO_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] adding to plan i = " << i << " stamp:" << t.seconds());
plan.push_back(pose);
}
RCLCPP_WARN_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] refined plan has " << plan.size() << " points");
}
else
{
RCLCPP_ERROR_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner ] undo global plan size: " << plan.size());
}
}
/**
******************************************************************************************************************
* makePlan()
******************************************************************************************************************
*/
nav_msgs::msg::Path UndoPathGlobalPlanner::createPlan(
const geometry_msgs::msg::PoseStamped & start, const geometry_msgs::msg::PoseStamped & goal)
{
// -------------- BASIC CHECKS ---------------------
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Undo global plan start ");
nav_msgs::msg::Path planMsg;
std::vector<geometry_msgs::msg::PoseStamped> & plan = planMsg.poses;
RCLCPP_INFO_STREAM(
nh_->get_logger(),
"[UndoPathGlobalPlanner] last forward path msg size: " << lastForwardPathMsg_.poses.size());
RCLCPP_INFO_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] last forward path frame id: "
<< lastForwardPathMsg_.poses.front().header.frame_id);
RCLCPP_INFO_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] start pose frame id: " << start.header.frame_id);
RCLCPP_INFO_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] goal pose frame id: " << goal.header.frame_id);
if (lastForwardPathMsg_.poses.size() == 0)
{
return planMsg;
}
// ---------- INPUTS ACCOMMODATION -------------------
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Inputs accommodation");
geometry_msgs::msg::PoseStamped transformedStart, transformedGoal;
{
rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
geometry_msgs::msg::PoseStamped pstart = start;
pstart.header.stamp = nh_->now();
nav_2d_utils::transformPose(
tf_, costmap_ros_->getGlobalFrameID(), pstart, transformedStart, ttol);
transformedStart.header.frame_id = costmap_ros_->getGlobalFrameID();
// geometry_msgs::msg::PoseStamped pgoal = goal;
// pgoal.header.stamp = nh_->now();
// nav_2d_utils::transformPose(tf_, costmap_ros_->getGlobalFrameID(), pgoal, transformedGoal, ttol);
// transformedGoal.header.frame_id = costmap_ros_->getGlobalFrameID();
//--------------- FORCE GOAL POSE----------------------------
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Forced goal");
auto forcedGoal =
lastForwardPathMsg_.poses[lastForwardPathMsg_.poses.size() - 1]; // FORCE LAST POSE
forcedGoal.header.stamp = nh_->now();
nav_2d_utils::transformPose(
tf_, costmap_ros_->getGlobalFrameID(), forcedGoal, transformedGoal, ttol);
transformedGoal.header.frame_id = costmap_ros_->getGlobalFrameID();
}
//------------- CREATING GLOBAL PLAN -----------------------------------------------
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Creating undo plan");
this->createDefaultUndoPathPlan(transformedStart, transformedGoal, plan);
planMsg.header.frame_id = this->costmap_ros_->getGlobalFrameID();
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] publishing goal markers");
publishGoalMarker(plan.back().pose, 1.0, 0, 1.0 /*purple color*/);
//-------- CHECKING VALID PLAN ------------------------------------
bool acceptedGlobalPlan = true;
RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] valid plan checking");
auto costmap2d = this->costmap_ros_->getCostmap();
for (auto & p : plan)
{
unsigned int mx, my;
costmap2d->worldToMap(p.pose.position.x, p.pose.position.y, mx, my);
auto cost = costmap2d->getCost(mx, my);
if (cost >= nav2_costmap_2d::INSCRIBED_INFLATED_OBSTACLE)
{
acceptedGlobalPlan = false;
break;
}
}
//-------- PUBLISHING RESULTS ---------------------------------------
RCLCPP_INFO_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] plan publishing. size: " << plan.size());
planPub_->publish(planMsg);
if (!acceptedGlobalPlan)
{
RCLCPP_INFO(
nh_->get_logger(),
"[UndoPathGlobalPlanner] not accepted global plan because of possible collision");
}
RCLCPP_INFO_STREAM(
nh_->get_logger(), "[UndoPathGlobalPlanner] plan publishing. size: " << planMsg.poses.size());
return planMsg;
}
} // namespace undo_path_global_planner
} // namespace cl_nav2z
PLUGINLIB_EXPORT_CLASS(
cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner, nav2_core::GlobalPlanner)
| 39.630021
| 126
| 0.604961
|
reelrbtx
|
773549df2e434fc2536cec9b73b891ef39a6a4b2
| 1,304
|
cpp
|
C++
|
third_party/libunwindstack/tests/fuzz/PeCoffRuntimeFunctionsFuzzer.cpp
|
ioperations/orbit
|
c7935085023cce1abb70ce96dd03339f47a1c826
|
[
"BSD-2-Clause"
] | 716
|
2017-09-22T11:50:40.000Z
|
2020-03-14T21:52:22.000Z
|
third_party/libunwindstack/tests/fuzz/PeCoffRuntimeFunctionsFuzzer.cpp
|
ioperations/orbit
|
c7935085023cce1abb70ce96dd03339f47a1c826
|
[
"BSD-2-Clause"
] | 132
|
2017-09-24T11:48:18.000Z
|
2020-03-17T17:39:45.000Z
|
third_party/libunwindstack/tests/fuzz/PeCoffRuntimeFunctionsFuzzer.cpp
|
ioperations/orbit
|
c7935085023cce1abb70ce96dd03339f47a1c826
|
[
"BSD-2-Clause"
] | 49
|
2017-09-23T10:23:59.000Z
|
2020-03-14T09:27:49.000Z
|
/*
* Copyright 2022 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 <inttypes.h>
#include <cstddef>
#include <memory>
#include <unwindstack/Memory.h>
#include <unwindstack/PeCoffInterface.h>
#include "PeCoffRuntimeFunctions.h"
namespace {
void FuzzPeCoffRuntimeFunctions(const uint8_t* data, size_t size) {
std::shared_ptr<unwindstack::Memory> memory =
unwindstack::Memory::CreateOfflineMemory(data, 0, size);
std::unique_ptr<unwindstack::PeCoffRuntimeFunctions> pe_coff_runtime_functions(
CreatePeCoffRuntimeFunctions(memory.get()));
pe_coff_runtime_functions->Init(0, size);
}
} // namespace
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
FuzzPeCoffRuntimeFunctions(data, size);
return 0;
}
| 33.435897
| 81
| 0.754601
|
ioperations
|
7737132c2c1eab3f31285311dcca89857655145a
| 10,534
|
hh
|
C++
|
dune/gdt/operators/oswald-interpolation.hh
|
pymor/dune-gdt
|
fabc279a79e7362181701866ce26133ec40a05e0
|
[
"BSD-2-Clause"
] | 4
|
2018-10-12T21:46:08.000Z
|
2020-08-01T18:54:02.000Z
|
dune/gdt/operators/oswald-interpolation.hh
|
dune-community/dune-gdt
|
fabc279a79e7362181701866ce26133ec40a05e0
|
[
"BSD-2-Clause"
] | 154
|
2016-02-16T13:50:54.000Z
|
2021-12-13T11:04:29.000Z
|
dune/gdt/operators/oswald-interpolation.hh
|
dune-community/dune-gdt
|
fabc279a79e7362181701866ce26133ec40a05e0
|
[
"BSD-2-Clause"
] | 5
|
2016-03-02T10:11:20.000Z
|
2020-02-08T03:56:24.000Z
|
// This file is part of the dune-gdt project:
// https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2019)
#ifndef DUNE_GDT_OPERATORS_OSWALD_INTERPOLATION_HH
#define DUNE_GDT_OPERATORS_OSWALD_INTERPOLATION_HH
#include <map>
#include <set>
#include <vector>
#include <dune/grid/common/rangegenerators.hh>
#include <dune/xt/common/memory.hh>
#include <dune/xt/grid/boundaryinfo/allneumann.hh>
#include <dune/xt/grid/boundaryinfo/interfaces.hh>
#include <dune/xt/grid/walker.hh>
#include <dune/xt/grid/type_traits.hh>
#include <dune/gdt/discretefunction/default.hh>
#include <dune/gdt/exceptions.hh>
#include <dune/gdt/spaces/h1/continuous-lagrange.hh>
#include <dune/gdt/tools/dirichlet-constraints.hh>
#include "interfaces.hh"
namespace Dune {
namespace GDT {
template <class M,
class AssemblyGridView,
size_t dim = 1,
size_t dim_cols = 1,
class SGV = AssemblyGridView,
class RGV = AssemblyGridView>
class OswaldInterpolationOperator : public OperatorInterface<M, SGV, dim, dim_cols, dim, dim_cols, RGV>
{
static_assert(XT::Grid::is_view<AssemblyGridView>::value, "");
static_assert(dim == 1, "I did not think about this yet, feel free to implement!");
static_assert(dim_cols == 1, "I did not think about this yet, feel free to implement!");
using BaseType = OperatorInterface<M, SGV, dim, dim_cols, dim, dim_cols, RGV>;
using ThisType = OswaldInterpolationOperator;
public:
using typename BaseType::RangeSpaceType;
using typename BaseType::SourceSpaceType;
using typename BaseType::VectorType;
using AGV = AssemblyGridView;
using AssemblyGridViewType = AGV;
using I = XT::Grid::extract_intersection_t<AssemblyGridViewType>;
/**
* \param boundary_info To determine the Dirichlet boundary DoFs on which to set the range to zero.
*/
OswaldInterpolationOperator(AssemblyGridViewType assembly_grid_view,
const SourceSpaceType& src_spc,
const RangeSpaceType& rng_spc,
const XT::Grid::BoundaryInfo<I>& boundary_info)
: assembly_grid_view_(assembly_grid_view)
, source_space_(src_spc)
, range_space_(rng_spc)
, boundary_info_(boundary_info)
, assembled_(false)
, global_DoF_id_to_global_LP_id_map_()
{
DUNE_THROW_IF(!range_space_.is_lagrangian(), Exceptions::operator_error, "This does not make any sense!");
DUNE_THROW_IF(range_space_.continuous(0), Exceptions::operator_error, "This does not make any sense!");
DUNE_THROW_IF(
range_space_.min_polorder() != range_space_.max_polorder(), Exceptions::operator_error, "Not implemented yet!");
}
/**
* Does not set any boundary DoFs to zero.
*/
OswaldInterpolationOperator(const AssemblyGridViewType& assembly_grid_view,
const SourceSpaceType& src_spc,
const RangeSpaceType& rng_spc)
: assembly_grid_view_(assembly_grid_view)
, source_space_(src_spc)
, range_space_(rng_spc)
, boundary_info_(new XT::Grid::AllNeumannBoundaryInfo<I>()) // Anything without Dirichlet
, assembled_(false)
{
DUNE_THROW_IF(!range_space_.is_lagrangian(), Exceptions::operator_error, "This does not make any sense!");
DUNE_THROW_IF(range_space_.continuous(0), Exceptions::operator_error, "This does not make any sense!");
DUNE_THROW_IF(
range_space_.min_polorder() != range_space_.max_polorder(), Exceptions::operator_error, "Not implemented yet!");
}
bool linear() const override final
{
return true;
}
const SourceSpaceType& source_space() const override final
{
return source_space_;
}
const RangeSpaceType& range_space() const override final
{
return range_space_;
}
ThisType& assemble(const bool use_tbb = false) override final
{
if (assembled_)
return *this;
// create conforming space of same order to be used as mapper for the global Lagrange points
const auto order = range_space_.min_polorder();
DUNE_THROW_IF(
range_space_.max_polorder() != order, Exceptions::operator_error, "Not implemented yet for variable orders!");
auto cg_space = make_continuous_lagrange_space(assembly_grid_view_, order);
// determine Dirichlet DoFs
DirichletConstraints<I, decltype(cg_space)> dirichlet_constraints(boundary_info_.access(), cg_space);
auto walker = XT::Grid::make_walker(assembly_grid_view_);
walker.append(dirichlet_constraints);
walker.walk(use_tbb);
boundary_LPs_ = std::move(dirichlet_constraints.dirichlet_DoFs());
global_LP_id_to_global_DoF_id_map_.resize(cg_space.mapper().size());
global_DoF_id_to_global_LP_id_map_.resize(range_space_.mapper().size(), std::numeric_limits<size_t>::max());
DynamicVector<size_t> global_lagrange_point_indices(cg_space.mapper().max_local_size());
DynamicVector<size_t> global_DoF_indices(range_space_.mapper().max_local_size());
// walk the grid
for (auto&& element : elements(assembly_grid_view_)) {
const auto& lagrange_points = cg_space.finite_elements().get(element.type(), order).lagrange_points();
DUNE_THROW_IF(range_space_.finite_elements().get(element.type(), order).lagrange_points().size()
!= lagrange_points.size(),
Exceptions::operator_error,
"This should not happen, the Lagrange points should coincide for Lagrange spaces of same order!\n"
<< "range_space_.finite_element(element.type(), order).lagrange_points().size() = "
<< range_space_.finite_elements().get(element.type(), order).lagrange_points().size()
<< "\nlagrange_points.size() = " << lagrange_points.size());
cg_space.mapper().global_indices(element, global_lagrange_point_indices);
range_space_.mapper().global_indices(element, global_DoF_indices);
for (size_t ii = 0; ii < lagrange_points.size(); ++ii) {
const auto global_LP_id = global_lagrange_point_indices[ii];
const auto global_DoF_id = global_DoF_indices[ii];
global_LP_id_to_global_DoF_id_map_[global_LP_id].insert(global_DoF_id);
global_DoF_id_to_global_LP_id_map_[global_DoF_id] = global_LP_id;
}
}
assembled_ = true;
return *this;
} // ... assemble(...)
using BaseType::apply;
void
apply(const VectorType& source, VectorType& range, const XT::Common::Parameter& /*param*/ = {}) const override final
{
// some checks
DUNE_THROW_IF(!assembled_, Exceptions::operator_error, "You need to call assemble() first!");
DUNE_THROW_IF(!source.valid(), Exceptions::operator_error, "source contains inf or nan!");
DUNE_THROW_IF(!source_space_.contains(source), Exceptions::operator_error, "");
DUNE_THROW_IF(!range_space_.contains(range), Exceptions::operator_error, "");
const auto source_function = make_discrete_function(source_space_, source);
auto local_source = source_function.local_function();
DynamicVector<size_t> global_DoF_indices(range_space_.mapper().max_local_size());
// clear range on those DoFs associated with assembly_grid_view_ individually
// (might only be a subset, range *= 0 would clear too much)
for (const auto& DoF_id : global_DoF_id_to_global_LP_id_map_)
if (DoF_id != std::numeric_limits<size_t>::max())
range[DoF_id] = 0;
// walk the grid to average on all inner Lagrange points
auto range_basis = range_space_.basis().localize();
for (auto&& element : elements(assembly_grid_view_)) {
local_source->bind(element);
range_basis->bind(element);
const auto& lagrange_points = range_basis->finite_element().lagrange_points();
range_space_.mapper().global_indices(element, global_DoF_indices);
DUNE_THROW_IF(global_DoF_indices.size() < lagrange_points.size(),
Exceptions::operator_error,
"This should not happen, the range_space is broken:\n"
<< "global_DoF_indices.size() = " << global_DoF_indices.size() << "\n"
<< "lagrange_points.size() = " << lagrange_points.size());
for (size_t ii = 0; ii < lagrange_points.size(); ++ii) {
const auto& lagrange_point = lagrange_points[ii];
const auto global_DoF_id = global_DoF_indices[ii];
const auto global_LP_id = global_DoF_id_to_global_LP_id_map_.at(global_DoF_id);
const auto& DoFs_per_global_LP = global_LP_id_to_global_DoF_id_map_.at(global_LP_id);
const auto source_value = local_source->evaluate(lagrange_point)[0] / DoFs_per_global_LP.size();
for (const auto& DoF_id : DoFs_per_global_LP) {
range[DoF_id] += source_value;
}
}
}
// set Dirichlet DoFs to zero
for (const auto& global_LP_id : boundary_LPs_)
for (const auto& global_DoF_id : global_LP_id_to_global_DoF_id_map_.at(global_LP_id))
range[global_DoF_id] = 0;
} // ... apply(...)
private:
const AssemblyGridViewType assembly_grid_view_;
const SourceSpaceType& source_space_;
const RangeSpaceType& range_space_;
const XT::Common::ConstStorageProvider<XT::Grid::BoundaryInfo<I>> boundary_info_;
bool assembled_;
std::vector<size_t> global_DoF_id_to_global_LP_id_map_;
std::vector<std::set<size_t>> global_LP_id_to_global_DoF_id_map_;
std::set<size_t> boundary_LPs_;
}; // class OswaldInterpolationOperator
template <class MatrixType, class AssemblyGridView, class SGV, size_t dim, size_t dim_cols, class RGV>
OswaldInterpolationOperator<MatrixType, AssemblyGridView, dim, dim_cols, SGV, RGV> make_oswald_interpolation_operator(
const AssemblyGridView& assembly_grid_view,
const SpaceInterface<SGV, dim, dim_cols>& source_space,
const SpaceInterface<RGV, dim, dim_cols>& range_space,
const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<AssemblyGridView>>& boundary_info)
{
return OswaldInterpolationOperator<MatrixType, AssemblyGridView, dim, dim_cols, SGV, RGV>(
assembly_grid_view, source_space, range_space, boundary_info);
}
} // namespace GDT
} // namespace Dune
#endif // DUNE_GDT_OPERATORS_OSWALD_INTERPOLATION_HH
| 46
| 120
| 0.713499
|
pymor
|
773736cb68535151ce1d93b7e3793323a59a5844
| 1,922
|
cpp
|
C++
|
DICE-Evaluation/ARM/Fuzzing/Firmware/Sources/Guitar-Pedal-MBED/flanger.cpp
|
jeffball55/DICE-DMA-Emulation
|
20db20c020940f0df186ec04bca1d3ec64152286
|
[
"Apache-2.0"
] | null | null | null |
DICE-Evaluation/ARM/Fuzzing/Firmware/Sources/Guitar-Pedal-MBED/flanger.cpp
|
jeffball55/DICE-DMA-Emulation
|
20db20c020940f0df186ec04bca1d3ec64152286
|
[
"Apache-2.0"
] | null | null | null |
DICE-Evaluation/ARM/Fuzzing/Firmware/Sources/Guitar-Pedal-MBED/flanger.cpp
|
jeffball55/DICE-DMA-Emulation
|
20db20c020940f0df186ec04bca1d3ec64152286
|
[
"Apache-2.0"
] | null | null | null |
/*******************FLANGER.C******************************/
#include "delay.h"
#include "flanger.h"
static short samp_freq;
static double var_delay;
static short counter;
static short counter_limit;
static short control;
static short max_delay;
static short min_delay;
static double mix_vol;
static double delay_step;
/*
This is the initialization function, basically
it passes the initialization parameters to the delay block
and initializes the flanger control variables.
*/
void Flanger_init(short effect_rate,short sampling,short maxd,short mind,double fwv,double stepd,double fbv) {
Delay_Init(2,fbv,fwv,1);
samp_freq = sampling;
counter = effect_rate;
control = 1;
var_delay = mind;
//User Parameters
counter_limit = effect_rate;
max_delay = maxd;
min_delay = mind;
mix_vol = 1;
delay_step = stepd;
}
/*This is the flanging process task
that uses the delay task inside*/
double Flanger_process(double xin) {
double yout;
yout = Delay_task(xin);
return yout;
}
/*
This sweep function creates a slow frequency
ramp that will go up and down changing the
delay value at the same time. The counter
variable is a counter of amount of samples that
the function waits before it can change the delay.
*/
void Flanger_sweep(void) {
if (!--counter) {
var_delay+=control*delay_step;
if (var_delay > max_delay) {
control = -1;
}
if (var_delay < min_delay) {
control = 1;
}
Delay_set_delay(var_delay);
counter = counter_limit;
}
}
/*****USAGE EXAMPLE****************************************/
/*#include "Flanger.h"
void main(void) {
double xin;
double yout;
Flanger_init(500,16000,70,2,0.3,1,0.3);
while(1) {
if (new_sample_flag()) {
xin = read_sample();
yout = Flanger_process(0.7*xin);
write_output(yout);
Flanger_sweep();
}
}
}
*/
| 20.446809
| 110
| 0.644641
|
jeffball55
|
773b2c8561ca9e645ba65407cbd46dd92ab164c5
| 1,674
|
cpp
|
C++
|
src/filterbank_test.cpp
|
kernsuite-debian/peasoup
|
d542e0b707d797883d7dacbfce8234d2465068de
|
[
"Apache-2.0"
] | 10
|
2015-10-03T00:17:03.000Z
|
2021-05-09T11:29:24.000Z
|
src/filterbank_test.cpp
|
kernsuite-debian/peasoup
|
d542e0b707d797883d7dacbfce8234d2465068de
|
[
"Apache-2.0"
] | 1
|
2018-03-20T08:37:41.000Z
|
2018-03-20T08:50:01.000Z
|
src/filterbank_test.cpp
|
kernsuite-debian/peasoup
|
d542e0b707d797883d7dacbfce8234d2465068de
|
[
"Apache-2.0"
] | 8
|
2015-10-28T16:01:58.000Z
|
2021-11-03T05:53:41.000Z
|
#include <data_types/filterbank.hpp>
#include <iostream>
#include <stdexcept>
#include <assert.h>
using namespace std;
int main(void){
std::string filename("/lustre/projects/p002_swin/surveys/HTRU/medlat/2009-09-12-01:41:41/11/2009-09-12-01:41:41.fil");
try {
SigprocFilterbank filobj(filename);
} catch (std::runtime_error& e) {
std::cout << e.what() << std::endl;
}
unsigned char* data_ptr;
unsigned int nsamps = 100000;
unsigned int nchans = 1024;
unsigned char nbits = 2;
float fch1 = 1560.0;
float foff = 0.39;
float tsamp = 0.000054;
SigprocFilterbank filobj(data_ptr,nsamps,nchans,nbits,fch1,foff,tsamp);
assert(nsamps==filobj.get_nsamps());
assert(nchans==filobj.get_nchans());
assert(tsamp==filobj.get_tsamp());
assert(nbits==filobj.get_nbits());
assert(foff==filobj.get_foff());
assert(fch1==filobj.get_fch1());
assert(data_ptr==filobj.get_data());
unsigned char* new_data_ptr;
unsigned int new_nsamps = 100000+1;
unsigned int new_nchans = 1024+1;
unsigned char new_nbits = 2+1;
float new_fch1 = 1560.0+1;
float new_foff = 0.39+1;
float new_tsamp = 0.000054+1;
filobj.set_nsamps(new_nsamps);
filobj.set_nchans(new_nchans);
filobj.set_tsamp(new_tsamp);
filobj.set_data(new_data_ptr);
filobj.set_nbits(new_nbits);
filobj.set_foff(new_foff);
filobj.set_fch1(new_fch1);
assert(new_nsamps==filobj.get_nsamps());
assert(new_nchans==filobj.get_nchans());
assert(new_tsamp==filobj.get_tsamp());
assert(new_nbits==filobj.get_nbits());
assert(new_foff==filobj.get_foff());
assert(new_fch1==filobj.get_fch1());
assert(new_data_ptr==filobj.get_data());
return 0;
}
| 27.9
| 120
| 0.708483
|
kernsuite-debian
|
773c7908f97f90cedecdc644de87012e01b10b46
| 2,081
|
cpp
|
C++
|
MMOCoreORB/src/server/zone/objects/tangible/components/droid/DroidContainerComponent.cpp
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 18
|
2017-02-09T15:36:05.000Z
|
2021-12-21T04:22:15.000Z
|
MMOCoreORB/src/server/zone/objects/tangible/components/droid/DroidContainerComponent.cpp
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 61
|
2016-12-30T21:51:10.000Z
|
2021-12-10T20:25:56.000Z
|
MMOCoreORB/src/server/zone/objects/tangible/components/droid/DroidContainerComponent.cpp
|
V-Fib/FlurryClone
|
40e0ca7245ec31b3815eb6459329fd9e70f88936
|
[
"Zlib",
"OpenSSL"
] | 71
|
2017-01-01T05:34:38.000Z
|
2022-03-29T01:04:00.000Z
|
/*
* DroidContainerComponent.cpp
*/
#include "DroidContainerComponent.h"
#include "server/zone/objects/scene/SceneObject.h"
#include "server/zone/objects/creature/CreatureObject.h"
#include "server/zone/objects/creature/ai/DroidObject.h"
#include "server/zone/objects/player/PlayerObject.h"
bool DroidContainerComponent::checkContainerPermission(SceneObject* sceneObject, CreatureObject* creature, uint16 permission) const {
ManagedReference<SceneObject*> p = sceneObject->getParent().get();
if (p == nullptr || !p->isDroidObject()) {
return false;
}
DroidObject* droid = p.castTo<DroidObject*>();
if(droid == nullptr){
return false;
}
if (!creature->getPlayerObject()->isPrivileged() && droid->getLinkedCreature() != creature){
return false;
}
if(permission == ContainerPermissions::MOVEIN){
return true;
}else if (permission == ContainerPermissions::MOVEOUT ){
return true;
} else if ( permission == ContainerPermissions::OPEN ) {
return true;
}
return false;
}
int DroidContainerComponent::canAddObject(SceneObject* sceneObject, SceneObject* object, int containmentType, String& errorDescription) const {
if (object->isContainerObject() && !object->isResourceContainer()) {
errorDescription = "@container_error_message:container12";
return TransferErrorCode::INVALIDTYPE;
}
if (object->isControlDevice() || object->isInstallationObject() || object->isBuildingObject() || object->isCraftingStation()) {
errorDescription = "@container_error_message:container12";
return TransferErrorCode::INVALIDTYPE;
}
if (object->isNoTrade() || object->containsNoTradeObjectRecursive()) {
errorDescription = "@container_error_message:container28";
return TransferErrorCode::CANTADD;
}
ManagedReference<SceneObject*> p = sceneObject->getParent().get();
if (p) {
DroidObject* droid = p.castTo<DroidObject*>();
if (droid) {
if(!object->isASubChildOf(droid->getLinkedCreature().get())) {
errorDescription = "@container_error_message:container14";
return TransferErrorCode::MUSTBEINPLAYERINVENTORY;
}
}
}
return 0;
}
| 31.059701
| 143
| 0.742912
|
V-Fib
|
773f8b212caca61c6dd726e507fda56f90e39318
| 589
|
cpp
|
C++
|
Jarek_przyklady/if_init_raii/if_init_raii.cpp
|
WektorZabrze/ADV_29_11_2018
|
afab03af53cfd47b0cb67c60280259bef2ce1c96
|
[
"MIT"
] | null | null | null |
Jarek_przyklady/if_init_raii/if_init_raii.cpp
|
WektorZabrze/ADV_29_11_2018
|
afab03af53cfd47b0cb67c60280259bef2ce1c96
|
[
"MIT"
] | null | null | null |
Jarek_przyklady/if_init_raii/if_init_raii.cpp
|
WektorZabrze/ADV_29_11_2018
|
afab03af53cfd47b0cb67c60280259bef2ce1c96
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <mutex>
#include <thread>
std::mutex cout_mutex;
void printThreadId(){
bool success = true;
if(std::unique_lock<std::mutex> lck(cout_mutex, std::try_to_lock); lck.owns_lock()){
std::cout <<"Ten napis nie zostal poszatkowany "<< std::this_thread::get_id()<<std::endl;
}else{
success = false;
}
if(!success){
printThreadId();
}
}
int main(){
std::thread Threads[10];
for(int i = 0 ; i < 10 ;++i){
Threads[i] = std::thread(printThreadId);
}
for(int i = 0 ; i < 10 ;++i){
Threads[i].join();
}
return 0;
}
| 18.40625
| 92
| 0.597623
|
WektorZabrze
|
773f8f74951d2c6263fc0bf35317c8c35db15f4c
| 345
|
cpp
|
C++
|
ShaderGLLib/Image.cpp
|
anirul/ShaderGL-Classroom-2
|
f91a354588b09f34f6814e714cad015db2fa51e6
|
[
"MIT"
] | null | null | null |
ShaderGLLib/Image.cpp
|
anirul/ShaderGL-Classroom-2
|
f91a354588b09f34f6814e714cad015db2fa51e6
|
[
"MIT"
] | null | null | null |
ShaderGLLib/Image.cpp
|
anirul/ShaderGL-Classroom-2
|
f91a354588b09f34f6814e714cad015db2fa51e6
|
[
"MIT"
] | null | null | null |
#include "Image.h"
#include <algorithm>
#include <fstream>
#include <vector>
#include <tuple>
#include <assert.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
namespace sgl {
Image::Image(const std::string& file)
{
#pragma message("Fill me up!")
}
Image::~Image()
{
#pragma message("Fill me up!")
}
} // End namespace sgl.
| 14.375
| 38
| 0.684058
|
anirul
|
7745e6dfb999aacc259f50033d856d2aded7d28a
| 8,454
|
cc
|
C++
|
content/common/gpu/media/vt_video_decode_accelerator.cc
|
aranajhonny/chromium
|
caf5bcb822f79b8997720e589334266551a50a13
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1
|
2019-01-16T03:57:39.000Z
|
2019-01-16T03:57:39.000Z
|
content/common/gpu/media/vt_video_decode_accelerator.cc
|
aranajhonny/chromium
|
caf5bcb822f79b8997720e589334266551a50a13
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1
|
2018-02-10T21:00:08.000Z
|
2018-03-20T05:09:50.000Z
|
content/common/gpu/media/vt_video_decode_accelerator.cc
|
aranajhonny/chromium
|
caf5bcb822f79b8997720e589334266551a50a13
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
// Copyright 2014 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 <CoreVideo/CoreVideo.h>
#include <OpenGL/CGLIOSurface.h>
#include "base/bind.h"
#include "base/thread_task_runner_handle.h"
#include "content/common/gpu/media/vt_video_decode_accelerator.h"
#include "media/filters/h264_parser.h"
using content_common_gpu_media::kModuleVt;
using content_common_gpu_media::InitializeStubs;
using content_common_gpu_media::IsVtInitialized;
using content_common_gpu_media::StubPathMap;
namespace content {
// Size of length headers prepended to NALUs in MPEG-4 framing. (1, 2, or 4.)
static const int kNALUHeaderLength = 4;
// Route decoded frame callbacks back into the VTVideoDecodeAccelerator.
static void OutputThunk(
void* decompression_output_refcon,
void* source_frame_refcon,
OSStatus status,
VTDecodeInfoFlags info_flags,
CVImageBufferRef image_buffer,
CMTime presentation_time_stamp,
CMTime presentation_duration) {
VTVideoDecodeAccelerator* vda =
reinterpret_cast<VTVideoDecodeAccelerator*>(decompression_output_refcon);
int32_t* bitstream_id_ptr = reinterpret_cast<int32_t*>(source_frame_refcon);
int32_t bitstream_id = *bitstream_id_ptr;
delete bitstream_id_ptr;
CFRetain(image_buffer);
vda->Output(bitstream_id, status, info_flags, image_buffer);
}
VTVideoDecodeAccelerator::VTVideoDecodeAccelerator(CGLContextObj cgl_context)
: cgl_context_(cgl_context),
client_(NULL),
decoder_thread_("VTDecoderThread"),
format_(NULL),
session_(NULL),
weak_this_factory_(this) {
callback_.decompressionOutputCallback = OutputThunk;
callback_.decompressionOutputRefCon = this;
}
VTVideoDecodeAccelerator::~VTVideoDecodeAccelerator() {
}
bool VTVideoDecodeAccelerator::Initialize(
media::VideoCodecProfile profile,
Client* client) {
DCHECK(CalledOnValidThread());
client_ = client;
// Only H.264 is supported.
if (profile < media::H264PROFILE_MIN || profile > media::H264PROFILE_MAX)
return false;
// TODO(sandersd): Move VideoToolbox library loading to sandbox startup;
// until then, --no-sandbox is required.
if (!IsVtInitialized()) {
StubPathMap paths;
// CoreVideo is also required, but the loader stops after the first
// path is loaded. Instead we rely on the transitive dependency from
// VideoToolbox to CoreVideo.
// TODO(sandersd): Fallback to PrivateFrameworks for VideoToolbox.
paths[kModuleVt].push_back(FILE_PATH_LITERAL(
"/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox"));
if (!InitializeStubs(paths))
return false;
}
// Spawn a thread to handle parsing and calling VideoToolbox.
if (!decoder_thread_.Start())
return false;
// Note that --ignore-gpu-blacklist is still required to get here.
return true;
}
// TODO(sandersd): Proper error reporting instead of CHECKs.
void VTVideoDecodeAccelerator::ConfigureDecoder(
const std::vector<const uint8_t*>& nalu_data_ptrs,
const std::vector<size_t>& nalu_data_sizes) {
format_.reset();
CHECK(!CMVideoFormatDescriptionCreateFromH264ParameterSets(
kCFAllocatorDefault,
nalu_data_ptrs.size(), // parameter_set_count
&nalu_data_ptrs.front(), // ¶meter_set_pointers
&nalu_data_sizes.front(), // ¶meter_set_sizes
kNALUHeaderLength, // nal_unit_header_length
format_.InitializeInto()
));
// TODO(sandersd): Check if the size has changed and handle picture requests.
CMVideoDimensions coded_size = CMVideoFormatDescriptionGetDimensions(format_);
coded_size_.SetSize(coded_size.width, coded_size.height);
base::ScopedCFTypeRef<CFMutableDictionaryRef> decoder_config(
CFDictionaryCreateMutable(
kCFAllocatorDefault,
1, // capacity
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
CFDictionarySetValue(
decoder_config,
// kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder
CFSTR("EnableHardwareAcceleratedVideoDecoder"),
kCFBooleanTrue);
base::ScopedCFTypeRef<CFMutableDictionaryRef> image_config(
CFDictionaryCreateMutable(
kCFAllocatorDefault,
4, // capacity
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
// TODO(sandersd): ARGB for video that is not 4:2:0.
int32_t pixel_format = '2vuy';
#define CFINT(i) CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &i)
base::ScopedCFTypeRef<CFNumberRef> cf_pixel_format(CFINT(pixel_format));
base::ScopedCFTypeRef<CFNumberRef> cf_width(CFINT(coded_size.width));
base::ScopedCFTypeRef<CFNumberRef> cf_height(CFINT(coded_size.height));
#undef CFINT
CFDictionarySetValue(
image_config, kCVPixelBufferPixelFormatTypeKey, cf_pixel_format);
CFDictionarySetValue(image_config, kCVPixelBufferWidthKey, cf_width);
CFDictionarySetValue(image_config, kCVPixelBufferHeightKey, cf_height);
CFDictionarySetValue(
image_config, kCVPixelBufferOpenGLCompatibilityKey, kCFBooleanTrue);
// TODO(sandersd): Skip if the session is compatible.
// TODO(sandersd): Flush frames when resetting.
session_.reset();
CHECK(!VTDecompressionSessionCreate(
kCFAllocatorDefault,
format_, // video_format_description
decoder_config, // video_decoder_specification
image_config, // destination_image_buffer_attributes
&callback_, // output_callback
session_.InitializeInto()
));
DVLOG(2) << "Created VTDecompressionSession";
}
void VTVideoDecodeAccelerator::Decode(const media::BitstreamBuffer& bitstream) {
DCHECK(CalledOnValidThread());
decoder_thread_.message_loop_proxy()->PostTask(FROM_HERE, base::Bind(
&VTVideoDecodeAccelerator::DecodeTask, base::Unretained(this),
bitstream));
}
void VTVideoDecodeAccelerator::DecodeTask(
const media::BitstreamBuffer bitstream) {
DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread());
// Map the bitstream buffer.
base::SharedMemory memory(bitstream.handle(), true);
size_t size = bitstream.size();
CHECK(memory.Map(size));
const uint8_t* buf = static_cast<uint8_t*>(memory.memory());
// Locate relevant NALUs in the buffer.
size_t data_size = 0;
std::vector<media::H264NALU> nalus;
std::vector<const uint8_t*> config_nalu_data_ptrs;
std::vector<size_t> config_nalu_data_sizes;
parser_.SetStream(buf, size);
media::H264NALU nalu;
while (true) {
media::H264Parser::Result result = parser_.AdvanceToNextNALU(&nalu);
if (result == media::H264Parser::kEOStream)
break;
CHECK_EQ(result, media::H264Parser::kOk);
if (nalu.nal_unit_type == media::H264NALU::kSPS ||
nalu.nal_unit_type == media::H264NALU::kPPS ||
nalu.nal_unit_type == media::H264NALU::kSPSExt) {
config_nalu_data_ptrs.push_back(nalu.data);
config_nalu_data_sizes.push_back(nalu.size);
}
nalus.push_back(nalu);
// Each NALU will have a 4-byte length header prepended.
data_size += kNALUHeaderLength + nalu.size;
}
if (!config_nalu_data_ptrs.empty())
ConfigureDecoder(config_nalu_data_ptrs, config_nalu_data_sizes);
// TODO(sandersd): Rewrite slice NALU headers and send for decoding.
}
// This method may be called on any VideoToolbox thread.
void VTVideoDecodeAccelerator::Output(
int32_t bitstream_id,
OSStatus status,
VTDecodeInfoFlags info_flags,
CVImageBufferRef image_buffer) {
// TODO(sandersd): Store the frame in a queue.
CFRelease(image_buffer);
}
void VTVideoDecodeAccelerator::AssignPictureBuffers(
const std::vector<media::PictureBuffer>& pictures) {
DCHECK(CalledOnValidThread());
}
void VTVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_id) {
DCHECK(CalledOnValidThread());
}
void VTVideoDecodeAccelerator::Flush() {
DCHECK(CalledOnValidThread());
// TODO(sandersd): Trigger flush, sending frames.
}
void VTVideoDecodeAccelerator::Reset() {
DCHECK(CalledOnValidThread());
// TODO(sandersd): Trigger flush, discarding frames.
}
void VTVideoDecodeAccelerator::Destroy() {
DCHECK(CalledOnValidThread());
// TODO(sandersd): Trigger flush, discarding frames, and wait for them.
delete this;
}
bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() {
return false;
}
} // namespace content
| 35.372385
| 80
| 0.746747
|
aranajhonny
|
7749b720d095b17c3c61eb5e094b823743fe34c8
| 4,695
|
cpp
|
C++
|
sources/Elements/CPS4.cpp
|
podgorskiy/TinyFEM
|
c1a5fedf21e6306fc11fa19afdaf48dab1b6740f
|
[
"MIT"
] | 4
|
2017-11-05T14:01:04.000Z
|
2019-12-11T15:24:54.000Z
|
sources/Elements/CPS4.cpp
|
podgorskiy/TinyFEM
|
c1a5fedf21e6306fc11fa19afdaf48dab1b6740f
|
[
"MIT"
] | null | null | null |
sources/Elements/CPS4.cpp
|
podgorskiy/TinyFEM
|
c1a5fedf21e6306fc11fa19afdaf48dab1b6740f
|
[
"MIT"
] | null | null | null |
#include "Common.h"
#include "CPS4.h"
#include "PropertiesHolder/PropertiesHolder.h"
#include "Material.h"
#include <Eigen/Dense>
#include "GaussQuadrature.h"
Eigen::Matrix<float, 4, 4> CPS4::m_C;
Eigen::Matrix<float, 4, 4> CPS4::m_IC;
float XI[4] = { -1.0, 1.0, 1.0, -1.0 };
float ETA[4] = { -1.0, -1.0, 1.0, 1.0 };
void CPS4::Init()
{
//x0: -1; x1: 1; x2: 1; x3: -1
//y0: -1; y1: -1; y2: 1; y3: 1
m_C << Eigen::Vector4f(1.0, 1.0, 1.0, 1.0),
Eigen::Vector4f(XI[0], XI[1], XI[2], XI[3]), // x0, x1, x2, x3
Eigen::Vector4f(ETA[0], ETA[1], ETA[2], ETA[3]), // y0, y1, y2, y3
Eigen::Vector4f(XI[0] * ETA[0], XI[1] * ETA[1], XI[2] * ETA[2], XI[3] * ETA[3]); // x0y0, x1y1, x2y2, x3y3
m_IC = m_C.inverse();
}
void CPS4::SetIndices(const std::vector<int>& indices)
{
assert(indices.size() == 4);
m_nodes[0] = indices[0];
m_nodes[1] = indices[1];
m_nodes[2] = indices[2];
m_nodes[3] = indices[3];
}
std::vector<int> CPS4::GetIndices() const
{
std::vector<int> indices(4);
indices[0] = m_nodes[0];
indices[1] = m_nodes[1];
indices[2] = m_nodes[2];
indices[3] = m_nodes[3];
return indices;
}
std::vector<Eigen::Vector3f> CPS4::GetFunctionValuesAtNodes(const Eigen::VectorXf& deforms)const
{
Eigen::Matrix<float, 8, 1> uv;
std::vector<Eigen::Vector3f> output;
for (int i = 0; i < 4; ++i)
{
uv[2 * i + 0] = deforms[2 * m_nodes[i] + 0];
uv[2 * i + 1] = deforms[2 * m_nodes[i] + 1];
}
for (int i = 0; i < 4; i++)
{
Eigen::Matrix<float, 3, 8> B = GetB(XI[i], ETA[i] );
Eigen::Vector3f strain = B * uv;
output.push_back(strain);
}
return output;
}
void CPS4::CalcK(const StrideDataArray& nodes, const tfem::MaterialPtr mat, std::vector<Eigen::Triplet<float> >& tripletVector)
{
m_mat = mat;
Eigen::Vector4f X;
Eigen::Vector4f Y;
for (int i = 0; i < 4; ++i)
{
X[i] = nodes(m_nodes[i], 0);
Y[i] = nodes(m_nodes[i], 1);
}
m_KX = m_IC * X;
m_KY = m_IC * Y;
float area = 0;
Eigen::Matrix<float, 8, 8> K;
K.setZero();
float xi, eta, w1, w2;
for (int i = 0; GaussQuadrature::GetWeights<2>(i, xi, w1); i++)
{
for (int j = 0; GaussQuadrature::GetWeights<2>(j, eta, w2); j++)
{
float w = w1 * w2;
Eigen::Matrix<float, 2, 2> J = GetJ(xi, eta);
Eigen::Matrix<float, 3, 8> B = GetB(xi, eta);
K += B.transpose() * mat->GetElasticityMatrix(fem::PT_FlatStress) * B * J.determinant() * w;
area += J.determinant() * w;
}
}
GrabTriplets(K, tripletVector);
}
void CPS4::GrabTriplets(const Eigen::Matrix<float, 8, 8>& K, std::vector<Eigen::Triplet<float> >& tripletVector) const
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
Eigen::Triplet<float> trplt11(2 * m_nodes[i] + 0, 2 * m_nodes[j] + 0, K(2 * i + 0, 2 * j + 0));
Eigen::Triplet<float> trplt12(2 * m_nodes[i] + 0, 2 * m_nodes[j] + 1, K(2 * i + 0, 2 * j + 1));
Eigen::Triplet<float> trplt21(2 * m_nodes[i] + 1, 2 * m_nodes[j] + 0, K(2 * i + 1, 2 * j + 0));
Eigen::Triplet<float> trplt22(2 * m_nodes[i] + 1, 2 * m_nodes[j] + 1, K(2 * i + 1, 2 * j + 1));
tripletVector.push_back(trplt11);
tripletVector.push_back(trplt12);
tripletVector.push_back(trplt21);
tripletVector.push_back(trplt22);
}
}
}
tfem::Material* CPS4::GetMaterial()
{
return m_mat.get();
}
IElement* CPS4::Create()
{
return new CPS4;
}
CPS4::CPS4()
{
}
Eigen::Matrix<float, 1, 4> CPS4::GetP(float xi, float eta) const
{
return Eigen::Matrix<float, 1, 4>(1, xi, eta, xi * eta);
}
Eigen::Matrix<float, 1, 4> CPS4::GetdPdxi(float xi, float eta) const
{
return Eigen::Matrix<float, 1, 4>(0, 1, 0, eta);
}
Eigen::Matrix<float, 1, 4> CPS4::GetdPdeta(float xi, float eta) const
{
return Eigen::Matrix<float, 1, 4>(0, 0, 1, xi);
}
Eigen::Matrix<float, 2, 2> CPS4::GetJ(float xi, float eta) const
{
float dxdxi = GetdPdxi(xi, eta) * m_KX;
float dydxi = GetdPdxi(xi, eta) * m_KY;
float dxdeta = GetdPdeta(xi, eta) * m_KX;
float dydeta = GetdPdeta(xi, eta) * m_KY;
Eigen::Matrix<float, 2, 2> result;
result << dxdxi, dydxi, dxdeta, dydeta;
return result;
}
Eigen::Matrix<float, 3, 8> CPS4::GetB(float xi, float eta) const
{
Eigen::Matrix<float, 3, 8> B;
Eigen::Matrix<float, 2, 2> J = GetJ(xi, eta);
Eigen::Matrix<float, 2, 2> IJ = J.inverse();
Eigen::Matrix<float, 1, 4> dNdxi = GetdPdxi(xi, eta) * m_IC;
Eigen::Matrix<float, 1, 4> dNdeta = GetdPdeta(xi, eta) * m_IC;
for (int k = 0; k < 4; ++k)
{
Eigen::Matrix<float, 2, 1> dNkdxieta(dNdxi[k], dNdeta[k]);
Eigen::Matrix<float, 2, 1> dNkdxy = IJ * dNkdxieta;
B(0, 2 * k + 0) = dNkdxy[0];
B(0, 2 * k + 1) = 0;
B(1, 2 * k + 0) = 0;
B(1, 2 * k + 1) = dNkdxy[1];
B(2, 2 * k + 0) = dNkdxy[1];
B(2, 2 * k + 1) = dNkdxy[0];
}
return B;
}
| 25.796703
| 127
| 0.589563
|
podgorskiy
|
774a459c11c5b4c69570340ea964d268e3db13b4
| 42,725
|
cpp
|
C++
|
src/caffe/test/test_gauss_convolution_layer.cpp
|
skokec/caffe
|
f6fd2961b9aa63d818212ee2490620fe0e703cc6
|
[
"BSD-2-Clause"
] | 1
|
2021-05-16T08:35:43.000Z
|
2021-05-16T08:35:43.000Z
|
src/caffe/test/test_gauss_convolution_layer.cpp
|
skokec/caffe
|
f6fd2961b9aa63d818212ee2490620fe0e703cc6
|
[
"BSD-2-Clause"
] | null | null | null |
src/caffe/test/test_gauss_convolution_layer.cpp
|
skokec/caffe
|
f6fd2961b9aa63d818212ee2490620fe0e703cc6
|
[
"BSD-2-Clause"
] | null | null | null |
#include <boost/smart_ptr/shared_ptr.hpp>
#include <caffe/blob.hpp>
#include <caffe/common.hpp>
#include <caffe/filler.hpp>
#include <caffe/layers/gauss_conv_layer.hpp>
#include <caffe/proto/caffe.pb.h>
#include <caffe/test/test_caffe_main.hpp>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <vector>
namespace caffe {
template <typename Dtype>
void compare_blobs(Blob<Dtype>& a, Blob<Dtype>& b, bool compare_diff, Dtype eps) {
Dtype* data_a = compare_diff ? a.mutable_cpu_diff() : a.mutable_cpu_data();
Dtype* data_b = compare_diff ? b.mutable_cpu_diff() : b.mutable_cpu_data();
for (int i = 0; i < a.count(); ++i) {
EXPECT_NEAR(data_a[i], data_b[i], eps);
}
}
// Reference convolution for checking results:
// accumulate through explicit loops over input, output, and filters.
template <typename Dtype>
void caffe_conv(const Blob<Dtype>* in, ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<Dtype> > >& weights,
Blob<Dtype>* out) {
const bool has_depth = (out->num_axes() == 5);
if (!has_depth) { CHECK_EQ(4, out->num_axes()); }
// Kernel size, stride, and pad
int kernel_h, kernel_w;
if (conv_param->has_kernel_h() || conv_param->has_kernel_w()) {
kernel_h = conv_param->kernel_h();
kernel_w = conv_param->kernel_w();
} else {
kernel_h = kernel_w = conv_param->kernel_size(0);
}
int pad_h, pad_w;
if (conv_param->has_pad_h() || conv_param->has_pad_w()) {
pad_h = conv_param->pad_h();
pad_w = conv_param->pad_w();
} else {
pad_h = pad_w = conv_param->pad_size() ? conv_param->pad(0) : 0;
}
int stride_h, stride_w;
if (conv_param->has_stride_h() || conv_param->has_stride_w()) {
stride_h = conv_param->stride_h();
stride_w = conv_param->stride_w();
} else {
stride_h = stride_w = conv_param->stride_size() ? conv_param->stride(0) : 1;
}
int kernel_d, pad_d, stride_d;
if (has_depth) {
kernel_d = kernel_h;
stride_d = stride_h;
pad_d = pad_h;
} else {
kernel_d = stride_d = 1;
pad_d = 0;
}
// Groups
int groups = conv_param->group();
int o_g = out->shape(1) / groups;
int k_g = in->shape(1) / groups;
int o_head, k_head;
// Convolution
vector<int> weight_offset(4 + has_depth);
vector<int> in_offset(4 + has_depth);
vector<int> out_offset(4 + has_depth);
Dtype* out_data = out->mutable_cpu_data();
for (int n = 0; n < out->shape(0); n++) {
for (int g = 0; g < groups; g++) {
o_head = o_g * g;
k_head = k_g * g;
for (int o = 0; o < o_g; o++) {
for (int k = 0; k < k_g; k++) {
for (int z = 0; z < (has_depth ? out->shape(2) : 1); z++) {
for (int y = 0; y < out->shape(2 + has_depth); y++) {
for (int x = 0; x < out->shape(3 + has_depth); x++) {
for (int r = 0; r < kernel_d; r++) {
for (int p = 0; p < kernel_h; p++) {
for (int q = 0; q < kernel_w; q++) {
int in_z = z * stride_d - pad_d + r;
int in_y = y * stride_h - pad_h + p;
int in_x = x * stride_w - pad_w + q;
if (in_z >= 0 && in_z < (has_depth ? in->shape(2) : 1)
&& in_y >= 0 && in_y < in->shape(2 + has_depth)
&& in_x >= 0 && in_x < in->shape(3 + has_depth)) {
weight_offset[0] = o + o_head;
weight_offset[1] = k;
if (has_depth) { weight_offset[2] = r; }
weight_offset[2 + has_depth] = p;
weight_offset[3 + has_depth] = q;
in_offset[0] = n;
in_offset[1] = k + k_head;
if (has_depth) { in_offset[2] = in_z; }
in_offset[2 + has_depth] = in_y;
in_offset[3 + has_depth] = in_x;
out_offset[0] = n;
out_offset[1] = o + o_head;
if (has_depth) { out_offset[2] = z; }
out_offset[2 + has_depth] = y;
out_offset[3 + has_depth] = x;
out_data[out->offset(out_offset)] +=
in->data_at(in_offset)
* weights[0]->data_at(weight_offset);
}
}
}
}
}
}
}
}
}
}
}
// Bias
if (conv_param->bias_term()) {
const Dtype* bias_data = weights[1]->cpu_data();
for (int n = 0; n < out->shape(0); n++) {
for (int o = 0; o < out->shape(1); o++) {
for (int z = 0; z < (has_depth ? out->shape(2) : 1); z++) {
for (int y = 0; y < out->shape(2 + has_depth); y++) {
for (int x = 0; x < out->shape(3 + has_depth); x++) {
out_offset[0] = n;
out_offset[1] = o;
if (has_depth) { out_offset[2] = z; }
out_offset[2 + has_depth] = y;
out_offset[3 + has_depth] = x;
out_data[out->offset(out_offset)] += bias_data[o];
}
}
}
}
}
}
}
template void caffe_conv(const Blob<float>* in,
ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<float> > >& weights,
Blob<float>* out);
template void caffe_conv(const Blob<double>* in,
ConvolutionParameter* conv_param,
const vector<shared_ptr<Blob<double> > >& weights,
Blob<double>* out);
template <typename TypeParam>
class GaussConvolutionLayerTest : public MultiDeviceTest<TypeParam> {
typedef typename TypeParam::Dtype Dtype;
protected:
GaussConvolutionLayerTest()
: blob_bottom_(new Blob<Dtype>(2, 3, 6, 4)),
blob_bottom_2_(new Blob<Dtype>(2, 3, 6, 4)),
blob_bottom_3_(new Blob<Dtype>(1, 1, 4, 4)),
//blob_bottom_3_(new Blob<Dtype>(2, 3, 32, 48)),
blob_top_(new Blob<Dtype>()),
blob_top_2_(new Blob<Dtype>()),
blob_top_3_(new Blob<Dtype>()) {}
virtual void SetUp() {
// fill the values
FillerParameter filler_param;
filler_param.set_value(1.);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(this->blob_bottom_);
filler.Fill(this->blob_bottom_2_);
filler.Fill(this->blob_bottom_3_);
blob_bottom_vec_.push_back(blob_bottom_);
blob_top_vec_.push_back(blob_top_);
}
virtual ~GaussConvolutionLayerTest() {
delete blob_bottom_;
delete blob_bottom_2_;
delete blob_bottom_3_;
delete blob_top_;
delete blob_top_2_;
delete blob_top_3_;
}
virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) {
this->ref_blob_top_.reset(new Blob<Dtype>());
this->ref_blob_top_->ReshapeLike(*top);
return this->ref_blob_top_.get();
}
Blob<Dtype>* const blob_bottom_;
Blob<Dtype>* const blob_bottom_2_;
Blob<Dtype>* const blob_bottom_3_;
Blob<Dtype>* const blob_top_;
Blob<Dtype>* const blob_top_2_;
Blob<Dtype>* const blob_top_3_;
shared_ptr<Blob<Dtype> > ref_blob_top_;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
};
TYPED_TEST_CASE(GaussConvolutionLayerTest, TestDtypesAndDevices);
TYPED_TEST(GaussConvolutionLayerTest, TestSetup) {
/*typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(4);
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
shared_ptr<Layer<Dtype> > layer(
new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 4);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 4);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);
// setting group should not change the shape
convolution_param->set_num_output(3);
convolution_param->set_group(3);
layer.reset(new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(this->blob_top_->num(), 2);
EXPECT_EQ(this->blob_top_->channels(), 3);
EXPECT_EQ(this->blob_top_->height(), 2);
EXPECT_EQ(this->blob_top_->width(), 1);
EXPECT_EQ(this->blob_top_2_->num(), 2);
EXPECT_EQ(this->blob_top_2_->channels(), 3);
EXPECT_EQ(this->blob_top_2_->height(), 2);
EXPECT_EQ(this->blob_top_2_->width(), 1);*/
}
/*
TYPED_TEST(GaussConvolutionLayerTest, TestSimpleConvolution) {
typedef typename TypeParam::Dtype Dtype;
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(7);
convolution_param->add_stride(1);
convolution_param->add_pad(3);
convolution_param->set_number_gauss(2);
convolution_param->set_num_output(16);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_weight_filler()->set_std(0.01);
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
convolution_param->mutable_sigma_filler()->set_type("constant");
convolution_param->mutable_sigma_filler()->set_value(0.8);
convolution_param->set_gmm_component_border_bound(1.5);
convolution_param->set_gmm_sigma_lower_bound(0.5);
convolution_param->set_gmm_weight_normalization(false);
convolution_param->set_gmm_gauss_normalization(true);
convolution_param->set_gmm_square_gauss_normalization(true);
shared_ptr<Layer<Dtype> > layer(
new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
caffe_conv(this->blob_bottom_2_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_2_));
top_data = this->blob_top_2_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
*/
TYPED_TEST(GaussConvolutionLayerTest, TestKernelPrecompute) {
typedef typename TypeParam::Dtype Dtype;
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(7);
convolution_param->add_stride(1);
convolution_param->add_pad(3);
convolution_param->set_number_gauss(2);
convolution_param->set_num_output(32);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_weight_filler()->set_std(0.01);
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
convolution_param->mutable_sigma_filler()->set_type("constant");
convolution_param->mutable_sigma_filler()->set_value(0.8);
convolution_param->set_gmm_component_border_bound(1.5);
convolution_param->set_gmm_sigma_lower_bound(0.5);
convolution_param->set_gmm_weight_normalization(false);
convolution_param->set_gmm_gauss_normalization(true);
for (int gmm_sqrt_norm = 0; gmm_sqrt_norm <= 1; gmm_sqrt_norm++) {
convolution_param->set_gmm_square_gauss_normalization((bool)gmm_sqrt_norm);
shared_ptr<GaussianConvLayer<Dtype> > layer(new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
// RUN CPU version
layer->precompute_guassian_weights(true); // run CPU first since it will force buffers to cpu and would cause errors if gpu would be allocated first
// store output
Blob<Dtype> weight_cpu, deriv_error_cpu, deriv_weight_cpu, deriv_mu1_cpu, deriv_mu2_cpu, deriv_sigma_cpu;
weight_cpu.CopyFrom(*layer->weight_buffer_, false, true);
deriv_error_cpu.CopyFrom(*layer->deriv_error_buffer_, false, true);
deriv_weight_cpu.CopyFrom(*layer->deriv_weight_buffer_, false, true);
deriv_mu1_cpu.CopyFrom(*layer->deriv_mu1_buffer_, false, true);
deriv_mu2_cpu.CopyFrom(*layer->deriv_mu2_buffer_, false, true);
deriv_sigma_cpu.CopyFrom(*layer->deriv_sigma_buffer_, false, true);
// RUN CPU version
layer->precompute_guassian_weights_gpu(true);
// Check both versions
Dtype* data_gpu;
Dtype* data_cpu;
data_cpu = weight_cpu.mutable_cpu_data();
data_gpu = layer->weight_buffer_->mutable_cpu_data();
for (int i = 0; i < weight_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
data_cpu = deriv_error_cpu.mutable_cpu_data();
data_gpu = layer->deriv_error_buffer_->mutable_cpu_data();
for (int i = 0; i < deriv_error_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
data_cpu = deriv_weight_cpu.mutable_cpu_data();
data_gpu = layer->deriv_weight_buffer_->mutable_cpu_data();
for (int i = 0; i < deriv_weight_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
data_cpu = deriv_mu1_cpu.mutable_cpu_data();
data_gpu = layer->deriv_mu1_buffer_->mutable_cpu_data();
for (int i = 0; i < deriv_mu1_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
data_cpu = deriv_mu2_cpu.mutable_cpu_data();
data_gpu = layer->deriv_mu2_buffer_->mutable_cpu_data();
for (int i = 0; i < deriv_mu2_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
data_cpu = deriv_sigma_cpu.mutable_cpu_data();
data_gpu = layer->deriv_sigma_buffer_->mutable_cpu_data();
for (int i = 0; i < deriv_sigma_cpu.count(); ++i) { EXPECT_NEAR(data_gpu[i], data_cpu[i], 1e-4); }
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestSeperableConvolution) {
if (Caffe::mode() == Caffe::GPU)
return;
typedef typename TypeParam::Dtype Dtype;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
blob_bottom_vec_.push_back(this->blob_bottom_3_);
blob_top_vec_.push_back(this->blob_top_3_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(7);
convolution_param->add_stride(1);
convolution_param->add_pad(3);
convolution_param->set_number_gauss(2);
convolution_param->set_num_output(16);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_weight_filler()->set_std(0.01);
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
convolution_param->mutable_sigma_filler()->set_type("constant");
convolution_param->mutable_sigma_filler()->set_value(0.8);
convolution_param->set_gmm_component_border_bound(1.5);
convolution_param->set_gmm_sigma_lower_bound(0.5);
convolution_param->set_gmm_weight_normalization(false);
convolution_param->set_gmm_gauss_normalization(true);
for (int gmm_sqrt_norm = 0; gmm_sqrt_norm < 1; gmm_sqrt_norm++) {
convolution_param->set_gmm_square_gauss_normalization((bool)gmm_sqrt_norm);
convolution_param->set_gmm_seperable_forward_pass(false);
shared_ptr<GaussianConvLayer<Dtype> > layer(new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(blob_bottom_vec_, blob_top_vec_);
// RUN non-seperable
layer->Forward(blob_bottom_vec_, blob_top_vec_);
// store output
Blob<Dtype> top_org;
top_org.CopyFrom(*blob_top_vec_[0], false, true);
layer->use_gmm_seperable_kernels = true;
// RUN seperable version
layer->Forward(blob_bottom_vec_, blob_top_vec_);
// Check both versions
Dtype* data_non_sep = top_org.mutable_cpu_data();
Dtype* data_sep = blob_top_vec_[0]->mutable_cpu_data();
for (int i = 0; i < top_org.count(); ++i) { EXPECT_NEAR(data_non_sep[i], data_sep[i], 1e-4); }
Dtype* data_diff = top_org.mutable_cpu_diff();
caffe_sub(top_org.count(), data_non_sep, data_sep, data_diff);
Dtype mean_error = caffe_cpu_asum(top_org.count(), data_diff) /top_org.count();
EXPECT_NEAR(mean_error, 0, 1e-4);
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestCuDNNConvolution) {
if (Caffe::mode() == Caffe::CPU)
return;
typedef typename TypeParam::Dtype Dtype;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
vector<Blob<Dtype>*> blob_bottom_vec_org_;
vector<Blob<Dtype>*> blob_top_vec_org_;
vector<bool> propagate_down;
if (sizeof(Dtype) > 4)
return;
propagate_down.push_back(true);
blob_bottom_vec_.push_back(this->blob_bottom_3_);
blob_top_vec_.push_back(this->blob_top_3_);
FillerParameter filler_param;
filler_param.set_value(0.1);
Blob<Dtype>* blob_top_diff = new Blob<Dtype>();
Blob<Dtype>* blob_bottom_3_org_ = new Blob<Dtype>();
Blob<Dtype>* blob_top_3_org_ = new Blob<Dtype>();
blob_bottom_3_org_->CopyFrom(*this->blob_bottom_3_, false, true);
blob_bottom_vec_org_.push_back(blob_bottom_3_org_);
blob_top_vec_org_.push_back(blob_top_3_org_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(1);
convolution_param->add_pad(1);
convolution_param->set_number_gauss(2);
convolution_param->set_num_output(8);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_weight_filler()->set_std(0.01);
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
convolution_param->mutable_sigma_filler()->set_type("constant");
convolution_param->mutable_sigma_filler()->set_value(0.8);
convolution_param->set_gmm_component_border_bound(1.5);
convolution_param->set_gmm_sigma_lower_bound(0.5);
convolution_param->set_gmm_weight_normalization(false);
convolution_param->set_gmm_gauss_normalization(true);
for (int gmm_sqrt_norm = 0; gmm_sqrt_norm < 1; gmm_sqrt_norm++) {
convolution_param->set_gmm_square_gauss_normalization((bool)gmm_sqrt_norm);
shared_ptr<BaseGaussianConvLayer<Dtype> > layer(new CuDNNGaussianConvLayer<Dtype>(layer_param));
shared_ptr<BaseGaussianConvLayer<Dtype> > layer_org(new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(blob_bottom_vec_, blob_top_vec_);
layer_org->SetUp(blob_bottom_vec_org_, blob_top_vec_org_);
layer_org->param_buffer_w_->CopyFrom(*layer->param_buffer_w_, false, false);
layer_org->param_buffer_mu1_->CopyFrom(*layer->param_buffer_mu1_, false, false);
layer_org->param_buffer_mu2_->CopyFrom(*layer->param_buffer_mu2_, false, false);
layer_org->param_buffer_sigma_->CopyFrom(*layer->param_buffer_sigma_, false, false);
layer_org->param_buffer_bias_->CopyFrom(*layer->param_buffer_bias_, false, false);
// RUN forward
layer->Forward(blob_bottom_vec_, blob_top_vec_);
layer_org->Forward(blob_bottom_vec_org_, blob_top_vec_org_);
blob_top_diff->ReshapeLike(*blob_top_vec_[0]);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(blob_top_diff);
caffe_copy( blob_top_vec_[0]->count(), blob_top_diff->cpu_data(), blob_top_vec_[0]->mutable_cpu_diff());
blob_top_vec_[0]->cpu_data();
blob_top_vec_[0]->gpu_diff();
blob_top_vec_org_[0]->CopyFrom(*blob_top_vec_[0], true, true);
// blob_top_vec_org_[0]->cpu_diff();
const Dtype* gpu_data = blob_top_vec_[0]->cpu_data();
const Dtype* cpu_data = blob_top_vec_org_[0]->cpu_data();
for (int i = 0; i < blob_top_vec_[0]->count(); ++i) { EXPECT_NEAR(gpu_data[i], cpu_data[i], 1e-4); }
// set all back-propagated error values to 1 to ease debugging
// caffe_gpu_set(blob_top_vec_org_[0]->count(), (Dtype)3.0, blob_top_vec_org_[0]->mutable_gpu_diff());
// caffe_gpu_set(blob_top_vec_[0]->count(), (Dtype)3.0, blob_top_vec_[0]->mutable_gpu_diff());
// caffe_gpu_set(blob_bottom_vec_org_[0]->count(), (Dtype)2.0, blob_bottom_vec_org_[0]->mutable_gpu_data());
// caffe_gpu_set(blob_bottom_vec_[0]->count(), (Dtype)2.0, blob_bottom_vec_[0]->mutable_gpu_data());
// RUN backward
layer->Backward(blob_top_vec_, propagate_down, blob_bottom_vec_);
layer_org->Backward(blob_top_vec_org_, propagate_down, blob_bottom_vec_org_);
const Dtype* gpu_diff = blob_bottom_vec_[0]->cpu_diff();
const Dtype* cpu_diff = blob_bottom_vec_org_[0]->cpu_diff();
for (int i = 0; i < blob_bottom_vec_[0]->count(); ++i) { EXPECT_NEAR(gpu_diff[i], cpu_diff[i], 1e-4); }
// layer->param_buffer_w_->cpu_data();
// layer_org->param_buffer_w_->cpu_data();
compare_blobs(*layer->param_buffer_w_, *layer_org->param_buffer_w_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_mu1_, *layer_org->param_buffer_mu1_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_mu2_, *layer_org->param_buffer_mu2_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_sigma_, *layer_org->param_buffer_sigma_, true, (Dtype)1e-4);
}
delete blob_bottom_3_org_;
delete blob_top_3_org_;
delete blob_top_diff;
}
TYPED_TEST(GaussConvolutionLayerTest, TestCuDNNConvolutionExtensive) {
if (Caffe::mode() == Caffe::CPU)
return;
typedef typename TypeParam::Dtype Dtype;
if (sizeof(Dtype) > 4)
return;
// run with different combinations of settings
// num images: 1, 2, 3, 5, 8, 11
// num subfeatures: 1, 2, 3, 5, 8, 11
// width: 4, 9, 16, 32, 33,
// height: 4, 9, 16, 32, 33,
// num features: 4, 6, 8, 16
// num gauss: 2,3,4
vector<int> num_imgs_args = {1, 11};
vector<int> num_subfeat_args = {1, 2, 3, 8, 11};
vector<int> width_args = {4, 9, 32, 33};
vector<int> height_args = {4, 9, 32, 33,};
vector<int> num_feat_args = {4, 16};
vector<int> num_gauss_args = {2,3,4}; // do not forget, this is squared, so in effect with 4,9 and 16 gauss per filter
for (int img_i = 0; img_i < num_imgs_args.size(); ++img_i) {
for (int subfeat_i = 0; subfeat_i < num_subfeat_args.size(); ++subfeat_i) {
for (int width_i = 0; width_i < width_args.size(); ++width_i) {
for (int height_i = 0; height_i < height_args.size(); ++height_i) {
for (int feat_i = 0; feat_i < num_feat_args.size(); ++feat_i) {
for (int gauss_i = 0; gauss_i < num_gauss_args.size(); ++gauss_i) {
int num_imgs = num_imgs_args[img_i];
int num_subfeat = num_subfeat_args[subfeat_i];
int width = width_args[width_i];
int height = height_args[height_i];
int num_feat = num_feat_args[feat_i];
int num_gauss = num_gauss_args[gauss_i];
std::cout << "testing num_imgs " << num_imgs << ", num_subfeat " << num_subfeat << ", width " << width << ", height " << height << ", num_feat " << num_feat << ",num_gauss " << num_gauss << std::endl;
vector<Blob<Dtype>*> blob_bottom_vec_;
vector<Blob<Dtype>*> blob_top_vec_;
vector<Blob<Dtype>*> blob_bottom_vec_org_;
vector<Blob<Dtype>*> blob_top_vec_org_;
vector<bool> propagate_down;
Blob<Dtype>* blob_bottom_3_ = new Blob<Dtype>(num_imgs, num_subfeat, height, width);
Blob<Dtype>* blob_top_3_ = new Blob<Dtype>();
{
FillerParameter filler_param;
filler_param.set_value(1.);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(blob_bottom_3_);
}
propagate_down.push_back(true);
blob_bottom_vec_.push_back(blob_bottom_3_);
blob_top_vec_.push_back(blob_top_3_);
FillerParameter filler_param;
filler_param.set_value(0.1);
Blob<Dtype>* blob_top_diff = new Blob<Dtype>();
Blob<Dtype>* blob_bottom_3_org_ = new Blob<Dtype>();
Blob<Dtype>* blob_top_3_org_ = new Blob<Dtype>();
blob_bottom_3_org_->CopyFrom(*blob_bottom_3_, false, true);
blob_bottom_vec_org_.push_back(blob_bottom_3_org_);
blob_top_vec_org_.push_back(blob_top_3_org_);
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(1);
convolution_param->add_pad(1);
convolution_param->set_number_gauss(num_gauss);
convolution_param->set_num_output(num_feat);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_weight_filler()->set_std(0.01);
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
convolution_param->mutable_sigma_filler()->set_type("constant");
convolution_param->mutable_sigma_filler()->set_value(0.8);
convolution_param->set_gmm_component_border_bound(1.5);
convolution_param->set_gmm_sigma_lower_bound(0.5);
convolution_param->set_gmm_weight_normalization(false);
convolution_param->set_gmm_gauss_normalization(true);
for (int gmm_sqrt_norm = 0; gmm_sqrt_norm < 1; gmm_sqrt_norm++) {
convolution_param->set_gmm_square_gauss_normalization((bool)gmm_sqrt_norm);
shared_ptr<BaseGaussianConvLayer<Dtype> > layer(new CuDNNGaussianConvLayer<Dtype>(layer_param));
shared_ptr<BaseGaussianConvLayer<Dtype> > layer_org(new GaussianConvLayer<Dtype>(layer_param));
layer->SetUp(blob_bottom_vec_, blob_top_vec_);
layer_org->SetUp(blob_bottom_vec_org_, blob_top_vec_org_);
layer_org->param_buffer_w_->CopyFrom(*layer->param_buffer_w_, false, false);
layer_org->param_buffer_mu1_->CopyFrom(*layer->param_buffer_mu1_, false, false);
layer_org->param_buffer_mu2_->CopyFrom(*layer->param_buffer_mu2_, false, false);
layer_org->param_buffer_sigma_->CopyFrom(*layer->param_buffer_sigma_, false, false);
layer_org->param_buffer_bias_->CopyFrom(*layer->param_buffer_bias_, false, false);
// RUN forward
layer->Forward(blob_bottom_vec_, blob_top_vec_);
layer_org->Forward(blob_bottom_vec_org_, blob_top_vec_org_);
blob_top_diff->ReshapeLike(*blob_top_vec_[0]);
GaussianFiller<Dtype> filler(filler_param);
filler.Fill(blob_top_diff);
caffe_copy( blob_top_vec_[0]->count(), blob_top_diff->cpu_data(), blob_top_vec_[0]->mutable_cpu_diff());
blob_top_vec_[0]->cpu_data();
blob_top_vec_[0]->gpu_diff();
blob_top_vec_org_[0]->CopyFrom(*blob_top_vec_[0], true, true);
// blob_top_vec_org_[0]->cpu_diff();
const Dtype* gpu_data = blob_top_vec_[0]->cpu_data();
const Dtype* cpu_data = blob_top_vec_org_[0]->cpu_data();
for (int i = 0; i < blob_top_vec_[0]->count(); ++i) { EXPECT_NEAR(gpu_data[i], cpu_data[i], 1e-4); }
// set all back-propagated error values to 1 to ease debugging
//caffe_gpu_set(blob_top_vec_org_[0]->count(), (Dtype)1.0, blob_top_vec_org_[0]->mutable_gpu_diff());
//caffe_gpu_set(blob_top_vec_[0]->count(), (Dtype)1.0, blob_top_vec_[0]->mutable_gpu_diff());
// RUN backward
layer->Backward(blob_top_vec_, propagate_down, blob_bottom_vec_);
layer_org->Backward(blob_top_vec_org_, propagate_down, blob_bottom_vec_org_);
const Dtype* gpu_diff = blob_bottom_vec_[0]->cpu_diff();
const Dtype* cpu_diff = blob_bottom_vec_org_[0]->cpu_diff();
for (int i = 0; i < blob_bottom_vec_[0]->count(); ++i) { EXPECT_NEAR(gpu_diff[i], cpu_diff[i], 1e-4); }
// layer->param_buffer_w_->cpu_data();
// layer_org->param_buffer_w_->cpu_data();
compare_blobs(*layer->param_buffer_w_, *layer_org->param_buffer_w_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_mu1_, *layer_org->param_buffer_mu1_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_mu2_, *layer_org->param_buffer_mu2_, true, (Dtype)1e-4);
compare_blobs(*layer->param_buffer_sigma_, *layer_org->param_buffer_sigma_, true, (Dtype)1e-4);
}
delete blob_top_3_;
delete blob_bottom_3_;
delete blob_bottom_3_org_;
delete blob_top_3_org_;
delete blob_top_diff;
} } } } } }
}
/*
TYPED_TEST(GaussConvolutionLayerTest, Test0DConvolution) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
const int kNumOutput = 3;
convolution_param->set_num_output(kNumOutput);
convolution_param->set_axis(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
vector<int> top_shape = this->blob_bottom_->shape();
top_shape[3] = kNumOutput;
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
EXPECT_EQ(top_shape, this->blob_top_->shape());
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
vector<int> weight_offset(2);
const Blob<Dtype>* weight = layer->blobs()[0].get();
const Blob<Dtype>* bias = layer->blobs()[1].get();
const int num = this->blob_top_->count(3);
const int dim = this->blob_top_->shape(3);
const int bottom_dim = this->blob_bottom_->shape(3);
for (int n = 0; n < num; ++n) {
for (int d = 0; d < dim; ++d) {
weight_offset[0] = d;
Dtype value = bias->cpu_data()[d];
for (int bottom_d = 0; bottom_d < bottom_dim; ++bottom_d) {
weight_offset[1] = bottom_d;
value += weight->data_at(weight_offset) *
this->blob_bottom_->cpu_data()[n * bottom_dim + bottom_d];
}
EXPECT_NEAR(value, this->blob_top_->cpu_data()[n * dim + d], 1e-4);
}
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestSimple3DConvolution) {
typedef typename TypeParam::Dtype Dtype;
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
vector<int> bottom_shape(5);
bottom_shape[0] = this->blob_bottom_vec_[0]->shape(0);
bottom_shape[1] = this->blob_bottom_vec_[0]->shape(1);
bottom_shape[2] = 5;
bottom_shape[3] = this->blob_bottom_vec_[0]->shape(2);
bottom_shape[4] = this->blob_bottom_vec_[0]->shape(3);
FillerParameter filler_param;
GaussianFiller<Dtype> filler(filler_param);
for (int i = 0; i < this->blob_bottom_vec_.size(); ++i) {
this->blob_bottom_vec_[i]->Reshape(bottom_shape);
filler.Fill(this->blob_bottom_vec_[i]);
}
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(4);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
caffe_conv(this->blob_bottom_2_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_2_));
top_data = this->blob_top_2_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(GaussConvolutionLayerTest, Test1x1Convolution) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(1);
convolution_param->add_stride(1);
convolution_param->set_num_output(4);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestSimpleConvolutionGroup) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("constant");
convolution_param->mutable_bias_filler()->set_value(0.1);
shared_ptr<Layer<Dtype> > layer(
new ConvolutionLayer<Dtype>(layer_param));
layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
layer->Forward(this->blob_bottom_vec_, this->blob_top_vec_);
// Check against reference convolution.
const Dtype* top_data;
const Dtype* ref_top_data;
caffe_conv(this->blob_bottom_, convolution_param, layer->blobs(),
this->MakeReferenceTop(this->blob_top_));
top_data = this->blob_top_->cpu_data();
ref_top_data = this->ref_blob_top_->cpu_data();
for (int i = 0; i < this->blob_top_->count(); ++i) {
EXPECT_NEAR(top_data[i], ref_top_data[i], 1e-4);
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestNDAgainst2D) {
typedef typename TypeParam::Dtype Dtype;
const int kernel_h = 11;
const int kernel_w = 13;
vector<int> bottom_shape(4);
bottom_shape[0] = 15;
bottom_shape[1] = 18;
bottom_shape[2] = kernel_h * 2;
bottom_shape[3] = kernel_w * 2;
FillerParameter filler_param;
GaussianFiller<Dtype> filler(filler_param);
for (int i = 0; i < this->blob_bottom_vec_.size(); ++i) {
this->blob_bottom_vec_[i]->Reshape(bottom_shape);
filler.Fill(this->blob_bottom_vec_[i]);
}
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->set_num_output(12);
convolution_param->set_bias_term(false);
convolution_param->set_group(6);
convolution_param->set_kernel_h(kernel_h);
convolution_param->set_kernel_w(kernel_w);
convolution_param->mutable_weight_filler()->set_type("gaussian");
Blob<Dtype> weights;
Blob<Dtype> top_diff;
// Shape and fill weights and top_diff.
bool copy_diff;
bool reshape;
{
ConvolutionLayer<Dtype> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
top_diff.ReshapeLike(*this->blob_top_);
filler.Fill(&top_diff);
ASSERT_EQ(1, layer.blobs().size());
copy_diff = false; reshape = true;
weights.CopyFrom(*layer.blobs()[0], copy_diff, reshape);
}
vector<bool> propagate_down(1, true);
Blob<Dtype> result_2d;
Blob<Dtype> backward_result_2d;
Blob<Dtype> backward_weight_result_2d;
// Test with 2D im2col
{
caffe_set(this->blob_top_->count(), Dtype(0),
this->blob_top_->mutable_cpu_data());
caffe_set(this->blob_bottom_->count(), Dtype(0),
this->blob_bottom_->mutable_cpu_diff());
caffe_set(weights.count(), Dtype(0), weights.mutable_cpu_diff());
// Do SetUp and Forward; save Forward result in result_2d.
convolution_param->set_force_nd_im2col(false);
ConvolutionLayer<Dtype> layer_2d(layer_param);
layer_2d.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
ASSERT_EQ(1, layer_2d.blobs().size());
copy_diff = false; reshape = false;
layer_2d.blobs()[0]->CopyFrom(weights, copy_diff, reshape);
layer_2d.Forward(this->blob_bottom_vec_, this->blob_top_vec_);
copy_diff = false; reshape = true;
result_2d.CopyFrom(*this->blob_top_, copy_diff, reshape);
// Copy pre-generated top diff into actual top diff;
// do Backward and save result in backward_result_2d.
ASSERT_EQ(this->blob_top_->shape(), top_diff.shape());
caffe_copy(top_diff.count(), top_diff.cpu_data(),
this->blob_top_->mutable_cpu_diff());
layer_2d.Backward(this->blob_top_vec_, propagate_down,
this->blob_bottom_vec_);
copy_diff = true; reshape = true;
backward_result_2d.CopyFrom(*this->blob_bottom_, copy_diff, reshape);
backward_weight_result_2d.CopyFrom(weights, copy_diff, reshape);
}
Blob<Dtype> result_nd;
Blob<Dtype> backward_result_nd;
Blob<Dtype> backward_weight_result_nd;
// Test with ND im2col
{
caffe_set(this->blob_top_->count(), Dtype(0),
this->blob_top_->mutable_cpu_data());
caffe_set(this->blob_bottom_->count(), Dtype(0),
this->blob_bottom_->mutable_cpu_diff());
caffe_set(weights.count(), Dtype(0), weights.mutable_cpu_diff());
// Do SetUp and Forward; save Forward result in result_nd.
convolution_param->set_force_nd_im2col(true);
ConvolutionLayer<Dtype> layer_nd(layer_param);
layer_nd.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
ASSERT_EQ(1, layer_nd.blobs().size());
copy_diff = false; reshape = false;
layer_nd.blobs()[0]->CopyFrom(weights, copy_diff, reshape);
layer_nd.Forward(this->blob_bottom_vec_, this->blob_top_vec_);
copy_diff = false; reshape = true;
result_nd.CopyFrom(*this->blob_top_, copy_diff, reshape);
// Copy pre-generated top diff into actual top diff;
// do Backward and save result in backward_result_nd.
ASSERT_EQ(this->blob_top_->shape(), top_diff.shape());
caffe_copy(top_diff.count(), top_diff.cpu_data(),
this->blob_top_->mutable_cpu_diff());
layer_nd.Backward(this->blob_top_vec_, propagate_down,
this->blob_bottom_vec_);
copy_diff = true; reshape = true;
backward_result_nd.CopyFrom(*this->blob_bottom_, copy_diff, reshape);
backward_weight_result_nd.CopyFrom(weights, copy_diff, reshape);
}
ASSERT_EQ(result_nd.count(), result_2d.count());
for (int i = 0; i < result_2d.count(); ++i) {
EXPECT_EQ(result_2d.cpu_data()[i], result_nd.cpu_data()[i]);
}
ASSERT_EQ(backward_result_nd.count(), backward_result_2d.count());
for (int i = 0; i < backward_result_2d.count(); ++i) {
EXPECT_EQ(backward_result_2d.cpu_diff()[i],
backward_result_nd.cpu_diff()[i]);
}
ASSERT_EQ(backward_weight_result_nd.count(),
backward_weight_result_2d.count());
for (int i = 0; i < backward_weight_result_2d.count(); ++i) {
EXPECT_EQ(backward_weight_result_2d.cpu_diff()[i],
backward_weight_result_nd.cpu_diff()[i]);
}
}
TYPED_TEST(GaussConvolutionLayerTest, TestGradient) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(GaussConvolutionLayerTest, TestGradient3D) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
vector<int> bottom_shape(5);
bottom_shape[0] = this->blob_bottom_vec_[0]->shape(0);
bottom_shape[1] = this->blob_bottom_vec_[0]->shape(1);
bottom_shape[2] = 5;
bottom_shape[3] = this->blob_bottom_vec_[0]->shape(2);
bottom_shape[4] = this->blob_bottom_vec_[0]->shape(3);
FillerParameter filler_param;
GaussianFiller<Dtype> filler(filler_param);
for (int i = 0; i < this->blob_bottom_vec_.size(); ++i) {
this->blob_bottom_vec_[i]->Reshape(bottom_shape);
filler.Fill(this->blob_bottom_vec_[i]);
}
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(GaussConvolutionLayerTest, Test1x1Gradient) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
this->blob_bottom_vec_.push_back(this->blob_bottom_2_);
this->blob_top_vec_.push_back(this->blob_top_2_);
convolution_param->add_kernel_size(1);
convolution_param->add_stride(1);
convolution_param->set_num_output(2);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
TYPED_TEST(GaussConvolutionLayerTest, TestGradientGroup) {
typedef typename TypeParam::Dtype Dtype;
LayerParameter layer_param;
ConvolutionParameter* convolution_param =
layer_param.mutable_convolution_param();
convolution_param->add_kernel_size(3);
convolution_param->add_stride(2);
convolution_param->set_num_output(3);
convolution_param->set_group(3);
convolution_param->mutable_weight_filler()->set_type("gaussian");
convolution_param->mutable_bias_filler()->set_type("gaussian");
ConvolutionLayer<Dtype> layer(layer_param);
GradientChecker<Dtype> checker(1e-2, 1e-3);
checker.CheckGradientExhaustive(&layer, this->blob_bottom_vec_,
this->blob_top_vec_);
}
*/
#ifdef USE_CUDNN
#endif
} // namespace caffe
| 38.770417
| 202
| 0.71464
|
skokec
|
774ab34511087ae6ecaef31852ba1522b5386a18
| 1,634
|
cpp
|
C++
|
solutions/LeetCode/C++/375.cpp
|
timxor/leetcode-journal
|
5f1cb6bcc44a5bc33d88fb5cdb4126dfc6f4232a
|
[
"MIT"
] | 854
|
2018-11-09T08:06:16.000Z
|
2022-03-31T06:05:53.000Z
|
solutions/LeetCode/C++/375.cpp
|
timxor/leetcode-journal
|
5f1cb6bcc44a5bc33d88fb5cdb4126dfc6f4232a
|
[
"MIT"
] | 29
|
2019-06-02T05:02:25.000Z
|
2021-11-15T04:09:37.000Z
|
solutions/LeetCode/C++/375.cpp
|
timxor/leetcode-journal
|
5f1cb6bcc44a5bc33d88fb5cdb4126dfc6f4232a
|
[
"MIT"
] | 347
|
2018-12-23T01:57:37.000Z
|
2022-03-12T14:51:21.000Z
|
__________________________________________________________________________________________________
sample 4 ms submission
class Solution {
public:
int getMoneyAmount(int n) {
vector<vector<int>> cache(n+1, vector<int>(n+1, 0));
return cost(cache, 1, n);
}
int cost(vector<vector<int>>& v, int l, int r) {
if (l >= r) return 0;
if (v[l][r] != 0) return v[l][r];
int res = INT_MAX;
int start = l + (r - l) / 2;
for (int i = start; i <= r; ++i) {
int lc = cost(v, l, i-1);
int rc = cost(v, i+1, r);
int tmp = i + std::max(lc, rc);
res = std::min(res, tmp);
if (lc >= rc) break;
}
v[l][r] = res;
return res;
}
};
__________________________________________________________________________________________________
sample 8256 kb submission
class Solution {
public:
int getMoneyAmount(int n) {
int dp[n+5][n+5];
for(int len=0;len<n;len++)
for(int i =1;i+len<=n;i++){
int j=i+len;
if(len==0)
dp[i][j]=0;
else if(len==1)
dp[i][j] = i;
else{
int minx = min(i + dp[i+1][j], dp[i][j-1] + j);
for(int k=i+1;k<j;k++)
minx = min(minx, k + max(dp[i][k-1], dp[k+1][j]));
dp[i][j] = minx;
}
}
return dp[1][n];
}
};
__________________________________________________________________________________________________
| 31.423077
| 98
| 0.49082
|
timxor
|
774abe8746e18e9a0ffd205c8e03c8667447129b
| 339
|
hpp
|
C++
|
include/esc/detail/is_any_of.hpp
|
a-n-t-h-o-n-y/Escape
|
45ca047bacffbbde768768c6631df6336dd4e03c
|
[
"MIT"
] | 10
|
2021-06-30T15:10:55.000Z
|
2022-03-20T18:34:06.000Z
|
include/esc/detail/is_any_of.hpp
|
a-n-t-h-o-n-y/Escape
|
45ca047bacffbbde768768c6631df6336dd4e03c
|
[
"MIT"
] | null | null | null |
include/esc/detail/is_any_of.hpp
|
a-n-t-h-o-n-y/Escape
|
45ca047bacffbbde768768c6631df6336dd4e03c
|
[
"MIT"
] | null | null | null |
#ifndef ESC_DETAIL_IS_ANY_OF_HPP
#define ESC_DETAIL_IS_ANY_OF_HPP
#include <type_traits>
namespace esc::detail {
/// Type Trait defined as true if T is_same as any of Us.
template <typename T, typename... Args>
bool constexpr is_any_of = (std::is_same_v<Args, T> || ...);
} // namespace esc::detail
#endif // ESC_DETAIL_IS_ANY_OF_HPP
| 26.076923
| 60
| 0.743363
|
a-n-t-h-o-n-y
|
7753c11d29c35ff08d33709109ed7b7643b02d44
| 4,988
|
cpp
|
C++
|
src/Entity/Plane.cpp
|
evanbowman/FLIGHT
|
cdb06059498efd63d9a94b27e8b9501e90bde86c
|
[
"BSD-2-Clause"
] | 15
|
2017-03-07T21:42:55.000Z
|
2021-05-20T04:28:46.000Z
|
src/Entity/Plane.cpp
|
evanbowman/FLIGHT
|
cdb06059498efd63d9a94b27e8b9501e90bde86c
|
[
"BSD-2-Clause"
] | null | null | null |
src/Entity/Plane.cpp
|
evanbowman/FLIGHT
|
cdb06059498efd63d9a94b27e8b9501e90bde86c
|
[
"BSD-2-Clause"
] | 4
|
2017-02-10T15:47:25.000Z
|
2021-05-20T04:27:29.000Z
|
#include <FLIGHT/Core/Game.hpp>
#include <FLIGHT/Entity/Plane.hpp>
#include <FLIGHT/Entity/Coin.hpp>
namespace FLIGHT {
Plane::Plane(const Blueprint & blueprint, const std::string & blueprintName)
: m_srcBlueprint(blueprintName), m_pitch(0.f), m_roll(0.f), m_thrust(1.f),
m_yVelocity(0.f) {
for (auto & part : blueprint.GetParts()) {
Sprite sprite;
auto model =
Singleton<Game>::Instance().GetAssetMgr().GetModel(part.model);
auto material = Singleton<Game>::Instance().GetAssetMgr().GetMaterial(
part.material);
auto texture =
Singleton<Game>::Instance().GetAssetMgr().GetTexture(part.texture);
if (not model) {
throw std::runtime_error("model \'" + part.model +
"\' isn\'t loaded");
}
if (not texture) {
throw std::runtime_error("texture \'" + part.texture +
"\' isn\'t loaded");
}
if (not material) {
throw std::runtime_error("material \'" + part.material +
"\' isn\'t loaded");
}
sprite.SetModel(model);
sprite.SetTexture(texture);
sprite.SetMaterial(material);
sprite.SetPosition(part.position);
sprite.SetScale(part.scale);
sprite.SetRotation(part.rotation);
m_parts.push_back(sprite);
}
m_mbsRadius = MBS(GetAABB()).GetRadius();
}
const std::string & Plane::GetBlueprintName() const { return m_srcBlueprint; }
void Plane::Serialize(Serializer & serializer) { serializer.Dispatch(*this); }
void Plane::Display(DisplayImpl & renderer) { renderer.Dispatch(*this); }
AABB Plane::GetAABB() {
AABB ret = m_parts.front().GetAABB();
auto it = m_parts.begin();
++it;
for (; it not_eq m_parts.end(); ++it) {
ret.Merge(it->GetAABB());
}
ret.Rotate(m_rotation.y, {0, 1, 0});
ret.Rotate(m_rotation.z, {0, 0, 1});
ret.Rotate(m_rotation.x, {1, 0, 0});
ret.Translate(m_position);
return ret;
}
const std::vector<Sprite> & Plane::GetParts() const { return m_parts; }
void Plane::CastShadow(ShaderProgram & shader) {
glm::mat4 modelMatrix;
modelMatrix = glm::translate(modelMatrix, m_position);
modelMatrix = glm::rotate(modelMatrix, m_rotation.y, {0, 1, 0});
modelMatrix = glm::rotate(modelMatrix, m_rotation.z, {0, 0, 1});
modelMatrix = glm::rotate(modelMatrix, m_rotation.x, {1, 0, 0});
for (auto & part : m_parts) {
part.Display(modelMatrix, shader);
}
}
OBB Plane::GetOBB() {
AABB aabb = m_parts.front().GetAABB();
auto it = m_parts.begin();
++it;
for (; it not_eq m_parts.end(); ++it) {
aabb.Merge(it->GetAABB());
}
OBB obb(aabb);
obb.Rotate(m_rotation.y, {0, 1, 0});
obb.Rotate(m_rotation.z, {0, 0, 1});
obb.Rotate(m_rotation.x, {1, 0, 0});
obb.Translate(m_position);
return obb;
}
void Plane::SetThrust(const float thrust) { m_thrust = thrust; }
float Plane::GetThrust() const { return m_thrust; }
void Plane::MessageLoop() {
m_inbox.Poll([this](auto & msg) {
msg.match(
[this](Collision & c) {
if (dynamic_cast<Plane *>(c.with.get())) {
m_outbox.Push(Message(Death()));
} else if (dynamic_cast<Coin *>(c.with.get())) {
SetColor({0.949f, 0.765f, 0.027f, 1.f});
BeginDecay();
m_outbox.Push(Message(PickedUpCoin()));
}
},
[this](TerrainCollision) { m_outbox.Push(Message(Death())); },
[](auto &) { throw MessageError(); });
});
}
void Plane::Update(const Time dt) {
MessageLoop();
ColorMixDecay::Update(dt);
const float rateFactor = 0.000035f * dt;
static const float yCeil = GetElevationLimit();
static const float yFloor = -3.f;
const float yDisp = std::sin(m_rotation.x) * rateFactor;
m_yVelocity = MATH::lerp(yDisp, m_yVelocity, 0.05 * dt * 0.0001f);
if (m_position.y + m_yVelocity < yCeil and
m_position.y + m_yVelocity > yFloor) {
m_position.y += m_thrust * m_yVelocity;
}
m_position.z -=
m_thrust * std::cos(m_rotation.y) * rateFactor * std::cos(m_rotation.x);
m_position.x -=
m_thrust * std::sin(m_rotation.y) * rateFactor * std::cos(m_rotation.x);
static const float turningRate = 0.000000025f;
m_rotation.y += m_thrust * turningRate * dt * m_roll;
}
const glm::vec3 & Plane::GetDirection() const { return m_direction; }
void Plane::SetDirection(const glm::vec3 & direction) {
m_direction = direction;
}
void Plane::SetPitch(const float pitch) {
m_rotation.x = glm::radians(pitch);
m_pitch = pitch;
}
float Plane::GetPitch() const { return m_pitch; }
void Plane::SetRoll(const float roll) {
m_rotation.z = glm::radians(roll);
m_roll = roll;
}
float Plane::GetRoll() const { return m_roll; }
}
| 33.47651
| 80
| 0.593224
|
evanbowman
|
775aca3902f0883abd4b97d5055444eb899365ae
| 107
|
cpp
|
C++
|
docs/assets/playground/choice.cpp
|
IohannRabeson/lexy
|
881beb56f030e8f4761514e70cb50d809ac4ad17
|
[
"BSL-1.0"
] | 527
|
2020-12-01T14:23:50.000Z
|
2022-03-31T11:30:24.000Z
|
docs/assets/playground/choice.cpp
|
ExternalRepositories/lexy
|
edc6bd4aabd6f0ecbddba6f2bbf9bd2c6e4fa61d
|
[
"BSL-1.0"
] | 44
|
2020-12-01T18:39:38.000Z
|
2022-03-08T00:22:39.000Z
|
docs/assets/playground/choice.cpp
|
ExternalRepositories/lexy
|
edc6bd4aabd6f0ecbddba6f2bbf9bd2c6e4fa61d
|
[
"BSL-1.0"
] | 24
|
2020-12-02T01:45:53.000Z
|
2022-03-22T21:31:31.000Z
|
// INPUT:Hello
struct production
{
static constexpr auto rule = LEXY_LIT("Hello") | LEXY_LIT("Hi");
};
| 17.833333
| 68
| 0.672897
|
IohannRabeson
|
775c953f1c9d1412519e0d7bddf4c1763db0bccc
| 16,384
|
cpp
|
C++
|
simpleshell/westeros-simpleshell.cpp
|
moorthy-bs/westeros
|
d026756a91333b376d167d9e248e18309a177c95
|
[
"MIT"
] | null | null | null |
simpleshell/westeros-simpleshell.cpp
|
moorthy-bs/westeros
|
d026756a91333b376d167d9e248e18309a177c95
|
[
"MIT"
] | null | null | null |
simpleshell/westeros-simpleshell.cpp
|
moorthy-bs/westeros
|
d026756a91333b376d167d9e248e18309a177c95
|
[
"MIT"
] | null | null | null |
/*
* If not stated otherwise in this file or this component's Licenses.txt file the
* following copyright and licenses apply:
*
* Copyright 2016 RDK Management
*
* 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 <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <sys/time.h>
#include <vector>
#include "westeros-simpleshell.h"
#include "wayland-server.h"
#include "simpleshell-server-protocol.h"
#define WST_UNUSED( n ) ((void)n)
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define DEFAULT_NAME "noname"
#define BROADCAST_DELAY (2000)
static void destroy_shell(struct wl_resource *resource);
static void wstSimpleShellBroadcastCreation( struct wl_simple_shell *shell, uint32_t surfaceId );
typedef struct _ShellInfo
{
struct wl_client *client;
struct wl_resource *resource;
} ShellInfo;
typedef struct _PendingBroadcastInfo
{
uint32_t surfaceId;
long long creationTime;
} PendingBroadcastInfo;
struct wl_simple_shell
{
struct wl_display *display;
struct wl_global *wl_simple_shell_global;
struct wayland_simple_shell_callbacks *callbacks;
WstRenderer *renderer;
void *userData;
struct wl_event_source *delayTimer;
std::vector<ShellInfo> shells;
std::vector<uint32_t> surfaces;
std::vector<PendingBroadcastInfo> pendingCreateBroadcast;
};
static long long getCurrentTimeMillis()
{
struct timeval tv;
long long utcCurrentTimeMillis;
gettimeofday(&tv,0);
utcCurrentTimeMillis= tv.tv_sec*1000LL+(tv.tv_usec/1000LL);
return utcCurrentTimeMillis;
}
static void wstISimpleShellSetName(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, const char *name);
static void wstISimpleShellSetVisible(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, uint32_t visible);
static void wstISimpleShellSetGeometry(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, int32_t x, int32_t y, int32_t width, int32_t height);
static void wstISimpleShellSetOpacity(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, wl_fixed_t opacity);
static void wstISimpleShellSetZOrder(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, wl_fixed_t zorder);
static void wstISimpleShellGetStatus(struct wl_client *client, struct wl_resource *resource, uint32_t surface);
static void wstISimpleShellGetSurfaces(struct wl_client *client, struct wl_resource *resource);
static void wstISimpleShellSetFocus(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId);
const static struct wl_simple_shell_interface simple_shell_interface = {
wstISimpleShellSetName,
wstISimpleShellSetVisible,
wstISimpleShellSetGeometry,
wstISimpleShellSetOpacity,
wstISimpleShellSetZOrder,
wstISimpleShellGetStatus,
wstISimpleShellGetSurfaces,
wstISimpleShellSetFocus
};
static void wstSimpleShellBroadcastSurfaceUpdate(struct wl_client *client, struct wl_simple_shell *shell, uint32_t surfaceId )
{
const char *name= 0;
bool visible;
int x, y, width, height;
float opacity, zorder;
wl_fixed_t fixedOpacity, fixedZOrder;
shell->callbacks->get_name( shell->userData, surfaceId, &name );
if ( !name )
{
name= (const char *)DEFAULT_NAME;
}
shell->callbacks->get_status( shell->userData, surfaceId,
&visible,
&x, &y, &width, &height,
&opacity, &zorder );
fixedOpacity= wl_fixed_from_double( (double)opacity );
fixedZOrder= wl_fixed_from_double( (double)zorder );
// Broadcast the surface update announcement to all other clients.
for( std::vector<ShellInfo>::iterator it= shell->shells.begin();
it != shell->shells.end();
++it )
{
if ((*it).client != client) {
struct wl_resource *shell_resource = (*it).resource;
wl_simple_shell_send_surface_status(shell_resource, surfaceId,
name, (visible ? 1 : 0),
x, y, width, height, fixedOpacity, fixedZOrder);
}
}
}
static void wstISimpleShellSetName(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, const char *name)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
shell->callbacks->set_name( shell->userData, surfaceId, name );
for( std::vector<PendingBroadcastInfo>::iterator it= shell->pendingCreateBroadcast.begin();
it != shell->pendingCreateBroadcast.end();
++it )
{
if ( (*it).surfaceId == surfaceId )
{
shell->pendingCreateBroadcast.erase( it );
wstSimpleShellBroadcastCreation( shell, surfaceId );
break;
}
}
wstSimpleShellBroadcastSurfaceUpdate(client, shell, surfaceId );
}
static void wstISimpleShellSetVisible(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, uint32_t visible)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
shell->callbacks->set_visible( shell->userData, surfaceId, (visible != 0) );
wstSimpleShellBroadcastSurfaceUpdate(client, shell, surfaceId );
}
static void wstISimpleShellSetGeometry(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, int32_t x, int32_t y, int32_t width, int32_t height)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
shell->callbacks->set_geometry( shell->userData, surfaceId, x, y, width, height );
wstSimpleShellBroadcastSurfaceUpdate(client, shell, surfaceId );
}
static void wstISimpleShellSetOpacity(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, wl_fixed_t opacity)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
float opacityLevel= wl_fixed_to_double( opacity );
if ( opacityLevel < 0.0 ) opacityLevel= 0.0;
if ( opacityLevel > 1.0 ) opacityLevel= 1.0;
shell->callbacks->set_opacity( shell->userData, surfaceId, opacityLevel );
wstSimpleShellBroadcastSurfaceUpdate(client, shell, surfaceId );
}
static void wstISimpleShellSetZOrder(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId, wl_fixed_t zorder)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
float zOrderLevel= wl_fixed_to_double( zorder );
if ( zOrderLevel < 0.0 ) zOrderLevel= 0.0;
if ( zOrderLevel > 1.0 ) zOrderLevel= 1.0;
shell->callbacks->set_zorder( shell->userData, surfaceId, zOrderLevel );
wstSimpleShellBroadcastSurfaceUpdate(client, shell, surfaceId );
}
static void wstISimpleShellGetStatus(struct wl_client *client, struct wl_resource *resource, uint32_t surfaceId )
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
const char *name= 0;
bool visible;
int x, y, width, height;
float opacity, zorder;
wl_fixed_t fixedOpacity, fixedZOrder;
shell->callbacks->get_name( shell->userData, surfaceId, &name );
if ( !name )
{
name= (const char *)DEFAULT_NAME;
}
shell->callbacks->get_status( shell->userData, surfaceId,
&visible,
&x, &y, &width, &height,
&opacity, &zorder );
fixedOpacity= wl_fixed_from_double( (double)opacity );
fixedZOrder= wl_fixed_from_double( (double)zorder );
wl_simple_shell_send_surface_status( resource, surfaceId,
name, (visible ? 1 : 0),
x, y, width, height, fixedOpacity, fixedZOrder );
}
static void wstISimpleShellGetSurfaces(struct wl_client *client, struct wl_resource *resource)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
for( std::vector<uint32_t>::iterator it= shell->surfaces.begin();
it != shell->surfaces.end();
++it )
{
uint32_t surfaceId= (*it);
wstISimpleShellGetStatus(client, resource, surfaceId );
}
wl_simple_shell_send_get_surfaces_done( resource );
}
static void wstISimpleShellSetFocus(struct wl_client *client, struct wl_resource *resource,
uint32_t surfaceId)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
shell->callbacks->set_focus(shell->userData, surfaceId);
}
static void destroy_shell(struct wl_resource *resource)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)wl_resource_get_user_data(resource);
for ( std::vector<ShellInfo>::iterator it= shell->shells.begin();
it != shell->shells.end();
++it )
{
if ( (*it).resource == resource )
{
shell->shells.erase(it);
break;
}
}
}
static void wstSimpleShellBind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
struct wl_simple_shell *shell= (struct wl_simple_shell*)data;
struct wl_resource *resource;
ShellInfo info;
printf("westeros-simpleshell: wstSimpleShellBind: enter: client %p data %p version %d id %d\n", client, data, version, id);
resource= wl_resource_create(client, &wl_simple_shell_interface, MIN(version, 1), id);
if (!resource)
{
wl_client_post_no_memory(client);
return;
}
wl_resource_set_implementation(resource, &simple_shell_interface, shell, destroy_shell);
info.client= client;
info.resource= resource;
shell->shells.push_back( info );
}
static void wstSimpleShellBroadcastCreation( struct wl_simple_shell *shell, uint32_t surfaceId )
{
const char *name= 0;
// Get any name the creator may have assigned the surface
shell->callbacks->get_name( shell->userData, surfaceId, &name );
if ( !name )
{
name= (const char *)DEFAULT_NAME;
}
printf("broadcast for surfaceId %x name %s\n", surfaceId, name);
// Broadcast the surface creation announcement
for( std::vector<ShellInfo>::iterator it= shell->shells.begin();
it != shell->shells.end();
++it )
{
struct wl_resource *shell_resource= (*it).resource;
wl_simple_shell_send_surface_created( shell_resource, surfaceId, name );
}
}
static int wstSimpleShellTimeOut( void *data )
{
bool more= true;
long long now;
long long delay;
PendingBroadcastInfo pendingInfo;
struct wl_simple_shell *shell= (struct wl_simple_shell*)data;
while( more )
{
if ( shell->pendingCreateBroadcast.size() > 0 )
{
pendingInfo= shell->pendingCreateBroadcast.front();
shell->pendingCreateBroadcast.erase( shell->pendingCreateBroadcast.begin() );
wstSimpleShellBroadcastCreation( shell, pendingInfo.surfaceId );
if ( shell->pendingCreateBroadcast.size() > 0 )
{
pendingInfo= shell->pendingCreateBroadcast.front();
now= getCurrentTimeMillis();
delay= now-pendingInfo.creationTime;
if ( delay >= BROADCAST_DELAY )
{
continue;
}
else
{
delay= BROADCAST_DELAY-delay;
wl_event_source_timer_update( shell->delayTimer, delay );
more= false;
}
}
}
else
{
break;
}
}
return 0;
}
wl_simple_shell* WstSimpleShellInit( struct wl_display *display,
wayland_simple_shell_callbacks *callbacks,
void *userData )
{
struct wl_simple_shell *shell= 0;
struct wl_event_loop *loop= 0;
printf("westeros-simpleshell: WstSimpleShellInit: enter: display %p\n", display );
shell= (struct wl_simple_shell*)calloc( 1, sizeof(struct wl_simple_shell) );
if ( !shell )
{
goto exit;
}
shell->display= display;
shell->callbacks= callbacks;
shell->userData= userData;
loop= wl_display_get_event_loop(shell->display);
if ( !loop )
{
free( shell );
shell= 0;
goto exit;
}
shell->delayTimer= wl_event_loop_add_timer( loop, wstSimpleShellTimeOut, shell );
if ( !shell->delayTimer )
{
free( shell );
shell= 0;
goto exit;
}
shell->wl_simple_shell_global= wl_global_create(display, &wl_simple_shell_interface, 1, shell, wstSimpleShellBind );
exit:
printf("westeros-simpleshell: WstSimpleShellInit: exit: display %p shell %p\n", display, shell);
return shell;
}
void WstSimpleShellUninit( wl_simple_shell *shell )
{
if ( shell )
{
if ( shell->delayTimer )
{
wl_event_source_remove( shell->delayTimer );
shell->delayTimer= 0;
}
wl_global_destroy( shell->wl_simple_shell_global );
shell->pendingCreateBroadcast.clear();
shell->surfaces.clear();
shell->shells.clear();
free( shell );
}
}
void WstSimpleShellNotifySurfaceCreated( wl_simple_shell *shell, struct wl_client *client,
struct wl_resource *surface_resource, uint32_t surfaceId )
{
bool creatorNotified= false;
// Add surface to list
shell->surfaces.push_back(surfaceId);
// Provide surface creator with surfaceId
for( std::vector<ShellInfo>::iterator it= shell->shells.begin();
it != shell->shells.end();
++it )
{
if ( (*it).client == client )
{
long long now;
PendingBroadcastInfo pendingInfo;
struct wl_resource *shell_resource= (*it).resource;
wl_simple_shell_send_surface_id( shell_resource, surface_resource, surfaceId );
creatorNotified= true;
// Perform the surface creation broadcast after an asynchronous
// delay to give the surface creator time to assign a name
now= getCurrentTimeMillis();
pendingInfo.creationTime= now;
pendingInfo.surfaceId= surfaceId;
shell->pendingCreateBroadcast.push_back(pendingInfo);
if ( shell->pendingCreateBroadcast.size() == 1 )
{
wl_event_source_timer_update( shell->delayTimer, BROADCAST_DELAY );
}
break;
}
}
if ( !creatorNotified )
{
wstSimpleShellBroadcastCreation( shell, surfaceId );
}
}
void WstSimpleShellNotifySurfaceDestroyed( wl_simple_shell *shell, struct wl_client *client, uint32_t surfaceId )
{
const char *name;
WST_UNUSED(client);
// Get any name the creator may have assigned the surface
shell->callbacks->get_name( shell->userData, surfaceId, &name );
if ( !name )
{
name= (const char *)DEFAULT_NAME;
}
// Broadcast the surface destruction announcement
for( std::vector<ShellInfo>::iterator it= shell->shells.begin();
it != shell->shells.end();
++it )
{
struct wl_resource *shell_resource= (*it).resource;
wl_simple_shell_send_surface_destroyed( shell_resource, surfaceId, name );
}
// Remove surface from list
for( std::vector<uint32_t>::iterator it= shell->surfaces.begin();
it != shell->surfaces.end();
++it )
{
if ( (*it) == surfaceId )
{
shell->surfaces.erase(it);
break;
}
}
}
| 32.251969
| 126
| 0.659424
|
moorthy-bs
|
776337ab0c60c5cb11d2528f22f50a174e7683fd
| 2,147
|
hpp
|
C++
|
MainGame/settings/Settings.hpp
|
JoaoBaptMG/ReboundTheGame
|
48c3d8b81de1f7fa7c622c3f815860257ccdba8e
|
[
"MIT"
] | 63
|
2017-05-18T16:10:19.000Z
|
2022-03-26T18:05:59.000Z
|
MainGame/settings/Settings.hpp
|
JoaoBaptMG/ReboundTheGame
|
48c3d8b81de1f7fa7c622c3f815860257ccdba8e
|
[
"MIT"
] | 1
|
2018-02-10T12:40:33.000Z
|
2019-01-11T07:33:13.000Z
|
MainGame/settings/Settings.hpp
|
JoaoBaptMG/ReboundTheGame
|
48c3d8b81de1f7fa7c622c3f815860257ccdba8e
|
[
"MIT"
] | 4
|
2017-12-31T21:38:14.000Z
|
2019-11-20T15:13:00.000Z
|
//
// Copyright (c) 2016-2018 João Baptista de Paula e Silva.
//
// 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.
//
#pragma once
#include <string>
#include <vector>
#include <utility>
#include <SFML/System.hpp>
#include <OutputStream.hpp>
#include "InputSettings.hpp"
#include "VideoSettings.hpp"
#include "AudioSettings.hpp"
#include "gameplay/SavedGame.hpp"
constexpr size_t SettingsVersion = 0;
struct KeyPair
{
std::string name;
SavedGame::Key key;
KeyPair(std::string name, SavedGame::Key key) : name(name), key(key) {}
KeyPair() {}
};
struct Settings
{
InputSettings inputSettings;
VideoSettings videoSettings;
AudioSettings audioSettings;
std::string languageFile;
std::vector<KeyPair> savedKeys;
};
bool readFromStream(sf::InputStream &stream, KeyPair& keyPair);
bool writeToStream(OutputStream& stream, const KeyPair& keyPair);
bool readFromStream(sf::InputStream &stream, Settings& settings);
bool writeToStream(OutputStream& stream, const Settings& settings);
Settings loadSettingsFile(bool *success = nullptr);
bool storeSettingsFile(const Settings& settings);
| 33.546875
| 81
| 0.755007
|
JoaoBaptMG
|
776722a74f9267edf4bc43db31704a8270db44d0
| 11,618
|
cxx
|
C++
|
Src/Projects/device_faceCap/device_facecap_device.cxx
|
Mikkelbf/OpenMoBu
|
c57c41a0908ad7734d48642549758271d11263b8
|
[
"BSD-3-Clause"
] | 53
|
2018-04-21T14:16:46.000Z
|
2022-03-19T11:27:37.000Z
|
Src/Projects/device_faceCap/device_facecap_device.cxx
|
Mikkelbf/OpenMoBu
|
c57c41a0908ad7734d48642549758271d11263b8
|
[
"BSD-3-Clause"
] | 6
|
2019-06-05T16:37:29.000Z
|
2021-09-20T07:17:03.000Z
|
Src/Projects/device_faceCap/device_facecap_device.cxx
|
Mikkelbf/OpenMoBu
|
c57c41a0908ad7734d48642549758271d11263b8
|
[
"BSD-3-Clause"
] | 10
|
2019-02-22T18:43:59.000Z
|
2021-09-02T18:53:37.000Z
|
/** \file device_facecap_device.cxx
* Developed by Sergei <Neill3d> Solokhin 2019
* e-mail to: s@neill3d.com
* twitter: @Neill3d
*
* OpenMoBu github - https://github.com/Neill3d/OpenMoBu
*/
//--- Class declaration
#include "device_facecap_device.h"
//--- Registration defines
#define CDEVICEFACECAP__CLASS CDEVICEFACECAP__CLASSNAME
#define CDEVICEFACECAP__NAME CDEVICEFACECAP__CLASSSTR
#define CDEVICEFACECAP__LABEL "FaceCap OSC Device"
#define CDEVICEFACECAP__DESC "FaceCap OSC Device"
#define CDEVICEFACECAP__PREFIX "FaceCap"
//--- FiLMBOX implementation and registration
FBDeviceImplementation ( CDEVICEFACECAP__CLASS );
FBRegisterDevice ( CDEVICEFACECAP__NAME,
CDEVICEFACECAP__CLASS,
CDEVICEFACECAP__LABEL,
CDEVICEFACECAP__DESC,
"character_actor.png"); // Icon filename (default=Open Reality icon)
/************************************************
* FiLMBOX Constructor.
************************************************/
bool CDevice_FaceCap::FBCreate()
{
mHardware.SetParent( this );
FBPropertyPublish(this, SpaceScale, "Space Scale", nullptr, nullptr);
FBPropertyPublish(this, ShapeValueMult, "Shape Value Mult", nullptr, nullptr);
SpaceScale = 100.0;
ShapeValueMult = 100.0;
// Create animation nodes
mNodeHead_InT = AnimationNodeOutCreate( 0, "Translation", ANIMATIONNODE_TYPE_LOCAL_TRANSLATION );
mNodeHead_InR = AnimationNodeOutCreate( 1, "Rotation", ANIMATIONNODE_TYPE_LOCAL_ROTATION );
mNodeLeftEye_InR = AnimationNodeOutCreate(2, "LeftEye Rotation", ANIMATIONNODE_TYPE_LOCAL_ROTATION);
mNodeRightEye_InR = AnimationNodeOutCreate(3, "RightEye Rotation", ANIMATIONNODE_TYPE_LOCAL_ROTATION);
for (uint32_t i = 0; i < static_cast<uint32_t>(EHardwareBlendshapes::count); ++i)
{
mNodeHead_Blendshapes[i] = AnimationNodeOutCreate(i+4, blendshape_names[i], ANIMATIONNODE_TYPE_NUMBER);
}
// default values
mNodeHead_InT->SetCandidate(FBVector3d(0.0, 5.0, 0.0));
// Create model templates
mTemplateRoot = new FBModelTemplate( CDEVICEFACECAP__PREFIX, "Reference", kFBModelTemplateRoot );
mTemplateHead = new FBModelTemplate( CDEVICEFACECAP__PREFIX, "Head", kFBModelTemplateMarker );
mTemplateLeftEye = new FBModelTemplate(CDEVICEFACECAP__PREFIX, "LeftEye", kFBModelTemplateMarker);
mTemplateRightEye = new FBModelTemplate(CDEVICEFACECAP__PREFIX, "RightEye", kFBModelTemplateMarker);
// Build model template hierarchy
ModelTemplate.Children.Add(mTemplateRoot);
mTemplateRoot->Children.Add(mTemplateHead);
mTemplateHead->Children.Add(mTemplateLeftEye);
mTemplateHead->Children.Add(mTemplateRightEye);
// Bind the model templates (if applicable) to device's animation nodes
mTemplateHead->Bindings.Add( mNodeHead_InR );
mTemplateHead->Bindings.Add( mNodeHead_InT );
mTemplateLeftEye->Bindings.Add(mNodeLeftEye_InR);
mTemplateRightEye->Bindings.Add(mNodeRightEye_InR);
mTemplateHead->DefaultTranslation = FBVector3d(0.0, 5.0, 0.0);
mTemplateLeftEye->DefaultTranslation = FBVector3d(-5.0, 5.0, 0.0);
mTemplateRightEye->DefaultTranslation = FBVector3d(5.0, 5.0, 0.0);
// Set sampling rate to 60 Hz
FBTime lPeriod;
lPeriod.SetSecondDouble(1.0/60.0);
SamplingPeriod = lPeriod;
CommType = kFBCommTypeNetworkUDP;
mSetCandidate = false;
return true;
}
/************************************************
* FiLMBOX Destructor.
************************************************/
void CDevice_FaceCap::FBDestroy()
{
}
/************************************************
* Device operation.
************************************************/
bool CDevice_FaceCap::DeviceOperation( kDeviceOperations pOperation )
{
switch (pOperation)
{
case kOpInit: return Init();
case kOpStart: return Start();
case kOpStop: return Stop();
case kOpReset: return Reset();
case kOpDone: return Done();
}
return FBDevice::DeviceOperation( pOperation );
}
/************************************************
* Initialization of device.
************************************************/
bool CDevice_FaceCap::Init()
{
FBProgress lProgress;
lProgress.Caption = "Device Template";
lProgress.Text = "Initializing device...";
return true;
}
/************************************************
* Device is put online.
************************************************/
bool CDevice_FaceCap::Start()
{
FBProgress lProgress;
lProgress.Caption = "Starting up device";
// Step 1: Open device communications
lProgress.Text = "Opening device communications";
Status = "Opening device communications";
if(!mHardware.Open())
{
Status = "Could not open device";
return false;
}
// Step 2: Ask hardware to get channel information
lProgress.Text = "Device found, getting setup information";
Status = "Getting setup information";
if(!mHardware.GetSetupInfo())
{
Status = "Could not get setup information from device.";
return false;
}
else
{
HardwareVersionInfo = "Device Template, v1.0";
Information = "";
}
if( mHardware.GetStreaming() )
{
// Step 3: Start streaming data from device
lProgress.Text = "Sending START STREAM command";
Status = "Starting device streaming";
if(!mHardware.StartStream())
{
Status = "Could not start stream mode";
return false;
}
}
Status = "Ok";
return true;
}
/************************************************
* Device is stopped (offline).
************************************************/
bool CDevice_FaceCap::Stop()
{
FBProgress lProgress;
lProgress.Caption = "Shutting down device";
if( mHardware.GetStreaming() )
{
// Step 1: Stop streaming data
lProgress.Text = "Sending STOP STREAM command";
Status = "Stopping device streaming";
if(!mHardware.StopStream())
{
Status = "Could not stop streaming";
return false;
}
}
// Step 1: Stop streaming data
lProgress.Text = "Stopping device communications";
Status = "Stopping device communications";
if(!mHardware.Close())
{
Status = "Could not close device";
return false;
}
Status = "?";
return false;
}
/************************************************
* Removal of device.
************************************************/
bool CDevice_FaceCap::Done()
{
return false;
}
/************************************************
* Reset of device.
************************************************/
bool CDevice_FaceCap::Reset()
{
Stop();
return Start();
}
/************************************************
* Real-Time Engine Evaluation.
************************************************/
bool CDevice_FaceCap::AnimationNodeNotify(FBAnimationNode* pAnimationNode ,FBEvaluateInfo* pEvaluateInfo)
{
double lPos[3];
double lRot[3];
const double space_scale = 0.01 * SpaceScale;
// head position and rotation
mHardware.GetPosition( lPos );
mHardware.GetRotation( lRot );
for (int i = 0; i < 3; ++i)
{
lPos[i] *= space_scale;
}
mNodeHead_InT->WriteData( lPos, pEvaluateInfo );
mNodeHead_InR->WriteData( lRot, pEvaluateInfo );
// left eye
mHardware.GetLeftEyeRotation(lRot);
lRot[2] = 0.0;
mNodeLeftEye_InR->WriteData(lRot, pEvaluateInfo);
// right eye
mHardware.GetRightEyeRotation(lRot);
lRot[2] = 0.0;
mNodeRightEye_InR->WriteData(lRot, pEvaluateInfo);
// blendshapes
for (int i = 0; i < mHardware.GetNumberOfBlendshapes(); ++i)
{
double value = ShapeValueMult * mHardware.GetBlendshapeValue(i);
mNodeHead_Blendshapes[i]->WriteData(&value, pEvaluateInfo);
}
return true;
}
/************************************************
* Device Evaluation Notify.
************************************************/
bool CDevice_FaceCap::DeviceEvaluationNotify( kTransportMode pMode, FBEvaluateInfo* pEvaluateInfo )
{
return true;
}
/************************************************
* Real-Time Synchronous Device IO.
************************************************/
void CDevice_FaceCap::DeviceIONotify( kDeviceIOs pAction,FBDeviceNotifyInfo &pDeviceNotifyInfo)
{
int i;
int lNumberOfPackets;
FBTime lPacketTimeCode;
switch (pAction)
{
// Output devices
case kIOPlayModeWrite:
case kIOStopModeWrite:
{
}
break;
// Input devices
case kIOStopModeRead:
case kIOPlayModeRead:
{
lNumberOfPackets = mHardware.FetchData();
for( i=0; i<lNumberOfPackets; i++ )
{
DeviceRecordFrame ( pDeviceNotifyInfo );
AckOneSampleReceived( );
}
if( !mHardware.GetStreaming() )
{
mHardware.PollData();
}
break;
}
}
}
/************************************************
* Record a frame of the device (recording).
************************************************/
void CDevice_FaceCap::DeviceRecordFrame( FBDeviceNotifyInfo &pDeviceNotifyInfo )
{
double lPos[3];
double lRot[3];
FBTime lTime;
const double space_scale = 0.01 * SpaceScale;
lTime = pDeviceNotifyInfo.GetLocalTime();
//
if( mPlayerControl.GetTransportMode() == kFBTransportPlay )
{
mHardware.GetPosition(lPos);
mHardware.GetRotation(lRot);
for (int i = 0; i < 3; ++i)
{
lPos[i] *= space_scale;
}
switch( SamplingMode )
{
case kFBHardwareTimestamp:
case kFBSoftwareTimestamp:
{
if (FBAnimationNode* data = mNodeHead_InT->GetAnimationToRecord())
{
data->KeyAdd(lTime, lPos);
}
if (FBAnimationNode* data = mNodeHead_InR->GetAnimationToRecord())
{
data->KeyAdd(lTime, lRot);
}
if (FBAnimationNode* data = mNodeLeftEye_InR->GetAnimationToRecord())
{
mHardware.GetLeftEyeRotation(lRot);
lRot[2] = 0.0;
data->KeyAdd(lTime, lRot);
}
if (FBAnimationNode* data = mNodeRightEye_InR->GetAnimationToRecord())
{
mHardware.GetRightEyeRotation(lRot);
lRot[2] = 0.0;
data->KeyAdd(lTime, lRot);
}
for (int i = 0; i < mHardware.GetNumberOfBlendshapes(); ++i)
{
if (FBAnimationNode* data = mNodeHead_Blendshapes[i]->GetAnimationToRecord())
{
double value = ShapeValueMult * mHardware.GetBlendshapeValue(i);
data->KeyAdd(lTime, &value);
}
}
}
break;
case kFBHardwareFrequency:
case kFBAutoFrequency:
{
if (FBAnimationNode* data = mNodeHead_InT->GetAnimationToRecord())
{
data->KeyAdd(lPos);
}
if (FBAnimationNode* data = mNodeHead_InR->GetAnimationToRecord())
{
data->KeyAdd(lRot);
}
if (FBAnimationNode* data = mNodeLeftEye_InR->GetAnimationToRecord())
{
mHardware.GetLeftEyeRotation(lRot);
lRot[2] = 0.0;
data->KeyAdd(lRot);
}
if (FBAnimationNode* data = mNodeRightEye_InR->GetAnimationToRecord())
{
mHardware.GetRightEyeRotation(lRot);
lRot[2] = 0.0;
data->KeyAdd(lRot);
}
for (int i = 0; i < mHardware.GetNumberOfBlendshapes(); ++i)
{
if (FBAnimationNode* data = mNodeHead_Blendshapes[i]->GetAnimationToRecord())
{
double value = ShapeValueMult * mHardware.GetBlendshapeValue(i);
data->KeyAdd(&value);
}
}
}
break;
}
}
}
void CDevice_FaceCap::SetCandidates()
{
double lPos[3];
double lRot[3];
mHardware.GetPosition( lPos );
mHardware.GetRotation( lRot );
const double space_scale = 0.01 * SpaceScale;
for (int i = 0; i < 3; ++i)
{
lPos[i] *= space_scale;
}
mNodeHead_InT->SetCandidate( lPos );
mNodeHead_InR->SetCandidate( lRot );
// left / right eyes
mHardware.GetLeftEyeRotation(lRot);
lRot[2] = 0.0;
mNodeLeftEye_InR->SetCandidate(lRot);
mHardware.GetRightEyeRotation(lRot);
lRot[2] = 0.0;
mNodeRightEye_InR->SetCandidate(lRot);
// blendshapes
for (int i = 0; i < mHardware.GetNumberOfBlendshapes(); ++i)
{
double value = ShapeValueMult * mHardware.GetBlendshapeValue(i);
mNodeHead_Blendshapes[i]->SetCandidate(&value);
}
}
| 24.771855
| 105
| 0.637545
|
Mikkelbf
|
777305d41cb6005d0343a95e544d96e23a2161e2
| 5,301
|
hpp
|
C++
|
libcore/include/sirikata/core/options/CommonOptions.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | 1
|
2016-05-09T03:34:51.000Z
|
2016-05-09T03:34:51.000Z
|
libcore/include/sirikata/core/options/CommonOptions.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | null | null | null |
libcore/include/sirikata/core/options/CommonOptions.hpp
|
pathorn/sirikata
|
5d366a822ef2fb57cd9f64cc4f6085c0a635fdfa
|
[
"BSD-3-Clause"
] | null | null | null |
/* Sirikata
* CommonOptions.hpp
*
* Copyright (c) 2009, Ewen Cheslack-Postava
* 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 Sirikata 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 _SIRIKATA_COMMON_OPTIONS_HPP_
#define _SIRIKATA_COMMON_OPTIONS_HPP_
#include <sirikata/core/util/Platform.hpp>
#define OPT_CRASHREPORT_URL "crashreport"
#define OPT_PLUGINS "plugins"
#define OPT_LOG_FILE "log-file"
#define STATS_TRACE_FILE "stats.trace-filename"
#define PROFILE "profile"
#define OPT_REGION_WEIGHT "region-weight"
#define OPT_REGION_WEIGHT_ARGS "region-weight-args"
#define OPT_CDN_HOST "cdn.host"
#define OPT_CDN_SERVICE "cdn.service"
#define OPT_CDN_DNS_URI_PREFIX "cdn.dns.prefix"
#define OPT_CDN_DOWNLOAD_URI_PREFIX "cdn.download.prefix"
#define OPT_TRACE_TIMESERIES "trace.timeseries"
#define OPT_TRACE_TIMESERIES_OPTIONS "trace.timeseries-options"
namespace Sirikata {
/// Report version information to the log
SIRIKATA_FUNCTION_EXPORT void ReportVersion();
SIRIKATA_FUNCTION_EXPORT void InitOptions();
SIRIKATA_FUNCTION_EXPORT void ParseOptions(int argc, char** argv);
SIRIKATA_FUNCTION_EXPORT void ParseOptionsFile(const String& fname, bool required=true);
/** Parse command line options and config files, ensuring the command line
* arguments take priority but reading the config file from an option rather
* than hard coding it.
*/
SIRIKATA_FUNCTION_EXPORT void ParseOptions(int argc, char** argv, const String& config_file_option);
// Parses empty options to get options properly initialized
SIRIKATA_FUNCTION_EXPORT void FakeParseOptions();
/// Fills in
SIRIKATA_FUNCTION_EXPORT void FillMissingOptionDefaults();
// Be careful with GetOption. Using it and ->as() directly can be dangerous
// because some types are defined per-library and won't dynamic_cast properly.
// It is suggested that you use GetOptionValue where possible.
SIRIKATA_FUNCTION_EXPORT OptionValue* GetOption(const char* name);
SIRIKATA_FUNCTION_EXPORT OptionValue* GetOption(const char* klass, const char* name);
template<typename T>
T GetOptionValue(const char* name) {
OptionValue* opt = GetOption(name);
return opt->as<T>();
}
template<typename T>
T GetOptionValue(const char* klass, const char* name) {
OptionValue* opt = GetOption(klass, name);
return opt->unsafeAs<T>(); // FIXME should be ->as<T>();
}
template<>
SIRIKATA_FUNCTION_EXPORT String GetOptionValue<String>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT Vector3f GetOptionValue<Vector3f>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT Vector3ui32 GetOptionValue<Vector3ui32>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT BoundingBox3f GetOptionValue<BoundingBox3f>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT ObjectHostID GetOptionValue<ObjectHostID>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT Task::DeltaTime GetOptionValue<Task::DeltaTime>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT uint32 GetOptionValue<uint32>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT int32 GetOptionValue<int32>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT uint64 GetOptionValue<uint64>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT int64 GetOptionValue<int64>(const char* name);
template<>
SIRIKATA_FUNCTION_EXPORT bool GetOptionValue<bool>(const char* name);
SIRIKATA_FUNCTION_EXPORT String GetPerServerString(const String& orig, const ServerID& sid);
/** Get an option which is a filename and modify it to be server specific. */
SIRIKATA_FUNCTION_EXPORT String GetPerServerFile(const char* opt_name, const ServerID& sid);
SIRIKATA_FUNCTION_EXPORT String GetPerServerFile(const char* opt_name, const ObjectHostID& ohid);
} // namespace Sirikata
#endif //_SIRIKATA_COMMON_OPTIONS_HPP_
| 40.776923
| 100
| 0.776646
|
pathorn
|
a55cdb5b46324a3125bcb3c81828b3cb4522773e
| 3,730
|
hpp
|
C++
|
ysu/node/bootstrap/bootstrap_attempt.hpp
|
lik2129/ysu_coin
|
47e40ed5d4000fc59566099929bd08a9ae16a4c1
|
[
"BSD-3-Clause"
] | null | null | null |
ysu/node/bootstrap/bootstrap_attempt.hpp
|
lik2129/ysu_coin
|
47e40ed5d4000fc59566099929bd08a9ae16a4c1
|
[
"BSD-3-Clause"
] | null | null | null |
ysu/node/bootstrap/bootstrap_attempt.hpp
|
lik2129/ysu_coin
|
47e40ed5d4000fc59566099929bd08a9ae16a4c1
|
[
"BSD-3-Clause"
] | null | null | null |
#pragma once
#include <ysu/node/bootstrap/bootstrap.hpp>
#include <atomic>
#include <future>
namespace ysu
{
class node;
class frontier_req_client;
class bulk_push_client;
class bootstrap_attempt : public std::enable_shared_from_this<bootstrap_attempt>
{
public:
explicit bootstrap_attempt (std::shared_ptr<ysu::node> node_a, ysu::bootstrap_mode mode_a, uint64_t incremental_id_a, std::string id_a);
virtual ~bootstrap_attempt ();
virtual void run () = 0;
virtual void stop ();
bool still_pulling ();
void pull_started ();
void pull_finished ();
bool should_log ();
std::string mode_text ();
virtual void restart_condition ();
virtual void add_frontier (ysu::pull_info const &);
virtual void add_bulk_push_target (ysu::block_hash const &, ysu::block_hash const &);
virtual bool request_bulk_push_target (std::pair<ysu::block_hash, ysu::block_hash> &);
virtual void add_recent_pull (ysu::block_hash const &);
virtual void lazy_start (ysu::hash_or_account const &, bool confirmed = true);
virtual void lazy_add (ysu::pull_info const &);
virtual void lazy_requeue (ysu::block_hash const &, ysu::block_hash const &, bool);
virtual uint32_t lazy_batch_size ();
virtual bool lazy_has_expired () const;
virtual bool lazy_processed_or_exists (ysu::block_hash const &);
virtual bool process_block (std::shared_ptr<ysu::block>, ysu::account const &, uint64_t, ysu::bulk_pull::count_t, bool, unsigned);
virtual void requeue_pending (ysu::account const &);
virtual void wallet_start (std::deque<ysu::account> &);
virtual size_t wallet_size ();
virtual void get_information (boost::property_tree::ptree &) = 0;
std::mutex next_log_mutex;
std::chrono::steady_clock::time_point next_log{ std::chrono::steady_clock::now () };
std::atomic<unsigned> pulling{ 0 };
std::shared_ptr<ysu::node> node;
std::atomic<uint64_t> total_blocks{ 0 };
std::atomic<unsigned> requeued_pulls{ 0 };
std::atomic<bool> started{ false };
std::atomic<bool> stopped{ false };
uint64_t incremental_id{ 0 };
std::string id;
std::chrono::steady_clock::time_point attempt_start{ std::chrono::steady_clock::now () };
std::atomic<bool> frontiers_received{ false };
std::atomic<bool> frontiers_confirmed{ false };
ysu::bootstrap_mode mode;
std::mutex mutex;
ysu::condition_variable condition;
};
class bootstrap_attempt_legacy : public bootstrap_attempt
{
public:
explicit bootstrap_attempt_legacy (std::shared_ptr<ysu::node> node_a, uint64_t incremental_id_a, std::string id_a = "");
void run () override;
bool consume_future (std::future<bool> &);
void stop () override;
bool request_frontier (ysu::unique_lock<std::mutex> &, bool = false);
void request_pull (ysu::unique_lock<std::mutex> &);
void request_push (ysu::unique_lock<std::mutex> &);
void add_frontier (ysu::pull_info const &) override;
void add_bulk_push_target (ysu::block_hash const &, ysu::block_hash const &) override;
bool request_bulk_push_target (std::pair<ysu::block_hash, ysu::block_hash> &) override;
void add_recent_pull (ysu::block_hash const &) override;
void run_start (ysu::unique_lock<std::mutex> &);
void restart_condition () override;
void attempt_restart_check (ysu::unique_lock<std::mutex> &);
bool confirm_frontiers (ysu::unique_lock<std::mutex> &);
void get_information (boost::property_tree::ptree &) override;
ysu::tcp_endpoint endpoint_frontier_request;
std::weak_ptr<ysu::frontier_req_client> frontiers;
std::weak_ptr<ysu::bulk_push_client> push;
std::deque<ysu::pull_info> frontier_pulls;
std::deque<ysu::block_hash> recent_pulls_head;
std::vector<std::pair<ysu::block_hash, ysu::block_hash>> bulk_push_targets;
std::atomic<unsigned> account_count{ 0 };
std::atomic<bool> frontiers_confirmation_pending{ false };
};
}
| 42.386364
| 137
| 0.755496
|
lik2129
|
a55dae0c5398b8b49004260c69bd3c2064099154
| 4,726
|
cpp
|
C++
|
src/object_detection.cpp
|
urastogi885/Supermarket-Cleaning-Robot
|
4d7b910458b73cba1c0efaf580e5f4b44ac0246a
|
[
"MIT"
] | 4
|
2020-05-26T15:53:07.000Z
|
2021-03-09T20:35:55.000Z
|
src/object_detection.cpp
|
urastogi885/supermarket-cleaning-robot
|
4d7b910458b73cba1c0efaf580e5f4b44ac0246a
|
[
"MIT"
] | 2
|
2020-12-23T04:39:41.000Z
|
2020-12-23T04:42:36.000Z
|
src/object_detection.cpp
|
urastogi885/supermarket-cleaning-robot
|
4d7b910458b73cba1c0efaf580e5f4b44ac0246a
|
[
"MIT"
] | 5
|
2020-07-03T14:03:53.000Z
|
2022-01-20T13:59:59.000Z
|
/**
* BSD 3-Clause License
*
* @copyright (c) 2019, Umang Rastogi Naman Gupta
* 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 copyright holder 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 HOLDER 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.
*/
/**
* @file object_detection.cpp
* @author Umang Rastogi - Driver
* @author Naman Gupta - Navigator
* @brief File to implement ObjectDetection class
* @detail Implements object detection using HSV method which detects color of
* the can in a certain range and creates a bounding box over it.
*/
#include "ros/ros.h"
#include "sensor_msgs/Image.h"
#include "cv_bridge/cv_bridge.h"
#include "object_detection/object_detection.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
ObjectDetection::ObjectDetection() {
ROS_INFO_STREAM("Initiliazing obejct detection...");
/// Subscribe to turtlebot camera to get feed from the camera
subscribeImages = nh.subscribe("/camera/rgb/image_raw", 1,
&ObjectDetection::convertImage, this);
ROS_INFO_STREAM("Object detection set up complete");
}
void ObjectDetection::convertImage(const
sensor_msgs::Image::ConstPtr& imageData) {
/// Create an object cv_ptr that bridges the ROS image and OpenCV image
cv_bridge::CvImagePtr cv_ptr;
try {
cv_ptr = cv_bridge::toCvCopy(imageData, sensor_msgs::image_encodings::BGR8);
convertedImage = cv_ptr->image;
/// Wait for 30ms
cv::waitKey(30);
}
catch (cv_bridge::Exception& e) {
ROS_ERROR_STREAM("cv_bridge exception: " << e.what());
return;
}
}
bool ObjectDetection::detectObject(cv::Mat image) {
/// Image conversion from BGR to HSV
cv::cvtColor(image, hsvImage, CV_BGR2HSV);
/// Detect hsv within the set limits
cv::inRange(hsvImage, colorLowerLimit, colorUpperLimit, maskImage);
/// Get image size to modify size of mask image
imageSize = image.size();
maskImage(cv::Rect(0, 0, imageSize.width, 0.8*imageSize.height)) = 0;
/// Find contours for better visualization
cv::findContours(maskImage, imageArray, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
/// Check if contours exist in the image
if (imageArray.size() != 0) {
auto contourSize = 0;
auto maxAreaContour = 0;
auto count = 0;
while (count < imageArray.size()) {
/// Find contour with maximum area
if (contourSize < imageArray[count].size()) {
maxAreaContour = count;
contourSize = imageArray[count].size();
}
count++;
}
/// Set boundary of the object in the image
setObjectBoundary(cv::boundingRect(imageArray[maxAreaContour]));
/// Draw the rectangle using the bounding box
rectangle(image, getObjectBoundary(), cv::Scalar(0, 255, 0), 2);
}
/// Mask image to limit the future turns affecting the output
maskImage(cv::Rect(0, 0, 0.3*imageSize.width, imageSize.height)) = 0;
if (cv::countNonZero(maskImage) == 0) {
setObjectDetected(true);
} else {
setObjectDetected(false);
}
cv::namedWindow("HSVImage");
cv::namedWindow("Turtlebot View");
imshow("HSVImage", hsvImage);
imshow("Turtlebot View", image);
return getObjectDetected();
}
cv::Mat ObjectDetection::applyGaussBlur(cv::Mat cvtImage) {
cv::Mat output;
/// Apply gaussian filter
cv::GaussianBlur(cvtImage, output, cv::Size(3, 3), 0.1, 0.1);
return output;
}
ObjectDetection::~ObjectDetection() {}
| 39.383333
| 81
| 0.724291
|
urastogi885
|
a56003e1f0d6423a7ed96b89bac370a374f70cbc
| 74,166
|
cpp
|
C++
|
Market/Market.cpp
|
MichaelXanth/RPG_Game
|
4ce98fb2b03719dbd026afea7e270b623b09b2a0
|
[
"MIT"
] | 3
|
2020-06-22T16:21:03.000Z
|
2020-07-05T12:10:29.000Z
|
Market/Market.cpp
|
MichaelXanth/RPG_Game
|
4ce98fb2b03719dbd026afea7e270b623b09b2a0
|
[
"MIT"
] | null | null | null |
Market/Market.cpp
|
MichaelXanth/RPG_Game
|
4ce98fb2b03719dbd026afea7e270b623b09b2a0
|
[
"MIT"
] | null | null | null |
/* File: Market.cpp */
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits>
#include <unistd.h>
#include "../Input_Validation/Input_Validation.hpp"
#include "../Items/Armor.hpp"
#include "../Items/Potion.hpp"
#include "../Items/Weapon.hpp"
#include "../Living/Heroes/Hero.hpp"
#include "../Spells/FireSpell.hpp"
#include "../Spells/IceSpell.hpp"
#include "../Spells/LightingSpell.hpp"
#include "../Spells/Spell.hpp"
#include "Market.hpp"
using namespace std;
void Market::RecalcMostItems(void)
{
mostItems = 0;
if (mostItems < lightingSpellsArray.size())
mostItems = lightingSpellsArray.size();
if (mostItems < fireSpellsArray.size())
mostItems = fireSpellsArray.size();
if (mostItems < iceSpellsArray.size())
mostItems = iceSpellsArray.size();
if (mostItems < weaponsArray.size())
mostItems = weaponsArray.size();
if (mostItems < potionsArray.size())
mostItems = potionsArray.size();
if (mostItems < armorsArray.size())
mostItems = armorsArray.size();
}
void Market::ResetForSaleProds(void)
{
lightingSpellsForSale = 0;
fireSpellsForSale = 0;
iceSpellsForSale = 0;
weaponsForSale = 0;
potionsForSale = 0;
armorsForSale = 0;
}
bool Market::isValidForPurchase(string testSelections[], int& column, int& row, const int& buyState)
{
if (!isValid(testSelections[0].c_str(),column,0,6))
return false;
if (!isNumeric(testSelections[1].c_str(),row))
return false;
if (buyState == 0 && column > 3) {
if (weaponsForSale || potionsForSale || armorsForSale)
cerr << endl << "\033[35mWarning:\033[0m There are no more available Item slots." << endl;
else
cerr << endl << "\033[35mWarning:\033[0m Sorry, there are no available Items for sale." << endl;
return false;
}
if (buyState == 1 && column < 4) {
if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale)
cerr << endl << "\033[35mWarning:\033[0m There are no more available Spell slots." << endl;
else
cerr << endl << "\033[35mWarning:\033[0m Sorry, there are no available Spells for sale." << endl;
return false;
}
switch(column)
{
case 1:
if (row == 0 || row > iceSpellsForSale) {
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
case 2:
if (row == 0 || row > fireSpellsForSale) {
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
case 3:
if (row == 0 || row > lightingSpellsForSale) {
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
case 4:
if (row == 0 || row > weaponsForSale){
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
case 5:
if (row == 0 || row > armorsForSale) {
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
case 6:
if (row == 0 || row > potionsForSale) {
cerr << "\n\033[31mError:\033[0m The input is invalid." << endl;
cerr << "Please, try again!" << endl << endl;
return false;
}
break;
}
return true;
}
Market::Market() : lightingSpellsForSale(0), fireSpellsForSale(0) , iceSpellsForSale(0),
weaponsForSale(0) , potionsForSale(0) , armorsForSale(0) ,
minSpellPrice(INT32_MAX), minItemPrice(INT32_MAX), minPrice(INT32_MAX),
mostItems(0) , prevLevel(0)
{
AddLightingSpells(10);
AddFireSpells(10);
AddIceSpells(10);
AddWeapons(10);
AddPotions(10);
AddArmors(10);
}
Market::~Market()
{
for (int i = iceSpellsArray.size(); !iceSpellsArray.empty(); i--) {
delete iceSpellsArray[i-1];
iceSpellsArray.erase(iceSpellsArray.begin() + i-1);
}
for (int i = fireSpellsArray.size(); !fireSpellsArray.empty(); i--) {
delete fireSpellsArray[i-1];
fireSpellsArray.erase(fireSpellsArray.begin() + i-1);
}
for (int i = lightingSpellsArray.size(); !lightingSpellsArray.empty(); i--) {
delete lightingSpellsArray[i-1];
lightingSpellsArray.erase(lightingSpellsArray.begin() + i-1);
}
for (int i = weaponsArray.size(); !weaponsArray.empty(); i--) {
delete weaponsArray[i-1];
weaponsArray.erase(weaponsArray.begin() + i-1);
}
for (int i = armorsArray.size(); !armorsArray.empty(); i--) {
delete armorsArray[i-1];
armorsArray.erase(armorsArray.begin() + i-1);
}
for (int i = potionsArray.size(); !potionsArray.empty(); i--) {
delete potionsArray[i-1];
potionsArray.erase(potionsArray.begin() + i-1);
}
}
void Market::AddLightingSpells(const int& num)
{
string spellName;
LightingSpell* tmpLightingSpell;
for (int i = 0; i < num; i++)
{
unsigned int level;
int tmpMinDamage;
int tmpMaxDamage;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
spellName = name.lightingSpellsNames[rand() % name.lightingSpellsNames.size()];
do {
tmpMinDamage = ((rand() % 2) + 2) * level;
tmpMaxDamage = ((rand() % 4) + 2) * level;
} while(tmpMinDamage == tmpMaxDamage);
if (tmpMaxDamage < tmpMinDamage) {
int temp = tmpMinDamage;
tmpMinDamage = tmpMaxDamage;
tmpMaxDamage = temp;
}
tmpLightingSpell = new LightingSpell(spellName , ((rand() % 2) + 3) * level, (rand() % 4) + 1 , level, tmpMinDamage , tmpMaxDamage,
((rand() % 4) + 1) * level , (unsigned int)((rand() % 6) + 1) * ((level / 25) + 1));
lightingSpellsArray.push_back(tmpLightingSpell);
if (minSpellPrice > tmpLightingSpell->GetPrice())
minSpellPrice = tmpLightingSpell->GetPrice();
}
if (mostItems < lightingSpellsArray.size())
mostItems = lightingSpellsArray.size();
if (minPrice > minSpellPrice)
minPrice = minSpellPrice;
}
void Market::AddFireSpells(const int& num)
{
string spellName;
FireSpell* tmpFireSpell;
for (int i = 0; i < num; i++)
{
unsigned int level;
int tmpMinDamage;
int tmpMaxDamage;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
spellName = name.fireSpellsNames[rand() % name.fireSpellsNames.size()];
do {
tmpMinDamage = ((rand() % 2) + 2) * level;
tmpMaxDamage = ((rand() % 4) + 2) * level;
} while(tmpMinDamage == tmpMaxDamage);
if (tmpMaxDamage < tmpMinDamage)
{
int temp = tmpMinDamage;
tmpMinDamage = tmpMaxDamage;
tmpMaxDamage = temp;
}
tmpFireSpell = new FireSpell(spellName , ((rand() % 2) + 3) * level, (rand() % 4) + 1 , level, tmpMinDamage , tmpMaxDamage,
((rand() % 4) + 1) * level , (unsigned int)((3.0 / 2.0) * level));
fireSpellsArray.push_back(tmpFireSpell);
if (minSpellPrice > tmpFireSpell->GetPrice())
minSpellPrice = tmpFireSpell->GetPrice();
}
if (mostItems < fireSpellsArray.size())
mostItems = fireSpellsArray.size();
if (minPrice > minSpellPrice)
minPrice = minSpellPrice;
}
void Market::AddIceSpells(const int& num)
{
string spellName;
IceSpell* tmpIceSpell;
for (int i = 0; i < num; i++)
{
unsigned int level;
int tmpMinDamage;
int tmpMaxDamage;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
spellName = name.iceSpellsNames[rand() % name.iceSpellsNames.size()];
do {
tmpMinDamage = ((rand() % 2) + 2) * level;
tmpMaxDamage = ((rand() % 4) + 2) * level;
} while(tmpMinDamage == tmpMaxDamage);
if (tmpMaxDamage < tmpMinDamage)
{
int temp = tmpMinDamage;
tmpMinDamage = tmpMaxDamage;
tmpMaxDamage = temp;
}
tmpIceSpell = new IceSpell(spellName , ((rand() % 2) + 3) * level, (rand() % 4) + 1 , level, tmpMinDamage , tmpMaxDamage,
((rand() % 4) + 1) * level , ((rand() % 2) + 1) * level);
iceSpellsArray.push_back(tmpIceSpell);
if (minSpellPrice > tmpIceSpell->GetPrice())
minSpellPrice = tmpIceSpell->GetPrice();
}
if (mostItems < iceSpellsArray.size())
mostItems = iceSpellsArray.size();
if (minPrice > minSpellPrice)
minPrice = minSpellPrice;
}
void Market::AddWeapons(const int& num)
{
string weaponName;
Weapon* tmpWeapon;
for (int i = 0; i < num; i++)
{
unsigned int level;
bool hand = rand() % 2;
int wdamage;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
weaponName = name.weaponsNames[rand() % name.weaponsNames.size()];
wdamage = (unsigned int)((hand + 1.0) * level * ((double)(rand() % 2) + 1) / 2.0);
tmpWeapon = new Weapon(weaponName , ((rand() % 2) + 3) * level , level , wdamage , hand);
weaponsArray.push_back(tmpWeapon);
if (minItemPrice > tmpWeapon->GetPrice())
minItemPrice = tmpWeapon->GetPrice();
}
if (mostItems < weaponsArray.size())
mostItems = weaponsArray.size();
if (minPrice > minItemPrice)
minPrice = minItemPrice;
}
void Market::AddPotions(const int& num)
{
string potionName;
Potion* tmpPotion;
for (int i = 0; i < num; i++)
{
unsigned int level;
float posibility;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
potionName = name.potionsNames[rand() % name.potionsNames.size()];
if ((double)(posibility = rand() % 100) < 100.0 / 3)
tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , (unsigned int)(((rand() % 6) + 1.0) * (level / 10.0) + 1) , 0 , 0);
else if ((double)posibility < 200.0 / 3)
tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , 0 , (unsigned int)(((rand() % 6) + 1.0) * (level / 10.0) + 1) , 0);
else
tmpPotion = new Potion(potionName , ((rand() % 2) + 2) * level , level , 0 , 0 , (float)(3.0 * ((level / 25.0) + 1)) / 100.0);
potionsArray.push_back(tmpPotion);
if (minItemPrice > tmpPotion->GetPrice())
minItemPrice = tmpPotion->GetPrice();
}
if (mostItems < potionsArray.size())
mostItems = potionsArray.size();
if (minPrice > minItemPrice)
minPrice = minItemPrice;
}
void Market::AddArmors(const int& num)
{
string armorName;
Armor* tmpArmor;
for (int i = 0; i < num; i++)
{
unsigned int level;
if ( ((double)rand() / RAND_MAX) < 0.7 )
level = rand() % 30 + 1;
else
level = rand() % 70 + 31;
armorName = name.armorsNames[rand() % name.armorsNames.size()];
tmpArmor = new Armor(armorName , ((rand() % 2) + 3) * level , level , (unsigned int)(level * (4.0 / 2.0)));
armorsArray.push_back(tmpArmor);
if (minItemPrice > tmpArmor->GetPrice())
minItemPrice = tmpArmor->GetPrice();
}
if (mostItems < armorsArray.size())
mostItems = armorsArray.size();
if (minPrice > minItemPrice)
minPrice = minItemPrice;
}
void Market::NewStuff(vector<Hero *>& heroes)
{
if (heroes.size() == 1)
{
if (heroes[0]->Living::GetLevel() < prevLevel + 2)
return;
prevLevel = heroes[0]->Living::GetLevel();
} else {
unsigned int averageLevel = 0;
for (unsigned int i = 0; i < heroes.size(); i++)
averageLevel += heroes[i]->Living::GetLevel();
averageLevel /= heroes.size();
if (averageLevel < prevLevel + 2)
return;
prevLevel = averageLevel;
}
if (rand() % prevLevel < prevLevel / 6)
AddLightingSpells(rand() % 10);
if (rand() % prevLevel < prevLevel / 6)
AddFireSpells(rand() % 10);
if (rand() % prevLevel < prevLevel / 6)
AddIceSpells(rand() % 10);
if (rand() % prevLevel < prevLevel / 6)
AddWeapons(rand() % 10);
if (rand() % prevLevel < prevLevel / 6)
AddPotions(rand() % 10);
if (rand() % prevLevel < prevLevel / 6)
AddArmors(rand() % 10);
}
int Market::isAbleToBuy(const Hero* hero, const bool& info = true)
{
int buyState = 2;
bool found = false;
if (hero->GetMoney() == 0) {
if (info) {
if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {
DisplayMarket(false, hero, 3);
cerr << endl;
cerr << "-------------------------------" << endl << endl;
cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m has no money. The minimum required amount is: " << minPrice << endl;
usleep(2500000);
} else
cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m has no money. The minimum required amount is: " << minPrice << endl;
}
return -1;
}
if (hero->GetMoney() < minPrice) {
if (info) {
if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {
DisplayMarket(false,hero,3);
cerr << endl;
cerr << "-------------------------------" << endl << endl;
cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
usleep(2500000);
} else
cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
}
return -1;
}
if (hero->GetAvailableItemSlots() == 0 || hero->GetMoney() < minItemPrice) {
if (hero->GetAvailableSpellSlots() == 0 || hero->GetMoney() < minSpellPrice) {
if (info) {
if (lightingSpellsForSale || fireSpellsForSale || iceSpellsForSale || weaponsForSale || potionsForSale || armorsForSale) {
DisplayMarket(false,hero,3);
cerr << endl;
cerr << "-------------------------------" << endl << endl;
cerr << "\033[35mWarning:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have any other available Item and Spell slots." << endl;
usleep(2500000);
} else
cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have enough money. The minimum required amount is: " << minPrice << endl;
}
return -1;
}
buyState = 0; //Means that he can buy Spells only
} else if (hero->GetAvailableSpellSlots() == 0 || hero->GetMoney() < minSpellPrice) {
buyState = 1; //Means that he can buy Items only
}
if (buyState != 1) {
unsigned int i;
for (i = 0; i < iceSpellsArray.size() && !canBeBought(iceSpellsArray[i],hero); i++)
;
if (i < iceSpellsArray.size())
found = true;
for (i = 0; i < fireSpellsArray.size() && !canBeBought(fireSpellsArray[i],hero); i++)
;
if (i < fireSpellsArray.size())
found = true;
for (i = 0; i < lightingSpellsArray.size() && !canBeBought(lightingSpellsArray[i],hero); i++)
;
if (i < lightingSpellsArray.size())
found = true;
}
if (buyState != 0) {
unsigned int i;
for (i = 0; i < weaponsArray.size() && !canBeBought(weaponsArray[i],hero); i++)
;
if (i < weaponsArray.size())
found = true;
for (i = 0; i < armorsArray.size() && !canBeBought(armorsArray[i],hero); i++)
;
if (i < armorsArray.size())
found = true;
for (i = 0; i < potionsArray.size() && !canBeBought(potionsArray[i],hero); i++)
;
if (i < potionsArray.size())
found = true;
}
if (!found) {
if (info) {
cerr << endl << "\033[31mError:\033[0m There are no available Items or Spells for Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m to buy." << endl;
usleep(3000000);
}
return -1;
}
return buyState;
}
void Market::Purchase(Hero& hero, const int& buyState)
{
int column, row;
char confirmation;
bool errFlag = false;
string testSelections[2];
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "(Type 0 to cancel)" << endl;
if (buyState == 0) {
cout << "Choose a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[77C";
} else if (buyState == 1) {
cout << "Choose an Item by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[77C";
} else {
cout << "Choose an Item or a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[88C";
}
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
errFlag = true;
cin >> testSelections[0];
if (testSelections[0] == "0") {
column = 0;
break;
}
cin >> testSelections[1];
} while(!isValidForPurchase(testSelections,column,row,buyState));
if (column == 0) {
cout << endl << "\033[1;32mInfo:\033[0m The purchase was canceled." << endl << endl;
return;
}
switch(column)
{
case 1:
cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;32m" << iceSpellsArray[iceSpellsIndexes[row - 1]]->GetName() << "\033[0m\" Ice Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-iceSpellsArray[iceSpellsIndexes[row - 1]]->GetPrice());
hero.AddNewSpell(iceSpellsArray[iceSpellsIndexes[row - 1]]);
iceSpellsArray.erase(iceSpellsArray.begin() + iceSpellsIndexes[row - 1]);
RecalcMostItems();
break;
case 2:
cout << endl << "Are you sure you want to buy \"\033[1m\033[1;31m" << fireSpellsArray[fireSpellsIndexes[row - 1]]->GetName() << "\033[0m\" Fire Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-fireSpellsArray[fireSpellsIndexes[row - 1]]->GetPrice());
hero.AddNewSpell(fireSpellsArray[fireSpellsIndexes[row - 1]]);
fireSpellsArray.erase(fireSpellsArray.begin() + fireSpellsIndexes[row - 1]);
RecalcMostItems();
break;
case 3:
cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;15m" << lightingSpellsArray[lightingSpellsIndexes[row - 1]]->GetName() << "\033[0m\" Lighting Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-lightingSpellsArray[lightingSpellsIndexes[row - 1]]->GetPrice());
hero.AddNewSpell(lightingSpellsArray[lightingSpellsIndexes[row - 1]]);
lightingSpellsArray.erase(lightingSpellsArray.begin() + lightingSpellsIndexes[row - 1]);
RecalcMostItems();
break;
case 4:
cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;166m" << weaponsArray[weaponsIndexes[row - 1]]->GetName() << "\033[0m\" Weapon? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-weaponsArray[weaponsIndexes[row - 1]]->GetPrice());
hero.AddNewItem(weaponsArray[weaponsIndexes[row - 1]]);
weaponsArray.erase(weaponsArray.begin() + weaponsIndexes[row - 1]);
RecalcMostItems();
break;
case 5:
cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;28m" << armorsArray[armorsIndexes[row - 1]]->GetName() << "\033[0m\" Armor? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-(armorsArray[armorsIndexes[row - 1]]->GetPrice()));
hero.AddNewItem(armorsArray[armorsIndexes[row - 1]]);
armorsArray.erase(armorsArray.begin() + armorsIndexes[row - 1]);
RecalcMostItems();
break;
case 6:
cout << endl << "Are you sure you want to buy \"\033[1m\033[38;5;90m" << potionsArray[potionsIndexes[row - 1]]->GetName() << "\033[0m\" Potion? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.ChangeMoney(-potionsArray[potionsIndexes[row - 1]]->GetPrice());
hero.AddNewItem(potionsArray[potionsIndexes[row - 1]]);
potionsArray.erase(potionsArray.begin() + potionsIndexes[row - 1]);
RecalcMostItems();
break;
}
}
void Market::Buy(vector<Hero *>& heroes)
{
unsigned int i;
int action;
string testAction;
bool infoState = false;
Hero* selectedHero = NULL;
if (heroes.size() == 1 && isAbleToBuy(heroes[0]) == -1) {
usleep(2500000);
DisplayMarket();
return;
} else {
for (i = 0; i < heroes.size() && isAbleToBuy(heroes[i],false) == -1; i++)
;
if (i == heroes.size()) {
cerr << endl << "\033[31mError:\033[0m No one of the heroes are able to buy any Items or Spells from the Market.";
usleep(2500000);
DisplayMarket();
return;
}
}
while(true) {
int buyState;
if (heroes.size() == 1) {
selectedHero = heroes[0];
} else {
for (i = 0; i < heroes.size() && isAbleToBuy(heroes[i],false) == -1; i++)
;
if (i == heroes.size()) {
cerr << endl << "-------------------------------" << endl << endl;
cerr << "\033[35mWarning:\033[0m There are no other heroes able to buy any Items or Spells from the Market.";
usleep(3000000);
DisplayMarket();
return;
}
while(selectedHero == NULL) {
//bool errorFlag = false;
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "(Type 0 to cancel)" << endl;
cout << "Choose a Hero (1 - " << heroes.size() << "): ";
cout << "\n\n\n\n\n";
cout << "\033[5A\033[23C";
while(true) {
bool errFlag = false;
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
cin >> testAction;
errFlag = true;
} while(!isNumeric(testAction.c_str(),action));
if (action < 0 || action > heroes.size()) {
cerr << endl << "\033[31mError:\033[0m Please choose a number in the given range." << endl;
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
//cout << "\033[K";
//cout << "\033[1A\033[K";
//cout << "\033[1A\033[K";
//if (errorFlag)
// cout << "\033[1A\033[K";
//errorFlag = true;
} else {
if (!action) {
DisplayMarket();
return;
}
selectedHero = heroes[action - 1];
break;
}
}
}
}
if ((buyState = isAbleToBuy(selectedHero)) != -1) {
bool errFlag = false;
DisplayMarket(infoState,selectedHero,buyState);
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "Choose an action: ";
cout << "\n\n\n\n\n";
cout << "\033[5A\033[18C";
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
cin >> testAction;
errFlag = true;
} while(!isValid(testAction.c_str(),action,1,3));
switch(action)
{
case 1:
Purchase(*selectedHero,buyState);
break;
case 2:
infoState = !infoState;
// DisplayMarket(infoState,selectedHero,buyState);
break;
case 3:
DisplayMarket();
return;
}
} else if (heroes.size() == 1) {
usleep(2500000);
DisplayMarket();
return;
}
if (buyState == -1) {
DisplayMarket();
return;
}
// selectedHero = NULL;
}
}
int Market::isAbleToSell(const Hero* hero, const bool& info = true)
{
int sellState = 2;
if (hero->GetAvailableItemSlots() == hero->GetMaxItemsSlots()) {
if (hero->GetAvailableSpellSlots() == hero->GetMaxSpellsSlots()) {
if (info) {
cerr << endl << "\033[31mError:\033[0m Hero \033[38;5;220m" << hero->Living::GetName() << "\033[0m doesn't have any Items or Spells for sale." << endl;
usleep(2500000);
}
return -1;
}
sellState = 0; //Means that he can sell Spells only
} else if (hero->GetAvailableSpellSlots() == hero->GetMaxSpellsSlots()) {
sellState = 1; //Means that he can buy Items only
}
return sellState;
}
void Market::Sale(Hero& hero, const int& sellState)
{
int column, row;
char confirmation;
bool errFlag = false;
string testSelections[2];
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "(Type 0 to cancel)" << endl;
if (sellState == 0) {
cout << "Choose a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[77C";
} else if (sellState == 1) {
cout << "Choose an Item by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[77C";
} else {
cout << "Choose an Item or a Spell by selecting its position in the table(e.g.: \033[1;34m<\033[1;33mcolumn\033[1;34m> <\033[1;33mrow\033[1;34m>\033[0m): ";
cout << "\n\n\n\n\n\n\n\n";
cout << "\033[8A\033[88C";
}
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
errFlag = true;
cin >> testSelections[0];
if (testSelections[0] == "0") {
column = 0;
break;
}
cin >> testSelections[1];
} while(!hero.isValidForSale(testSelections,column,row,sellState));
if (column == 0) {
cout << endl << "\033[1;32mInfo:\033[0m The sale operation was canceled." << endl << endl;
return;
}
switch(column)
{
case 1:
if (sellState == 1) {
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;166m" << hero.GetWeaponFromSlot(row - 1)->GetName() << "\033[0m\" Weapon? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveWeapon(row - 1);
} else {
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;32m" << hero.GetSpellFromSlot(row - 1, 2)->GetName() << "\033[0m\" Ice Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveIceSpell(row - 1);
}
break;
case 2:
if (sellState == 1) {
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;28m" << hero.GetArmorFromSlot(row - 1)->GetName() << "\033[0m\" Armor? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveArmor(row - 1);
} else {
cout << endl << "Are you sure you want to sell \"\033[1m\033[1;31m" << hero.GetSpellFromSlot(row - 1, 3)->GetName() << "\033[0m\" Fire Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveFireSpell(row - 1);
}
break;
case 3:
if (sellState == 1) {
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;90m" << hero.GetPotionFromSlot(row - 1)->GetName() << "\033[0m\" Potion? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemovePotion(row - 1);
} else {
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;15m" << hero.GetSpellFromSlot(row - 1, 1)->GetName() << "\033[0m\" Lighting Spell? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveLightingSpell(row - 1);
}
break;
case 4:
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;166m" << hero.GetWeaponFromSlot(row - 1)->GetName() << "\033[0m\" Weapon? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveWeapon(row - 1);
break;
case 5:
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;28m" << hero.GetArmorFromSlot(row - 1)->GetName() << "\033[0m\" Armor? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemoveArmor(row - 1);
break;
case 6:
cout << endl << "Are you sure you want to sell \"\033[1m\033[38;5;90m" << hero.GetPotionFromSlot(row - 1)->GetName() << "\033[0m\" Potion? [y/n]: ";
do {
cin >> confirmation;
} while(confirmation != 'y' && confirmation != 'Y' && confirmation != 'n' && confirmation != 'N');
if (confirmation == 'n' || confirmation == 'N')
break;
hero.RemovePotion(row - 1);
break;
}
}
void Market::Sell(vector<Hero *>& heroes)
{
unsigned int i;
int action;
string testAction;
bool infoState = false;
Hero* selectedHero = NULL;
if (heroes.size() == 1 && isAbleToSell(heroes[0]) == -1) {
usleep(2500000);
DisplayMarket();
return;
} else {
for (i = 0; i < heroes.size() && isAbleToSell(heroes[i],false) == -1; i++)
;
if (i == heroes.size()) {
cerr << endl << "\033[31mError:\033[0m No one of the heroes have any Items or Spells for sale.";
usleep(2500000);
DisplayMarket();
return;
}
}
while(true) {
int sellState;
if (heroes.size() == 1) {
selectedHero = heroes[0];
} else {
for (i = 0; i < heroes.size() && isAbleToSell(heroes[i],false) == -1; i++)
;
if (i == heroes.size()) {
cerr << endl << "-------------------------------" << endl << endl;
cerr << "\033[35mWarning:\033[0m No one of the heroes have any Items or Spells left for sale.";
usleep(2500000);
DisplayMarket();
return;
}
while(selectedHero == NULL) {
//bool errorFlag = false;
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "(Type 0 to cancel)" << endl;
cout << "Choose a Hero (1 - " << heroes.size() << "): ";
cout << "\n\n\n\n\n";
cout << "\033[5A\033[23C";
while(true) {
bool errFlag = false;
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
cin >> testAction;
errFlag = true;
} while(!isNumeric(testAction.c_str(),action));
if (action < 0 || action > heroes.size()) {
cerr << endl << "\033[31mError:\033[0m Please choose a number in the given range." << endl;
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
//cout << "\033[K";
//cout << "\033[1A\033[K";
//cout << "\033[1A\033[K";
//if (errorFlag)
// cout << "\033[1A\033[K";
//errorFlag = true;
} else {
if (!action) {
DisplayMarket();
return;
}
selectedHero = heroes[action - 1];
break;
}
}
}
}
if ((sellState = isAbleToSell(selectedHero)) != -1) {
bool errFlag = false;
selectedHero->DisplayProdsForSale(infoState,sellState);
cout << endl;
/*if (sellState == 0 || sellState == 1)
{
cout << "\033[44C-------------------------------" << endl << endl;
cout << "\033[44CChoose an action: ";
} else {*/
cout << "-------------------------------" << endl << endl;
cout << "Choose an action: ";
//}
cout << "\n\n\n\n\n";
cout << "\033[5A\033[18C";
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
cin >> testAction;
errFlag = true;
} while(!isValid(testAction.c_str(),action,1,3));
switch(action)
{
case 1:
Sale(*selectedHero,sellState);
break;
case 2:
infoState = !infoState;
//selectedHero->DisplayProdsForSale(infoState,sellState);
break;
case 3:
DisplayMarket();
return;
}
} else if (heroes.size() == 1) {
usleep(2500000);
DisplayMarket();
return;
}
if (sellState == -1) {
DisplayMarket();
return;
}
}
}
bool Market::EnterMarket(vector<Hero *>& heroes)
{
int action;
//int buyState;
string testAction;
bool infoState = false;
NewStuff(heroes);
DisplayMarket();
while(true){
bool errFlag = false;
cout << endl;
cout << "-------------------------------" << endl << endl;
cout << "Choose an action: ";
cout << "\n\n\n\n\n";
cout << "\033[5A\033[18C";
cout << "\033[s";
do {
if (errFlag)
usleep(1800000);
cout << "\033[u";
cout << "\033[J";
cout << "\033[s";
cin >> testAction;
errFlag = true;
} while(!isValid(testAction.c_str(),action,1,4));
switch(action)
{
case 1:
Buy(heroes);
break;
case 2:
Sell(heroes);
break;
case 3:
infoState = !infoState;
DisplayMarket(infoState);
break;
case 4:
return false;
}
}
}
bool Market::canBeBought(const Item* item, const Hero* hero)
{
if (hero->GetMoney() < item->GetPrice())
return false;
if (hero->Living::GetLevel() < item->GetMinReqLevel())
return false;
return true;
}
bool Market::canBeBought(const Spell* spell, const Hero* hero)
{
if (hero->GetMoney() < spell->GetPrice())
return false;
if (hero->Living::GetLevel() < spell->GetMinReqLevel())
return false;
return true;
}
void Market::DisplayMarket(const bool& showInfo, const Hero* hero, const int buyState)
{
cout << "\033[2J\033[1;1H";
cout << "\033[1;33m+\033[0;34m=========================================================================================================================================================================================\033[1;33m+\033[0m" << endl;
cout << "\033[34m|\033[0m Welcome to the Market \033[34m|\033[0m" << endl;
cout << "\033[1;33m+\033[0;34m=========================================================================================================================================================================================\033[1;33m+\033[0m" << endl;
if (buyState != -1) {
if (showInfo)
cout << "\033[34m|\033[0m \033[4mAvailable Actions\033[0m: 1. Purchase, 2. Disable Info, 3. Cancel \033[34m|\033[0m" << endl;
else
cout << "\033[34m|\033[0m \033[4mAvailable Actions\033[0m: 1. Purchase, 2. Info, 3. Cancel \033[34m|\033[0m" << endl;
} else {
if (showInfo)
cout << "\033[34m|\033[0m \033[4mAvailable Actions\033[0m: 1. Buy, 2. Sell, 3. Disable Info, 4. Exit \033[34m|\033[0m" << endl;
else
cout << "\033[34m|\033[0m \033[4mAvailable Actions\033[0m: 1. Buy, 2. Sell, 3. Info, 4. Exit \033[34m|\033[0m" << endl;
}
cout << "\033[1;33m+\033[0;34m=========================================================================================================================================================================================\033[1;33m+\033[0m" << endl;
cout << "\033[34m|\033[0m Spells \033[34m|\033[0m Items \033[34m|\033[0m" << endl;
if (showInfo) {
cout << "\033[34m|--------------------------------------------------------------------------------------------\033[1;33m+\033[0;34m--------------------------------------------------------------------------------------------|\033[0m" << endl;
cout << "\033[34m|\033[0m --> Spells are representing a magic attack that a hero can perform \033[34m|\033[0m --> There are items that a hero can use for attacking enemies, avoiding their attacks \033[34m|\033[0m" << endl;
cout << "\033[34m|\033[0m --> They cause an amount of damage according to the hero's dexterity \033[34m|\033[0m and items that increase some of his features \033[34m|\033[0m" << endl;
cout << "\033[34m|\033[0m --> They require a specific Magic Power that the hero must have in order to use them \033[34m|\033[0m --> Some of them can be used one time only \033[34m|\033[0m" << endl;
cout << "\033[34m|\033[0m --> After the use of a spell the Hero's Magic Power will be reduced \033[34m|\033[0m \033[34m|\033[0m" << endl;
}
cout << "\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0m" << endl;
cout << "\033[34m|\033[0m # \033[34m|\033[0m \033[38;5;32mIce Spells\033[0m \033[34m|\033[0m # \033[34m|\033[0m \033[1;31mFire Spells\033[0m \033[34m|\033[0m # \033[34m|\033[0m \033[38;5;15mLighting Spells\033[0m \033[34m|\033[0m # \033[34m|\033[0m \033[38;5;166mWeapons\033[0m \033[34m|\033[0m # \033[34m|\033[0m \033[38;5;28mArmors\033[0m \033[34m|\033[0m # \033[34m|\033[0m \033[38;5;90mPotions\033[0m \033[34m|\033[0m" << endl;
if (showInfo) {
cout << "\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------\033[1;33m+\033[0;34m---\033[1;33m+\033[0;34m--------------------------|\033[0m" << endl;
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m Ice Spells reduce \033[34m|\033[1;33m(i)\033[0;34m|\033[0m Fire Spells reduce \033[34m|\033[1;33m(i)\033[0;34m|\033[0m Lighting Spells reduce \033[34m|\033[1;33m(i)\033[0;34m|\033[0m Weapons cause damage \033[34m|\033[1;33m(i)\033[0;34m|\033[0m Armors reduce the \033[34m|\033[1;33m(i)\033[0;34m|\033[0m Potions increase \033[34m|\033[0m" << endl;
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m enemy's damage range \033[34m|\033[1;33m(i)\033[0;34m|\033[0m enemy's defence \033[34m|\033[1;33m(i)\033[0;34m|\033[0m enemy's chance to \033[34m|\033[1;33m(i)\033[0;34m|\033[0m to the enemies and \033[34m|\033[1;33m(i)\033[0;34m|\033[0m received damage \033[34m|\033[1;33m(i)\033[0;34m|\033[0m a hero's specific \033[34m|\033[0m" << endl;
cout << "\033[34m| | | | |\033[1;33m(i)\033[0;34m|\033[0m avoid an attack \033[34m|\033[1;33m(i)\033[0;34m|\033[0m they require one \033[34m| | |\033[1;33m(i)\033[0;34m|\033[0m feature and can \033[34m|\033[0m" << endl;
cout << "\033[34m| | | | | | |\033[1;33m(i)\033[0;34m|\033[0m or two hands \033[34m| | |\033[1;33m(i)\033[0;34m|\033[0m be used only once \033[34m|\033[0m" << endl;
}
cout << "\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0m" << endl;
if (buyState != -1)
ResetForSaleProds();
for (unsigned int i = 0, ice_i = 0, fire_i = 0, light_i = 0, wpn_i = 0, arm_i = 0, ptn_i = 0;
i < mostItems;
i++, ice_i++, fire_i++, light_i++, wpn_i++, arm_i++, ptn_i++)
{
short terminationState = 0;
if (buyState != -1) {
while(ice_i < iceSpellsArray.size() && !canBeBought(iceSpellsArray[ice_i],hero))
ice_i++;
}
if (ice_i < iceSpellsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
iceSpellsIndexes.insert(iceSpellsIndexes.begin() + i , ice_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 1 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
iceSpellsForSale++;
cout << left << iceSpellsArray[ice_i]->GetName() << "\033[0m";
} else {
if (terminationState == 0)
terminationState++;
cout << "\033[34m| |\033[0m\033[26C";
}
if (buyState != -1) {
while(fire_i < fireSpellsArray.size() && !canBeBought(fireSpellsArray[fire_i],hero))
fire_i++;
}
if (fire_i < fireSpellsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
fireSpellsIndexes.insert(fireSpellsIndexes.begin() + i , fire_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 1 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
fireSpellsForSale++;
cout << left << fireSpellsArray[fire_i]->GetName() << "\033[0m";
} else {
if (terminationState == 1)
terminationState++;
cout << "\033[34m| |\033[0m\033[26C";
}
if (buyState != -1) {
while(light_i < lightingSpellsArray.size() && !canBeBought(lightingSpellsArray[light_i],hero))
light_i++;
}
if (light_i < lightingSpellsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
lightingSpellsIndexes.insert(lightingSpellsIndexes.begin() + i , light_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 1 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
lightingSpellsForSale++;
cout << left << lightingSpellsArray[light_i]->GetName() << "\033[0m";
} else {
if (terminationState == 2)
terminationState++;
cout << "\033[34m| |\033[0m\033[26C";
}
if (buyState != -1) {
while(wpn_i < weaponsArray.size() && !canBeBought(weaponsArray[wpn_i],hero))
wpn_i++;
}
if (wpn_i < weaponsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
weaponsIndexes.insert(weaponsIndexes.begin() + i , wpn_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 0 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
weaponsForSale++;
cout << left << weaponsArray[wpn_i]->GetName() << "\033[0m";
} else {
if (terminationState == 3)
terminationState++;
cout << "\033[34m| |\033[0m\033[26C"; // \033[23C
}
if (buyState != -1) {
while(arm_i < armorsArray.size() && !canBeBought(armorsArray[arm_i],hero))
arm_i++;
}
if (arm_i < armorsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
armorsIndexes.insert(armorsIndexes.begin() + i , arm_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 0 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
armorsForSale++;
cout << left << armorsArray[arm_i]->GetName() << "\033[0m";
} else {
if (terminationState == 4)
terminationState++;
cout << "\033[34m| |\033[0m\033[26C"; //\033[22C
}
if (buyState != -1) {
while(ptn_i < potionsArray.size() && !canBeBought(potionsArray[ptn_i],hero))
ptn_i++;
}
if (ptn_i < potionsArray.size()) {
if (i < 9) cout << "\033[34m|\033[0m " << i+1 << " ";
else if (i < 99) cout << "\033[34m|\033[0m " << i+1;
else if (i < 999) cout << "\033[34m|\033[0m" << i+1;
potionsIndexes.insert(potionsIndexes.begin() + i , ptn_i);
cout << "\033[34m| \033[0m\u2022 ";
if (showInfo)
cout << "\033[1;33m";
if (buyState == 0 || buyState == 3)
cout << "\033[1;31m";
cout.width(23);
potionsForSale++;
cout << left << potionsArray[ptn_i]->GetName() << "\033[0;34m|\033[0m" << endl;
} else {
if (terminationState == 5)
terminationState++;
cout << "\033[34m| |\033[26C|\033[0m" << endl; //\033[21C
}
if (terminationState == 6) {
cout << "\033[1A";
break;
}
/*
if (ice_i >= iceSpellsArray.size() && fire_i >= fireSpellsArray.size() && light_i >= lightingSpellsArray.size() &&
wpn_i >= weaponsArray.size() && arm_i >= armorsArray.size() && ptn_i >= potionsArray.size())
{
if (showInfo)
cout << "\033[2A";
else
cout << "\033[1A";
cout << "\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0m" << endl;
if (showInfo)
{
cout << " " << endl;
cout << "\033[1A";
}
if (buyState != -1)
{
cout << endl << "\033[38;5;220m Hero: \033[0m" << hero->GetName() << endl;
cout << "\033[38;5;220mLevel: \033[0m" << hero->GetLevel() << endl;
cout << "\033[38;5;220mMoney: \033[0m" << hero->GetMoney() << endl;
}
cout << endl << "\t\t\t\t MOST ITEMS 1 = " << mostItems << endl;
return;
}*/
if (showInfo) {
/* ------------------------------- Start of 1st Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << iceSpellsArray[ice_i]->GetPrice();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << fireSpellsArray[fire_i]->GetPrice();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << lightingSpellsArray[light_i]->GetPrice();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (wpn_i < weaponsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << weaponsArray[wpn_i]->GetPrice();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (arm_i < armorsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << armorsArray[arm_i]->GetPrice();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (ptn_i < potionsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Price: ";
cout.width(15);
cout << left << potionsArray[ptn_i]->GetPrice() << "\033[34m|\033[0m" << endl;
} else
cout << "\033[34m| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 1st Line -------------------------------- */
/* ------------------------------- Start of 2nd Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << iceSpellsArray[ice_i]->GetMinReqLevel();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << fireSpellsArray[fire_i]->GetMinReqLevel();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << lightingSpellsArray[light_i]->GetMinReqLevel();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (wpn_i < weaponsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << weaponsArray[wpn_i]->GetMinReqLevel();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (arm_i < armorsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << armorsArray[arm_i]->GetMinReqLevel();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (ptn_i < potionsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Level: ";
cout.width(6);
cout << left << potionsArray[ptn_i]->GetMinReqLevel() << "\033[34m|\033[0m" << endl;
} else
cout << "\033[34m| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 2nd Line -------------------------------- */
/* ------------------------------- Start of 3rd Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required MP: ";
cout.width(9);
cout << left << iceSpellsArray[ice_i]->GetReqEnergy();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required MP: ";
cout.width(9);
cout << left << fireSpellsArray[fire_i]->GetReqEnergy();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required MP: ";
cout.width(9);
cout << left << lightingSpellsArray[light_i]->GetReqEnergy();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (wpn_i < weaponsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Damage: ";
cout.width(14);
cout << left << weaponsArray[wpn_i]->GetDamage();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (arm_i < armorsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Damage Reduction: ";
cout.width(4);
cout << left << armorsArray[arm_i]->GetDamageReduction();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (ptn_i < potionsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Power-Up: ";
cout.width(12);
if (potionsArray[ptn_i]->PotionIncreaseStrength()) {
string str = "+" + to_string(potionsArray[ptn_i]->PotionIncreaseStrength()) + " str/th";
cout << str << "\033[34m|\033[0m" << endl;
} else if (potionsArray[ptn_i]->PotionIncreaseDexterity()) {
string str = "+" + to_string(potionsArray[ptn_i]->PotionIncreaseDexterity()) + " dext/ty";
cout << str << "\033[34m|\033[0m" << endl;
} else {
string str = "+" + to_string((int)(potionsArray[ptn_i]->PotionIncreaseAgility() * 100)) + "\% agility";
cout << str << "\033[34m|\033[0m" << endl;
}
} else
cout << "\033[34m| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 3rd Line -------------------------------- */
/* ------------------------------- Start of 4th Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
string str = to_string(iceSpellsArray[ice_i]->GetMinDamage()) + "-" + to_string(iceSpellsArray[ice_i]->GetMaxDamage());
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Damage Range: ";
cout.width(8);
cout << left << str;
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
string str = to_string(fireSpellsArray[fire_i]->GetMinDamage()) + "-" + to_string(fireSpellsArray[fire_i]->GetMaxDamage());
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Damage Range: ";
cout.width(8);
cout << left << str;
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
string str = to_string(lightingSpellsArray[light_i]->GetMinDamage()) + "-" + to_string(lightingSpellsArray[light_i]->GetMaxDamage());
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Damage Range: ";
cout.width(8);
cout << left << str;
} else
cout << "\033[34m| |\033[0m\033[26C";
if (wpn_i < weaponsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Required Hands: ";
cout.width(6);
if (weaponsArray[wpn_i]->TwoHanded())
cout << left << "2";
else
cout << left << "1";
} else
cout << "\033[34m| |\033[0m\033[26C";
cout << "\033[34m| |\033[26C";
cout << "| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 4th Line -------------------------------- */
/* ------------------------------- Start of 5th Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Enemy Damage . ";
cout.width(7);
cout << left << (to_string(iceSpellsArray[ice_i]->GetDamageReduction()) + " HP");
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Enemy Defence . ";
cout.width(6);
cout << left << fireSpellsArray[fire_i]->GetDefenceReduction();
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Enemy Avoidance . ";
cout.width(4);
cout << left << (to_string(lightingSpellsArray[light_i]->GetAvoidanceReduction()) + "%");
} else
cout << "\033[34m| |\033[0m\033[26C";
cout << "\033[34m| |\033[26C";
cout << "| |\033[26C";
cout << "| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 5th Line -------------------------------- */
/* ------------------------------- Start of 6th Line ------------------------------- */
if (ice_i < iceSpellsArray.size())
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m Reduction · ";
else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size())
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m Reduction · ";
else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size())
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m Reduction · ";
else
cout << "\033[34m| |\033[0m\033[26C";
cout << "\033[34m| |\033[26C";
cout << "| |\033[26C";
cout << "| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 6th Line -------------------------------- */
/* ------------------------------- Start of 7th Line ------------------------------- */
if (ice_i < iceSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Applies to: ";
cout.width(10);
if (iceSpellsArray[ice_i]->GetRounds() == 1)
cout << left << (to_string(iceSpellsArray[ice_i]->GetRounds()) + " round");
else
cout << left << (to_string(iceSpellsArray[ice_i]->GetRounds()) + " rounds");
} else
cout << "\033[34m| |\033[0m\033[26C";
if (fire_i < fireSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Applies to: ";
cout.width(10);
if (fireSpellsArray[fire_i]->GetRounds() == 1)
cout << left << (to_string(fireSpellsArray[fire_i]->GetRounds()) + " round");
else
cout << left << (to_string(fireSpellsArray[fire_i]->GetRounds()) + " rounds");
} else
cout << "\033[34m| |\033[0m\033[26C";
if (light_i < lightingSpellsArray.size()) {
cout << "\033[34m|\033[1;33m(i)\033[0;34m|\033[0m ~> Applies to: ";
cout.width(10);
if (lightingSpellsArray[light_i]->GetRounds() == 1)
cout << left << (to_string(lightingSpellsArray[light_i]->GetRounds()) + " round");
else
cout << left << (to_string(lightingSpellsArray[light_i]->GetRounds()) + " rounds");
} else
cout << "\033[34m| |\033[0m\033[26C";
cout << "\033[34m| |\033[26C";
cout << "| |\033[26C";
cout << "| |\033[26C|\033[0m" << endl;
/* -------------------------------- End of 7th Line -------------------------------- */
cout << "\033[34m| |\033[26C| |\033[26C| |\033[26C| |\033[26C| |\033[26C| |\033[26C|\033[0m" << endl;
}
if (hero == NULL)
usleep(40000);
}
if (showInfo)
cout << "\033[K\033[1A\033[K";
cout << "\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0;34m===\033[1;33m+\033[0;34m==========================\033[1;33m+\033[0m" << endl;
if (hero != NULL) {
cout << endl;
cout << "\033[38;5;220m Hero: \033[0m" << hero->GetName() << endl;
cout << "\033[38;5;220m Level: \033[0m" << hero->GetLevel() << endl;
cout << "\033[38;5;220m Money: \033[0m" << hero->GetMoney() << endl;
cout << "\033[38;5;220m Items: \033[0m(" << hero->GetMaxItemsSlots() - hero->GetAvailableItemSlots() << "/" << hero->GetMaxItemsSlots() << ")" << endl;
cout << "\033[38;5;220mSpells: \033[0m(" << hero->GetMaxSpellsSlots() - hero->GetAvailableSpellSlots() << "/" << hero->GetMaxSpellsSlots() << ")" << endl;
}
}
| 38.09245
| 524
| 0.436912
|
MichaelXanth
|
a5639343acaa9d179e3370c34b5aa55147d01427
| 14,059
|
cpp
|
C++
|
HTWK_SD_FILTER/SD_FreestyleSchnapsSaufen/Freestyle.cpp
|
HTWKSmartDriving/aadc-2015
|
95ee77aa0f9ebbb541bbb1e3b99d3f044347d103
|
[
"BSD-2-Clause"
] | 2
|
2017-11-29T00:15:26.000Z
|
2017-11-29T01:45:54.000Z
|
HTWK_SD_FILTER/SD_FreestyleSchnapsSaufen/Freestyle.cpp
|
HTWKSmartDriving/aadc-2015
|
95ee77aa0f9ebbb541bbb1e3b99d3f044347d103
|
[
"BSD-2-Clause"
] | null | null | null |
HTWK_SD_FILTER/SD_FreestyleSchnapsSaufen/Freestyle.cpp
|
HTWKSmartDriving/aadc-2015
|
95ee77aa0f9ebbb541bbb1e3b99d3f044347d103
|
[
"BSD-2-Clause"
] | 2
|
2017-11-28T23:47:27.000Z
|
2019-07-19T08:04:50.000Z
|
/**
* Copyright (c) 2014-2015, HTWK SmartDriving
* 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.
*
* 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 HOLDER 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.
*
* AUTHORS: Silvio Feig, Denny Hecht, Andreas Kluge, Lars Kollmann, Eike Florian Petersen, Artem Pokas
*
*/
#include "stdafx.h"
ADTF_FILTER_PLUGIN(FILTER_NAME, OID_NEW_LANE_DETECTION, Test);
Test::Test(const char *__info) : cFilter(__info)
{
this->isFirstFrame = true;
this->isStopLineFound = false;
this->isConnectedToServer = false;
this->crossroadDetector.reset(new CrossRoadDetector());
this->driveAlgorithm.reset(new DriveAlgorithm());
this->tcpClient.reset(new Client());
this->stopOnStopLine = false;
this->tcpServer.reset(new Server(60000));
this->ip = "192.168.1.253";
SetPropertyStr(PROP_NAME_IP, this->ip.c_str());
SetPropertyBool(PROP_NAME_IP NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_IP NSSUBPROP_ISCHANGEABLE, tTrue);
this->numberOfStopLines = 20;
SetPropertyInt(PROP_NAME_STOP_LINES, this->numberOfStopLines);
SetPropertyInt(PROP_NAME_STOP_LINES NSSUBPROP_MIN, 1);
SetPropertyInt(PROP_NAME_STOP_LINES NSSUBPROP_MAX, 1000);
SetPropertyBool(PROP_NAME_STOP_LINES NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_STOP_LINES NSSUBPROP_ISCHANGEABLE, tTrue);
this->delay = 100000;
SetPropertyInt(PROP_NAME_DELAY, this->delay);
SetPropertyInt(PROP_NAME_DELAY NSSUBPROP_MIN, 1);
SetPropertyInt(PROP_NAME_DELAY NSSUBPROP_MAX, 1000);
SetPropertyBool(PROP_NAME_DELAY NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_DELAY NSSUBPROP_ISCHANGEABLE, tTrue);
this->driveSpeed = 30;
SetPropertyInt(PROP_NAME_DRIVE_SPEED, this->driveSpeed);
SetPropertyInt(PROP_NAME_DRIVE_SPEED NSSUBPROP_MIN, 1);
SetPropertyInt(PROP_NAME_DRIVE_SPEED NSSUBPROP_MAX, 1000);
SetPropertyBool(PROP_NAME_DRIVE_SPEED NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_DRIVE_SPEED NSSUBPROP_ISCHANGEABLE, tTrue);
this->smoothCurveValue = 7;
SetPropertyInt(PROP_NAME_SMOOTH_CURVE_VALUE, this->smoothCurveValue);
SetPropertyInt(PROP_NAME_SMOOTH_CURVE_VALUE NSSUBPROP_MIN, 1);
SetPropertyInt(PROP_NAME_SMOOTH_CURVE_VALUE NSSUBPROP_MAX, 1000);
SetPropertyBool(PROP_NAME_SMOOTH_CURVE_VALUE NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_SMOOTH_CURVE_VALUE NSSUBPROP_ISCHANGEABLE, tTrue);
this->ticksToStopLine = 10;
SetPropertyInt(PROP_NAME_TICKS_TO_STOP_LINE, this->ticksToStopLine);
SetPropertyInt(PROP_NAME_TICKS_TO_STOP_LINE NSSUBPROP_MIN, 1);
SetPropertyInt(PROP_NAME_TICKS_TO_STOP_LINE NSSUBPROP_MAX, 1000);
SetPropertyBool(PROP_NAME_TICKS_TO_STOP_LINE NSSUBPROP_REQUIRED, tTrue);
SetPropertyBool(PROP_NAME_TICKS_TO_STOP_LINE NSSUBPROP_ISCHANGEABLE, tTrue);
}
Test::~Test()
{
}
tResult Test::Init(tInitStage eStage, __exception)
{
RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));
if (eStage == StageFirst)
{
RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER, IID_ADTF_MEDIA_DESCRIPTION_MANAGER, (tVoid**) &this->descriptionManager, __exception_ptr));
cObjectPtr<IMediaType> typeSignalManeuver;
cObjectPtr<IMediaType> typeSignalSteeringAngle;
cObjectPtr<IMediaType> typeSignalAcceleration;
cObjectPtr<IMediaType> typeSignalWheelTicks;
RETURN_IF_FAILED(initMediaType("tSteeringAngleData", typeSignalManeuver, this->coderDescriptionManeuver));
RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalSteeringAngle, this->coderDescriptionSteeringAngle));
RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalAcceleration, this->coderDescriptionAcceleration));
RETURN_IF_FAILED(initMediaType("tSignalValue", typeSignalWheelTicks, this->coderDescriptionWheelTicks));
// input pins
RETURN_IF_FAILED(createVideoInputPin("rgbVideo", this->xtionPin));
RETURN_IF_FAILED(createInputPin("maneuver", this->maneuverPin, typeSignalManeuver));
RETURN_IF_FAILED(createInputPin("wheelTicks", this->wheelTicksPin, typeSignalWheelTicks));
// output pins
RETURN_IF_FAILED(createOutputPin("steeringAngle", this->steeringAnglePin, typeSignalSteeringAngle));
RETURN_IF_FAILED(createOutputPin("acceleration", this->accelerationPin, typeSignalAcceleration));
}
else if (eStage == StageGraphReady)
{
cObjectPtr<IMediaSerializer> serializer;
RETURN_IF_FAILED(this->coderDescriptionAcceleration->GetMediaSampleSerializer(&serializer));
this->ddlSizeUI16 = serializer->GetDeserializedSize();
std::thread test(&Test::accept, this);
}
RETURN_NOERROR;
}
tResult Test::initMediaType(const char *mediaTypeDescriptionName, cObjectPtr<IMediaType> &mediaType, cObjectPtr<IMediaTypeDescription> &coderDescription)
{
tChar const *descriptionSignalValue = this->descriptionManager->GetMediaDescription(mediaTypeDescriptionName);
RETURN_IF_POINTER_NULL(descriptionSignalValue);
mediaType = new cMediaType(0, 0, 0, mediaTypeDescriptionName, descriptionSignalValue, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
RETURN_IF_FAILED(mediaType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**) &coderDescription));
RETURN_NOERROR;
}
tResult Test::createVideoInputPin(const tChar *pinName, cVideoPin &pin)
{
pin.Create(pinName, IPin::PD_Input, static_cast<IPinEventSink*>(this));
RETURN_IF_FAILED(RegisterPin(&pin));
RETURN_NOERROR;
}
tResult Test::createInputPin(const char *pinName, cInputPin &pin, cObjectPtr<IMediaType> &typeSignal)
{
RETURN_IF_FAILED(pin.Create(pinName, typeSignal, static_cast<IPinEventSink*> (this)));
RETURN_IF_FAILED(RegisterPin(&pin));
RETURN_NOERROR;
}
tResult Test::createOutputPin(const char *pinName, cOutputPin &pin, cObjectPtr<IMediaType> &typeSignal)
{
RETURN_IF_FAILED(pin.Create(pinName, typeSignal));
RETURN_IF_FAILED(RegisterPin(&pin));
RETURN_NOERROR;
}
tResult Test::Start(__exception)
{
RETURN_IF_FAILED(cFilter::Start(__exception_ptr));
RETURN_NOERROR;
}
tResult Test::Stop(__exception)
{
RETURN_IF_FAILED(cFilter::Stop(__exception_ptr));
RETURN_NOERROR;
}
tResult Test::Shutdown(tInitStage eStage, __exception)
{
RETURN_IF_FAILED(cFilter::Shutdown(eStage, __exception_ptr));
RETURN_NOERROR;
}
tResult Test::OnPinEvent(IPin *source, tInt eventCore, tInt param1, tInt param2, IMediaSample *mediaSample)
{
RETURN_IF_POINTER_NULL(source);
RETURN_IF_POINTER_NULL(mediaSample);
if (eventCore == IPinEventSink::PE_MediaSampleReceived)
{
if (source == &this->maneuverPin)
{
static tUInt16 tmpManeuver;
getManeuver(mediaSample, maneuverPin, this->coderDescriptionManeuver, tmpManeuver);
if (tmpManeuver == MANEUVER_STRAIGHT)
{
this->isDriveActive = true;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(transmitAcceleration(this->driveSpeed), "Cant transmit drive");
}
}
else if (source == &this->wheelTicksPin)
{
if (!this->isConnectedToServer)
{
if (!tcpClient->connectToServer(this->ip, 5555))
{
LOG_INFO(cString::Format("Cant connect to server with ip: %s:5555", this->ip.c_str()));
RETURN_NOERROR;
}
else
{
this->isConnectedToServer = true;
LOG_INFO("Could connect to server :)");
}
}
static tFloat32 tmpWheelTicks;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(getWheelTicks(mediaSample, tmpWheelTicks), "cant get wheel ticks");
this->currentWheelTicks = static_cast<int>(tmpWheelTicks);
if (this->isStopLineFound)
{
driveToStopLine();
}
}
else if(source == &this->xtionPin)
{
if (this->isFirstFrame)
{
RETURN_IF_FAILED_AND_LOG_ERROR_STR(initVideoStream(), "Cant init video stream");
this->isFirstFrame = false;
}
else
{
const tVoid *buffer;
if (this->isDriveActive && IS_OK(mediaSample->Lock(&buffer)))
{
//Receive the image
Mat image(Size(this->videoInputInfo.nWidth, this->videoInputInfo.nHeight), CV_8UC3, (char*) buffer);
Mat result = image.clone();
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaSample->Unlock(buffer), "Cant unlock image");
this->driveAlgorithm->prepareImage(result);
if (!this->isStopLineFound)
{
this->isStopLineFound = this->crossroadDetector-> searchStopLine(result);
this->ticksToDrive = this->ticksToStopLine + this->currentWheelTicks;
}
}
}
}
}
RETURN_NOERROR;
}
void Test::accept(void)
{
tcpServer->startServer();
}
tResult Test::initVideoStream(void)
{
//Read media type
cObjectPtr<IMediaType> type;
RETURN_IF_FAILED(this->xtionPin.GetMediaType(&type));
cObjectPtr<IMediaTypeVideo> typeVideo;
RETURN_IF_FAILED(type->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid**)(&typeVideo)));
const tBitmapFormat *format = typeVideo->GetFormat();
RETURN_IF_POINTER_NULL(format);
//Set media type
setBitmapFormat(format);
RETURN_NOERROR;
}
tVoid Test::setBitmapFormat(const tBitmapFormat *format)
{
this->videoInputInfo.nBitsPerPixel = format->nBitsPerPixel;
this->videoInputInfo.nBytesPerLine = format->nBytesPerLine;
this->videoInputInfo.nPaletteSize = format->nPaletteSize;
this->videoInputInfo.nPixelFormat = format->nPixelFormat;
this->videoInputInfo.nHeight = format->nHeight;
this->videoInputInfo.nWidth = format->nWidth;
this->videoInputInfo.nSize = format->nSize;
}
tResult Test::driveToStopLine(void)
{
static tInt tmpDistance;
tmpDistance = this->ticksToDrive - this->currentWheelTicks;
if (tmpDistance <= 0)
{
if (this->stopOnStopLine)
{
RETURN_IF_FAILED(transmitAcceleration(-5.0f));
// sende zum anderen Auto, dass ich warte
}
else
{
// sende zum anderen Auto
this->numberOfStopLines--;
// sende...
LOG_INFO(cString::Format("StopLines: %d", this->numberOfStopLines));
this->isStopLineFound = false;
}
}
RETURN_NOERROR;
}
tResult Test::transmitSteeringAngle(const tFloat32 value)
{
RETURN_IF_FAILED(transmitF32Value(this->steeringAnglePin, this->coderDescriptionSteeringAngle, value));
RETURN_NOERROR;
}
tResult Test::transmitAcceleration(const tFloat32 value)
{
RETURN_IF_FAILED(transmitF32Value(this->accelerationPin, this->coderDescriptionAcceleration, value));
RETURN_NOERROR;
}
tResult Test::transmitStop(const tFloat32 value)
{
RETURN_IF_FAILED(transmitF32Value(this->accelerationPin, this->coderDescriptionAcceleration, value));
RETURN_NOERROR;
}
tResult Test::transmitF32Value(cOutputPin &pin, cObjectPtr<IMediaTypeDescription> &mediaType, const tFloat32 value)
{
cObjectPtr<IMediaSample> mediaSample;
RETURN_IF_FAILED(AllocMediaSample((tVoid**) &mediaSample));
RETURN_IF_FAILED(mediaSample->AllocBuffer(this->ddlSizeUI16));
// write date to the media sample with the coder of the descriptor
cObjectPtr<IMediaCoder> coder;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->WriteLock(mediaSample, &coder), "Set F32 Failed to lock f32");
static tTimeStamp now;
now = _clock ? _clock->GetStreamTime() : cHighResTimer::GetTime();
coder->Set("f32Value", (tVoid*) &value);
coder->Set("ui32ArduinoTimestamp", (tVoid*) &now);
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->Unlock(coder), "Set F32 Failed to lock f32");
// transmit media sample over output pin
RETURN_IF_FAILED(mediaSample->SetTime(now));
RETURN_IF_FAILED(pin.Transmit(mediaSample));
RETURN_NOERROR;
}
tResult Test::getWheelTicks(IMediaSample *mediaSample, tFloat32 &value)
{
RETURN_IF_FAILED(getF32Value(mediaSample, this->coderDescriptionWheelTicks, value));
RETURN_NOERROR;
}
tResult Test::getF32Value(IMediaSample *mediaSample, cObjectPtr<IMediaTypeDescription> &mediaType, tFloat32 &value)
{
static tFloat32 tmpValue;
static tTimeStamp timeStamp;
cObjectPtr<IMediaCoder> coder;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->Lock(mediaSample, &coder), "Get32 Failed to lock f32");
coder->Get("f32Value", (tVoid*) &tmpValue);
coder->Get("ui32ArduinoTimestamp", (tVoid*) &timeStamp);
value = tmpValue;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->Unlock(coder), "Get32 Failed to unlock f32");
RETURN_NOERROR;
}
tResult Test::getManeuver(IMediaSample *mediaSample, cInputPin &pin, cObjectPtr<IMediaTypeDescription> &mediaType, tUInt16 &value)
{
static tUInt16 tmpValue;
static tUInt32 timeStamp;
cObjectPtr<IMediaCoder> coder;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->Lock(mediaSample, &coder), "Get UI16 failed to unlock");
coder->Get("ui16Angle", (tVoid*) &tmpValue);
coder->Get("ui32ArduinoTimestamp", (tVoid*) &timeStamp);
value = tmpValue;
RETURN_IF_FAILED_AND_LOG_ERROR_STR(mediaType->Unlock(coder), "Get UI16 failed to unlock");
RETURN_NOERROR;
}
tResult Test::PropertyChanged(const char *name)
{
this->ip = GetPropertyStr(PROP_NAME_IP);
this->numberOfStopLines = GetPropertyInt(PROP_NAME_STOP_LINES);
this->delay = GetPropertyInt(PROP_NAME_DELAY);
this->driveSpeed = GetPropertyInt(PROP_NAME_DRIVE_SPEED);
this->smoothCurveValue = GetPropertyInt(PROP_NAME_SMOOTH_CURVE_VALUE);
this->ticksToStopLine = GetPropertyInt(PROP_NAME_TICKS_TO_STOP_LINE);
RETURN_NOERROR;
}
| 33.47381
| 166
| 0.775375
|
HTWKSmartDriving
|
a565e2c43ad945daf61e2949305b14d18a01a3ed
| 2,599
|
cpp
|
C++
|
src/boss/blob.cpp
|
Lab-RoCoCo/fps_mapper
|
376e557c8f5012e05187fe85ee3f4044f99f944a
|
[
"BSD-3-Clause"
] | 1
|
2017-12-01T14:57:16.000Z
|
2017-12-01T14:57:16.000Z
|
src/boss/blob.cpp
|
Lab-RoCoCo/fps_mapper
|
376e557c8f5012e05187fe85ee3f4044f99f944a
|
[
"BSD-3-Clause"
] | null | null | null |
src/boss/blob.cpp
|
Lab-RoCoCo/fps_mapper
|
376e557c8f5012e05187fe85ee3f4044f99f944a
|
[
"BSD-3-Clause"
] | null | null | null |
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2013 <copyright holder> <email>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#include <fstream>
#include <memory>
#include "blob.h"
#include "object_data.h"
#include "serialization_context.h"
#include "id_context.h"
using namespace boss;
using namespace std;
BLOB::~BLOB() {
if (_ref) {
_ref->dataDestroyed();
}
}
static string DEFAULT_EXTENSION("dat");
const string& BLOB::extension() {
return DEFAULT_EXTENSION;
}
const string& BaseBLOBReference::extension() {
if (_instance) {
return _instance->extension();
}
return DEFAULT_EXTENSION;
}
void BaseBLOBReference::dataDestroyed() {
_instance=0;
}
BaseBLOBReference::~BaseBLOBReference() {
if (_instance) {
delete _instance;
}
}
void BaseBLOBReference::serialize(ObjectData& data, IdContext& context) {
Identifiable::serialize(data,context);
if (_instance) {
//Check if binary file serialization is supported
SerializationContext* fileContext=context.serializationContext();
if (fileContext) {
_fileName=fileContext->createBinaryFilePath(*this);
auto_ptr<ostream> os(fileContext->getBinaryOutputStream(_fileName));
if (os.get()) {
_instance->write(*os);
}
}
}
data << field("pathName",_fileName);
}
void BaseBLOBReference::deserialize(ObjectData& data, IdContext& context) {
Identifiable::deserialize(data, context);
data >> field("pathName",_fileName);
_instance=0;
}
bool BaseBLOBReference::load(BLOB& instance) {
//Check if binary file serialization is supported
SerializationContext* fileContext=getContext()->serializationContext();
if (fileContext) {
auto_ptr<istream> is(fileContext->getBinaryInputStream(_fileName));
if (is.get()) {
return instance.read(*is);
}
}
return false;
}
void BaseBLOBReference::set(BLOB* instance) {
if (_instance) {
delete _instance;
}
_instance=instance;
}
| 26.252525
| 75
| 0.710273
|
Lab-RoCoCo
|
a569e99c0c0abfab7cdaa89a8d125cf39b96d901
| 786
|
cpp
|
C++
|
C++/Playlist Maker/Song.cpp
|
Andrustn/Andrustn.github.io
|
8cc1cf815a20be06373ca61c57bb29ec41ef79f2
|
[
"MIT"
] | null | null | null |
C++/Playlist Maker/Song.cpp
|
Andrustn/Andrustn.github.io
|
8cc1cf815a20be06373ca61c57bb29ec41ef79f2
|
[
"MIT"
] | null | null | null |
C++/Playlist Maker/Song.cpp
|
Andrustn/Andrustn.github.io
|
8cc1cf815a20be06373ca61c57bb29ec41ef79f2
|
[
"MIT"
] | null | null | null |
#include<iostream>
#include<string>
#include "Song.h"
void Song::SetSongName(string userSongName) {
songName = userSongName;
}
void Song::SetSongFirstLine(string userSongFirstLine) {
songFirstLine = userSongFirstLine;
}
void Song::SetTimesPlayed(int userTimesPlayed) {
timesPlayed = userTimesPlayed;
}
Song::Song() {
songName = "No Name";
songFirstLine = "No first line";
timesPlayed = 0;
}
Song::Song(string userSongName, string userSongFirstLine) {
songName = userSongName;
songFirstLine = userSongFirstLine;
}
string Song::GetSongName() {
return songName;
}
string Song::GetSongFirstLine() {
return songFirstLine;
}
int Song::GetTimesPlayed() {
return timesPlayed;
}
void Song::IncrementTimesPlayed() {
timesPlayed = timesPlayed + 1;
}
| 22.457143
| 60
| 0.720102
|
Andrustn
|
a573cd65a101e523428e648128c51c79e2092a58
| 1,127
|
cpp
|
C++
|
vulcan_test/debug_stream.cpp
|
WarlockD/Vulkan2D-Engine
|
c7808e7d29cd52ba096b03e26839efa781691de7
|
[
"MIT"
] | 1
|
2021-07-02T20:35:05.000Z
|
2021-07-02T20:35:05.000Z
|
vulcan_test/debug_stream.cpp
|
WarlockD/Vulkan2D-Engine
|
c7808e7d29cd52ba096b03e26839efa781691de7
|
[
"MIT"
] | null | null | null |
vulcan_test/debug_stream.cpp
|
WarlockD/Vulkan2D-Engine
|
c7808e7d29cd52ba096b03e26839efa781691de7
|
[
"MIT"
] | null | null | null |
#include "dbgstream.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <fstream>
#ifdef DBG_TIMESTAMP
extern "C" {
#include <time.h>
};
#endif /* DBG_TIMESTAMP */
using namespace std;
dbgstream dbg;
dbgbuf::~dbgbuf()
{
flushMsg();
}
void dbgbuf::flushMsg()
{
if (msg.length() > 0) {
#if DBG_TIMESTAMP
char tbuf[64];
time_t t = time(0);
struct tm tm;
tm = *localtime(&t);
strftime(tbuf, sizeof(tbuf), "%b %d %R:%S", &tm);
OutputDebugStringA(tbuf);
OutputDebugStringA(":");
if (tee) {
(*tee) << tbuf << ": ";
}
#endif /* DBG_TIMESTAMP */
OutputDebugStringA(msg.c_str());
OutputDebugStringA("\n");
if (tee) {
(*tee) << msg << endl << flush;
}
msg.erase(); // erase message buffer
}
}
std::ostream *dbgbuf::setTee(std::ostream *_tee)
{
std::ostream *otee = tee;
tee = _tee; return otee;
}
int dbgbuf::overflow(int c)
{
if (c == '\n') {
flushMsg();
}
else {
msg += c;
}
return c == -1 ? -1 : ' ';
}
#ifdef TEST_MAIN
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT)
{
dbgstream dbg;
dbg << "Hello, World." << endl;
return 0;
}
#endif /* TEST_MAIN */
| 15.22973
| 58
| 0.606921
|
WarlockD
|
a573d91bf5f42ade2faa44b67835c31c0bec6bb2
| 290
|
hpp
|
C++
|
font.hpp
|
5cript/cairo-wrap
|
d436eea920496830647a86488c2878a76c1e7479
|
[
"MIT"
] | 1
|
2020-11-11T17:19:14.000Z
|
2020-11-11T17:19:14.000Z
|
font.hpp
|
5cript/cairo-wrap
|
d436eea920496830647a86488c2878a76c1e7479
|
[
"MIT"
] | null | null | null |
font.hpp
|
5cript/cairo-wrap
|
d436eea920496830647a86488c2878a76c1e7479
|
[
"MIT"
] | 1
|
2021-03-01T08:53:46.000Z
|
2021-03-01T08:53:46.000Z
|
#pragma once
#include "core.hpp"
#include <string>
namespace Cairo
{
struct Font
{
std::string family = "Arial";
double size = 12;
cairo_font_weight_t weight = CAIRO_FONT_WEIGHT_NORMAL;
cairo_font_slant_t slant = CAIRO_FONT_SLANT_NORMAL;
};
}
| 17.058824
| 62
| 0.648276
|
5cript
|
a57b6b80abf97f8922a8e9ccf7804da5b09626ab
| 24,902
|
cpp
|
C++
|
kratos/processes/assign_scalar_input_to_entities_process.cpp
|
ma6yu/Kratos
|
02380412f8a833a2cdda6791e1c7f9c32e088530
|
[
"BSD-4-Clause"
] | null | null | null |
kratos/processes/assign_scalar_input_to_entities_process.cpp
|
ma6yu/Kratos
|
02380412f8a833a2cdda6791e1c7f9c32e088530
|
[
"BSD-4-Clause"
] | null | null | null |
kratos/processes/assign_scalar_input_to_entities_process.cpp
|
ma6yu/Kratos
|
02380412f8a833a2cdda6791e1c7f9c32e088530
|
[
"BSD-4-Clause"
] | null | null | null |
//
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Vicente Mataix Ferrandiz
//
// System includes
// External includes
// Project includes
#include "containers/model.h"
#include "utilities/string_utilities.h"
#include "utilities/variable_utils.h"
#include "processes/assign_scalar_input_to_entities_process.h"
namespace Kratos
{
/// Local Flags
template<class TEntity, bool THistorical>
const Kratos::Flags AssignScalarInputToEntitiesProcess<TEntity, THistorical>::GEOMETRIC_DEFINITION(Kratos::Flags::Create(0));
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
AssignScalarInputToEntitiesProcess<TEntity, THistorical>::AssignScalarInputToEntitiesProcess(
ModelPart& rModelPart,
Parameters rParameters
) : Process(Flags()) ,
mrModelPart(rModelPart)
{
KRATOS_TRY
// Validate against defaults -- this ensures no type mismatch
const Parameters default_parameters = GetDefaultParameters();
rParameters.ValidateAndAssignDefaults(default_parameters);
const std::string& r_variable_name = rParameters["variable_name"].GetString();
KRATOS_ERROR_IF_NOT(KratosComponents<Variable<double>>::Get(r_variable_name)) << "The variable " << r_variable_name << " does not exist" << std::endl;
mpVariable = &KratosComponents<Variable<double>>::Get(r_variable_name);
// Getting algorithm
mAlgorithm = ConvertAlgorithmString(rParameters["transfer_algorithm"].GetString());
// Get the geometry or entities
const std::string& r_filename = rParameters["file"].GetString();
if (StringUtilities::ContainsPartialString(r_filename, ".txt")) {
IdentifyDataTXT(r_filename);
} else if (StringUtilities::ContainsPartialString(r_filename, ".json")) {
IdentifyDataJSON(r_filename);
} else {
KRATOS_ERROR << "The process is only compatible with JSON and TXT" << std::endl;
}
// Read the input file
if (StringUtilities::ContainsPartialString(r_filename, ".txt")) {
ReadDataTXT(r_filename);
} else if (StringUtilities::ContainsPartialString(r_filename, ".json")) {
ReadDataJSON(r_filename);
} else {
KRATOS_ERROR << "The process is only compatible with JSON and TXT" << std::endl;
}
// Compute the extrpolation weights
ComputeExtrapolationWeight();
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::ExecuteInitializeSolutionStep()
{
KRATOS_TRY;
// Get time
const double time = mrModelPart.GetProcessInfo().GetValue(TIME);
// Case of only one entity defined
const SizeType number_of_databases = mCoordinates.size();
const auto& r_var_database = mDatabase.GetVariableData(*mpVariable);
if (number_of_databases == 1) {
InternalAssignValue(*mpVariable, r_var_database.GetValue(0, time));
} else {
// Getting entities array
auto& r_entities_array = GetEntitiesContainer();
const int number_of_entities = static_cast<int>(r_entities_array.size());
// Initialize values
ResetValues();
if(number_of_entities != 0) {
const auto it_begin = r_entities_array.begin();
#pragma omp parallel for
for(int i = 0; i < number_of_entities; i++) {
auto it_entity = it_begin + i;
const auto& r_weights = mWeightExtrapolation[i];
double& r_value = GetValue(*it_entity, *mpVariable);
for (auto& r_weight : r_weights) {
r_value += r_weight.second * r_var_database.GetValue(r_weight.first, time);
}
}
}
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
const Parameters AssignScalarInputToEntitiesProcess<TEntity, THistorical>::GetDefaultParameters() const
{
const Parameters default_parameters( R"(
{
"model_part_name" : "MODEL_PART_NAME",
"mesh_id" : 0,
"variable_name" : "VARIABLE_NAME",
"file" : "",
"transfer_algorithm" : "nearest_neighbour"
} )" );
return default_parameters;
}
/***********************************************************************************/
/***********************************************************************************/
template<>
array_1d<double, 3> AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>:: GetCoordinatesEntity(const IndexType Id)
{
return mrModelPart.pGetNode(Id)->Coordinates();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
array_1d<double, 3> AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>:: GetCoordinatesEntity(const IndexType Id)
{
return mrModelPart.pGetNode(Id)->Coordinates();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
array_1d<double, 3> AssignScalarInputToEntitiesProcess<Condition, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>:: GetCoordinatesEntity(const IndexType Id)
{
return mrModelPart.pGetCondition(Id)->GetGeometry().Center().Coordinates();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
array_1d<double, 3> AssignScalarInputToEntitiesProcess<Element, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>:: GetCoordinatesEntity(const IndexType Id)
{
return mrModelPart.pGetElement(Id)->GetGeometry().Center().Coordinates();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
PointerVectorSet<Node<3>, IndexedObject>& AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetEntitiesContainer()
{
return mrModelPart.GetMesh().Nodes();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
PointerVectorSet<Node<3>, IndexedObject>& AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>::GetEntitiesContainer()
{
return mrModelPart.GetMesh().Nodes();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
PointerVectorSet<Condition, IndexedObject>& AssignScalarInputToEntitiesProcess<Condition, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetEntitiesContainer()
{
return mrModelPart.GetMesh().Conditions();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
PointerVectorSet<Element, IndexedObject>& AssignScalarInputToEntitiesProcess<Element, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetEntitiesContainer()
{
return mrModelPart.GetMesh().Elements();
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::ResetValues()
{
VariableUtils().SetNonHistoricalVariable(*mpVariable, 0.0, GetEntitiesContainer());
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>::ResetValues()
{
VariableUtils().SetVariable(*mpVariable, 0.0, GetEntitiesContainer());
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Condition, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::ResetValues()
{
VariableUtils().SetNonHistoricalVariable(*mpVariable, 0.0, GetEntitiesContainer());
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Element, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::ResetValues()
{
VariableUtils().SetNonHistoricalVariable(*mpVariable, 0.0, GetEntitiesContainer());
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::SetValue(
Node<3>& rEntity,
const Variable<double>& rVariable,
const double Value
)
{
rEntity.SetValue(rVariable, Value);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>::SetValue(
Node<3>& rEntity,
const Variable<double>& rVariable,
const double Value
)
{
rEntity.FastGetSolutionStepValue(rVariable) = Value;
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Condition, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::SetValue(
Condition& rEntity,
const Variable<double>& rVariable,
const double Value
)
{
rEntity.SetValue(rVariable, Value);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
void AssignScalarInputToEntitiesProcess<Element, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::SetValue(
Element& rEntity,
const Variable<double>& rVariable,
const double Value
)
{
rEntity.SetValue(rVariable, Value);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
double& AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetValue(
Node<3>& rEntity,
const Variable<double>& rVariable
)
{
return rEntity.GetValue(rVariable);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
double& AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>::GetValue(
Node<3>& rEntity,
const Variable<double>& rVariable
)
{
return rEntity.FastGetSolutionStepValue(rVariable);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
double& AssignScalarInputToEntitiesProcess<Condition, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetValue(
Condition& rEntity,
const Variable<double>& rVariable
)
{
return rEntity.GetValue(rVariable);
}
/***********************************************************************************/
/***********************************************************************************/
template<>
double& AssignScalarInputToEntitiesProcess<Element, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>::GetValue(
Element& rEntity,
const Variable<double>& rVariable
)
{
return rEntity.GetValue(rVariable);
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::IdentifyDataTXT(const std::string& rFileName)
{
KRATOS_TRY;
// Read txt
std::ifstream infile(rFileName);
KRATOS_ERROR_IF_NOT(infile.good()) << "TXT file: " << rFileName << " cannot be found" << std::endl;
std::stringstream buffer;
buffer << infile.rdbuf();
// First line
std::string line;
std::getline(buffer, line);
// Checking if geometric definition or entity identifier
if (StringUtilities::ContainsPartialString(line, "(") && StringUtilities::ContainsPartialString(line, ")")) {
this->Set(GEOMETRIC_DEFINITION, true);
} else {
this->Set(GEOMETRIC_DEFINITION, false);
}
std::istringstream iss(line);
std::string token;
SizeType counter = 0;
std::string::size_type sz; // alias of size_t
if (this->Is(GEOMETRIC_DEFINITION)) {
array_1d<double, 3> aux_array;
while(std::getline(iss, token, '\t')) {
if (counter > 0) {
std::string aux_string = StringUtilities::ErasePartialString(token, "(");
aux_string = StringUtilities::ErasePartialString(aux_string, ")");
std::stringstream s_stream(aux_string); // Create string stream from the string
SizeType sub_counter = 0;
std::string substr;
while(s_stream.good()) {
std::getline(s_stream, substr, ','); // Get first string delimited by comma
aux_array[sub_counter] = std::stod(substr, &sz);
++sub_counter;
}
mCoordinates.push_back(aux_array);
}
++counter;
}
} else {
while(std::getline(iss, token, '\t')) {
if (counter > 0) {
const IndexType id = std::stod(token, &sz);
mCoordinates.push_back(GetCoordinatesEntity(id));
}
++counter;
}
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::IdentifyDataJSON(const std::string& rFileName)
{
KRATOS_TRY;
// Reading json file
std::ifstream infile(rFileName);
KRATOS_ERROR_IF_NOT(infile.good()) << "JSON file: " << rFileName << " cannot be found" << std::endl;
std::stringstream buffer;
buffer << infile.rdbuf();
Parameters json_input(buffer.str());
// Getting number of definitions
SizeType number_of_definitions = 0;
for (auto& r_param : json_input) {
if (!r_param.IsVector()) { // Removing TIME
++number_of_definitions;
}
}
// Check number of definitions
KRATOS_ERROR_IF(number_of_definitions == 0) << "Definitions must be superior to 0" << std::endl;
// Reserve
if (mCoordinates.size() != number_of_definitions) {
mCoordinates.resize(number_of_definitions);
}
KRATOS_ERROR_IF_NOT(json_input.Has("1")) << "Input not properly defined. Input must have values defined ordered" << std::endl;
if (json_input["1"].Has("ID")) {
this->Set(GEOMETRIC_DEFINITION, false);
} else if (json_input["1"].Has("COORDINATES")) {
this->Set(GEOMETRIC_DEFINITION, true);
} else {
KRATOS_ERROR << "ID or COORDINATES must be defined" << std::endl;
}
// Iterate over parameters
for (IndexType i = 0; i < number_of_definitions; ++i) {
const std::string identifier = std::to_string(i + 1);
if (this->Is(GEOMETRIC_DEFINITION)) {
mCoordinates[i] = array_1d<double, 3>(json_input[identifier]["COORDINATES"].GetVector());
} else {
const IndexType id = static_cast<IndexType>(json_input[identifier]["ID"].GetInt());
mCoordinates[i] = GetCoordinatesEntity(id);
}
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::ReadDataTXT(const std::string& rFileName)
{
KRATOS_TRY;
// Initialize the databases
std::vector<IndexType> variables_ids(1);
variables_ids[0] = mpVariable->Key();
std::vector<IndexType> values_sizes(1, 1);
const SizeType number_of_definitions = mCoordinates.size();
mDatabase.Initialize(variables_ids, values_sizes, number_of_definitions);
// Define the number of time steps
SizeType number_time_steps = 0;
// Definition of auxiliar line
std::string line;
// Initial read
{
// Read txt
std::ifstream infile(rFileName);
KRATOS_ERROR_IF_NOT(infile.good()) << "TXT file: " << rFileName << " cannot be found" << std::endl;
std::stringstream buffer;
buffer << infile.rdbuf();
// First line
std::getline(buffer, line);
// The other lines
while(std::getline(buffer, line)) {
++number_time_steps;
}
}
Vector time = ZeroVector(number_time_steps);
std::vector<Vector> values(number_of_definitions, time);
// Second read txt
std::ifstream infile(rFileName);
KRATOS_ERROR_IF_NOT(infile.good()) << "TXT file: " << rFileName << " cannot be found" << std::endl;
std::stringstream buffer;
buffer << infile.rdbuf();
// First line
std::getline(buffer, line);
// The other lines
SizeType counter = 0;
std::string::size_type sz; // alias of size_t
while(std::getline(buffer, line)) {
std::istringstream iss(line);
std::string token;
SizeType sub_counter = 0;
while(std::getline(iss, token, '\t')) {
const double value = std::stod(token, &sz);
if (sub_counter == 0) {
time[counter] = value;
} else {
values[sub_counter - 1][counter] = value;
}
++sub_counter;
}
++counter;
}
// Set the time table
mDatabase.SetCommonColumn(time);
// Set the entities values
auto& r_var_database = mDatabase.GetVariableData(*mpVariable);
for (IndexType i = 0; i < values.size(); ++i) {
r_var_database.SetValues(time, values[i], i);
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::ReadDataJSON(const std::string& rFileName)
{
KRATOS_TRY;
// Reading json file
std::ifstream infile(rFileName);
KRATOS_ERROR_IF_NOT(infile.good()) << "JSON file: " << rFileName << " cannot be found" << std::endl;
std::stringstream buffer;
buffer << infile.rdbuf();
Parameters json_input(buffer.str());
// Initialize the databases
std::vector<IndexType> variables_ids(1);
variables_ids[0] = mpVariable->Key();
std::vector<IndexType> values_sizes(1, 1);
const SizeType number_of_definitions = mCoordinates.size();
mDatabase.Initialize(variables_ids, values_sizes, number_of_definitions);
// Get the time vector
const Vector& r_time = json_input["TIME"].GetVector();
mDatabase.SetCommonColumn(r_time);
// Fill database
auto& r_var_database = mDatabase.GetVariableData(*mpVariable);
const std::string& r_variable_name = mpVariable->Name();
for (IndexType i = 0; i < number_of_definitions; ++i) {
const std::string identifier = std::to_string(i + 1);
const auto& r_vector = json_input[identifier]["VALUES"][r_variable_name].GetVector();
r_var_database.SetValues(r_time, r_vector, i);
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::ComputeExtrapolationWeight()
{
KRATOS_TRY;
// Some definitions
const auto& r_entities_array = GetEntitiesContainer();
const auto it_ent_begin = r_entities_array.begin();
const SizeType number_of_entities = r_entities_array.size();
// Resize the weight extrapolation vector
if (mWeightExtrapolation.size() != number_of_entities) {
mWeightExtrapolation.resize(number_of_entities);
}
// Considering different algorithms to fill the weights
const SizeType number_of_definitions = mCoordinates.size();
if (mAlgorithm == Algorithm::NEAREST_NEIGHBOUR) {
#pragma omp parallel for
for (int i = 0; i < static_cast<int>(number_of_entities); ++i) {
auto it_ent = it_ent_begin + i;
const IndexType id = it_ent->Id();
const array_1d<double, 3> coordinates = GetCoordinatesEntity(id);
double distance = 1.0e24;
IndexType index = 0;
for (IndexType j = 0; j < number_of_definitions; ++j) {
const double aux_distance = norm_2(coordinates - mCoordinates[j]);
if (aux_distance < distance) {
distance = aux_distance;
index = j;
}
}
std::unordered_map<IndexType, double> aux_map({{index, 1.0}});
mWeightExtrapolation[i] = aux_map;
}
} else {
KRATOS_ERROR << "Algorithm not defined" << std::endl;
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template<class TEntity, bool THistorical>
void AssignScalarInputToEntitiesProcess<TEntity, THistorical>::InternalAssignValue(
const Variable<double>& rVariable,
const double Value
)
{
KRATOS_TRY;
auto& r_entities_array = GetEntitiesContainer();
const int number_of_entities = static_cast<int>(r_entities_array.size());
if(number_of_entities != 0) {
const auto it_begin = r_entities_array.begin();
#pragma omp parallel for
for(int i = 0; i<number_of_entities; i++) {
auto it_entity = it_begin + i;
SetValue(*it_entity, rVariable, Value);
}
}
KRATOS_CATCH("");
}
/***********************************************************************************/
/***********************************************************************************/
template class AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsNonHistoricalVariable>;
template class AssignScalarInputToEntitiesProcess<Node<3>, AssignScalarInputToEntitiesProcessSettings::SaveAsHistoricalVariable>;
template class AssignScalarInputToEntitiesProcess<Condition>;
template class AssignScalarInputToEntitiesProcess<Element>;
} // namespace Kratos.
| 37.559578
| 186
| 0.544053
|
ma6yu
|
a57dca26601e33459ea64de3041af5be99acb32a
| 880
|
hh
|
C++
|
simlucid/include/SimLucidSteppingVerbose.hh
|
CERNatschool/SimLUCID-lite
|
ccc6000bfbcd70538e60a0d46fe3f2f2ef43653a
|
[
"MIT"
] | null | null | null |
simlucid/include/SimLucidSteppingVerbose.hh
|
CERNatschool/SimLUCID-lite
|
ccc6000bfbcd70538e60a0d46fe3f2f2ef43653a
|
[
"MIT"
] | null | null | null |
simlucid/include/SimLucidSteppingVerbose.hh
|
CERNatschool/SimLUCID-lite
|
ccc6000bfbcd70538e60a0d46fe3f2f2ef43653a
|
[
"MIT"
] | null | null | null |
/*! \file SimLucidSteppingVerbose.hh
* \brief The header file for the SimLucidSteppingVerbose class.
*/
class SimLucidSteppingVerbose;
#ifndef SimLucidSteppingVerbose_h
#define SimLucidSteppingVerbose_h 1
// GEANT4 includes
#include "G4SteppingVerbose.hh"
/*! \brief Class handling user-defined verbose actions.
@author T. Whyntie
@date Autumn 2013
Based on work on the Allpix simulation package by J. Idarraga et al.
This class provides methods for outputting information about the
step and tracking processes that take place in the simulations.
*/
class SimLucidSteppingVerbose : public G4SteppingVerbose
{
public:
SimLucidSteppingVerbose(); //!< Constructor.
~SimLucidSteppingVerbose(); //!< Destructor.
void StepInfo(); //!< Information printed at every step.
void TrackingStarted(); //!< Information printed when the tracking starts.
};
#endif
| 23.783784
| 77
| 0.765909
|
CERNatschool
|
a57fd356c2bfe0dcabd2affd17d0daae6cb3b0c2
| 829
|
cpp
|
C++
|
CFPExercise2.21.2019/CFPExercise2.21.2019/CFPExercise2.21.2019.cpp
|
cperez604/ITSE-1307-Spring-2019
|
c5137d7e6b2785c0eb37df0964ba6d61c7cc7555
|
[
"MIT"
] | null | null | null |
CFPExercise2.21.2019/CFPExercise2.21.2019/CFPExercise2.21.2019.cpp
|
cperez604/ITSE-1307-Spring-2019
|
c5137d7e6b2785c0eb37df0964ba6d61c7cc7555
|
[
"MIT"
] | null | null | null |
CFPExercise2.21.2019/CFPExercise2.21.2019/CFPExercise2.21.2019.cpp
|
cperez604/ITSE-1307-Spring-2019
|
c5137d7e6b2785c0eb37df0964ba6d61c7cc7555
|
[
"MIT"
] | null | null | null |
// CFPExercise2.21.2019.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
//establish variables
double dblfirstvariable = .0;
double dblsecondvariable = .0;
double dblvariablec = .0;
cout << "Calculator for equation C = A*B/A-B" << endl;
//input output for first variable/A
cout << "Please Enter Decimal Value for A variable" << endl;
cin >> dblfirstvariable;
//input output for second variable/B
cout << "Please Enter Decimal Value for B variable" << endl;
cin >> dblsecondvariable;
//calculate for C = A*B/A-C
float fltvariablec = (float)(dblfirstvariable * dblsecondvariable) / (dblfirstvariable - dblsecondvariable);
cout << "C equals: " << fltvariablec << endl;
}
| 29.607143
| 111
| 0.685163
|
cperez604
|
a5818f8c8078d29e54b073bb18211c39f0ed474d
| 552
|
cpp
|
C++
|
PTA_L1/L1_062.cpp
|
codehuanglei/-
|
933a55b5c5a49163f12e0c39b4edfa9c4f01678f
|
[
"MIT"
] | null | null | null |
PTA_L1/L1_062.cpp
|
codehuanglei/-
|
933a55b5c5a49163f12e0c39b4edfa9c4f01678f
|
[
"MIT"
] | null | null | null |
PTA_L1/L1_062.cpp
|
codehuanglei/-
|
933a55b5c5a49163f12e0c39b4edfa9c4f01678f
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
using namespace std;
int main()
{
int N;
cin >> N;
while (N--)
{
string s;
cin >> s;
int sum1 = 0, sum2 = 0;
sum1 = (s[0] - '0') + (s[1] - '0') + (s[2] - '0');
sum2 = (s[3] - '0') + (s[4] - '0') + (s[5] - '0');
if (sum1 == sum2)
{
cout << "You are lucky!" << endl;
}
else
{
cout << "Wish you good luck." << endl;
}
sum1 = sum2 = 0;
}
return 0;
}
| 21.230769
| 59
| 0.34058
|
codehuanglei
|
a582f06ceeaa1b13c8acfc0ed0d6b92790f214ff
| 5,237
|
cpp
|
C++
|
Main.cpp
|
d0lev/messageboard
|
8db6c72bb973981e6078b087f4e2e69e6998ac0d
|
[
"MIT"
] | null | null | null |
Main.cpp
|
d0lev/messageboard
|
8db6c72bb973981e6078b087f4e2e69e6998ac0d
|
[
"MIT"
] | null | null | null |
Main.cpp
|
d0lev/messageboard
|
8db6c72bb973981e6078b087f4e2e69e6998ac0d
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include "Direction.hpp"
#include "Board.hpp"
using namespace std;
using namespace ariel;
int main() {
ariel::Board board;
// declaration of all variables
uint row , column , length;
int func;
int dir;
string message;
Direction direction;
// wellcome line
cout << "Wellcome to Assignment number two : " << "\033[1;31mmessageboard part B\033[0m\n";
cout << "You can choose one of the option : " << "\033[1;32mPost (Press 1)\033[0m "
<< "\033[1;33mRead (Press 2)\033[0m "
<< "\033[1;34mShow (Press 3)\033[0m "
<< "\033[1;35mExit (Press 4)\033[0m " << endl;
cin >> func;
while (func != 4) {
switch(func) {
//post function
case 1: cout << "\033[1;32mYou choose : Post\033[0m \n";
cout << "\033[1;32m1)\033[0m " << "for inserting a message horizontally please press 1 \n";
cout << "\033[1;32m2)\033[0m " << "for inserting a message vertically please press 2\n";
cin >> dir;
if(dir == 1 || dir == 2) {
if (dir == 1) {direction = Horizontal;}
else if (dir == 2) {direction = Vertical;}
cout << "Please enter the position of the message by two indexes [i][j]\n";
cin >> row >> column;
cout << "\033[1;33mPlease enter the message \033[0m\n";
cin >> message;
board.post(row,column,direction,message);
cout << "\033[1;32mThe message was published successfully!\033[0m\n";
cout << "\nWellcome to Assignment number two : " << "\033[1;31mmessageboard part B\033[0m\n";
cout << "You can choose one of the option : " << "\033[1;32mPost (Press 1)\033[0m "
<< "\033[1;33mRead (Press 2)\033[0m "
<< "\033[1;34mShow (Press 3)\033[0m "
<< "\033[1;35mExit (Press 4)\033[0m " << endl;
cin >> func;
}
else cout << "Wrong input , please try again. \n";
break;
//read function
case 2: cout << "\033[1;33mYou choose : Read\033[0m \n";
cout << "Please enter the position by two indexes [i][j]\n";
cin >> row >> column;
cout << "\033[1;32m1)\033[0m " << "for read the message horizontally please press 1 \n";
cout << "\033[1;32m2)\033[0m " << "for read the message vertically please press 2\n";
cin >> dir;
if(dir == 1 || dir == 2) {
if (dir == 1) {direction = Horizontal;}
else if (dir == 2) {direction = Vertical;}
cout << "\033[1;32m2)\033[0m " << "Please enter the length of the reading\n";
cin >> length;
message = board.read(row,column,direction,length);
cout << "The message are : " << message << endl;
cout << "\nWellcome to Assignment number two : " << "\033[1;31mmessageboard part B\033[0m\n";
cout << "You can choose one of the option : " << "\033[1;32mPost (Press 1)\033[0m "
<< "\033[1;33mRead (Press 2)\033[0m "
<< "\033[1;34mShow (Press 3)\033[0m "
<< "\033[1;35mExit (Press 4)\033[0m " << endl;
cin >> func;
}
else cout << "Wrong input , please try again. \n";
break;
//show function
case 3: cout << "\033[1;34mYou choose : Show\033[0m \n";
cout << "The message board is :\n";
board.show();
cout << "\nWellcome to Assignment number two : " << "\033[1;31mmessageboard part B\033[0m\n";
cout << "You can choose one of the option : " << "\033[1;32mPost (Press 1)\033[0m "
<< "\033[1;33mRead (Press 2)\033[0m "
<< "\033[1;34mShow (Press 3)\033[0m "
<< "\033[1;35mExit (Press 4)\033[0m " << endl;
cin >> func;
break;
default: exit(1);
}
}
}
| 56.923913
| 121
| 0.384762
|
d0lev
|
a584c0e21e636636f4c9c8814415f22a23672567
| 376
|
hpp
|
C++
|
mr.Sadman/Classes/GameAct/Objects/Physical/PushPlate/PushPlate.hpp
|
1pkg/dump
|
0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b
|
[
"MIT"
] | null | null | null |
mr.Sadman/Classes/GameAct/Objects/Physical/PushPlate/PushPlate.hpp
|
1pkg/dump
|
0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b
|
[
"MIT"
] | 3
|
2020-12-11T10:01:27.000Z
|
2022-02-13T22:12:05.000Z
|
mr.Sadman/Classes/GameAct/Objects/Physical/PushPlate/PushPlate.hpp
|
1pkg/dump
|
0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b
|
[
"MIT"
] | null | null | null |
#ifndef __GAME_ACT_PHYSICAL_PUSH_PLATE_HPP__
#define __GAME_ACT_PHYSICAL_PUSH_PLATE_HPP__
#include "GameAct/Objects/Physical/Button/Button.hpp"
namespace GameAct
{
namespace Physical
{
class PushPlate
: public Button
{
public:
void setRotation( float angle ) override;
void runAction( const std::string & action ) override;
};
}
}
#endif
| 13.925926
| 56
| 0.723404
|
1pkg
|
a585088f28f2a6aca4ec849621838d21bdc7e58f
| 1,193
|
hpp
|
C++
|
src/CmdNodeDisconnect.hpp
|
Bwar/NebulaBeacon
|
4fbb53cd0c56811d25a08c47aaf67a8398e9ecc4
|
[
"Apache-2.0"
] | 3
|
2019-01-24T02:49:57.000Z
|
2021-06-06T08:40:34.000Z
|
src/CmdNodeDisconnect.hpp
|
Bwar/NebulaBeacon
|
4fbb53cd0c56811d25a08c47aaf67a8398e9ecc4
|
[
"Apache-2.0"
] | 3
|
2021-06-01T03:21:13.000Z
|
2021-09-02T04:46:27.000Z
|
src/CmdNodeDisconnect.hpp
|
Bwar/NebulaBeacon
|
4fbb53cd0c56811d25a08c47aaf67a8398e9ecc4
|
[
"Apache-2.0"
] | 3
|
2019-10-05T12:13:03.000Z
|
2021-06-06T08:40:20.000Z
|
/*******************************************************************************
* Project: Beacon
* @file CmdNodeDisconnect.hpp
* @brief
* @author bwar
* @date: Feb 14, 2017
* @note
* Modify history:
******************************************************************************/
#ifndef SRC_CMDNODEDISCONNECT_CMDNODEDISCONNECT_HPP_
#define SRC_CMDNODEDISCONNECT_CMDNODEDISCONNECT_HPP_
#include <actor/cmd/Cmd.hpp>
#include <Error.hpp>
#include <SessionOnlineNodes.hpp>
#include <util/json/CJsonObject.hpp>
namespace beacon
{
class CmdNodeDisconnect: public neb::Cmd, public neb::DynamicCreator<CmdNodeDisconnect, int32>
{
public:
CmdNodeDisconnect(int32 iCmd);
virtual ~CmdNodeDisconnect();
virtual bool Init();
virtual bool AnyMessage(
std::shared_ptr<neb::SocketChannel> pChannel,
const MsgHead& oMsgHead,
const MsgBody& oMsgBody);
virtual std::string ObjectName() const
{
return("beacon::CmdNodeReport");
}
private:
std::shared_ptr<SessionOnlineNodes> m_pSessionOnlineNodes;
};
} /* namespace beacon */
#endif /* SRC_CMDNODEDISCONNECT_CMDNODEDISCONNECT_HPP_ */
| 26.511111
| 94
| 0.601006
|
Bwar
|
a58b86ffcbbbc0f9e0057421f95ee69f03cc24a4
| 507
|
cpp
|
C++
|
lab3(assignment 3 date).cpp
|
ahmedtarek26/oop_assignments
|
a6f334e013dfaef5ca59658f0b2fd8d365902492
|
[
"MIT"
] | null | null | null |
lab3(assignment 3 date).cpp
|
ahmedtarek26/oop_assignments
|
a6f334e013dfaef5ca59658f0b2fd8d365902492
|
[
"MIT"
] | null | null | null |
lab3(assignment 3 date).cpp
|
ahmedtarek26/oop_assignments
|
a6f334e013dfaef5ca59658f0b2fd8d365902492
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include<string>
using namespace std;
struct Date {
int day=18 , month=11, year=2020;
};
void Date_next(){
Date current;
for (int i = 1; i < 45; i++) {
if(current.day==31){
current.day=1;
current.day+=1;
current.month+=1;
}
else
current.day+=1;
}
cout << current.day << endl;
cout << current.month <<endl;
cout << current.year << endl;
}
int main() {
Date_next();
system("pause");
return 0;
}
| 16.354839
| 39
| 0.530572
|
ahmedtarek26
|
a58c1e5e82b200b494cf624346a6313435d8266a
| 3,006
|
cpp
|
C++
|
src/udpbridge_ui.cpp
|
GFOE/udp_bridge
|
e845a587b300af802ca310f1df253e03baf32bc4
|
[
"BSD-2-Clause"
] | 6
|
2018-12-22T15:32:29.000Z
|
2022-03-07T14:56:44.000Z
|
src/udpbridge_ui.cpp
|
GFOE/udp_bridge
|
e845a587b300af802ca310f1df253e03baf32bc4
|
[
"BSD-2-Clause"
] | null | null | null |
src/udpbridge_ui.cpp
|
GFOE/udp_bridge
|
e845a587b300af802ca310f1df253e03baf32bc4
|
[
"BSD-2-Clause"
] | 8
|
2018-04-05T19:57:36.000Z
|
2022-02-07T15:49:41.000Z
|
#include <ros/ros.h>
#include <ros/master.h>
#include "udp_bridge/ChannelStatisticsArray.h"
void statisticsCallback(udp_bridge::ChannelStatisticsArray const &stats)
{
std::vector<std::string> headers {"source topic", "remote host", " messages", "message data", " packet data", " compressed", " ratio", "send error"};
std::vector<int> column_widths;
for(auto h: headers)
column_widths.push_back(h.size());
for(auto c: stats.channels)
{
column_widths[0] = std::max(column_widths[0], int(c.source_topic.size()));
column_widths[1] = std::max(column_widths[1], int(c.destination_host.size()));
}
std::cout << std::left;
for(int i = 0; i < headers.size(); i++)
std::cout << std::setw(column_widths[i]+1) << headers[i];
std::cout << std::endl;
std::vector<float> totals {0.0, 0.0, 0.0, 0.0};
for(auto c: stats.channels)
{
std::cout << std::left;
std::cout << std::setw(column_widths[0]+1) << c.source_topic;
std::cout << std::setw(column_widths[1]+1) << c.destination_host;
std::cout << std::fixed;
std::cout << std::setprecision(1);
std::cout << std::right;
std::cout << std::setw(5) << c.messages_per_second << " msg/sec ";
// bytes to kilobits, *8/100 -> /125
std::cout << std::setw(7) << c.message_bytes_per_second/125.0 << " kbps ";
std::cout << std::setw(7) << c.packet_bytes_per_second/125.0 << " kbps ";
std::cout << std::setw(7) << c.compressed_bytes_per_second/125.0 << " kbps";
std::cout << std::setw(7) << 100*c.compressed_bytes_per_second/c.message_bytes_per_second << "%";
std::cout << std::setw(7) << 100*(1.0-c.send_success_rate) << "%";
std::cout << std::endl;
totals[0] += c.messages_per_second;
totals[1] += c.message_bytes_per_second;
totals[2] += c.packet_bytes_per_second;
totals[3] += c.compressed_bytes_per_second;
}
std::cout << std::left;
std::cout << std::setw(column_widths[0]+column_widths[1]+2) << "totals:";
std::cout << std::right;
std::cout << std::setw(5) << totals[0] << " msg/sec ";
std::cout << std::setw(7) << totals[1]/125.0 << " kbps ";
std::cout << std::setw(7) << totals[2]/125.0 << " kbps ";
std::cout << std::setw(7) << totals[3]/125.0 << " kbps";
std::cout << std::setw(7) << 100*totals[3]/totals[1] << "%";
std::cout << std::endl;
std::cout << std::endl;
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "udp_bridge_ui");
ros::NodeHandle nh;
std::vector<ros::Subscriber> statsSubs;
ros::master::V_TopicInfo topic_infos;
ros::master::getTopics(topic_infos);
for(auto ti:topic_infos)
if(ti.datatype == "udp_bridge/ChannelStatisticsArray")
statsSubs.push_back(nh.subscribe(ti.name, 10, &statisticsCallback));
ros::spin();
return 0;
}
| 34.953488
| 159
| 0.574185
|
GFOE
|
a591d7ef8bc0fb27ae8c0b8fe4e82791f5fbb499
| 1,497
|
cpp
|
C++
|
src/CMessageHeader.cpp
|
gasteve/bitcoin
|
b5e79be9e7612c31403a2231ba03850f495ea9c1
|
[
"MIT"
] | 1
|
2017-05-18T17:12:00.000Z
|
2017-05-18T17:12:00.000Z
|
src/CMessageHeader.cpp
|
gasteve/bitcoin
|
b5e79be9e7612c31403a2231ba03850f495ea9c1
|
[
"MIT"
] | null | null | null |
src/CMessageHeader.cpp
|
gasteve/bitcoin
|
b5e79be9e7612c31403a2231ba03850f495ea9c1
|
[
"MIT"
] | null | null | null |
#include "CMessageHeader.h"
//
// Message header
// (4) message start
// (12) command
// (4) size
// (4) checksum
extern char pchMessageStart[4];
CMessageHeader::CMessageHeader()
{
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
memset(pchCommand, 0, sizeof(pchCommand));
pchCommand[1] = 1;
nMessageSize = -1;
nChecksum = 0;
}
CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
{
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
strncpy(pchCommand, pszCommand, COMMAND_SIZE);
nMessageSize = nMessageSizeIn;
nChecksum = 0;
}
string CMessageHeader::GetCommand()
{
if (pchCommand[COMMAND_SIZE-1] == 0)
return string(pchCommand, pchCommand + strlen(pchCommand));
else
return string(pchCommand, pchCommand + COMMAND_SIZE);
}
bool CMessageHeader::IsValid()
{
// Check start string
if (memcmp(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)) != 0)
return false;
// Check the command string for errors
for (char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++)
{
if (*p1 == 0)
{
// Must be all zeros after the first zero
for (; p1 < pchCommand + COMMAND_SIZE; p1++)
if (*p1 != 0)
return false;
}
else if (*p1 < ' ' || *p1 > 0x7E)
return false;
}
// Message size
if (nMessageSize > MAX_SIZE)
{
printf("CMessageHeader::IsValid() : (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand().c_str(), nMessageSize);
return false;
}
return true;
}
| 22.343284
| 117
| 0.691383
|
gasteve
|
a5998ad829b04b45d1ad23645e65ab2abde31d6c
| 1,834
|
cpp
|
C++
|
VME/GBO.cpp
|
KIKU-O/VME
|
e87d5d9543d30e5b15f7cf5a04878a32290326df
|
[
"MIT"
] | null | null | null |
VME/GBO.cpp
|
KIKU-O/VME
|
e87d5d9543d30e5b15f7cf5a04878a32290326df
|
[
"MIT"
] | null | null | null |
VME/GBO.cpp
|
KIKU-O/VME
|
e87d5d9543d30e5b15f7cf5a04878a32290326df
|
[
"MIT"
] | null | null | null |
#include "GBO.h"
void GBO::Load()
{
Shader.Load("Shaders\\Geometry-Buffer.vert", "Shaders\\Geometry-Buffer.frag");
}
void GBO::Initialize()
{
glGenFramebuffers(1, &FBO);
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
// POSITION
glGenTextures(1, &Position);
glBindTexture(GL_TEXTURE_2D, Position);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 624, 480, 0, GL_RGB, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, Position, 0);
// NORMAL
glGenTextures(1, &Normal);
glBindTexture(GL_TEXTURE_2D, Normal);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 624, 480, 0, GL_RGB, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, Normal, 0);
unsigned int attachments[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
glDrawBuffers(2, attachments);
glGenRenderbuffers(1, &RBO);
glBindRenderbuffer(GL_RENDERBUFFER, RBO);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 624, 480);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, RBO);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
OutputDebugStringA("Geometry-Pass buffer could not be completed!\n");
}
}
void GBO::Bind(Camera camera)
{
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Shader.Process();
Shader.SetMatrix4("projection", camera.Projection);
Shader.SetMatrix4("view", camera.View());
}
| 36.68
| 93
| 0.749182
|
KIKU-O
|
a59a6eb8901e97195d2f268082101a331396881b
| 3,559
|
hpp
|
C++
|
retrace.hpp
|
prahal/apitrace
|
e9426dd61586757d23d7dddc85b3076f477e7f07
|
[
"MIT"
] | 1
|
2020-06-19T12:34:44.000Z
|
2020-06-19T12:34:44.000Z
|
retrace.hpp
|
prahal/apitrace
|
e9426dd61586757d23d7dddc85b3076f477e7f07
|
[
"MIT"
] | null | null | null |
retrace.hpp
|
prahal/apitrace
|
e9426dd61586757d23d7dddc85b3076f477e7f07
|
[
"MIT"
] | null | null | null |
/**************************************************************************
*
* Copyright 2011 Jose Fonseca
* All Rights Reserved.
*
* 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.
*
**************************************************************************/
#ifndef _RETRACE_HPP_
#define _RETRACE_HPP_
#include <string.h>
#include <list>
#include <map>
#include <ostream>
#include "trace_model.hpp"
namespace retrace {
/**
* Handle map.
*
* It is just like a regular std::map<T, T> container, but lookups of missing
* keys return the key instead of default constructor.
*
* This is necessary for several GL named objects, where one can either request
* the implementation to generate an unique name, or pick a value never used
* before.
*
* XXX: In some cases, instead of returning the key, it would make more sense
* to return an unused data value (e.g., container count).
*/
template <class T>
class map
{
private:
typedef std::map<T, T> base_type;
base_type base;
public:
T & operator[] (const T &key) {
typename base_type::iterator it;
it = base.find(key);
if (it == base.end()) {
return (base[key] = key);
}
return it->second;
}
const T & operator[] (const T &key) const {
typename base_type::const_iterator it;
it = base.find(key);
if (it == base.end()) {
return (base[key] = key);
}
return it->second;
}
};
void
addRegion(unsigned long long address, void *buffer, unsigned long long size);
void
delRegionByPointer(void *ptr);
void *
toPointer(trace::Value &value, bool bind = false);
/**
* Output verbosity when retracing files.
*/
extern int verbosity;
std::ostream &warning(trace::Call &call);
void ignore(trace::Call &call);
void unsupported(trace::Call &call);
typedef void (*Callback)(trace::Call &call);
struct Entry {
const char *name;
Callback callback;
};
struct stringComparer {
bool operator() (const char *a, const char *b) const {
return strcmp(a, b) < 0;
}
};
extern const Entry stdc_callbacks[];
class Retracer
{
typedef std::map<const char *, Callback, stringComparer> Map;
Map map;
std::vector<Callback> callbacks;
public:
Retracer() {
addCallbacks(stdc_callbacks);
}
virtual ~Retracer() {}
void addCallback(const Entry *entry);
void addCallbacks(const Entry *entries);
void retrace(trace::Call &call);
};
} /* namespace retrace */
#endif /* _RETRACE_HPP_ */
| 24.047297
| 80
| 0.652711
|
prahal
|
a59c53b2e48a5327e9f15e69a2fb30db04b85584
| 3,279
|
cpp
|
C++
|
firmware-latest/wiring/src/spark_wiring_servo.cpp
|
adeeshag/particle_project
|
0c2ab278cf902f97d2422c44c008978be58fe6b7
|
[
"Unlicense"
] | 1
|
2019-02-24T07:13:51.000Z
|
2019-02-24T07:13:51.000Z
|
firmware-latest/wiring/src/spark_wiring_servo.cpp
|
adeeshag/particle_project
|
0c2ab278cf902f97d2422c44c008978be58fe6b7
|
[
"Unlicense"
] | 1
|
2018-05-29T19:27:53.000Z
|
2018-05-29T19:27:53.000Z
|
firmware-latest/wiring/src/spark_wiring_servo.cpp
|
adeeshag/particle_project
|
0c2ab278cf902f97d2422c44c008978be58fe6b7
|
[
"Unlicense"
] | null | null | null |
/**
******************************************************************************
* @file spark_wiring_spi.h
* @author Zach Supalla
* @version V1.0.0
* @date 06-December-2013
* @brief Header for spark_wiring_servo.cpp module
******************************************************************************
Copyright (c) 2013-2015 Particle Industries, Inc. All rights reserved.
Copyright (c) 2010 LeafLabs, LLC.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/
#include "spark_wiring_servo.h"
#include "servo_hal.h"
#define ANGLE_TO_US(a) ((uint16_t)(map((a), this->minAngle, this->maxAngle, \
this->minPW, this->maxPW)))
#define US_TO_ANGLE(us) ((int16_t)(map((us), this->minPW, this->maxPW, \
this->minAngle, this->maxAngle)))
Servo::Servo()
{
this->resetFields();
}
bool Servo::attach(uint16_t pin,
uint16_t minPW,
uint16_t maxPW,
int16_t minAngle,
int16_t maxAngle)
{
if (HAL_Validate_Pin_Function(pin, PF_TIMER)!=PF_TIMER)
{
return false;
}
// Safety check
if (!pinAvailable(pin))
{
return false;
}
if (this->attached())
{
this->detach();
}
this->pin = pin;
this->minPW = minPW;
this->maxPW = maxPW;
this->minAngle = minAngle;
this->maxAngle = maxAngle;
HAL_Servo_Attach(this->pin);
return true;
}
bool Servo::detach()
{
if (!this->attached())
{
return false;
}
HAL_Servo_Detach(this->pin);
this->resetFields();
return true;
}
void Servo::write(int degrees)
{
degrees = constrain(degrees, this->minAngle, this->maxAngle);
this->writeMicroseconds(ANGLE_TO_US(degrees)+trim);
}
int Servo::read() const
{
int a = US_TO_ANGLE(this->readMicroseconds()-trim);
// map() round-trips in a weird way we mostly correct for here;
// the round-trip is still sometimes off-by-one for write(1) and
// write(179).
return a == this->minAngle || a == this->maxAngle ? a : a + 1;
}
void Servo::writeMicroseconds(uint16_t pulseWidth)
{
if (!this->attached())
{
return;
}
pulseWidth = constrain(pulseWidth, this->minPW, this->maxPW);
HAL_Servo_Write_Pulse_Width(this->pin, pulseWidth);
}
uint16_t Servo::readMicroseconds() const
{
if (!this->attached())
{
return 0;
}
return HAL_Servo_Read_Pulse_Width(this->pin);
}
void Servo::resetFields(void)
{
this->pin = NOT_ATTACHED;
this->minAngle = SERVO_DEFAULT_MIN_ANGLE;
this->maxAngle = SERVO_DEFAULT_MAX_ANGLE;
this->minPW = SERVO_DEFAULT_MIN_PW;
this->maxPW = SERVO_DEFAULT_MAX_PW;
this->trim = 0;
}
| 24.288889
| 80
| 0.623056
|
adeeshag
|
a59d19d73faa5c2c36046f9d45c426234de83be1
| 8,746
|
hpp
|
C++
|
include/ssci/bio/bioseqtree.hpp
|
syntheticgio/fda-hive
|
5e645c6a5b76b5a437635631819a1c934c7fd7fc
|
[
"Unlicense",
"MIT"
] | null | null | null |
include/ssci/bio/bioseqtree.hpp
|
syntheticgio/fda-hive
|
5e645c6a5b76b5a437635631819a1c934c7fd7fc
|
[
"Unlicense",
"MIT"
] | null | null | null |
include/ssci/bio/bioseqtree.hpp
|
syntheticgio/fda-hive
|
5e645c6a5b76b5a437635631819a1c934c7fd7fc
|
[
"Unlicense",
"MIT"
] | null | null | null |
/*
* ::718604!
*
* Copyright(C) November 20, 2014 U.S. Food and Drug Administration
* Authors: Dr. Vahan Simonyan (1), Dr. Raja Mazumder (2), et al
* Affiliation: Food and Drug Administration (1), George Washington University (2)
*
* All rights Reserved.
*
* The MIT License (MIT)
*
* 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.
*/
#pragma once
#ifndef sBio_BioseqTree_hpp
#define sBio_BioseqTree_hpp
#include <slib/core/vec.hpp>
#include <ssci/bio/bioseqalign.hpp>
using namespace slib;
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// // _/
// // _/ Classes and Data Structures
// // _/
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// This class contains the tree with all the nodes
class BioseqTree
{
protected:
struct NodeTree
{
// A list of the nodes of this node
idx offsets[4];
// ID of the original sequence
idx seqOriginalID;
// index of the original sequence
idx seqIndex;
// Number of sequences that end at this node
idx rptcount;
// End index of the sequence
idx seq_end;
// is the Reverse complement
bool revcomp;
};
// maintain the list of all nodes
sVec < NodeTree > iseq;
// All nodes contain only indices of this sequence
//sFil * qryTree;
idx ofsSeq;
idx numSeq;
idx lastNode;
typedef char * (*sequenceProviderFunc)(idx ofs);
public:
sequenceProviderFunc seqFunc;
sBioseq * bioseqPtr;
sMex * mexPtr;
char * basicMemPtr;
public:
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// // _/
// // _/ Auxiliary functions to the Nodes
// // _/
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// createNode :
// Initialize the node with different parameters.
//
// Input : The node, the last position of the sequence it reaches and the sequence ID
// Output: The node will adopt all these values and initialize itself with no offsets.
void createNode(NodeTree *node, idx end, idx index, idx seq, bool rev)
{
node->seqOriginalID = seq;
node->seqIndex = index;
node->seq_end = end;
node->offsets[0] = -1, node->offsets[1] = -1, node->offsets[2] = -1, node->offsets[3] = -1;
node->rptcount = 0;
node->revcomp = rev;
}
;
// printNode :
// Initialize the node with different parameters.
//
// Input : It requires the node to be printed: it will print the sequence ID, the
// number of sequences that end at this node, the value of the offsets
// to different nodes and the end index of the sequence.
// Output: A printout of the subtree to the screen.
static void printNode(NodeTree *node, idx pos)
{
::printf("\n \t pos = %lld ", pos);
::printf("\n \t OrigId = %lld, seqId = %lld, rptcount = %lld ", node->seqOriginalID, node->seqIndex, node->rptcount);
::printf("\n \t\t offsets = %lld %lld %lld %lld", node->offsets[0], node->offsets[1], node->offsets[2], node->offsets[3]);
::printf("\n \t\t end = %lld rev = %lld\n", node->seq_end, (idx)node->revcomp);
}
idx getSeqOriginalID (idx nodepos)
{
NodeTree *node = iseq.ptr(nodepos);
return node->seqOriginalID;
}
idx getSeqIndex (idx nodepos)
{
NodeTree *node = iseq.ptr(nodepos);
return node->seqIndex;
}
idx getCount (idx nodepos)
{
NodeTree *node = iseq.ptr(nodepos);
return (node->rptcount);
}
bool getRevComp (idx nodepos)
{
NodeTree *node = iseq.ptr(nodepos);
return (node->revcomp);
}
idx getLastNode ()
{
return lastNode;
}
void setCount (idx nodepos, idx newcount)
{
NodeTree *node = iseq.ptr(nodepos);
node->rptcount = newcount;
}
static void printlet(sStr *out, idx ACGT)
{
if( ACGT == 0 )
out->printf("A");
else if( ACGT == 1 )
out->printf("C");
else if( ACGT == 2 )
out->printf("G");
else
out->printf("T");
return;
}
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// // _/
// // _/ Constructor of the class BioseqTree
// // _/
// // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
BioseqTree()
{
}
// Initialize sVec vector with fSetZero, set it at the beginning of the buffer and
// adds the root node to the first position
void init(idx ofs)
{
iseq.mex()->flags |= sMex::fSetZero;
iseq.cut(0); // set at the beginning of the buffer
NodeTree *rot = iseq.add(1); // add the root to the tree
createNode(rot, -1, 0, 0, false); // create the root
numSeq = 0;
ofsSeq = ofs;
//qryTree = Qry;
seqFunc = 0;
bioseqPtr = 0;
basicMemPtr = 0;
mexPtr = 0;
lastNode = -1;
}
BioseqTree(sMex *ptr, idx ofs)
{
this->init(ofs);
this->mexPtr = ptr;
}
BioseqTree(sBioseq *ptr, idx ofs)
{
this->init(ofs);
this->bioseqPtr = ptr;
}
BioseqTree(char *ptr, idx ofs)
{
this->init(ofs);
this->basicMemPtr = ptr;
}
idx addSequence(idx seqnum, idx seqlen, idx seqrpt = 1, idx reversecomplement = 0, idx auxID = -1);
void printTree(bool generalInfo = false);
// printNode:
// It prints a specific node of the tree
// Input : It requires the index of the sequence to print.
// Output: A printout of the node to the screen.
static void printNode(idx pos)
{
::printf("\n Unique sequence pos = %lld \n", pos);
// ::printf("%s\n", qryTree->id(pos));
}
void inOrderTree(idx root);
void inOrderTree2(idx root, sVec<idx> * inSort);
void inOrderTree3(idx root, sVec<idx> * inSort, sVec<idx> * diffSort);
idx getSubNode(const char *sequence, idx seqlen, bool isCompressed = false, bool exactMatch = false);
idx getLongestSeq(idx *node, idx rptcount, idx tabu);
idx getNodesSeq (sVec<idx> *seqs, idx node, idx rptcount, idx tabu);
idx fixNodeTree(idx node, idx seqnum, idx seqlen, bool isRev);
const char * seq(idx ofs)
{
if( seqFunc )
return seqFunc(ofs);
if( bioseqPtr )
return (char *) bioseqPtr->seq(ofs);
else if( mexPtr )
return (char*) mexPtr->ptr(ofs);
else if( basicMemPtr )
return basicMemPtr + ofs;
else
return "we are doomed";
}
idx len (idx ofs)
{
if (seqFunc)
return 0;
if (bioseqPtr)
return (idx) bioseqPtr->len(ofs);
else if (mexPtr)
return 0;
else if (basicMemPtr)
return 0;
else
return 0;
}
};
#endif // sBio_bioseqtree_hpp
| 32.756554
| 134
| 0.532815
|
syntheticgio
|
a5a404d4ecb691b9ef137d35da8ffeffabbfa127
| 1,870
|
cxx
|
C++
|
osf-to-esf/dborl/dborl_image_bbox_description.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | 1
|
2022-01-01T20:43:47.000Z
|
2022-01-01T20:43:47.000Z
|
osf-to-esf/dborl/dborl_image_bbox_description.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | null | null | null |
osf-to-esf/dborl/dborl_image_bbox_description.cxx
|
wenhanshi/lemsvxl-shock-computation
|
1208e5f6a0c9fddbdffcc20f2c1d914e07015b45
|
[
"MIT"
] | null | null | null |
//:
// \file
// \brief
// \author Ozge Can Ozcanli (ozge@lems.brown.edu)
// \date 10/03/07
#include "dborl_image_bbox_description.h"
#include <vsol/vsol_box_2d.h>
#include <vcl_iostream.h>
void dborl_image_bbox_description::add_box(vcl_string cat, vsol_box_2d_sptr b)
{
vcl_map<vcl_string, vcl_vector<vsol_box_2d_sptr> >::iterator iter = data_.find(cat);
if (iter == data_.end()) {
vcl_vector<vsol_box_2d_sptr> tmp(1, b);
data_[cat] = tmp;
} else {
(iter->second).push_back(b);
}
}
//: CAUTION: assumes that cat exists!! check with category_exists() before using
vcl_vector<vsol_box_2d_sptr>& dborl_image_bbox_description::get_box_vector(vcl_string cat)
{
vcl_map<vcl_string, vcl_vector<vsol_box_2d_sptr> >::iterator iter = data_.find(cat);
return iter->second;
}
unsigned dborl_image_bbox_description::version()
{
return 0;
}
void dborl_image_bbox_description::b_read()
{
vcl_cout << "IMPLEMENT: dborl_image_bbox_description::b_read()\n";
}
void dborl_image_bbox_description::b_write()
{
vcl_cout << "IMPLEMENT: dborl_image_bbox_description::b_write()\n";
}
void dborl_image_bbox_description::write_xml(vcl_ostream& os)
{
for (vcl_map<vcl_string, vcl_vector<vsol_box_2d_sptr> >::iterator iter = data_.begin(); iter != data_.end(); iter++) {
for (unsigned i = 0; i < (iter->second).size(); i++) {
os << "\t\t<instance>\n";
os << "\t\t\t<category>" << iter->first << "</category>\n";
os << "\t\t\t<bndbox>\n";
vsol_box_2d_sptr box = (iter->second)[i];
os << "\t\t\t\t<xmin>" << box->get_min_x() << "</xmin>\n";
os << "\t\t\t\t<ymin>" << box->get_min_y() << "</ymin>\n";
os << "\t\t\t\t<xmax>" << box->get_max_x() << "</xmax>\n";
os << "\t\t\t\t<ymax>" << box->get_max_y() << "</ymax>\n";
os << "\t\t\t</bndbox>\n";
os << "\t\t</instance>\n";
}
}
}
| 29.68254
| 120
| 0.638503
|
wenhanshi
|
a5a6d839502a01a11f2720b80fdd3f29eb0587c6
| 2,330
|
cpp
|
C++
|
main.cpp
|
ennis/autograph-shaders-2
|
7b7b91400206409c2fc422b04ab8732093e8b082
|
[
"MIT"
] | null | null | null |
main.cpp
|
ennis/autograph-shaders-2
|
7b7b91400206409c2fc422b04ab8732093e8b082
|
[
"MIT"
] | null | null | null |
main.cpp
|
ennis/autograph-shaders-2
|
7b7b91400206409c2fc422b04ab8732093e8b082
|
[
"MIT"
] | null | null | null |
#include "clang/Frontend/FrontendActions.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "clang/Tooling/ArgumentsAdjusters.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Serialization/ASTReader.h"
#include <fstream>
#include <iostream>
#include "Driver.hpp"
#include "Module.hpp"
using namespace clang;
using namespace clang::ast_matchers;
using namespace clang::tooling;
// Apply a custom category to all command-line options so that they are the
// only ones displayed.
static llvm::cl::OptionCategory MyToolCategory("agfxc options");
// CommonOptionsParser declares HelpMessage with a description of the common
// command-line options related to the compilation database and input files.
// It's nice to have this help message in all tools.
static llvm::cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
// A help message for this specific tool can be added afterwards.
static llvm::cl::extrahelp MoreHelp("\nMore help text...");
/*
enum class ShaderStage
{
VertexShader,
FragmentShader,
GeometryShader,
TessEvalShader,
TessControlShader,
ComputeShader
};
*/
//////////////////// Main frontend action
class FXCDriverFrontendAction : public clang::ASTFrontendAction
{
public:
virtual std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
clang::CompilerInstance &Compiler, llvm::StringRef InFile)
{
return std::unique_ptr<clang::ASTConsumer>(new fxc::Driver(Compiler.getASTContext(), Compiler.getDiagnostics()));
}
};
//////////////////// Main
int main(int argc, const char **argv) {
CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
ClangTool Tool(OptionsParser.getCompilations(),
OptionsParser.getSourcePathList());
Tool.appendArgumentsAdjuster(clang::tooling::getInsertArgumentAdjuster("-fmodules"));
return Tool.run(newFrontendActionFactory<FXCDriverFrontendAction>().get());
}
| 31.917808
| 116
| 0.745923
|
ennis
|
a5af59e56fb3473c35d2877a58fc811bbac716b9
| 49,201
|
hh
|
C++
|
Dimensions.hh
|
pirl-lpl/pirlplusplus
|
d3211b05fc18f11fc66d97d5bcaeabcbd0b8b6e0
|
[
"Apache-2.0"
] | null | null | null |
Dimensions.hh
|
pirl-lpl/pirlplusplus
|
d3211b05fc18f11fc66d97d5bcaeabcbd0b8b6e0
|
[
"Apache-2.0"
] | null | null | null |
Dimensions.hh
|
pirl-lpl/pirlplusplus
|
d3211b05fc18f11fc66d97d5bcaeabcbd0b8b6e0
|
[
"Apache-2.0"
] | null | null | null |
/* Dimensions
PIRL CVS ID: $Id: Dimensions.hh,v 1.27 2011/02/18 02:29:28 castalia Exp $
Copyright (C) 2010 Arizona Board of Regents on behalf of the
Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
the University of Arizona.
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License, version 2.1,
as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef _Dimensions_
#define _Dimensions_
#include <iosfwd>
namespace PIRL
{
/*==============================================================================
Types
*/
#ifndef COORDINATE_TYPE
#define COORDINATE_TYPE int
#endif
#ifndef DIMENSIONS_TYPE
#define DIMENSIONS_TYPE unsigned COORDINATE_TYPE
#endif
//! The integer data type of a coordinate value.
typedef COORDINATE_TYPE Coordinate_Type;
//! The integer data type of a dimension value.
typedef DIMENSIONS_TYPE Dimensions_Type;
/** Rounds a floating point number to the nearest integer value.
The nearest integer value is found by adding 0.5 to the floating
point number and truncating the result to the Coordinate_Type integer
value. For negative numbers 0.5 is subtracted. Thus a floating point
number exactly halfway beteen two integer values is rounded to the
absolute larger integer with the sign preserved.
@param number The floating point (double) number to be rounded.
@return The integer value of the rounded number.
*/
inline Coordinate_Type Round (double number)
{return (Coordinate_Type)(number > 0 ? (number + 0.5) : (number - 0.5));}
//******************************************************************************
/** A <i>Point_2D</i> holds 2-dimensional position information.
@author Bradford Castalia, UA/PIRL
@version $Revision: 1.27 $
*/
struct Point_2D
{
//! Class identification name with source code version and date.
static const char* const
ID;
//! The horizontal (x-axis) position of the Point_2D.
Coordinate_Type
X;
//! The vertical (y-axis) position of the Point_2D.
Coordinate_Type
Y;
/*==============================================================================
Constructors:
*/
//! Constructs a Point_2D at position 0,0.
Point_2D ();
/** Constructs a Point_2D at position x,y.
@param x The horizontal (x-axis) position of the Point_2D.
@param y The vertical (y-axis) position of the Point_2D.
*/
Point_2D (const Coordinate_Type& x,const Coordinate_Type& y);
/** Constructs a Point_2D from another Point_2D.
@param point A Point_2D to be copied.
*/
Point_2D (const Point_2D& point);
/*==============================================================================
Accessors:
*/
/** Set the position of this Point_2D.
@param x The horizontal (x-axis) position of the Point_2D.
@param y The vertical (y-axis) position of the Point_2D.
@return This Point_2D.
*/
inline Point_2D& position (const Coordinate_Type& x,const Coordinate_Type& y)
{
X = x;
Y = y;
return *this;
}
/** Set the position of this Point_2D.
@param point A Point_2D whose coordinates are to be assigned to
this Point_2D.
@return This Point_2D.
*/
inline Point_2D& position (const Point_2D& point)
{
X = point.X;
Y = point.Y;
return *this;
}
/** Assign the position of another Point_2D to this Point_2D.
@param point A Point_2D whose coordinates are to be assigned to
this Point_2D.
*/
inline Point_2D& operator= (const Point_2D& point)
{
if (this != &point)
{
X = point.X;
Y = point.Y;
}
return *this;
}
/** Set the horizontal (x-axis) position.
@param x_position The horizontal (x-axis) position of the Point_2D.
@return This Point_2D.
*/
inline Point_2D& x (const Coordinate_Type& x_position)
{X = x_position; return *this;}
/** Get the horizontal (x-axis) position.
@return The horizontal (x-axis) position of the Point_2D.
*/
inline Coordinate_Type x () const
{return X;}
/** Set the vertical (y-axis) position.
@param y_position The vertical (y-axis) position of the Point_2D.
@return This Point_2D.
*/
inline Point_2D& y (const Coordinate_Type& y_position)
{Y = y_position; return *this;}
/** Get the vertical (y-axis) position.
@return The vertical (y-axis) position of the Point_2D.
*/
inline Coordinate_Type y () const
{return Y;}
/** Test if this Point_2D is equal to another Point_2D.
The two Point_2Ds are equal if both their X and Y coordinates are equal.
@param point The Point_2D to which this Point_2D is to be compared.
@return true if the two Point_2Ds are equal; false otherwise.
*/
inline bool operator== (const Point_2D& point) const
{return X == point.X && Y == point.Y;}
/** Test if this Point_2D is not equal to another Point_2D.
The two Point_2Ds are not equal if either their X or Y coordinates are
not equal.
@param point The Point_2D to which this Point_2D is to be compared.
@return true if the two Point_2Ds are not equal; false otherwise.
*/
inline bool operator!= (const Point_2D& point) const
{return X != point.X || Y != point.Y;}
/** Test for all zero coordinate values.
@return true if any coordinate value is non-zero; false otherwise.
@see is_null()
*/
inline operator bool ()
{return X != 0 || Y != 0;}
/** Test for all zero coordinate values.
@return true if both coordinates are zero; false otherwise.
@see operator bool()
*/
inline bool is_null ()
{return X == 0 && Y == 0;}
/*==============================================================================
Manipulators:
*/
/** Add an offset.
@param offset A Point_2D that provides the offset values.
@return This Point_2D with its values offset.
*/
inline Point_2D& operator+= (const Point_2D& offset)
{X += offset.X; Y += offset.Y; return *this;}
/** Subtract an offset.
@param offset A Point_2D that provides the offset values.
@return This Point_2D with its values offset.
*/
inline Point_2D& operator-= (const Point_2D& offset)
{X -= offset.X; Y -= offset.Y; return *this;}
/** Multiply by a factor.
The new coordinate values will be rounded to the nearest
Coordinate_Type values.
@param factor A factor by which to multiply the Point_2D coordinates.
@return This Point_2D with its values changed.
*/
inline Point_2D& operator*= (double factor)
{X = Round (X * factor); Y = Round (Y * factor); return *this;}
/** Divide by a factor.
The new coordinate values will be rounded to the nearest
Coordinate_Type values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Coordinate_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Coordinate_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param factor A factor by which to divide the Point_2D dimensions.
@return This Point_2D with its values changed.
*/
Point_2D& operator/= (double factor);
}; // End of Point_2D class.
/** Add two points.
@param point_1 A Point_2D.
@param point_2 A Point_2D.
@return A Point_2D in which the dimensions are the sum of the
dimensions of the specified points.
*/
inline Point_2D operator+ (const Point_2D& point_1, const Point_2D& point_2)
{return Point_2D (point_1) += point_2;}
/** Subtract one point from another.
@param point_1 A Point_2D.
@param point_2 A Point_2D.
@return A Point_2D in which the dimensions are the difference of the
dimensions of the specified points.
*/
inline Point_2D operator- (const Point_2D& point_1, const Point_2D& point_2)
{return Point_2D (point_1) -= point_2;}
/** Get the negation of a point.
@param point A Point_2D.
@return A Point_2D in which the dimensions are the negation of the
dimensions of the specified points.
*/
inline Point_2D operator- (const Point_2D& point)
{return Point_2D (-point.X, -point.Y);}
/** Multiply a point by a factor.
@param point A Point_2D.
@param factor A floating point (double) number.
@return A Point_2D in which the dimensions are the dimensions of the
specified point multiplied by the factor and {@link Round(double)
rounded}.
*/
inline Point_2D operator* (const Point_2D& point, double factor)
{return Point_2D (point) *= factor;}
/** Multiply a point by a factor.
@param factor A floating point (double) number.
@param point A Point_2D.
@return A Point_2D in which the dimensions are the dimensions of the
specified point multiplied by the factor and {@link Round(double)
rounded}.
*/
inline Point_2D operator* (double factor, const Point_2D& point)
{return Point_2D (point) *= factor;}
/** Divide a point by a factor.
@param point A Point_2D.
@param factor A floating point (double) number.
@return A Point_2D in which the dimensions are the dimensions of the
specified point divided by the factor and {@link Round(double)
rounded}.
*/
inline Point_2D operator/ (const Point_2D& point, double factor)
{return Point_2D (point) /= factor;}
/** Print a Point_2D description to an output stream.
@param stream The ostream where the Point_2D will be printed.
@param point The Print_2D to be printed.
@return The stream that was written.
*/
std::ostream& operator<< (std::ostream& stream, const Point_2D& point);
//******************************************************************************
/** A <i>Size_2D</i> holds 2-dimensional size information.
@author Bradford Castalia, UA/PIRL
@version $Revision: 1.27 $
*/
struct Size_2D
{
//! The Width of the Size_2D.
Dimensions_Type
Width;
//! The Height of the Size_2D.
Dimensions_Type
Height;
/*==============================================================================
Constructors:
*/
/** Constructs an empty Size_2D.
Both Width and Height are zero.
*/
Size_2D ();
/** Constructs a Size_2D with width,height size.
@param width The Width of the Size_2D.
@param height The Height of the Size_2D.
*/
Size_2D (const Dimensions_Type& width, const Dimensions_Type& height);
/** Constructs a Size_2D of equal Width and Height.
@param side The length of each side. Both Width and Height will
be set to this value.
*/
Size_2D (const Dimensions_Type& side);
/** Constructs a Size_2D from another Size_2D.
@param size A Size_2D to be copied.
*/
Size_2D (const Size_2D& size);
/*==============================================================================
Accessors:
*/
/** Set the size of this Size_2D.
@param width The Width of the Size_2D.
@param height The Height of the Size_2D.
@return This Size_2D.
*/
inline Size_2D& size
(const Dimensions_Type& width, const Dimensions_Type& height)
{
Width = width;
Height = height;
return *this;
}
/** Set the size of this Size_2D.
@param size A Size_2D to have its dimensions assigned to this
Size_2D.
@return This Size_2D.
*/
inline Size_2D& size (const Size_2D& size)
{
Width = size.Width;
Height = size.Height;
return *this;
}
/** Assign the dimensions of another Size_2D to this Size_2D.
@param size A Size_2D to have its dimensions assigned to this
Size_2D.
*/
inline Size_2D& operator= (const Size_2D& size)
{
if (this != &size)
{
Width = size.Width;
Height = size.Height;
}
return *this;
}
/** Set the Width of the Size_2D.
@param width The Width of the Size_2D.
@return This Size_2D.
*/
inline Size_2D& width (const Dimensions_Type& width)
{Width = width; return *this;}
/** Get the Width of the Size_2D.
@return The Width of the Size_2D.
*/
inline Dimensions_Type width () const
{return Width;}
/** Set the Height of the Size_2D.
@param height The Height of the Size_2D.
@return This Size_2D.
*/
inline Size_2D& height (const Dimensions_Type& height)
{Height = height; return *this;}
/** Get the Height of the Size_2D.
@return The Height of the Size_2D.
*/
inline Dimensions_Type height () const
{return Height;}
/** Get the area of this Size_2D.
@return The area (Width * Height) of the Size_2D.
*/
inline unsigned long long area () const
{return (long long)Width * Height;}
/** Test if this Size_2D is equal to another Size_2D.
The two Size_2Ds are equal if both their Width and Height dimensions
are equal.
@param size The Size_2D to which this Size_2D is to be compared.
@return true if the two Size_2Ds are equal; false otherwise.
*/
inline bool operator== (const Size_2D& size) const
{return Width == size.Width && Height == size.Height;}
/** Test if this Size_2D is not equal to another Size_2D.
The two Size_2Ds are not equal if either their Width or Height
dimensions are not equal.
@param size The Size_2D to which this Size_2D is to be compared.
@return true if the two Size_2Ds are not equal; false otherwise.
*/
inline bool operator!= (const Size_2D& size) const
{return Width != size.Width || Height != size.Height;}
/** Test for all zero dimension values.
@return true if any dimension value is non-zero; false otherwise.
*/
inline operator bool ()
{return Width != 0 || Height != 0;}
/** Test for any zero dimension values.
@return true if any dimension is zero; false otherwise.
*/
inline bool is_empty ()
{return Width == 0 || Height == 0;}
/*==============================================================================
Manipulators:
*/
/** Add a size amount.
@param size A Size_2D that provides the amount values.
@return This Size_2D with the amount added to its values.
*/
inline Size_2D& operator+= (const Size_2D& size)
{Width += size.Width; Height += size.Height; return *this;}
/** Subtract a size amount.
<b>N.B.</b>: If the size Dimensions_Type values are an unsigned type
(as they are by default) and a size amount to be subtracted is greater
than the corresponding dimension value, the result will be zero.
@param size A Size_2D that provides the amount values.
@return This Size_2D with the amount subtracted to its values.
*/
Size_2D& operator-= (const Size_2D& size);
/** Multiply by a factor.
The new size values will be rounded to the nearest Dimensions_Types.
@param factor A factor by which to multiply the Size_2D dimensions.
@return This Size_2D with its values changed.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
Size_2D& operator*= (double factor);
/** Divide by a factor.
The new dimension values will be rounded to the nearest Dimensions_Type
values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Dimensions_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Dimensions_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param factor A factor by which to divide the Size_2D dimensions.
@return This Size_2D with its values changed.
@throws invalid_argument If the factor is negative and the size
values Dimensions_Type are an unsigned type (as they are by
default).
*/
Size_2D& operator/= (double factor);
}; // End of Size_2D class.
/** Add two sizes.
@param size_1 A Size_2D.
@param size_2 A Size_2D.
@return A Size_2D in which the dimensions are the sum of the
dimensions of the specified sizes.
*/
inline Size_2D operator+ (const Size_2D& size_1, const Size_2D& size_2)
{return Size_2D (size_1) += size_2;}
/** Subtract one size from another.
<b>N.B.</b>: If the size Dimensions_Type values are an unsigned type
(as they are by default) and a size amount to be subtracted is greater
than the corresponding dimension value, the result will be zero.
@param size_1 A Size_2D.
@param size_2 A Size_2D.
@return A Size_2D in which the dimensions are the difference of the
dimensions of the specified sizes.
*/
inline Size_2D operator- (const Size_2D& size_1, const Size_2D& size_2)
{return Size_2D (size_1) -= size_2;}
/** Multiply a size by a factor.
@param size A Size_2D.
@param factor A floating point (double) number.
@return A Size_2D in which the dimensions are the dimensions of the
specified size multiplied by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Size_2D operator* (const Size_2D& size, double factor)
{return Size_2D (size) *= factor;}
/** Multiply a size by a factor.
@param factor A floating point (double) number.
@param size A Size_2D.
@return A Size_2D in which the dimensions are the dimensions of the
specified size multiplied by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Size_2D operator* (double factor, const Size_2D& size)
{return Size_2D (size) *= factor;}
/** Divide a size by a factor.
@param size A Size_2D.
@param factor A floating point (double) number.
@return A Size_2D in which the dimensions are the dimensions of the
specified size divided by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Size_2D operator/ (const Size_2D& size, double factor)
{return Size_2D (size) /= factor;}
/** Print a Size_2D description to an output stream.
@param stream The ostream where the Size_2D will be printed.
@param size The Size_2D to be printed.
@return The stream that was written.
*/
std::ostream& operator<< (std::ostream& stream, const Size_2D& size);
//******************************************************************************
/** A <i>Rectangle</i> is a position with a size.
The Rectangle's position is based in a Point_2D being at the upper
left corner of the Rectangle, and its size is based in a Size_2D with
the X-axis Width increasing to the right and the Y-axis Height
increasing downward (raster order).
@author Bradford Castalia, UA/PIRL
@version $Revision: 1.27 $
@see Point_2D
@see Size_2D
*/
struct Rectangle
: public Point_2D,
public Size_2D
{
/*==============================================================================
Constructors:
*/
/** Constructs an empty Rectangle.
The position is 0,0 and the size is 0,0.
*/
Rectangle ();
/** Constructs a Rectangle from an x,y position and width,height size.
@param x The horizontal (x-axis) position.
@param y The vertical (y-axis) position.
@param width The Width of the Rectangle.
@param height The Height of the Rectangle.
*/
Rectangle
(
const Coordinate_Type x,
const Coordinate_Type y,
const Dimensions_Type width = 0,
const Dimensions_Type height = 0
);
/** Constructs a Rectangle from a position and a size.
@param position A Point_2D.
@param size A Size_2D.
*/
Rectangle (const Point_2D& position, const Size_2D& size);
/** Constructs a Rectangle from a size at position 0,0.
@param size A Size_2D.
*/
Rectangle (const Size_2D& size);
/** Constructs a Rectangle as a copy of another Rectangle.
@param rectangle A Rectangle to be copied.
*/
Rectangle (const Rectangle& rectangle);
/*==============================================================================
Accessors:
*/
/** Set the position of this Rectangle.
@param x The horizontal (x-axis) position of the Rectangle.
@param y The vertical (y-axis) position of the Rectangle.
@return This Rectangle.
*/
inline Rectangle& position (const Coordinate_Type& x,const Coordinate_Type& y)
{Point_2D::position (x, y); return *this;}
/** Set the position of this Rectangle.
@param point A Point_2D whose dimensions are to be assigned to
this Rectangle.
@return This Rectangle.
*/
inline Rectangle& position (const Point_2D& point)
{Point_2D::position (point); return *this;}
/** Assign the position of the Rectangle from a Point_2D.
@param point A Point_2D for the position of the Rectangle.
@return This Rectangle.
*/
inline Rectangle& operator= (const Point_2D& point)
{Point_2D::operator= (point); return *this;}
/** Get the Rectangle position.
@return A Point_2D with the Rectangle position. <b>N.B.</b>: Changing
this Point_2D will not change the position of the Rectangle.
*/
inline Point_2D position () const
{return Point_2D (X, Y);}
/** Convert the Rectangle to its corresponding Point_2D.
@return A Point_2D with the Rectangle position.
*/
inline operator Point_2D () const
{return position ();}
/** Set the size of this Rectangle.
@param width The Width of the Rectangle.
@param height The Height of the Rectangle.
@return This Rectangle.
*/
inline Rectangle& size
(const Dimensions_Type& width, const Dimensions_Type& height)
{Size_2D::size (width, height); return *this;}
/** Set the size of this Rectangle.
@param size A Size_2D to have its dimensions assigned to this
Rectangle.
@return This Rectangle.
*/
inline Rectangle& size (const Size_2D& size)
{Size_2D::size (size); return *this;}
/** Assign the size of the Rectangle from a Size_2D.
@param size A Size_2D for the size of the Rectangle.
@return This Rectangle.
*/
inline Rectangle& operator= (const Size_2D& size)
{Size_2D::operator= (size); return *this;}
/** Get the Rectangle size.
@return A Size_2D with the Rectangle size. <b>N.B.</b>: Changing
this size will not change the size of the Rectangle.
*/
inline Size_2D size () const
{return Size_2D (Width, Height);}
/** Convert the Rectangle to its corresponding Size_2D.
@return A Size_2D with the Rectangle size.
*/
inline operator Size_2D () const
{return size ();}
/** Assign the position and size of another Rectangle to this Rectangle.
@param rectangle A Rectangle whose position and size are to be
assigned to this Rectangle.
@return This Rectangle.
*/
inline Rectangle& operator= (const Rectangle& rectangle)
{
if (this != &rectangle)
{
X = rectangle.X;
Y = rectangle.Y;
Width = rectangle.Width;
Height = rectangle.Height;
}
return *this;
}
/** Test if this Rectangle is equal to another Rectangle.
The two Rectangles are equal if both their position and size
dimensions are equal.
@param rectangle The Rectangle to which this Rectangle is to be
compared.
@return true if the two Rectangles are equal; false otherwise.
*/
inline bool operator== (const Rectangle& rectangle) const
{return Point_2D::operator== ((const Point_2D)rectangle) &&
Size_2D::operator== ((const Size_2D)rectangle);}
/** Test if this Rectangle is not equal to another Rectangle.
The two Rectangles are not equal if either their position or size
dimensions are not equal.
@param rectangle The Rectangle to which this Rectangle is to be
compared.
@return true if the two Rectangles are not equal; false otherwise.
*/
inline bool operator!= (const Rectangle& rectangle) const
{return Point_2D::operator!= ((const Point_2D)rectangle) ||
Size_2D::operator!= ((const Size_2D)rectangle);}
/** Test for all zero dimension values.
@return true if any dimension value is non-zero; false otherwise.
*/
inline operator bool ()
{return Point_2D::operator bool () || Size_2D::operator bool ();}
/*==============================================================================
Manipulators:
*/
/** Add an offset.
@param offset A Point_2D that provides the offset values.
@return This Rectangle with its values offset.
*/
inline Rectangle& operator+= (const Point_2D& offset)
{Point_2D::operator+= (offset); return *this;}
/** Add a size amount.
@param size A Size_2D that provides the amount values.
@return This Rectangle with the amount added to its size values.
*/
inline Rectangle& operator+= (const Size_2D& size)
{Size_2D::operator+= (size); return *this;}
/** Add another Rectangle's point coordinate offset and size amount.
@param rectangle A Rectangle.
@return This Rectangle with its point coordinate offset by the
other Rectangle's point coordinate values, and the other Rectangle's
size amount added to its size dimensions.
*/
inline Rectangle& operator+= (const Rectangle& rectangle)
{
Point_2D::operator+= (static_cast<Point_2D>(rectangle));
Size_2D::operator+= (static_cast<Size_2D>(rectangle));
return *this;
}
/** Subtract an offset.
@param offset A Point_2D that provides the offset values.
@return This Rectangle with its values offset.
*/
inline Rectangle& operator-= (const Point_2D& offset)
{Point_2D::operator-= (offset); return *this;}
/** Subtract a size amount.
<b>N.B.</b>: If the size Dimensions_Type values are an unsigned type
(as they are by default) and a size amount to be subtracted is greater
than the corresponding dimension value, the result will be zero.
@param size A Size_2D that provides the amount values.
@return This Rectangle with the amount subtracted to its values.
*/
inline Rectangle& operator-= (const Size_2D& size)
{Size_2D::operator-= (size); return *this;}
/** Subtract another Rectangle's point coordinate offset and size amount.
@param rectangle A Rectangle.
@return This Rectangle with its point coordinate offset by the
other Rectangle's point coordinate values, and the other Rectangle's
size amount subtracted from its size dimensions.
*/
inline Rectangle& operator-= (const Rectangle& rectangle)
{
Point_2D::operator-= (static_cast<Point_2D>(rectangle));
Size_2D::operator-= (static_cast<Size_2D>(rectangle));
return *this;
}
/** Multiply by a factor.
The new size values will be rounded to the nearest Dimensions_Types.
@param factor A factor by which to multiply the Size_2D dimensions.
@return This Rectangle with its values changed.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Rectangle& operator*= (double factor)
{Size_2D::operator*= (factor); return *this;}
/** Divide by a factor.
The new size dimensions will be rounded to the nearest Dimensions_Type
values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Dimensions_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Dimensions_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param factor A factor by which to divide the Size_2D dimensions.
@return This Rectangle with its values changed.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Rectangle& operator/= (double factor)
{Size_2D::operator/= (factor); return *this;}
/** Take the intersection with another Rectangle.
The intersection of two Rectangles is the overlapping area of both.
@param rectangle The Rectangle to intersect with this Rectangle.
@return This Rectangle with its position and size set to the
intersection with the other Rectangle. If the Rectangles do not
intersect this will result in a Rectangle with no area (Width
and Height both zero) but the position will be unchanged.
*/
Rectangle& operator&= (const Rectangle& rectangle);
/** Take the union with another Rectangle.
The union of two Rectangles is the bounding area of both.
@param rectangle The Rectangle to unite with this Rectangle.
@return This Rectangle with its position and size set to the
union - i.e. the bounding box - with the other Rectangle.
*/
Rectangle& operator|= (const Rectangle& rectangle);
}; // End of Rectangle class.
/** Add a Point_2D offset to a Rectangle.
@param rectangle A Rectangle.
@param point A Point_2D.
@return A Rectangle in which the coordinate point dimensions are the
Point_2D have been added to the coordinate point of the Rectangle.
*/
inline Rectangle operator+ (const Rectangle& rectangle, const Point_2D& point)
{return Rectangle (rectangle) += point;}
/** Add a Point_2D offset to a Rectangle.
@param point A Point_2D.
@param rectangle A Rectangle.
@return A Rectangle in which the coordinate point dimensions of the
Point_2D have been added to the coordinate point of the Rectangle.
*/
inline Rectangle operator+ (const Point_2D& point, const Rectangle& rectangle)
{return Rectangle (rectangle) += point;}
/** Add two Rectangles.
@param rectangle_1 A Rectangle.
@param rectangle_2 A Rectangle.
@return A Rectangle in which the coordinate point dimensions and the size
amounts of the two Rectangles have been added.
*/
inline Rectangle operator+
(const Rectangle& rectangle_1, const Rectangle& rectangle_2)
{return Rectangle (rectangle_1) += rectangle_2;}
/** Subtract a Point_2D offset from a Rectangle.
@param rectangle A Rectangle.
@param point A Point_2D.
@return A Rectangle in which the coordinate point dimensions of the
Point_2D have been subtracted from the coordinate point of the
Rectangle.
*/
inline Rectangle operator- (const Rectangle& rectangle, const Point_2D& point)
{return Rectangle (rectangle) -= point;}
/** Subtract two Rectangles.
@param rectangle_1 A Rectangle.
@param rectangle_2 A Rectangle.
@return A Rectangle in which the coordinate point dimensions and the size
amounts of the two Rectangles have been added.
*/
inline Rectangle operator-
(const Rectangle& rectangle_1, const Rectangle& rectangle_2)
{return Rectangle (rectangle_1) -= rectangle_2;}
/** Get the negation of a Rectangle.
@param rectangle A Rectangle.
@return A Rectangle in which the coordinate point dimensions are the
negation of the Rectangle's coordinate point; the size is the same.
*/
inline Rectangle operator- (const Rectangle& rectangle)
{return Rectangle (-rectangle.X, -rectangle.Y,
rectangle.Width, rectangle.Height);}
/** Add a size amount to a Rectangle.
@param rectangle A Rectangle.
@param size A Size_2D.
@return A Rectangle in which the size amount has been added to the
Rectangle size dimensions; the coordinate point is the same.
*/
inline Rectangle operator+ (const Rectangle& rectangle, const Size_2D& size)
{return Rectangle (rectangle) += size;}
/** Add a size amount to a Rectangle.
@param size A Size_2D.
@param rectangle A Rectangle.
@return A Rectangle in which the size amount has been added to the
negation of the Rectangle size dimensions; the coordinate point
is the same.
*/
inline Rectangle operator+ (const Size_2D& size, const Rectangle& rectangle)
{return Rectangle (rectangle) += size;}
/** Subtract a size amount from a Rectangle.
<b>N.B.</b>: If the size Dimensions_Type values are an unsigned type
(as they are by default) and a size amount to be subtracted is greater
than the corresponding dimension value, the result will be zero.
@param size A Size_2D.
@param rectangle A Rectangle.
@return A Rectangle in which the size amount has been subtracted from
the Rectangle size dimensions; the coordinate point is the same.
*/
inline Rectangle operator- (const Rectangle& rectangle, const Size_2D& size)
{return Rectangle (rectangle) -= size;}
/** Multiply a Rectangle by a factor.
@param rectangle A Rectangle.
@param factor A floating point (double) number.
@return A Size_2D in which the dimensions are the dimensions of the
specified size multiplied by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Rectangle operator* (const Rectangle& rectangle, double factor)
{return Rectangle (rectangle) *= factor;}
/** Multiply a Rectangle by a factor.
@param factor A floating point (double) number.
@param rectangle A Rectangle.
@return A Rectangle in which the size dimensions are the dimensions
of the specified Rectangle multiplied by the factor and {@link
Round(double) rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Rectangle operator* (double factor, const Rectangle& rectangle)
{return Rectangle (rectangle) *= factor;}
/** Divide a Rectangle by a factor.
The new size dimensions will be rounded to the nearest Dimensions_Type
values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Dimensions_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Dimensions_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param rectangle A Rectangle.
@param factor A floating point (double) number.
@return A Rectangle in which the dimensions are the dimensions of the
specified Rectangle divided by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Rectangle operator/ (const Rectangle& rectangle, double factor)
{return Rectangle (rectangle) /= factor;}
/** Get the intersection of two Rectangles.
@param rectangle_1 A Rectangle.
@param rectangle_2 A Rectangle.
@return A Rectangle with its position and size set to the
intersection of the two Rectangles. If the Rectangles do not
intersect this will result in a Rectangle with no area (Width
and Height both zero) but the position of the first Rectangle.
*/
inline Rectangle operator&
(const Rectangle& rectangle_1, const Rectangle& rectangle_2)
{return Rectangle (rectangle_1) &= rectangle_2;}
/** Get the union of two Rectangles.
@param rectangle_1 A Rectangle.
@param rectangle_2 A Rectangle.
@return A Rectangle with its position and size set to the
union - i.e. the bounding box - of the two Rectangles.
*/
inline Rectangle& operator|
(const Rectangle& rectangle_1, const Rectangle& rectangle_2)
{return Rectangle (rectangle_1) |= rectangle_2;}
/** Print a Rectangle description to an output stream.
@param stream The ostream where the Rectangle will be printed.
@param rectangle The Rectangle to be printed.
@return The stream that was written.
*/
std::ostream& operator<< (std::ostream& stream, const Rectangle& rectangle);
//******************************************************************************
/** A <i>Cube</i> is a Rectangle with depth.
A Cube does not have a Z-dimension position. Instead it has a Depth
with the position of the Cube having an implicit Z-coordinate of
zero; i.e. the facing surface of the Cube defined by its Rectangle is
at the Z-coordinate origin with the Z-axis Depth increasing away from
the observer (right handed coordinate system).
@author Bradford Castalia, UA/PIRL
@version $Revision: 1.27 $
@see Rectangle
*/
struct Cube
: public Rectangle
{
//! The Depth of the Cube.
Dimensions_Type
Depth;
/*==============================================================================
Constructors:
*/
/** Constructs an empty Cube.
The position is 0,0; the size is 0,0; the Depth is 0.
*/
Cube ();
/** Constructs a Cube from an x,y position, width,height size, and depth.
@param x The horizontal (x-axis) position.
@param y The vertical (y-axis) position.
@param width The Width of the Cube.
@param height The Height of the Cube.
@param depth The Depth of the Cube.
*/
Cube
(
const Coordinate_Type x,
const Coordinate_Type y,
const Dimensions_Type width = 0,
const Dimensions_Type height = 0,
const Dimensions_Type depth = 0
);
/** Constructs a Cube from a position and a size.
The Cube will have a Depth of 1.
@param position A Point_2D.
@param size A Size_2D.
*/
Cube (const Point_2D& position, const Size_2D& size);
/** Constructs a Cube from a size.
The Cube will have a position of 0,0 and a Depth of 1.
@param size A Size_2D.
*/
Cube (const Size_2D& size);
/** Constructs a Cube from a Rectangle.
The Cube will have a Depth of 1.
@param rectangle A Rectangle.
*/
Cube (const Rectangle& rectangle);
/** Constructs a Cube as a copy of another Cube.
@param cube A Cube to be copied.
*/
Cube (const Cube& cube);
/*==============================================================================
Accessors:
*/
/** Set the position of this Cube.
@param x The horizontal (x-axis) position of the Cube.
@param y The vertical (y-axis) position of the Cube.
@return This Cube.
*/
inline Cube& position (const Coordinate_Type& x,const Coordinate_Type& y)
{Point_2D::position (x, y); return *this;}
/** Set the position of this Cube.
@param point A Point_2D whose dimensions are to be assigned as
the position of this Cube.
@return This Cube.
*/
inline Cube& position (const Point_2D& point)
{Point_2D::position (point); return *this;}
/** Assign the position of the Cube from a Point_2D.
@param point A Point_2D for the position of the Cube.
@return This Cube.
*/
inline Cube& operator= (const Point_2D& point)
{Point_2D::operator= (point); return *this;}
/** Set the size of this Cube.
@param width The Width of the Cube.
@param height The Height of the Cube.
@return This Cube.
*/
inline Cube& size
(const Dimensions_Type& width, const Dimensions_Type& height)
{Size_2D::size (width, height); return *this;}
/** Set the size of this Cube.
@param size A Size_2D to have its dimensions assigned to this
Cube.
@return This Cube.
*/
inline Cube& size (const Size_2D& size)
{Size_2D::size (size); return *this;}
/** Set the Depth of this Cube.
@param depth The Depth of this Cube.
@return This Cube.
*/
inline Cube& depth (Dimensions_Type depth)
{Depth = depth; return *this;}
/** Get the Depth of this Cube.
@return The Depth of this Cube.
*/
inline Dimensions_Type depth () const
{return Depth;}
/** Assign the size of the Cube from a Size_2D.
@param size A Size_2D for the size of the Cube.
@return This Cube.
*/
inline Cube& operator= (const Size_2D& size)
{Size_2D::operator= (size); return *this;}
/** Set the dimensions of this Cube from a Rectangle.
@param rectangle A Rectangle to have its dimensions assigned to
this Cube.
@return This Cube.
*/
inline Cube& dimensions (const Rectangle& rectangle)
{Rectangle::operator= (rectangle); return *this;}
/** Set the dimensions of this Cube from a Rectangle.
@param rectangle A Rectangle to have its dimensions assigned to
this Cube.
@return This Cube.
*/
inline Cube& operator= (const Rectangle& rectangle)
{Rectangle::operator= (rectangle); return *this;}
/** Assign the dimensions of another Cube to this Cube.
@param cube A Cube whose dimensions are be assigned
to this Cube.
@return This Cube.
*/
inline Cube& operator= (const Cube& cube)
{
if (this != &cube)
{
X = cube.X;
Y = cube.Y;
Width = cube.Width;
Height = cube.Height;
Depth = cube.Depth;
}
return *this;
}
/** Get the volume of this Cube.
@return The volume (Width * Height * Depth) of the Cube.
*/
inline unsigned long long volume () const
{return area () * Depth;}
/** Test if this Cube is equal to another Cube.
The two Cubes are equal if both their Depth and Rectangle dimensions
are equal.
@param cube The Cube to which this Cube is to be compared.
@return true if the two Cubes are equal; false otherwise.
*/
inline bool operator== (const Cube& cube) const
{return Depth == cube.Depth &&
Rectangle::operator== ((const Rectangle)cube);}
/** Test if this Cube is not equal to another Cube.
The two Cubes are not equal if either their Depth or Rectangle
dimensions are not equal.
@param cube The Cube to which this Cube is to be compared.
@return true if the two Cubes are not equal; false otherwise.
*/
inline bool operator!= (const Cube& cube) const
{return Depth != cube.Depth ||
Rectangle::operator!= ((const Rectangle)cube);}
/** Test for all zero dimension values.
@return true if any dimension value is non-zero; false otherwise.
*/
inline operator bool ()
{return Depth != 0 || Rectangle::operator bool ();}
/** Test for any zero dimension values.
@return true if any dimension is zero; false otherwise.
*/
inline bool is_empty ()
{return Depth == 0 || Size_2D::is_empty ();}
/*==============================================================================
Manipulators:
*/
/** Add an amount to the Cube Depth.
<B>N.B.</B>: If the Depth Dimensions_Type is unsigned (the default)
and the amount is negative, the resulting Depth will not be less
than zero.
@param amount An integer amount to add to the Depth.
@return This Cube with the amount applied.
*/
Cube& operator+= (int amount);
/** Add another Cube's point coordinate offset, and depth and size amount.
@param cube A Cube.
@return This Cube with its point coordinate offset by the other
Cube's point coordinate values, its Depth increased the other
Cube's Depth, and the other Cube's size amount added to its size
dimensions.
*/
inline Cube& operator+= (const Cube& cube)
{
Rectangle::operator+= (static_cast<Rectangle>(cube));
operator+= (cube.Depth);
return *this;
}
/** Subtract an amount from the Cube Depth.
<B>N.B.</B>: If the Depth Dimensions_Type is unsigned (the default)
and the amount is positive, the resulting Depth will not be less
than zero.
@param amount An integer amount to subtract from the Depth.
@return This Cube with the amount applied.
*/
inline Cube& operator-= (int amount)
{operator+= (-amount); return *this;}
/** Subtract another Cube's point coordinate and depth offset and size amount.
@param cube A Cube.
@return This Cube with its point coordinate offset negatively by the
other Cube's point coordinate values, its Depth offset negatively
by the other Cube's Depth, and the other Cube's size amount
subtracted from its size dimensions.
*/
inline Cube& operator-= (const Cube& cube)
{
Rectangle::operator-= (static_cast<Rectangle>(cube));
operator-= (cube.Depth);
return *this;
}
/** Multiply by a factor.
The new size values will be rounded to the nearest Dimensions_Types.
@param factor A factor by which to multiply the dimensions.
@return This Cube with its dimension values changed.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Cube& operator*= (double factor)
{
Rectangle::operator*= (factor);
Depth = Round (Depth * factor);
return *this;
}
/** Divide by a factor.
The new size dimensions will be rounded to the nearest Dimensions_Type
values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Dimensions_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Dimensions_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param factor A factor by which to divide the dimensions.
@return This Cube with its dimension values changed.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
Cube& operator/= (double factor);
/** Take the intersection with another Cube.
The intersection of the Depths of two Cubes is the minimum Depth; i.e.
the two Cubes are assumed to be aligned at the zero X-Y plane.
@param cube The Cube to intersect with this Cube.
@return This Cube with its position, size and depth set to the
intersection with the other Cube. If the Cubes do not intersect
this will result in an {@link is_empty() emtpy} Cube (Width,
Height and Depth zero) but the position will be unchanged.
*/
Cube& operator&= (const Cube& cube);
/** Take the union with another Cube.
The union of the Depths of two Cubes is the maximum Depth; i.e.
the two Cubes are assumed to be aligned at the zero X-Y plane.
@param cube The Cube to unite with this Cube.
@return This Cube with its position, size and depth set to the
union - i.e. the bounding volume - with the other Cube.
*/
Cube& operator|= (const Cube& cube);
}; // End of Cube class.
/** Add an amount to a Cube Depth.
@param cube A Cube.
@param amount An integer amount to add to the Depth.
@return A Cube in which the amount has been added to the
Depth of the other cube.
@see Cube::operator+=(int)
*/
inline Cube operator+ (const Cube& cube, int amount)
{return Cube (cube) += amount;}
/** Subtract an amount from a Cube Depth.
@param cube A Cube.
@param amount An integer amount to substract from the Depth of
the other cube.
@return A Cube in which the amount has been subtracted from the
Depth of the other cube.
@see Cube::operator-=(int)
*/
inline Cube operator- (const Cube& cube, int amount)
{return Cube (cube) -= amount;}
/** Add two Cubes.
@param cube_1 A Cube.
@param cube_2 A Cube.
@return A Cube in which the coordinate point dimensions and the size
and depth amounts of the two Cubes have been added.
@see Cube::operator+=(const Cube&)
*/
inline Cube operator+
(const Cube& cube_1, const Cube& cube_2)
{return Cube (cube_1) += cube_2;}
/** Subtract two Cubes.
@param cube_1 A Cube.
@param cube_2 A Cube.
@return A Cube in which the coordinate point dimensions and the size
and depth amounts of the two Cubes have been subtracted.
@see Cube::operator-=(const Cube&)
*/
inline Cube operator-
(const Cube& cube_1, const Cube& cube_2)
{return Cube (cube_1) -= cube_2;}
/** Multiply a Cube by a factor.
@param cube A Cube.
@param factor A floating point (double) number.
@return A Cube in which the dimensions are the dimensions of the
specified cube multiplied by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Cube operator* (const Cube& cube, double factor)
{return Cube (cube) *= factor;}
/** Multiply a Cube by a factor.
@param factor A floating point (double) number.
@param cube A Cube.
@return A Cube in which the dimensions are the dimensions of the
specified cube multiplied by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Cube operator* (double factor, const Cube& cube)
{return Cube (cube) *= factor;}
/** Divide a Cube by a factor.
The new size dimensions will be rounded to the nearest Dimensions_Type
values.
<b>N.B.</b>: Divide by zero is handled as a special case. If the
coordinate value was zero it will remain zero. If the Dimensions_Type
has an infinity value (determined by numeric_types) that is used, or
its negative if the coordinate value is negative. Otherwise, if the
Dimensions_Type is signed the type's max value is used, or the min
value if the coordinate value is negative; for an unsigned value the
max value is used.
@param cube A Cube.
@param factor A floating point (double) number.
@return A Cube in which the dimensions are the dimensions of the
specified Cube divided by the factor and {@link Round(double)
rounded}.
@throws invalid_argument If the factor is negative and the size values
Dimensions_Type are an unsigned type (as they are by default).
*/
inline Cube operator/ (const Cube& cube, double factor)
{return Cube (cube) /= factor;}
/** Get the intersection of two Cubes.
The intersection the Depths of two Cubes is the minimum Depth; i.e.
the two Cubes are assumed to be aligned at the zero X-Y plane.
@param cube_1 A Cube.
@param cube_2 A Cube.
@return A Cube with its position, size and depth set to the
intersection with the other Cube. If the Cubes do not intersect
this will result in an emtpy Cube (Width, Height and Depth zero)
but the position of the first Cube.
*/
inline Cube operator&
(const Cube& cube_1, const Cube& cube_2)
{return Cube (cube_1) &= cube_2;}
/** Get the union of two Cubes.
The union of the Depths of two Cubes is the maximum Depth; i.e.
the two Cubes are assumed to be aligned at the zero X-Y plane.
@param cube_1 A Cube.
@param cube_2 A Cube.
@return A Cube with its position, size and depth set to the
union - i.e. the bounding volume - of the two Cubes.
*/
inline Cube& operator|
(const Cube& cube_1, const Cube& cube_2)
{return Cube (cube_1) |= cube_2;}
/** Print a Cube description to an output stream.
@param stream The ostream where the Cube will be printed.
@param cube The Cube to be printed.
@return The stream that was written.
*/
std::ostream& operator<< (std::ostream& stream, const Cube& cube);
} // namespace PIRL
#endif
| 30.635741
| 80
| 0.717242
|
pirl-lpl
|
a5b1aba678b7bd2cf1fedd5310d6b14c6c0247e4
| 1,116
|
hpp
|
C++
|
include/dca/phys/dca_step/cluster_solver/ctaux/walker/ct_aux_walker_tools_kernels.hpp
|
frobnitzem/DCA
|
9f5d16cbfe1a4c4df1d4c8353654dd2882671dca
|
[
"BSD-3-Clause"
] | 27
|
2018-08-02T04:28:23.000Z
|
2021-07-08T02:14:20.000Z
|
include/dca/phys/dca_step/cluster_solver/ctaux/walker/ct_aux_walker_tools_kernels.hpp
|
frobnitzem/DCA
|
9f5d16cbfe1a4c4df1d4c8353654dd2882671dca
|
[
"BSD-3-Clause"
] | 200
|
2018-08-02T18:19:03.000Z
|
2022-03-16T21:28:41.000Z
|
include/dca/phys/dca_step/cluster_solver/ctaux/walker/ct_aux_walker_tools_kernels.hpp
|
PDoakORNL/DCA-2
|
5a373f6af5a7d4b5be69199f60ec75a16e58c626
|
[
"BSD-3-Clause"
] | 22
|
2018-08-15T15:50:00.000Z
|
2021-09-30T13:41:46.000Z
|
// Copyright (C) 2018 ETH Zurich
// Copyright (C) 2018 UT-Battelle, LLC
// All rights reserved.
//
// See LICENSE for terms of usage.
// See CITATION.md for citation guidelines, if DCA++ is used for scientific publications.
//
// Author: Peter Staar (taa@zurich.ibm.com)
//
// GPU kernels for walker tools.
#ifndef DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTAUX_WALKER_CT_AUX_WALKER_TOOLS_KERNELS_HPP
#define DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTAUX_WALKER_CT_AUX_WALKER_TOOLS_KERNELS_HPP
namespace dca {
namespace phys {
namespace solver {
namespace ctaux {
namespace walkerkernels {
// dca::phys::solver::ctaux::walkerkernels::
template <typename Real>
void compute_Gamma(Real* Gamma, int Gamma_n, int Gamma_ld, Real* N, int N_r, int N_c, int N_ld,
Real* G, int G_r, int G_c, int G_ld, int* random_vertex_vector, Real* exp_V,
Real* exp_delta_V, int thread_id, int stream_id);
} // namespace walkerkernels
} // namespace ctaux
} // namespace solver
} // namespace phys
} // namespace dca
#endif // DCA_PHYS_DCA_STEP_CLUSTER_SOLVER_CTAUX_WALKER_CT_AUX_WALKER_TOOLS_KERNELS_HPP
| 32.823529
| 95
| 0.747312
|
frobnitzem
|
a5b232cf0e41043f2151ecd73a85066b68d773c1
| 78
|
cpp
|
C++
|
Source/L2NextCrypto/Private/Utils/Streams/InputStream.cpp
|
L2Next/L2NextCrypto
|
005a893b5d04e8fc522cb0e08f92b39d5411b98c
|
[
"MIT"
] | 4
|
2020-09-04T21:33:35.000Z
|
2021-05-30T14:25:27.000Z
|
Source/L2NextCrypto/Private/Utils/Streams/InputStream.cpp
|
L2Next/L2NextCrypto
|
005a893b5d04e8fc522cb0e08f92b39d5411b98c
|
[
"MIT"
] | 9
|
2020-08-15T14:07:12.000Z
|
2021-06-25T05:48:58.000Z
|
Source/L2NextCrypto/Private/Utils/Streams/InputStream.cpp
|
L2Next/L2NextCrypto
|
005a893b5d04e8fc522cb0e08f92b39d5411b98c
|
[
"MIT"
] | 2
|
2020-11-20T04:03:42.000Z
|
2021-03-04T21:46:50.000Z
|
#include "Utils/Streams/InputStream.h"
using namespace L2NextCryptoStreams;
| 15.6
| 38
| 0.820513
|
L2Next
|
a5b236b6cb8db861e5fde0f54ae936edf0c32709
| 4,375
|
hpp
|
C++
|
experiments/util/benchmark_util.hpp
|
keszocze/abo
|
2d59ac20832b308ef5f90744fc98752797a4f4ba
|
[
"MIT"
] | null | null | null |
experiments/util/benchmark_util.hpp
|
keszocze/abo
|
2d59ac20832b308ef5f90744fc98752797a4f4ba
|
[
"MIT"
] | null | null | null |
experiments/util/benchmark_util.hpp
|
keszocze/abo
|
2d59ac20832b308ef5f90744fc98752797a4f4ba
|
[
"MIT"
] | 1
|
2020-03-11T14:50:31.000Z
|
2020-03-11T14:50:31.000Z
|
#ifndef BENCHMARK_UTIL_H
#define BENCHMARK_UTIL_H
#include <cudd/cplusplus/cuddObj.hh>
#include <string>
#include <vector>
namespace abo::benchmark {
enum class ErrorMetric
{
WORST_CASE,
WORST_CASE_RELATIVE_APPROX,
WORST_CASE_RELATIVE_BINARY_SEARCH,
WORST_CASE_RELATIVE_RANDOMIZED,
WORST_CASE_RELATIVE_ADD,
WORST_CASE_RELATIVE_SYMBOLIC,
APPROXIMATE_WORST_CASE_5,
AVERAGE_CASE,
AVERAGE_RELATIVE_APPROX,
AVERAGE_RELATIVE_ADD,
MEAN_SQUARED,
ERROR_RATE,
AVERAGE_BIT_FLIP,
WORST_CASE_BIT_FLIP,
};
/**
* Returns a human readable string containing the name of the error metric that is given as the enum
*/
std::string error_metric_name(ErrorMetric metric);
/**
* @brief Computes the error metric for the given functions
* @param mgr The BDD object manager
* @param original The original function. As most metrics are symmetric, it can be swapped with the
* approximated function for them. The only exceptions are the average case relative and worst case
* relative error
* @param approx The approximated function. Must be an unsigned integer.
* @param metric The metric to evaluate
* @return The metric value. For the approximate metrics, it is the average between the lower and
* upper bound on the error
*/
double compute_error_metric(const Cudd& mgr, const std::vector<BDD>& original,
const std::vector<BDD>& approx, ErrorMetric metric);
/**
* @brief Collection of all supported ISCAS'85 benchmark files for easy access
*/
enum class ISCAS85File
{
// the numbering is done by hand to ensure that we can use this as array index
C17 = 0,
C432 = 1,
C499 = 2,
C880 = 3,
C1355 = 4,
C1908 = 5,
C2670 = 6,
C3540 = 7,
C5315 = 8,
C6288 = 9,
C7552 = 10
};
/**
* Returns the filename of the iscas'85 file identified the the enum input
*/
std::string iscas_85_filename_by_id(ISCAS85File file);
/*
* Returns the full path of the iscas'85 benchmark
*/
std::string iscas_85_filepath_by_id(ISCAS85File file);
/**
* @brief Loads an iscas 85 benchmark and returns it as a BDD vector
* @param mgr The BDD object manager
* @param file The file to load
* @return The iscas 85 benchmark
*/
std::vector<BDD> load_iscas_85_file(Cudd& mgr, ISCAS85File file);
/**
* @brief Collection of all supported EPFL benchmark files for easy access
*/
enum class EPFLFile
{
// the numbering is done by hand to ensure that we can use this as array index
Adder = 0,
Bar = 1,
Div = 2,
Hyp = 3,
Log2 = 4,
Max = 5,
Mul = 6,
Sin = 7,
Sqrt = 8,
Square = 9
};
/**
* Returns the filename of the EPFL file identified the the enum input
*/
std::string epfl_filename_by_id(EPFLFile file);
/*
* Returns the full path of the EPFL benchmark
*/
std::string epfl_filepath_by_id(EPFLFile file);
std::vector<BDD> load_epfl_benchmark_file(Cudd& mgr, EPFLFile file);
enum class ApproximateAdder
{
ACA1,
ACA2,
GDA,
GEAR
};
/**
* @brief Returns a shorthand form of the name of the approximate adder and its exact configuration
* @param adder The adder to use
* @param bits The number of bits the adder should have
* @param par1 The first parameter of the approximate adder. This has different meanings for
* different adders
* @param par2 (optional) The second parameter of the approximate adder. This has different meanings
* for different adders
* @return A string containing the name of the configuration
*/
std::string approximate_adder_name(ApproximateAdder adder, std::size_t bits, std::size_t par1,
std::size_t par2 = 0);
/**
* @brief Creates the approximate adder specified by the parameters
* @param mgr The BDD object manager
* @param adder The approximate adder type to create
* @param bits The number of bits the adder should have
* @param par1 The first parameter of the approximate adder. This has different meanings for
* different adders
* @param par2 par2 (optional) The second parameter of the approximate adder. This has different
* meanings for different adders
* @return The approximate adder
*/
std::vector<BDD> get_approximate_adder(Cudd& mgr, ApproximateAdder adder, std::size_t bits,
std::size_t par1, std::size_t par2 = 0);
} // namespace abo::benchmark
#endif // BENCHMARK_UTIL_H
| 28.782895
| 100
| 0.709257
|
keszocze
|
a5b3bfd9a2e0f91548f241f2dfab0c95df20e437
| 615
|
cpp
|
C++
|
DearPyGui/src/ui/AppItems/widget_handlers/mvToggledOpenHandler.cpp
|
BadSugar/DearPyGui
|
95f3f86e2efb7fbe31d76c52a1a7965d96ee9151
|
[
"MIT"
] | 7,471
|
2020-08-12T13:36:38.000Z
|
2022-03-31T14:50:37.000Z
|
DearPyGui/src/ui/AppItems/widget_handlers/mvToggledOpenHandler.cpp
|
BadSugar/DearPyGui
|
95f3f86e2efb7fbe31d76c52a1a7965d96ee9151
|
[
"MIT"
] | 922
|
2020-08-12T21:03:42.000Z
|
2022-03-31T01:19:10.000Z
|
DearPyGui/src/ui/AppItems/widget_handlers/mvToggledOpenHandler.cpp
|
BadSugar/DearPyGui
|
95f3f86e2efb7fbe31d76c52a1a7965d96ee9151
|
[
"MIT"
] | 550
|
2020-08-12T21:58:55.000Z
|
2022-03-30T09:09:58.000Z
|
#include "mvToggledOpenHandler.h"
#include "mvLog.h"
#include "mvItemRegistry.h"
#include "mvPythonExceptions.h"
#include "mvUtilities.h"
namespace Marvel {
mvToggledOpenHandler::mvToggledOpenHandler(mvUUID uuid)
:
mvAppItem(uuid)
{
}
void mvToggledOpenHandler::customAction(void* data)
{
if (static_cast<mvAppItemState*>(data)->toggledOpen)
{
mvSubmitCallback([=]()
{
if(config.alias.empty())
mvRunCallback(getCallback(false), uuid, GetPyNone(), config.user_data);
else
mvRunCallback(getCallback(false), config.alias, GetPyNone(), config.user_data);
});
}
}
}
| 19.83871
| 85
| 0.700813
|
BadSugar
|
a5b5f6c80e4282aaa7efc01261996209d533ca83
| 10
|
cpp
|
C++
|
greedy-algorithms/basic-principles/tempCodeRunnerFile.cpp
|
dushimsam/deep-dive-in-algorithms
|
0c6a04b3115ba789ab4aca68cce51c9a3c3a075a
|
[
"MIT"
] | null | null | null |
greedy-algorithms/basic-principles/tempCodeRunnerFile.cpp
|
dushimsam/deep-dive-in-algorithms
|
0c6a04b3115ba789ab4aca68cce51c9a3c3a075a
|
[
"MIT"
] | null | null | null |
greedy-algorithms/basic-principles/tempCodeRunnerFile.cpp
|
dushimsam/deep-dive-in-algorithms
|
0c6a04b3115ba789ab4aca68cce51c9a3c3a075a
|
[
"MIT"
] | null | null | null |
int min(){
| 10
| 10
| 0.6
|
dushimsam
|
a5b6f00b1d7d88b4738a8210393a59c3b0c44b3a
| 7,048
|
cpp
|
C++
|
tests/unit/SummaryBuilder.cpp
|
keithmendozasr/mimeographer
|
84a2b99b27830b8679d4f35f8cc913bf69be842a
|
[
"Apache-2.0"
] | 1
|
2021-05-01T14:49:09.000Z
|
2021-05-01T14:49:09.000Z
|
tests/unit/SummaryBuilder.cpp
|
keithmendozasr/mimeographer
|
84a2b99b27830b8679d4f35f8cc913bf69be842a
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/SummaryBuilder.cpp
|
keithmendozasr/mimeographer
|
84a2b99b27830b8679d4f35f8cc913bf69be842a
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2017 Keith Mendoza
*
* 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 <functional>
#include "SummaryBuilder.h"
#include "gtest/gtest.h"
using namespace std;
namespace mimeographer
{
TEST(SummaryBuilderTest, buildTitleClean)
{
string expectText = "Test Title";
string markdown = "# " + expectText;
unique_ptr<cmark_node, function<void(cmark_node*)>> rootNode(
cmark_parse_document(markdown.c_str(), markdown.size(),
CMARK_OPT_DEFAULT),
[](cmark_node *node)
{
if(node)
cmark_node_free(node);
}
);
SummaryBuilder obj;
obj.iterator = move(
shared_ptr<cmark_iter>(cmark_iter_new(rootNode.get()),
[](cmark_iter *iter)
{
if(iter)
cmark_iter_free(iter);
}
));
EXPECT_EQ(cmark_iter_next(obj.iterator.get()), CMARK_EVENT_ENTER);
EXPECT_NO_THROW({
obj.buildTitle();
EXPECT_EQ(obj.title, expectText);
});
}
TEST(SummaryBuilderTest, buildTitleWithInlines)
{
string expectText = "Test Title with inlines and link";
string markdown =
"# Test Title *with* **inlines** [and link](/randomspot)";
unique_ptr<cmark_node, function<void(cmark_node*)>> rootNode(
cmark_parse_document(markdown.c_str(), markdown.size(),
CMARK_OPT_DEFAULT),
[](cmark_node *node)
{
if(node)
cmark_node_free(node);
}
);
SummaryBuilder obj;
obj.iterator = move(
shared_ptr<cmark_iter>(cmark_iter_new(rootNode.get()),
[](cmark_iter *iter)
{
if(iter)
cmark_iter_free(iter);
}
));
EXPECT_EQ(cmark_iter_next(obj.iterator.get()), CMARK_EVENT_ENTER);
EXPECT_NO_THROW({
obj.buildTitle();
EXPECT_EQ(obj.title, expectText);
});
}
TEST(SummaryBuilderTest, buildPreviewClean)
{
string expectedText =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pulvinar"
"pellentesque fringilla. Vestibulum ante ipsum primis in faucibus orci "
"luctus et ultrices posuere cubilia Curae; Nunc maximus augue magna, ve"
"l euismod purus efficitur eu. Nunc massa nunc.";
unique_ptr<cmark_node, function<void(cmark_node*)>> rootNode(
cmark_parse_document(expectedText.c_str(), expectedText.size(),
CMARK_OPT_DEFAULT),
[](cmark_node *node)
{
if(node)
cmark_node_free(node);
}
);
SummaryBuilder obj;
obj.iterator = move(
shared_ptr<cmark_iter>(cmark_iter_new(rootNode.get()),
[](cmark_iter *iter)
{
if(iter)
cmark_iter_free(iter);
}
));
EXPECT_EQ(cmark_iter_next(obj.iterator.get()), CMARK_EVENT_ENTER);
EXPECT_NO_THROW({
obj.buildPreview();
EXPECT_EQ(obj.preview, expectedText);
});
}
TEST(SummaryBuilderTest, buildPreviewWithInlines)
{
string markdown =
"Lorem ipsum dolor,  consectetur "
"**adipiscing elit**. Duis pulvinar *pellentesque* fringilla. Vestibulum "
"ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia "
"Curae; Nunc maximus augue magna, vel euismod purus efficitur eu. Nunc "
"massa nunc.\n\n"
"Fusce egestas sem ac metus mollis egestas. Donec ultrices turpis sed ex aliquam";
string expectText =
"Lorem ipsum dolor, random image consectetur adipiscing elit. Duis pulvinar pellen"
"tesque fringilla. Vestibulum ante ipsum primis in faucibus orci luctu"
"s et ultrices posuere cubilia Curae; Nunc maximus augue magna, vel eu"
"ismod purus efficitur eu. Nunc massa ";
unique_ptr<cmark_node, function<void(cmark_node*)>> rootNode(
cmark_parse_document(markdown.c_str(), markdown.size(),
CMARK_OPT_DEFAULT),
[](cmark_node *node)
{
if(node)
cmark_node_free(node);
}
);
SummaryBuilder obj;
obj.iterator = move(
shared_ptr<cmark_iter>(cmark_iter_new(rootNode.get()),
[](cmark_iter *iter)
{
if(iter)
cmark_iter_free(iter);
}
));
EXPECT_EQ(cmark_iter_next(obj.iterator.get()), CMARK_EVENT_ENTER);
EXPECT_NO_THROW({
obj.buildPreview();
EXPECT_EQ(obj.preview, expectText);
});
}
TEST(SummaryBuilderTest, build)
{
string markdown =
"# Test Title\n"
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vi"
"tae dictum sem. Cras a lorem sed felis dictum elementum eu vel risus."
" Donec pretium lobortis pulvinar. Donec eu sodales mi. Aenean id elem"
"entum ante. Nam id urna hendrerit, mattis neque ut, faucibus purus. N"
"am scelerisque vulputate blandit. Proin euismod viverra mollis. Donec"
"auctor porta libero, in mollis enim vulputate eu. Sed rutrum mollis u"
"rna nec facilisis. Aliquam vel neque posuere, vestibulum tellus id, b"
"landit leo.\n\n"
"Fusce egestas sem ac metus mollis egestas. Donec ultrices turpis sed "
"ex aliquam, sed porttitor lectus porttitor. Integer pellentesque tris"
"tique dolor, a tincidunt nisl rhoncus sit amet. Donec at risus quam. "
"Proin vehicula nibh vel quam viverra bibendum. Proin eu libero sem. P"
"roin ultricies neque nec leo convallis dignissim. Vestibulum sagittis"
" neque dui, sit amet eleifend purus mattis vitae. Sed fermentum enim "
"ligula, in cursus nisl semper non. Aenean a pulvinar purus, sit amet "
"malesuada ante. In sed euismod lorem. Maecenas scelerisque bibendum n"
"isi, vitae condimentum arcu viverra id. Integer augue est, molestie q"
"uis semper lobortis, consequat eget quam.";
string expectedTitle = "Test Title";
string expectedPreview =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vi"
"tae dictum sem. Cras a lorem sed felis dictum elementum eu vel risus."
" Donec pretium lobortis pulvinar. Donec eu sodales mi. Aenean id elem"
"entum ante. Nam id urna hendrerit, mattis neque u";
SummaryBuilder obj;
EXPECT_NO_THROW({
obj.build(markdown);
EXPECT_EQ(obj.getTitle(), expectedTitle);
EXPECT_EQ(obj.getPreview(), expectedPreview);
});
}
} // namespace
| 33.722488
| 94
| 0.644296
|
keithmendozasr
|
a5bf5522e582265fcf94446cc08e82e5bceec868
| 4,397
|
cpp
|
C++
|
Mirror/event.cpp
|
Maxul/sgx_vmx_protocol
|
b18dcdd6cbbf10c7d609649295676f0163dd9a5e
|
[
"MIT"
] | null | null | null |
Mirror/event.cpp
|
Maxul/sgx_vmx_protocol
|
b18dcdd6cbbf10c7d609649295676f0163dd9a5e
|
[
"MIT"
] | null | null | null |
Mirror/event.cpp
|
Maxul/sgx_vmx_protocol
|
b18dcdd6cbbf10c7d609649295676f0163dd9a5e
|
[
"MIT"
] | null | null | null |
/*
* event.cpp
* This file is part of SVMOS
*
* Copyright (C) 2017 - Ecular, Maxul
*
* VmOs is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* VmOs is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with VmOs. If not, see <http://www.gnu.org/licenses/>.
*/
#include "svmos.h"
static void input_event_enqueue(Item item) {
pthread_mutex_lock(&mutex_queue);
event_queue.push_back(item);
pthread_mutex_unlock(&mutex_queue);
}
void *input_event_queue(void *arg) {
XEvent host_event;
Time last_move_time = 0;
Item item;
Display *dpy_wnd = ((struct event_arg *)(arg))->dpy;
Node *find_result;
pthread_mutex_lock(&mutex_link);
item.source_wid = getGuestID(((struct event_arg *)(arg))->wnd);
pthread_mutex_unlock(&mutex_link);
for (;;) {
XNextEvent(dpy_wnd, &host_event);
switch (host_event.type) {
case ButtonPress: // code 0
item.x = host_event.xbutton.x - color_border;
item.y = host_event.xbutton.y - color_border;
item.button = host_event.xbutton.button;
item.event_type = '0';
input_event_enqueue(item);
break;
case ButtonRelease: // code 2
item.x = host_event.xbutton.x - color_border;
item.y = host_event.xbutton.y - color_border;
item.button = host_event.xbutton.button;
item.event_type = '2';
input_event_enqueue(item);
break;
case MotionNotify: // code 1
/* 控制传输频率 */
if (host_event.xbutton.time - last_move_time >= 120) {
item.x = host_event.xbutton.x;
item.y = host_event.xbutton.y;
item.event_type = '1';
input_event_enqueue(item);
last_move_time = host_event.xbutton.time;
}
break;
case KeyPress: // code 3
item.x = host_event.xbutton.x - color_border;
item.y = host_event.xbutton.y - color_border;
item.button = host_event.xkey.keycode;
item.event_type = '3';
input_event_enqueue(item);
// printf("press %d\n", item.button);
break;
case KeyRelease: // code 4
item.x = host_event.xbutton.x - color_border;
item.y = host_event.xbutton.y - color_border;
item.button = host_event.xkey.keycode;
item.event_type = '4';
input_event_enqueue(item);
break;
/* windows resize */
case ConfigureNotify: // code 5
#if 0
pthread_mutex_lock(&mutex_link);
find_result = FindNodeBySwinValue(head, host_event.xconfigure.window);
if (find_result == NULL) {
printf("swid=0x%lx. not find Node!\n", host_event.xconfigure.window);
pthread_mutex_unlock(&mutex_link);
goto input_event_exit;
}
/* only in this case it's called "RESIZE" */
if (host_event.xconfigure.width - color_border * 2 !=
find_result->width ||
host_event.xconfigure.height - color_border * 2 !=
find_result->height) {
item.x = host_event.xconfigure.width - color_border * 2;
item.y = host_event.xconfigure.height - color_border * 2;
item.event_type = '5';
input_event_enqueue(item);
find_result->width = item.x;
find_result->height = item.y;
find_result->resize = 1;
}
pthread_mutex_unlock(&mutex_link);
#endif
break;
/* window close */
case ClientMessage: // code 6
item.x = 0;
item.y = 0;
item.button = 0;
item.event_type = '6';
input_event_enqueue(item);
break;
case Expose: // code 7
if (host_event.xexpose.count != 0)
break;
item.x = 0;
item.y = 0;
item.button = 0;
item.event_type = '7';
input_event_enqueue(item);
break;
case DestroyNotify:
goto input_event_exit;
default:
// printf("event %d\n", host_event.type);
break;
}
/* MUST KNOW: We'd better not sleep or miss the hit */
}
input_event_exit:
free(arg);
return NULL;
}
| 24.292818
| 77
| 0.634069
|
Maxul
|
a5c5a1dab21e48bf25ebd79c6dfe1a7301bca52c
| 226
|
hpp
|
C++
|
examples/05_with_textureManager_and_gameObject/TextureManager.hpp
|
nathandaven/sdl-vscode-template
|
098125e250ede58eeaa6cd06738d76c2983cdb58
|
[
"MIT"
] | null | null | null |
examples/05_with_textureManager_and_gameObject/TextureManager.hpp
|
nathandaven/sdl-vscode-template
|
098125e250ede58eeaa6cd06738d76c2983cdb58
|
[
"MIT"
] | null | null | null |
examples/05_with_textureManager_and_gameObject/TextureManager.hpp
|
nathandaven/sdl-vscode-template
|
098125e250ede58eeaa6cd06738d76c2983cdb58
|
[
"MIT"
] | null | null | null |
#ifndef TextureManager_hpp
#define TextureManager_hpp
#include "Game.hpp"
class TextureManager
{
public:
static SDL_Texture *LoadTexture(const char *textureFile, SDL_Renderer *renderer);
};
#endif /* TextureManager_hpp */
| 18.833333
| 83
| 0.787611
|
nathandaven
|
a5c5a6788cf7ba5ce88cc1a6fd2fc114b5646aa0
| 2,202
|
hpp
|
C++
|
frida/frida-cycript/src/Location.hpp
|
bzxy/cydia
|
f8c838cdbd86e49dddf15792e7aa56e2af80548d
|
[
"MIT"
] | 678
|
2017-11-17T08:33:19.000Z
|
2022-03-26T10:40:20.000Z
|
frida/frida-cycript/src/Location.hpp
|
chenfanfang/Cydia
|
5efce785bfd5f1064b9c0f0e29a9cc05aa24cad0
|
[
"MIT"
] | 22
|
2019-04-16T05:51:53.000Z
|
2021-11-08T06:18:45.000Z
|
frida/frida-cycript/src/Location.hpp
|
chenfanfang/Cydia
|
5efce785bfd5f1064b9c0f0e29a9cc05aa24cad0
|
[
"MIT"
] | 170
|
2018-06-10T07:59:20.000Z
|
2022-03-22T16:19:33.000Z
|
/* Cycript - The Truly Universal Scripting Language
* Copyright (C) 2009-2016 Jay Freeman (saurik)
*/
/* GNU Affero General Public License, Version 3 {{{ */
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
/* }}} */
#ifndef CYCRIPT_LOCATION_HPP
#define CYCRIPT_LOCATION_HPP
#include <iostream>
class CYPosition {
public:
std::string *filename;
unsigned int line;
unsigned int column;
CYPosition() :
filename(NULL),
line(1),
column(0)
{
}
void Lines(unsigned count = 1) {
column = 0;
line += count;
}
void Columns(unsigned count = 1) {
column += count;
}
};
inline std::ostream &operator <<(std::ostream &out, const CYPosition &position) {
if (position.filename != NULL)
out << *position.filename << ":";
out << position.line << "." << position.column;
return out;
}
class CYLocation {
public:
CYPosition begin;
CYPosition end;
void step() {
begin = end;
}
};
inline std::ostream &operator <<(std::ostream &out, const CYLocation &location) {
const CYPosition &begin(location.begin);
const CYPosition &end(location.end);
out << begin;
if (end.filename != NULL && (begin.filename == NULL || *begin.filename != *end.filename))
out << '-' << *end.filename << ':' << end.line << '.' << end.column;
else if (begin.line != end.line)
out << '-' << end.line << '.' << end.column;
else if (begin.column != end.column)
out << '-' << end.column;
return out;
}
#endif/*CYCRIPT_LOCATION_HPP*/
| 26.853659
| 93
| 0.634423
|
bzxy
|
a5cb7df08d1faf5661ca2d65b58cc93300724f23
| 2,150
|
cpp
|
C++
|
tests/DataHelpers.cpp
|
michaelwillis/sfizz
|
0461f6e5e288da71aeccf7b7dfd71302bf0ba175
|
[
"BSD-2-Clause"
] | 281
|
2019-06-06T05:58:59.000Z
|
2022-03-06T12:20:09.000Z
|
tests/DataHelpers.cpp
|
michaelwillis/sfizz
|
0461f6e5e288da71aeccf7b7dfd71302bf0ba175
|
[
"BSD-2-Clause"
] | 590
|
2019-09-22T00:26:10.000Z
|
2022-03-31T19:21:58.000Z
|
tests/DataHelpers.cpp
|
michaelwillis/sfizz
|
0461f6e5e288da71aeccf7b7dfd71302bf0ba175
|
[
"BSD-2-Clause"
] | 44
|
2019-10-08T08:24:20.000Z
|
2022-02-26T04:21:44.000Z
|
// SPDX-License-Identifier: BSD-2-Clause
// This code is part of the sfizz library and is licensed under a BSD 2-clause
// license. You should have receive a LICENSE.md file along with the code.
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
#include "DataHelpers.h"
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstring>
#include <fstream>
void load_txt(DataPoints& dp, std::istream& in)
{
struct RawValue {
bool rowJump;
float value;
};
std::vector<RawValue> raw;
raw.reserve(1024);
// read raw value data
{
std::string line;
line.reserve(256);
while (std::getline(in, line)) {
size_t commentPos = line.find('#');
if (commentPos == line.npos)
line = line.substr(0, commentPos);
std::istringstream lineIn(line);
RawValue rv;
rv.rowJump = true;
while (lineIn >> rv.value) {
raw.push_back(rv);
rv.rowJump = false;
}
}
}
if (raw.empty()) {
dp.rows = 0;
dp.cols = 0;
dp.data.reset();
return;
}
// count rows and columns
size_t numRows = 0;
size_t numCols = 0;
{
size_t c = 0;
for (const RawValue& rv : raw) {
if (!rv.rowJump)
++c;
else {
numRows += c != 0;
c = 1;
}
numCols = std::max(numCols, c);
}
numRows += c != 0;
}
// fill the data
float* data = new float[numRows * numCols];
dp.rows = numRows;
dp.cols = numCols;
dp.data.reset(data);
for (size_t i = 0, j = 0; i < numRows * numCols; ) {
size_t c = 1;
data[i++] = raw[j++].value;
for (; j < raw.size() && !raw[j].rowJump; ++c)
data[i++] = raw[j++].value;
for ( ; c < numCols; ++c)
data[i++] = 0.0f;
}
}
bool load_txt_file(DataPoints& dp, const fs::path& path)
{
fs::ifstream in(path);
load_txt(dp, in);
return !in.bad();
}
| 23.626374
| 78
| 0.506977
|
michaelwillis
|
a5cf9abc34ce8a74718244dfcdc33bf6f4554973
| 281
|
cpp
|
C++
|
OJ/PT/PT23.cpp
|
doan201203/truong_doan
|
68350b7a24ea266320cd41e1a4878e8a58b3f707
|
[
"Apache-2.0"
] | null | null | null |
OJ/PT/PT23.cpp
|
doan201203/truong_doan
|
68350b7a24ea266320cd41e1a4878e8a58b3f707
|
[
"Apache-2.0"
] | null | null | null |
OJ/PT/PT23.cpp
|
doan201203/truong_doan
|
68350b7a24ea266320cd41e1a4878e8a58b3f707
|
[
"Apache-2.0"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n;
cin>>n;
for(int i =1 ; i<= n ; i++){
int le = 1 , chan = 0;
for(int j = i-1 ; j >= 0 ; j--){
if(j%2 ==0){
cout<<le;
}else{
cout<<chan;
}
}cout<<"\n";
}
}
| 16.529412
| 37
| 0.448399
|
doan201203
|
a5d157928cea04d1b8269b374fe29a9686caa95c
| 4,506
|
cpp
|
C++
|
src/Frodo-core/core/event/eventdispatcher.cpp
|
JeppeSRC/Frodo
|
f3229c4601608254f16f4499052d8d03c94c0e86
|
[
"MIT"
] | 19
|
2016-04-19T21:31:47.000Z
|
2018-02-28T19:28:43.000Z
|
src/Frodo-core/core/event/eventdispatcher.cpp
|
JeppeSRC/Frodo
|
f3229c4601608254f16f4499052d8d03c94c0e86
|
[
"MIT"
] | null | null | null |
src/Frodo-core/core/event/eventdispatcher.cpp
|
JeppeSRC/Frodo
|
f3229c4601608254f16f4499052d8d03c94c0e86
|
[
"MIT"
] | null | null | null |
#include "eventdispatcher.h"
#include <core/log/log.h>
#include <core/video/context.h>
namespace fd {
namespace core {
namespace event {
using namespace utils;
using namespace log;
using namespace video;
List<EventListener*> EventDispatcher::allListeners;
List<EventListener*> EventDispatcher::windowListeners;
List<EventListener*> EventDispatcher::mouseListeners;
List<EventListener*> EventDispatcher::keyboardListeners;
void EventDispatcher::DispatchEvent(const Event* const event) {
OnEvent(event);
}
bool EventDispatcher::OnEvent(const Event* const event) {
uint_t size = allListeners.GetSize();
for (uint_t i = 0; i < size; i++) {
EventListener* listener = allListeners[i];
bool handled = listener->OnEvent(event);
if (handled) continue;
switch (event->type) {
case EventType::Unknown:
Log::Warning("[EventDispatcher] Received unknown event");
return false;
case EventType::InputKeyboard:
handled = OnKeyboardEvent(listener, (KeyboardEvent*)event);
break;
case EventType::InputMouse:
handled = OnMouseEvent(listener, (MouseEvent*)event);
break;
case EventType::Window:
handled = OnWindowEvent(listener, (WindowEvent*)event);
break;
}
}
if (event->type == EventType::Window) {
size = windowListeners.GetSize();
WindowEvent* e = (WindowEvent*)event;
for (uint_t i = 0; i < size; i++) {
EventListener* listener = windowListeners[i];
OnWindowEvent(listener, (WindowEvent*)event);
}
} else if (event->type == EventType::InputMouse) {
size = mouseListeners.GetSize();
for (uint_t i = 0; i < size; i++) {
EventListener* listener = mouseListeners[i];
OnMouseEvent(listener, (MouseEvent*)event);
}
} else if (event->type == EventType::InputKeyboard) {
size = keyboardListeners.GetSize();
for (uint_t i = 0; i < size; i++) {
EventListener* listener = keyboardListeners[i];
OnKeyboardEvent(listener, (KeyboardEvent*)event);
}
}
return true;
}
bool EventDispatcher::OnWindowEvent(EventListener* const listener, const WindowEvent* const event) {
if (listener->OnWindowEvent(event)) return true;
bool handled = false;
switch (event->action) {
case EventAction::Move:
handled = listener->OnWindowEventMove(event->position);
break;
case EventAction::Resize:
handled = listener->OnWindowEventResize(event->size);
break;
case EventAction::Focus:
handled = listener->OnWindowEventFocus(event->focus);
break;
case EventAction::MinimizeMaximize:
handled = listener->OnWindowEventVisiblity(event->visibility);
break;
}
return handled;
}
bool EventDispatcher::OnKeyboardEvent(EventListener* const listener, const KeyboardEvent* const event) {
if (listener->OnKeyboardEvent(event)) return true;
bool handled = false;
switch (event->action) {
case EventAction::Pressed:
handled = listener->OnKeyboardEventPressed(event->key);
break;
case EventAction::Released:
handled = listener->OnKeyboardEventReleased(event->key);
break;
}
return handled;
}
bool EventDispatcher::OnMouseEvent(EventListener* const listener, const MouseEvent* const event) {
if (listener->OnMouseEvent(event)) return true;
bool handled = false;
switch (event->action) {
case EventAction::Move:
handled = listener->OnMouseEventMove(event->absolute, event->relative);
break;
case EventAction::Pressed:
handled = listener->OnMouseEventPressed(event->button);
break;
case EventAction::Released:
handled = listener->OnMouseEventReleased(event->button);
break;
}
return handled;
}
void EventDispatcher::RegisterListener(EventListener* listener, EventListenerTypes events) {
if (events == EventAll) {
allListeners.Push_back(listener);
return;
}
if (events & EventWindow) {
windowListeners.Push_back(listener);
}
if (events & EventMouse) {
mouseListeners.Push_back(listener);
}
if (events & EventKeyboard) {
keyboardListeners.Push_back(listener);
}
}
void EventDispatcher::UnRegisterListener(EventListener* listener, EventListenerTypes events) {
if (events == EventAll) {
allListeners.Remove(listener);
return;
}
if (events & EventWindow) {
windowListeners.Remove(listener);
}
if (events & EventMouse) {
mouseListeners.Remove(listener);
}
if (events & EventKeyboard) {
keyboardListeners.Remove(listener);
}
}
}
}
}
| 24.758242
| 105
| 0.691522
|
JeppeSRC
|
a5d1707ea6bea6172e65ca2ecb1fe489760f3d30
| 8,011
|
cpp
|
C++
|
msj_archives/code/MSJApr97.src/MSN Case Study/container/events.cpp
|
sarangbaheti/misc-code
|
d47a8d1cc41f19701ce628c9f15976bb5baa239d
|
[
"Unlicense"
] | 1
|
2020-10-22T12:58:55.000Z
|
2020-10-22T12:58:55.000Z
|
msj_archives/code/MSJApr97.src/MSN Case Study/container/events.cpp
|
sarangbaheti/misc-code
|
d47a8d1cc41f19701ce628c9f15976bb5baa239d
|
[
"Unlicense"
] | null | null | null |
msj_archives/code/MSJApr97.src/MSN Case Study/container/events.cpp
|
sarangbaheti/misc-code
|
d47a8d1cc41f19701ce628c9f15976bb5baa239d
|
[
"Unlicense"
] | 2
|
2020-10-19T23:36:26.000Z
|
2020-10-22T12:59:37.000Z
|
#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <crtdbg.h>
#include <olectl.h>
#include <docobj.h>
#include <servprov.h>
#include <exdisp.h>
#include <exdispid.h>
#include "winmain.h"
#include "events.h"
#include "ctr.h"
//+---------------------------------------------------------------------------
//
// Member: CEventMap::~CEventMap
//
// Synopsis: unhooks the event sink from the WebBrowser OC.
//
//----------------------------------------------------------------------------
CEventMap::~CEventMap(VOID)
{
UnhookEvents();
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::UnhookEvents
//
// Synopsis: plumbing to unhook us from event source.
//
//----------------------------------------------------------------------------
VOID
CEventMap::UnhookEvents(VOID)
{
if (m_pConnPt)
{
m_pConnPt->Unadvise(m_dwCookie);
m_pConnPt->Release();
m_pConnPt = 0;
}
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::GetEventsFromCtrl
//
// Synopsis: Loads the typelib, gets the typeinfo for the eventset,
// and uses IConnectionPointContainer protocol for hooking
// up our implementation of IDispatch so it gets called
// when events are fired.
//
// Arguments: [pOleCtl] -- the WebBrowser OC.
//
// Returns: HRESULT
//
//----------------------------------------------------------------------------
HRESULT
CEventMap::GetEventsFromCtrl(LPOLECONTROL pOleCtl)
{
HRESULT hr;
LPCONNECTIONPOINTCONTAINER pConnCtr = 0;
_ASSERTE(pOleCtl);
// HOOKING UP EVENTS - let's get find the connection point and
// set up the connection for events to be fired.
hr = pOleCtl->QueryInterface(
IID_IConnectionPointContainer,
(LPVOID *) &pConnCtr);
if (hr)
goto Cleanup;
// find the connectionpoint for us to hook up event sink
hr = pConnCtr->FindConnectionPoint(DIID_DWebBrowserEvents, &m_pConnPt);
if (hr)
goto Cleanup;
// hook up the event sink
hr = m_pConnPt->Advise((LPUNKNOWN) this, &m_dwCookie);
if (hr)
goto Cleanup;
// if we got this far, we should be receiving events now.
Cleanup:
if (pConnCtr)
pConnCtr->Release();
return hr;
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::Invoke
//
// Synopsis: This is our mondo event set handler, the thing the
// WebBrowser OC calls when it fires an event.
//
// Arguments: standard IDispatch args per-spec.
//
// Returns: HRESULT - currently, all the members return S_OK
// no matter what - probably the right thing to do in
// an event handler.
//
//----------------------------------------------------------------------------
STDMETHODIMP
CEventMap::Invoke(
DISPID dispidMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS FAR * pdispparams,
VARIANT FAR * pvarResult,
EXCEPINFO FAR * pexcepinfo,
UINT FAR * puArgErr)
{
switch (dispidMember)
{
case DISPID_BEFORENAVIGATE:
{
return _OnBeginNavigate(pdispparams, puArgErr);
break;
}
case DISPID_NAVIGATECOMPLETE:
{
return _OnNavigate(pdispparams, puArgErr);
break;
}
case DISPID_STATUSTEXTCHANGE:
{
return _OnStatusTextChange(pdispparams, puArgErr);
break;
}
case DISPID_PROGRESSCHANGE:
{
return _OnProgress(pdispparams, puArgErr);
break;
}
case DISPID_DOWNLOADCOMPLETE:
{
return m_pCtr->OnDownloadComplete();
break;
}
case DISPID_COMMANDSTATECHANGE:
{
return _OnCommandStateChange(pdispparams, puArgErr);
break;
}
case DISPID_DOWNLOADBEGIN:
{
return m_pCtr->OnDownloadBegin();
break;
}
case DISPID_NEWWINDOW:
{
return m_pCtr->OnNewWindow();
break;
}
case DISPID_QUIT:
{
return m_pCtr->OnQuit();
break;
}
default:
return S_OK;
break;
}
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::_OnBeginNavigate
//
// Synopsis: a little wrapper to get the argument passing
// code out of the Invoke() above. It extracts args
// and calls CMSJOCCtr::OnBeginNavigate().
//
// Arguments: [pDP] -- pointer to argument block
// [puArgErr] -- on DispGetParam error, returns index to
// argument that caused the error.
//
// Returns: HRESULT
//
//----------------------------------------------------------------------------
HRESULT
CEventMap::_OnBeginNavigate(DISPPARAMS * pDP, PUINT puArgErr)
{
VARIANT varURL;
HRESULT hr;
::VariantInit(&varURL);
hr = ::DispGetParam(pDP, 0, VT_BSTR, &varURL, puArgErr);
if (hr)
return hr;
hr = m_pCtr->OnBeginNavigate(V_BSTR(&varURL));
::VariantClear(&varURL);
return hr;
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::_OnBeginNavigate
//
// Synopsis: a little wrapper to get the argument passing
// code out of the Invoke() above. It extracts args
// and calls CMSJOCCtr::OnNavigate().
//
// Arguments: [pDP] -- pointer to argument block
// [puArgErr] -- on DispGetParam error, returns index to
// argument that caused the error.
//
// Returns: HRESULT
//
//----------------------------------------------------------------------------
HRESULT
CEventMap::_OnNavigate(DISPPARAMS * pDP, PUINT puArgErr)
{
// ByVal URL As String, ByVal Flags As Long,
// ByVal TargetFrameName As String,
// PostData As Variant, ByVal Headers As String,
// ByVal Referrer As String
VARIANT varURL;
HRESULT hr;
::VariantInit(&varURL);
hr = ::DispGetParam(pDP, 0, VT_BSTR, &varURL, puArgErr);
if (hr)
return hr;
hr = m_pCtr->OnNavigate(V_BSTR(&varURL));
::VariantClear(&varURL);
return hr;
}
//+---------------------------------------------------------------------------
//
// Member: CEventMap::_OnCommandStateChange
//
// Synopsis: lets us determine whether and how to update the navbar
//
// Arguments: [pDP] -- args
// [puArgErr] -- err index returned from DispGetParam
//
// Returns: HRESULT
//
//----------------------------------------------------------------------------
HRESULT
CEventMap::_OnCommandStateChange(DISPPARAMS * pDP, PUINT puArgErr)
{
HRESULT hr;
VARIANT varlValue;
VARIANT varfEnable;
// get the arguments.
// this init is necessary for DispGetParam
::VariantInit(&varlValue);
::VariantInit(&varfEnable);
hr = ::DispGetParam(pDP, 1, VT_BOOL, &varfEnable, puArgErr);
if (hr)
return hr;
hr = ::DispGetParam(pDP, 0, VT_I4, &varlValue, puArgErr);
if (hr)
return hr;
// pass them to the container
return m_pCtr->OnCommandStateChange(V_BOOL(&varfEnable), V_I4(&varlValue));
}
HRESULT
CEventMap::_OnStatusTextChange(DISPPARAMS * pDP, PUINT puArgErr)
{
_ASSERTE(pDP);
if (pDP->cArgs != 1 || VT_BSTR != V_VT(&pDP->rgvarg[0]))
{
puArgErr = 0; // zeroth arg had the error.
return DISP_E_PARAMNOTFOUND; // we didn't find the arg we expected.
}
return m_pCtr->OnStatusTextChange(V_BSTR(&pDP->rgvarg[0]));
}
HRESULT
CEventMap::_OnProgress(DISPPARAMS * pDP, PUINT puArgErr)
{
_ASSERTE(V_VT(&pDP->rgvarg[0]) == VT_I4);
_ASSERTE(V_VT(&pDP->rgvarg[1]) == VT_I4);
return m_pCtr->OnProgress(V_I4(&pDP->rgvarg[1]), V_I4(&pDP->rgvarg[0]));
}
| 25.676282
| 79
| 0.524154
|
sarangbaheti
|
a5d28068bfb604329d6704855d6019a4f53ef1bd
| 11,918
|
cpp
|
C++
|
zebROS_ws/src/tf_object_detection/src/depth_algorithms.cpp
|
FRC900/2020Offseason
|
36ccd74667d379b07d9b7a1e937307c6d8119229
|
[
"BSD-3-Clause"
] | 2
|
2021-09-23T22:34:11.000Z
|
2022-01-13T00:20:12.000Z
|
zebROS_ws/src/tf_object_detection/src/depth_algorithms.cpp
|
FRC900/2020Offseason
|
36ccd74667d379b07d9b7a1e937307c6d8119229
|
[
"BSD-3-Clause"
] | 19
|
2021-03-20T01:10:04.000Z
|
2022-01-17T22:51:05.000Z
|
zebROS_ws/src/tf_object_detection/src/depth_algorithms.cpp
|
FRC900/2020Offseason
|
36ccd74667d379b07d9b7a1e937307c6d8119229
|
[
"BSD-3-Clause"
] | null | null | null |
#include "depth_algorithms.h"
// Find the median of a continuous cv::Mat
float findMedianOfMat(cv::Mat mat) {
float median = 0;
if (mat.isContinuous()) {
// copy matrix data to a vector
std::vector<float> vec;
mat = mat.reshape(0, 1);
mat.copyTo(vec);
// remove 255 (when this is called, values that are masked are 255)
vec.erase(std::remove(vec.begin(), vec.end(), 255), vec.end());
if ((vec.size() % 2) != 0) { // if odd
auto it = vec.begin() + vec.size()/2;
std::nth_element(vec.begin(), it, vec.end()); // sort vector so that the middle value is sorted, but not any of the other values
median = vec[vec.size()/2];
} else { // if even
auto it = vec.begin() + vec.size()/2;
std::nth_element(vec.begin(), it, vec.end()); // sort vector so that the middle value is sorted, but not any of the other values
median += vec[vec.size()/2];
it = vec.begin() + vec.size()/2 - 1;
std::nth_element(vec.begin(), it, vec.end()); // sort vector so that the value before the middle value is sorted, but not any of the other values
median += vec[vec.size()/2 - 1];
median = median/(float)2.0;
}
}
return median;
}
// Get the most useful depth value in the cv::Mat depth contained within
// the supplied bounding rectangle, using contour finding
float contoursDepthMat(const cv::Mat& depth_, const cv::Rect& bound_rect, bool debug, bool adaptive) {
if (bound_rect.size().area() == 0) { // if the ROI is zero, return -1 (no depth)
return -1;
}
// Crop depth to region of interest
cv::Mat depth = depth_(bound_rect);
// set very large outliers and nan to 0 so they can be removed later. TODO see if the ZED actually reports negative depth
float nan_ = std::numeric_limits<float>::quiet_NaN();
cv::Mat inf = depth>=900;
cv::Mat neg_inf = depth<=-900;
cv::Mat nan = depth==nan_;
cv::Mat neg_nan = depth==-nan_;
depth.setTo(0, inf);
depth.setTo(0, neg_inf);
depth.setTo(0, nan);
depth.setTo(0, neg_nan);
if (debug) {
double min, max; // cv::minMaxLoc requires doubles which is why a double is used here. Also, this is only enabled when debug==true.
cv::minMaxLoc(depth, &min, &max);
ROS_INFO_STREAM("min: " << min << ", max: " << max);
cv::Mat dest;
depth.copyTo(dest);
cv::normalize(dest, dest, 0, 255, cv::NORM_MINMAX);
dest.convertTo(dest, CV_8UC1);
cv::imshow("Depth", dest);
cv::waitKey(1);
}
// convert depth to a 0-255 grayscale image (for contour finding)
cv::Mat depthDifferentFormat;
cv::Mat zeros = depth==0; // no depth is 0 with the ZED. May also need to check for inf and nan.
depth.copyTo(depthDifferentFormat);
cv::normalize(depthDifferentFormat, depthDifferentFormat, 0, 128, cv::NORM_MINMAX); // 0-128 because outliers will be 255 (and we want a clear background)
depthDifferentFormat.setTo(255, zeros); // set zeros (no depth) to 255
depthDifferentFormat.convertTo(depthDifferentFormat, CV_8UC1, 1);
// Find the median of the image
float median = findMedianOfMat(depthDifferentFormat);
// Create a cv::Mat for thresholding output
cv::Mat threshOutput;
if (adaptive) {
// use adaptive thresholding to convert image to black and white for finding
// contours
int blockSize = depthDifferentFormat.size().area() / 25;
blockSize = blockSize > 1 ? (blockSize % 2 == 0 ? blockSize + 1 : blockSize) : 5; // block size must be at least 3 and odd
cv::adaptiveThreshold(depthDifferentFormat, threshOutput, 1, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY_INV, blockSize, 0);
} else {
// thresholding using median
cv::Mat threshOutput;
cv::threshold(depthDifferentFormat, threshOutput, median, 1, cv::THRESH_BINARY_INV);
}
// find contours
std::vector<std::vector<cv::Point>> contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(threshOutput, contours, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_SIMPLE);
// create a mask
cv::Mat mask = cv::Mat::zeros(threshOutput.size(), CV_8UC1);
int largestContourIndex;
float largestArea = 0;
for (size_t i = 0; i < contours.size(); i++) {
std::vector<cv::Point> contour = contours[(int)i];
cv::Rect rect = cv::boundingRect(contour);
if (rect.area() > largestArea) {
largestArea = rect.area();
largestContourIndex = (int)i;
}
}
// draw the largest contour onto the mask
cv::Scalar color = cv::Scalar(255);
cv::drawContours(mask, contours, largestContourIndex, color, -1, cv::LINE_8, hierarchy, 0);
// make a new image for the original depth cut out by the mask, and fill it with std::numeric_limits<float>::max()
// std::numeric_limits<float>::max() = ignore value, see line 168
cv::Mat masked = cv::Mat::ones(depth.size(), depth.type()) * std::numeric_limits<float>::max();
depth.copyTo(masked, mask);
// if debug is enabled,
if (debug) {
// show the masked image
cv::Mat destination = cv::Mat::zeros(depth.size(), depth.type());
depth.copyTo(destination, mask);
cv::normalize(destination, destination, 0, 255, cv::NORM_MINMAX);
destination.convertTo(destination, CV_8UC1);
cv::imshow("Masked", destination);
cv::waitKey(0);
}
// copy matrix data to a vector
std::vector<float> vec;
masked = masked.reshape(0, 1);
masked.copyTo(vec);
// remove std::numeric_limits<float>::max() values from the mask
vec.erase(std::remove(vec.begin(), vec.end(), std::numeric_limits<float>::max()), vec.end());
// and 0 values (no depth)
vec.erase(std::remove(vec.begin(), vec.end(), 0), vec.end());
// sort vector
std::sort(vec.begin(), vec.end());
return (vec.size() != 0 ? vec[(size_t)(percent_from_bottom_contours * vec.size())] : usefulDepthMat(depth_, bound_rect, debug, K_MEANS)); // return lowest value after throwing out the bottom <percent_from_bottom_contours>%.
// If there are no values, fall back to k-means.
/* Test results (adaptive thresholding):
[ INFO] [1635948213.029497061]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_goal_8.jpg
[ INFO] [1635948213.689598629]: Calculated depth is 113.001 ✅
[ INFO] [1635948229.253951900]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_goal_behind_power_cell.png
[ INFO] [1635948229.870174338]: Calculated depth is 138.001 ✅
[ INFO] [1635948236.848476178]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_goal.png
[ INFO] [1635948237.445102845]: Calculated depth is 113.001 ✅
[ INFO] [1635948248.428153064]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_loading_bay.png
[ INFO] [1635948249.227361594]: Calculated depth is 141.001 ✅
[ INFO] [1635948255.684437760]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_low_goal.png
[ INFO] [1635948256.286312490]: Calculated depth is 92.001 ✅
[ INFO] [1635948266.234706198]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/cropped_power_cell.png
[ INFO] [1635948266.316279430]: Calculated depth is 0.001 ✅
[ INFO] [1635948273.702984310]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/goal_behind_power_cell.png
[ INFO] [1635948275.086796499]: Calculated depth is 0.001 **non-cropped version** ❌
[ INFO] [1635948302.568242461]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/goal_with_power_cell_in_front.jpg
[ INFO] [1635948302.598558216]: Calculated depth is 0.001 ❌
[ INFO] [1635948312.950812216]: Received /home/ubuntu/2020Offseason/zebROS_ws/src/tf_object_detection/test_bitmaps/test_weirdness.jpg
[ INFO] [1635948312.980837687]: Calculated depth is 73.001 ✅
*/
}
// Get the most useful depth value in the cv::Mat depth contained within
// the supplied bounding rectangle, using k-means
float kMeansDepthMat(const cv::Mat& depth, const cv::Rect& bound_rect, bool debug, size_t maximumK, float tolerance)
{
// setup randomizing (for initialization of k-means)
std::random_device seeder;
std::mt19937 engine(seeder());
// Start of checking if k is too high
// Convert cropped depth matrix to vector
std::vector<float> vec;
cv::Mat mat = depth(bound_rect);
for (int i = 0; i < mat.rows; i++) {
vec.insert(vec.end(), mat.ptr<float>(i), mat.ptr<float>(i)+mat.cols*mat.channels());
}
// Find unique (defined as >`depth_epsilon` meters away) values in the vector
std::sort(vec.begin(), vec.end());
auto last = std::unique(vec.begin(), vec.end(), [](float first, float second){ return fabs(second - first)<depth_epsilon; });
vec.erase(last, vec.end());
// Set k to maximumK if there are more than maximumK unique values, otherwise set it to the number of unique values
size_t k = std::min(vec.size(), maximumK);
// End of checking if k is too high
// initialize arrays (and a vector) for k-means
float centroids[k];
float prevCentroids[k];
std::vector<float> clusters[k];
// Pick centroids
std::sample(vec.begin(), vec.end(), centroids, k, engine);
// Print centroids
if (debug) {
ROS_INFO_STREAM("k = " << k);
ROS_INFO_STREAM("Centroids: ");
for (size_t i = 0; i < k; i++) {
ROS_INFO_STREAM(centroids[i]);
}
}
while (true) { // once the algorithm converges this returns
for (int j = bound_rect.tl().y+1; j < bound_rect.br().y; j++) // for each row
{
const float *ptr_depth = depth.ptr<float>(j);
for (int i = bound_rect.tl().x+1; i < bound_rect.br().x; i++) // for each pixel in row
{
if (!(isnan(ptr_depth[i]) || isinf(ptr_depth[i]) || (ptr_depth[i] <= 0)))
{
// Calculate which centroid/mean the current pixel is closest to
size_t closestCentroidIndex = -1;
float smallestDiff = std::numeric_limits<float>::max();
for (size_t c = 0; c < k; c++) {
float diff = fabs(centroids[c] - ptr_depth[i]);
if (diff < smallestDiff) {
closestCentroidIndex = c;
smallestDiff = diff;
}
}
// Append the pixel's value to the cluster corresponding to that centroid
clusters[closestCentroidIndex].push_back(ptr_depth[i]);
}
}
}
// Recalculate centroids using the average of the cluster closest to each centroid
// (or set the centroid to std::numeric_limits<float>::max() if there are no values in the cluster)
for (size_t i = 0; i < k; i++) {
float sum = 0;
for (float f : clusters[i]) {
sum += f;
}
if (clusters[i].size() != 0) {
centroids[i] = sum / (float)clusters[i].size();
} else { // If the centroid's cluster has no values, set it to std::numeric_limits<float>::max() (basically remove it)
centroids[i] = std::numeric_limits<float>::max();
}
clusters[i].clear(); // Clear clusters
}
// Calculate and print the difference between the current and previous centroids
// this lets us see when the difference is very low (in which case the algorithm will be done)
float diff = 0;
for (size_t i = 0; i < k; i++) {
diff += fabs(centroids[i] - prevCentroids[i]);
}
if (debug) {
ROS_INFO_STREAM("diff: " << diff);
}
// If the difference is less than the tolerance, return the closest centroid
if (diff <= tolerance) {
return (*std::min_element(centroids, centroids+k)) == std::numeric_limits<float>::max() ? -1 : (*std::min_element(centroids, centroids+k));
}
// If the above statement didn't return, copy centroids to prevCentroids and
// re-run the algorithm
memcpy(prevCentroids, centroids, sizeof(prevCentroids));
}
}
// Get the most useful depth value in the cv::Mat depth contained within
// the supplied bounding rectangle
float usefulDepthMat(const cv::Mat& depth, const cv::Rect& bound_rect, bool debug, DepthCalculationAlgorithm algorithm, int k, float tolerance)
{
switch (algorithm) {
case CONTOURS:
return contoursDepthMat(depth, bound_rect, debug);
case CONTOURS_NON_ADAPTIVE:
return contoursDepthMat(depth, bound_rect, debug, false);
case K_MEANS:
return kMeansDepthMat(depth, bound_rect, debug, k, tolerance);
}
}
| 42.412811
| 224
| 0.700453
|
FRC900
|
a5d5254c6914988a305cd586ace8c47a53a3b9a2
| 23,509
|
cc
|
C++
|
lib-src/automata/lexergen2.cc
|
AaronNGray/prop-cc-new
|
3d9660f55c94c5bd260f6b7cc902fa19109d35a9
|
[
"BSD-2-Clause"
] | 1
|
2018-03-23T20:32:09.000Z
|
2018-03-23T20:32:09.000Z
|
lib-src/automata/lexergen2.cc
|
AaronNGray/prop-cc-new
|
3d9660f55c94c5bd260f6b7cc902fa19109d35a9
|
[
"BSD-2-Clause"
] | null | null | null |
lib-src/automata/lexergen2.cc
|
AaronNGray/prop-cc-new
|
3d9660f55c94c5bd260f6b7cc902fa19109d35a9
|
[
"BSD-2-Clause"
] | null | null | null |
//////////////////////////////////////////////////////////////////////////////
// NOTICE:
//
// ADLib, Prop and their related set of tools and documentation are in the
// public domain. The author(s) of this software reserve no copyrights on
// the source code and any code generated using the tools. You are encouraged
// to use ADLib and Prop to develop software, in both academic and commercial
// settings, and are free to incorporate any part of ADLib and Prop into
// your programs.
//
// Although you are under no obligation to do so, we strongly recommend that
// you give away all software developed using our tools.
//
// We also ask that credit be given to us when ADLib and/or Prop are used in
// your programs, and that this notice be preserved intact in all the source
// code.
//
// This software is still under development and we welcome any suggestions
// and help from the users.
//
// Allen Leung
// 1994
//////////////////////////////////////////////////////////////////////////////
#include <cassert>
#include <cstring>
#include <cctype>
#include <new>
#include <AD/automata/lexergen.h> // Lexical scanner generator
#include <AD/automata/gentable.h> // Table emitter
#include <AD/strings/charesc.h> // Escape sequence parsing
#include <AD/memory/mempool.h> // Memory pools
#include <AD/hash/dchash.h> // Direct chaining hash table
#include <AD/contain/vararray.h> // Generic arrays
#include <AD/contain/bitset.h> // bit set
////////////////////////////////////////////////////////////////////////////
// Make hidden types visible
////////////////////////////////////////////////////////////////////////////
typedef LexerGen::Symbol Symbol;
typedef LexerGen::State State;
typedef LexerGen::Rule Rule;
typedef LexerGen::Options Options;
////////////////////////////////////////////////////////////////////////////
// Constructor and destructor
////////////////////////////////////////////////////////////////////////////
LexerGen::LexerGen() : rule(0), bad_rule(-1), equiv_classes(0) {}
LexerGen::~LexerGen() { delete [] rule; delete [] equiv_classes; }
////////////////////////////////////////////////////////////////////////////
// Some flags and constants
////////////////////////////////////////////////////////////////////////////
#define nil 0 // nil pointer
#define RANGE_BIT 0x80000000 // marks a range in character class
#define COMPLEMENT 0x40000000 // marks a set complement in the same
#define END_CHAR_CLASS 0x20000000 // marks the end of a character class
////////////////////////////////////////////////////////////////////////////
// To create a set of tables
////////////////////////////////////////////////////////////////////////////
void LexerGen::create_tables(int size, int states, Symbol min, Symbol max)
{ Super::create_tables(size,states,min,max);
rule = new Rule [states];
}
////////////////////////////////////////////////////////////////////////////
// To grow the number of states
////////////////////////////////////////////////////////////////////////////
void LexerGen::grow_states(int increment)
{ Rule * new_rule = new Rule [ number_of_states + increment ];
std::memcpy(new_rule,rule,sizeof(Rule) * number_of_states);
delete [] rule;
rule = new_rule;
Super::grow_states(increment);
}
////////////////////////////////////////////////////////////////////////////
// A node in the nfa.
////////////////////////////////////////////////////////////////////////////
struct Nfa {
enum { Accept, Delta, Epsilon } tag;
BitSet * epsilon_closure;
union {
struct Dummy2 {
State state; // nfa state number
Symbol c; // symbol to branch on
Nfa * out; // out transition
BitSet * delta_set; //
} n;
Nfa * epsilon[2]; // out transitions
};
void * operator new (int, MemPool& mem)
{ Nfa * nfa = (Nfa*)mem[sizeof(Nfa)];
nfa->epsilon_closure = nil; return nfa;
}
void * operator new (int, MemPool& mem, Nfa * x, Nfa * y)
{ if (x == nil) return y;
Nfa * nfa = (Nfa*)mem[sizeof(Nfa)];
nfa->tag = Epsilon; nfa->epsilon_closure = nil;
nfa->epsilon[0] = x; nfa->epsilon[1] = y; return nfa;
}
};
////////////////////////////////////////////////////////////////////////////
// Parse a regular expression and construct a sub-nfa
////////////////////////////////////////////////////////////////////////////
static Nfa * construct_nfa
( const char * regexp, Rule rule, MemPool& mem,
int& number_of_nfa_states, Bool partitions[], Bool singletons[],
Symbol ** char_classes, Symbol * character_classes[],
int& char_class_num, const char * const * contexts, int number_of_contexts,
Nfa * context_nfas[], Bool foldcase
)
{ Nfa * stack[LexerGen::Max_star_height];
register const char * p; // current pointer to regular expression
register Symbol c; // current character
register Nfa * root; // the root of the current sub-nfa
register Nfa * current; // the current point of the sub-nfa
register Nfa * next; // the next availble node of the nfa
Nfa ** sp = stack;
char ch; int i;
Bool in_context[LexerGen::Max_contexts];
Bool anchored = false; // pattern must start at beginning of line??
Bool in_any_context = false;
//
// Determine the context, if any
//
if (regexp[0] == '<') {
char name[256];
char * q;
int i;
std::memset(in_context,0,sizeof(in_context));
if (contexts == nil) goto syntax_error;
for (p = regexp+1, q = name;; ) {
switch (c = *p++) {
case '\0': goto syntax_error;
case '>': case ',':
q = '\0';
for (i = 0; contexts[i]; i++)
if (std::strcmp(contexts[i], name) == 0) goto found;
goto syntax_error;
found: q = name;
in_context[i] = true;
in_any_context = true;
if (c == '>') goto finish;
break;
default: *q++ = c; break;
}
}
finish: ;
} else p = regexp;
//
// Now scan the pattern and parse
//
root = current = next = new(mem) Nfa;
for (;;) {
Nfa * next_node = new(mem) Nfa; // Get a new node
switch (c = (unsigned char)*p++) {
case '(': // grouping
case '|': // disjunction
{ sp[0] = root; sp[1] = next; sp[2] = c == '|' ? (Nfa*)1 : nil;
sp += 3; root = current = next = next_node;
} break;
case '\0': case ')': // end of pattern or end of grouping
{ while (sp > stack && sp[-1]) {
Nfa * old_root = sp[-3];
Nfa * old_next = sp[-2];
sp -= 3;
Nfa * n = new(mem) Nfa;
old_next->tag = Nfa::Epsilon;
old_next->epsilon[0] = next;
old_next->epsilon[1] = nil;
n->tag = Nfa::Epsilon;
n->epsilon[0] = old_root;
n->epsilon[1] = root;
root = n;
}
if (c == ')') {
if (sp == stack) goto syntax_error;
Nfa * old_next = sp[-2];
Nfa * old_root = sp[-3];
sp -= 3;
old_next->tag = Nfa::Epsilon;
old_next->epsilon[0] = root;
old_next->epsilon[1] = nil;
root = current = old_root;
} else {
if (sp > stack) goto syntax_error;
goto done;
}
} break;
case '^': if (p-1 > regexp) goto build_delta;
anchored = true; break;
case '$': c = '\n'; goto build_delta;
case '*': if (root == next) goto syntax_error;
{ *next_node = *current;
current->tag = Nfa::Epsilon;
current->epsilon[0] = next_node;
current->epsilon[1] = next;
next->tag = Nfa::Epsilon;
next->epsilon[0] = next_node;
next->epsilon[1] = new(mem) Nfa;
next = next->epsilon[1];
} break;
case '+': if (root == next) goto syntax_error;
{ next->tag = Nfa::Epsilon;
next->epsilon[0] = current;
next->epsilon[1] = next_node;
next = next_node;
} break;
case '?': if (root == next) goto syntax_error;
{ *next_node = *current;
current->tag = Nfa::Epsilon;
current->epsilon[0] = next_node;
current->epsilon[1] = next;
} break;
case '.': // wild card
{ Symbol * char_class = *char_classes;
*char_class++ = '\n' | COMPLEMENT;
*char_class++ = END_CHAR_CLASS;
singletons['\n'] = true;
character_classes[char_class_num++] = *char_classes;
*char_classes = char_class;
c = -char_class_num;
goto build_delta;
} break;
case '[': // process a character class
{ Symbol start_range = -1;
const char * start = p;
Bool complement = false;
Symbol last_char;
Symbol * char_class = *char_classes;
for (last_char = -1; (c = (unsigned char)*p++) != ']'; ) {
switch (c) {
case '\0': goto syntax_error;
case '-': if (last_char < 0) goto syntax_error;
start_range = last_char;
break;
case '^': if (p-1 == start) { complement = true; break; }
case '\\': p = parse_char(p-1,ch); c = (unsigned char)ch;
default:
if (foldcase) c = std::toupper(c);
*char_class++ = c;
if (start_range >= 0) {
if (start_range >= c) goto syntax_error;
char_class[-2] |= RANGE_BIT;
start_range = -1;
last_char = -1;
partitions[c+1] = true;
} else {
partitions[c] = true;
last_char = c;
if (*p != '-') singletons[c] = true;
}
break;
}
}
*char_class++ = END_CHAR_CLASS;
if (complement) (*char_classes)[0] |= COMPLEMENT;
character_classes[char_class_num++] = *char_classes;
*char_classes = char_class;
c = -char_class_num;
goto build_delta;
}
case '\\': p = parse_char(p-1,ch); c = ch;
build_delta: default: // process normal characters
{ next->tag = Nfa::Delta;
next->n.state = number_of_nfa_states++;
if (foldcase && c >= 0) c = std::toupper(c);
next->n.c = c;
next->n.out = next_node;
current = next; next = next->n.out;
if (c >= 0) singletons[c] = true;
} break;
}
}
done:
next->tag = Nfa::Accept;
next->n.state = rule;
for (i = 0; i < number_of_contexts; i++) {
if (in_context[i]) {
if (! anchored)
context_nfas[2*i+2] = new(mem,context_nfas[2*i+2],root) Nfa;
context_nfas[2*i+3] = new(mem,context_nfas[2*i+3],root) Nfa;
}
}
if (! in_any_context) {
if (! anchored)
context_nfas[0] = new(mem,context_nfas[0],root) Nfa;
context_nfas[1] = new(mem,context_nfas[1],root) Nfa;
}
return root;
syntax_error:
return nil;
}
////////////////////////////////////////////////////////////////////////////
// Compute the epsilon closure for one state
////////////////////////////////////////////////////////////////////////////
static void compute_epsilon_closure(Nfa * nfa, BitSet * closure)
{ if (nfa == nil) return;
switch (nfa->tag) {
case Nfa::Accept:
case Nfa::Delta: closure->add(nfa->n.state); return;
case Nfa::Epsilon:
compute_epsilon_closure(nfa->epsilon[0],closure);
compute_epsilon_closure(nfa->epsilon[1],closure);
return;
default:
assert("bug: compute_epsilon_closure()");
}
}
////////////////////////////////////////////////////////////////////////////
// Find the accept rule of the state, if any
////////////////////////////////////////////////////////////////////////////
inline Rule accept_thinning(BitSet * set, int n)
{ for (int i = 0; i < n; i++)
if ((*set)[i]) {
for (int j = i+1; j < n; j++) set->remove(j);
return i+1;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
// Compute epsilon closure for each state of the nfa.
////////////////////////////////////////////////////////////////////////////
static BitSet * epsilon_closure
( Nfa * nfa, MemPool& mem, int number_of_nfa_states, Nfa * nfa_states[], int n)
{ BitSet * set;
if (nfa == nil) return nil;
if (nfa->epsilon_closure) return nfa->epsilon_closure;
switch (nfa->tag) {
case Nfa::Accept:
nfa_states[nfa->n.state] = nfa;
set = nfa->epsilon_closure = new(mem,number_of_nfa_states) BitSet;
set->add(nfa->n.state);
return set;
case Nfa::Delta:
nfa_states[nfa->n.state] = nfa;
set = nfa->epsilon_closure = new(mem,number_of_nfa_states) BitSet;
set->add(nfa->n.state);
nfa->n.delta_set = new(mem,number_of_nfa_states) BitSet;
compute_epsilon_closure(nfa->n.out,nfa->n.delta_set);
epsilon_closure(nfa->n.out,mem,number_of_nfa_states,nfa_states,n);
return set;
case Nfa::Epsilon:
set = nfa->epsilon_closure = new(mem,number_of_nfa_states) BitSet;
compute_epsilon_closure(nfa->epsilon[0],set);
compute_epsilon_closure(nfa->epsilon[1],set);
accept_thinning(set, n);
epsilon_closure(nfa->epsilon[0],mem,number_of_nfa_states,nfa_states,n);
epsilon_closure(nfa->epsilon[1],mem,number_of_nfa_states,nfa_states,n);
return set;
default:
assert("bug: epsilon_closure()");
return nil;
}
}
////////////////////////////////////////////////////////////////////////////
// Compute transition from a set of nfa states
////////////////////////////////////////////////////////////////////////////
inline void compute_transitions
(Nfa * nfa, Nfa * nfa_states[], BitSet * transitions[],
BitSet * char_class_map[], int number_of_equiv_classes,
Symbol equiv_classes[])
{ register int s;
register BitSet& set = *nfa->epsilon_closure;
foreach_bit (s, set) {
Nfa * node = nfa_states[s];
if (node->tag == Nfa::Delta) {
Symbol c = node->n.c;
if (c >= 0) {
transitions[equiv_classes[c]]->Union(*node->n.delta_set);
} else {
BitSet& chars = *char_class_map[-c-1];
for (int ch = 0; ch < number_of_equiv_classes; ch++)
if (chars[ch]) transitions[ch]->Union(*node->n.delta_set);
}
}
}
}
////////////////////////////////////////////////////////////////////////////
// The main entry point of the lexical scanner compiler
////////////////////////////////////////////////////////////////////////////
void LexerGen::compile
( int n, const char * const * regexp, const char * const * contexts,
int max_ch, int options
)
{
//
// Here are the tables and maps that we'll need
//
MemPool mem(4096); // Memory pool with page size of 4K
DCHashTable<BitSet *,State> dstates(257); // Map sets of nfa states to dfa states
VarArray<BitSet *> nstates; // Inverse of above
VarArray<Rule> accept_rule; // Accept rule of state, if any
Nfa ** context_nfas; // Sub-nfas of each context
//
// Local variables
//
int i; // loop index
State processed; // current state to be processed
State number_of_dfa_states = 1;
int number_of_nfa_states = n;
int number_of_equiv_classes = 0;
int number_of_character_classes = 0;
int character_class_size = 0;
int number_of_contexts = 0;
//
// Count the number of contexts and allocate space
//
if (contexts) while (contexts[number_of_contexts]) number_of_contexts++;
context_nfas =
(Nfa**)mem.c_alloc(sizeof(Nfa*) * (number_of_contexts + 1) * 2);
//
// Estimate the number of character classes and their combined size
//
for (i = 0; i < n; i++) {
character_class_size += std::strlen(regexp[i]) + 1;
for (register const char * p = regexp[i]; *p; p++)
if (*p == '[' || *p == '.') number_of_character_classes++;
}
//
// Allocate storage for the character classes
//
Bool partitions[257];
Bool singletons[257];
Symbol * char_classes =
(Symbol*)mem[sizeof(Symbol) * character_class_size ];
Symbol ** character_classes =
(Symbol**)mem[sizeof(Symbol*) * number_of_character_classes];
number_of_character_classes = 0;
//
// Set the partition map to all equivalent initially
//
std::memset(partitions,0,sizeof(partitions));
std::memset(singletons,0,sizeof(singletons));
//
//
// Parse the regular expressions and create a non-deterministic
// automaton.
//
Nfa * the_nfa = nil;
for (bad_rule = -1, i = 0; i < n; i++) {
Nfa * sub_nfa =
construct_nfa(regexp[i],i,mem,number_of_nfa_states,
partitions,singletons,
&char_classes,character_classes,
number_of_character_classes,contexts,
number_of_contexts, context_nfas,
options & CaseInsensitive
);
if (sub_nfa == nil) { bad_rule = i; return; }
the_nfa = new(mem,the_nfa,sub_nfa) Nfa;
}
//
// Compute the equivalence class map
//
int partition_number = -1;
max_char = max_ch;
equiv_classes = new Symbol [max_char + 1];
for (i = 0; i <= max_char; i++) {
if ((options & CaseInsensitive) && i >= 'a' && i <= 'z')
{ equiv_classes[i] = equiv_classes[i - 'a' + 'A']; continue; }
if (partitions[i] || partition_number < 0)
partition_number = number_of_equiv_classes++;
if (singletons[i])
{ equiv_classes[i] = number_of_equiv_classes++; continue; }
equiv_classes[i] = partition_number;
}
//
// Compute the characteristic map for each character class
//
BitSet ** char_class_map =
(BitSet**)mem[sizeof(BitSet*) * number_of_character_classes];
for (i = 0; i < number_of_character_classes; i++) {
BitSet * map = char_class_map[i] =
new(mem,number_of_equiv_classes) BitSet;
register Symbol * p;
for (p = character_classes[i]; *p != END_CHAR_CLASS; p++) {
if (*p & RANGE_BIT) {
for (int a = (*p & 0xff), b = (*++p & 0xff); a <= b; a++)
map->add(equiv_classes[a]);
} else map->add(equiv_classes[*p & 0xff]);
}
if (character_classes[i][0] & COMPLEMENT) map->complement();
}
//
// Compute epsilon closure for each state
//
Nfa ** nfa_states =
(Nfa**) mem.c_alloc(sizeof(Nfa*) * number_of_nfa_states);
epsilon_closure(the_nfa, mem, number_of_nfa_states, nfa_states, n);
//
// Start emitting table
//
create_tables(number_of_nfa_states * number_of_equiv_classes,
number_of_nfa_states, 0, number_of_equiv_classes-1);
start();
//
// Some auxiliary tables
//
BitSet * transitions [256]; // Outgoing state indexed by equiv class
State delta [256]; // DFA state number of outgoing state
for (i = number_of_equiv_classes - 1; i >= 0; i--)
transitions[i] = new(mem,number_of_nfa_states) BitSet;
//
// Create an error state (state number 0). This state always jams.
//
BitSet * err = new (mem,number_of_nfa_states) BitSet;
dstates.insert(err,(State)0);
nstates[0] = err;
rule[0] = (options & Backtracking) ? -1 : 0;
//
// Create two start states for each context, one for the context
// and one for the context anchored to the beginning of the line.
//
for (State s = 1; s < number_of_contexts * 2 + 3; s++) {
if (context_nfas[s-1] == nil) continue;
BitSet * set;
set = new(mem,number_of_nfa_states) BitSet;
compute_epsilon_closure(context_nfas[s-1],set);
accept_rule[s] = accept_thinning(set,n);
dstates.insert(set,s);
nstates[s] = set;
}
number_of_dfa_states = number_of_contexts * 2 + 3;
//
// Compute new states
//
for (processed = 1; processed < number_of_dfa_states; processed++) {
BitSet * set = nstates[processed];
Bool is_jammed = true; // no out transitions??
if (set == nil) continue;
int j, s;
for (i = number_of_equiv_classes - 1; i >= 0; i--)
transitions[i]->clear();
foreach_bit (s, *set)
compute_transitions(nfa_states[s],nfa_states,transitions,
char_class_map,number_of_equiv_classes,
equiv_classes);
for (i = number_of_equiv_classes - 1; i >= 0; i--) {
Rule accept = accept_thinning(transitions[i],n);
Ix d = dstates.lookup(transitions[i]);
if (d == nil) {
dstates.insert(transitions[i],number_of_dfa_states);
nstates[number_of_dfa_states] = transitions[i];
accept_rule[number_of_dfa_states] = accept;
delta[i] = number_of_dfa_states++;
transitions[i] = new(mem,number_of_nfa_states) BitSet;
is_jammed = false;
} else {
delta[i] = dstates.value(d);
if (delta[i] != 0) is_jammed = false;
}
}
add_state(processed,delta);
///////////////////////////////////////////////////////////////////
// The rule table actually contains more information than
// just the rule number. It encodes the following information:
// (a) the accept rule number $r$ if the state is an accept state
// (b) whether the state is jammed, i.e. having no out going state
///////////////////////////////////////////////////////////////////
if (is_jammed && (options & Backtracking))
rule[processed] = -accept_rule[processed]-1;
else
rule[processed] = accept_rule[processed];
}
//
// Finish emitting table
//
finish();
}
////////////////////////////////////////////////////////////////////////////
// Emit C++ code
////////////////////////////////////////////////////////////////////////////
std::ostream& LexerGen::gen_code(std::ostream& out, const char name[]) const
{ if (ok()) {
Super::gen_code(out,name);
TablePrinter pr;
pr.print(out, (const char *)equiv_classes,
max_char + 1, sizeof(Symbol),
"static const unsigned char ", name, "equiv_classes", true);
pr.print(out, (const char *)rule,
max_state + 1, sizeof(Rule),
"static const DFATables::Rule ", name, "accept_rule");
}
return out;
}
| 37.978998
| 84
| 0.502914
|
AaronNGray
|
a5d862c6542161b62284ad873485e857d51b4428
| 280
|
cpp
|
C++
|
Kreator/implementation/GUI/ImguiBuild.cpp
|
ashish1009/Kreator
|
68ff5073faef22ade314772a5127dd1cc98060b7
|
[
"Apache-2.0"
] | null | null | null |
Kreator/implementation/GUI/ImguiBuild.cpp
|
ashish1009/Kreator
|
68ff5073faef22ade314772a5127dd1cc98060b7
|
[
"Apache-2.0"
] | null | null | null |
Kreator/implementation/GUI/ImguiBuild.cpp
|
ashish1009/Kreator
|
68ff5073faef22ade314772a5127dd1cc98060b7
|
[
"Apache-2.0"
] | null | null | null |
//
// ImguiBuild.cpp
// Kreator
//
// Created by iKan on 10/04/22.
//
/// Include the Imgui example .cpp files for implementation of Imgui functionality
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
#include <examples/imgui_impl_opengl3.cpp>
#include <examples/imgui_impl_glfw.cpp>
| 20
| 82
| 0.757143
|
ashish1009
|
a5da5baa671dd355d2e84acfa11c54bd792d1e61
| 302
|
cpp
|
C++
|
mod.cpp
|
Soliders-in-Arms-Arma-3-Group/-SIA-Additional-Factions-V2
|
3631a42eb51e7296d8da40b9b9d088c03ba29dca
|
[
"MIT"
] | null | null | null |
mod.cpp
|
Soliders-in-Arms-Arma-3-Group/-SIA-Additional-Factions-V2
|
3631a42eb51e7296d8da40b9b9d088c03ba29dca
|
[
"MIT"
] | 5
|
2022-01-23T01:26:54.000Z
|
2022-03-07T21:54:25.000Z
|
mod.cpp
|
Soliders-in-Arms-Arma-3-Group/-SIA-Additional-Factions-V2
|
3631a42eb51e7296d8da40b9b9d088c03ba29dca
|
[
"MIT"
] | null | null | null |
name = "SIA Additional Factions v2 (DEV)";
author = "Solders in Arms";
picture = "picture.paa";
logoSmall = "LogoSmall.paa";
logo = "Logo.paa";
logoOver = "LogoOver.paa";
action = "https://github.com/Soliders-in-Arms-Arma-3-Group/SIA-Additional-Factions-V2.git";
overview = "Adds additional factions.";
| 37.75
| 91
| 0.718543
|
Soliders-in-Arms-Arma-3-Group
|
777c4dd8526447fc554e07d6a8d0984956084ba7
| 2,878
|
hpp
|
C++
|
csf_workspace/ec/src/device_io/ec_device_io/hi/conf/hisys_conf.hpp
|
Kitty-Kitty/csf_library
|
011e56fb8b687818d20b9998a0cdb72332375534
|
[
"BSD-2-Clause"
] | 2
|
2019-12-17T13:16:48.000Z
|
2019-12-17T13:16:51.000Z
|
csf_workspace/ec/src/device_io/ec_device_io/hi/conf/hisys_conf.hpp
|
Kitty-Kitty/csf_library
|
011e56fb8b687818d20b9998a0cdb72332375534
|
[
"BSD-2-Clause"
] | null | null | null |
csf_workspace/ec/src/device_io/ec_device_io/hi/conf/hisys_conf.hpp
|
Kitty-Kitty/csf_library
|
011e56fb8b687818d20b9998a0cdb72332375534
|
[
"BSD-2-Clause"
] | null | null | null |
/*******************************************************************************
*
*Copyright: armuxinxian@aliyun.com
*
*Author: f
*
*File name: hisys_conf.hpp
*
*Version: 1.0
*
*Date: 03-12月-2019 13:31:48
*
*Description: Class(hisys_conf) 表示海思系统配置信息
*
*Others:
*
*History:
*
*******************************************************************************/
#if !defined(HISYS_CONF_H_INCLUDED_)
#define HISYS_CONF_H_INCLUDED_
#include <iostream>
#include <map>
namespace ec
{
namespace core
{
/**
* 表示海思系统配置信息
* @author f
* @version 1.0
* @created 03-12月-2019 13:31:48
*/
class hisys_conf
{
public:
/**
* 平台的功耗场景类型
* @author f
* @version 1.0
* @updated 05-12月-2019 10:27:05
*/
enum hiprofile_type
{
/**
* 表示未知的功耗场景类型
*/
hiprofile_type_none = 0x00,
/**
* 表示1080p@30的功耗场景类型
*/
hiprofile_type_1080p_30 = 0x01,
/**
* 表示1080p@60的功耗场景类型
*/
hiprofile_type_1080p_60 = 0x02,
/**
* 表示3m@30的功耗场景类型
*/
hiprofile_type_3m_30 = 0x03,
/**
* 表示5m@30的功耗场景类型
*/
hiprofile_type_5m_30 = 0x04
};
public:
hisys_conf();
virtual ~hisys_conf();
/**
* 表示系统内存的对齐方式
*/
inline int get_align_width() {
return m_align_width;
}
/**
* 表示系统内存的对齐方式
*
* @param newVal
*/
inline void set_align_width(int newVal) {
m_align_width = newVal;
}
/**
* 最大内存池数量
*/
inline int get_max_pool_count() {
return m_max_pool_count;
}
/**
* 最大内存池数量
*
* @param newVal
*/
inline void set_max_pool_count(int newVal) {
m_max_pool_count = newVal;
}
/**
* 表示硬件平台的功耗场景类型
*/
inline std::string get_profile() {
return m_profile;
}
/**
* 表示硬件平台的功耗场景类型名称与索引的对应表
*/
inline const std::map<std::string, hiprofile_type>& get_profile_map() {
return m_profile_map;
}
/**
* 表示硬件平台的功耗场景类型
*
* @param newVal
*/
inline void set_profile(std::string newVal) {
m_profile = newVal;
}
/**
* 功能:
* 获取当前对象的功耗场景类型索引
* 返回:
* 索引数值
*/
inline hiprofile_type get_profile_index() {
return get_profile(get_profile());
}
/**
* 功能:
* 根据配置文件名称获取类型索引数值
* 返回:
* 索引数值
*
* @param name 表示功耗场景类型名称
*/
inline hiprofile_type get_profile(std::string name) {
auto tmp_iter = get_profile_map().find(name);
if (tmp_iter != get_profile_map().end()) {
return tmp_iter->second;
}
return hiprofile_type_none;
}
private:
/**
* 表示系统内存的对齐方式
*/
int m_align_width = 16;
/**
* 最大内存池数量
*/
int m_max_pool_count = 128;
/**
* 表示硬件平台的功耗场景类型
*/
std::string m_profile = "";
/**
* 表示硬件平台的功耗场景类型名称与索引的对应表
*/
static const std::map<std::string, hiprofile_type> m_profile_map;
};
}
}
#endif // !defined(HISYS_CONF_H_INCLUDED_)
| 16.078212
| 81
| 0.548297
|
Kitty-Kitty
|
777c52e72ebed23d33736a4dcd95a1cf838aaf70
| 1,655
|
cc
|
C++
|
src/utils/cpputils/cxxutils.cc
|
Apraso/iSulad_test
|
c9bb9b9e2787275f6147c9353f279e49f6a4a086
|
[
"MulanPSL-1.0"
] | 34
|
2020-03-09T11:57:08.000Z
|
2022-03-29T12:18:33.000Z
|
src/utils/cpputils/cxxutils.cc
|
Apraso/iSulad_test
|
c9bb9b9e2787275f6147c9353f279e49f6a4a086
|
[
"MulanPSL-1.0"
] | null | null | null |
src/utils/cpputils/cxxutils.cc
|
Apraso/iSulad_test
|
c9bb9b9e2787275f6147c9353f279e49f6a4a086
|
[
"MulanPSL-1.0"
] | 8
|
2020-03-21T02:36:22.000Z
|
2021-11-13T18:15:43.000Z
|
/******************************************************************************
* Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
* iSulad licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
* Author: wujing
* Create: 2019-05-17
* Description: provide c++ common utils functions
*******************************************************************************/
#include "cxxutils.h"
#include <algorithm>
#include <numeric>
namespace CXXUtils {
std::vector<std::string> Split(const std::string &str, char delimiter)
{
std::vector<std::string> ret_vec;
std::string tmpstr;
std::istringstream istream(str);
while (std::getline(istream, tmpstr, delimiter)) {
ret_vec.push_back(tmpstr);
}
return ret_vec;
}
// Join concatenates the elements of a to create a single string. The separator string
// sep is placed between elements in the resulting string.
std::string StringsJoin(const std::vector<std::string> &vec, const std::string &sep)
{
auto func = [&sep](const std::string & a, const std::string & b) -> std::string {
return a + (a.length() > 0 ? sep : "") + b;
};
return std::accumulate(vec.begin(), vec.end(), std::string(), func);
}
} // namespace CXXUtils
| 38.488372
| 99
| 0.626586
|
Apraso
|
777e920a31b860baa3c65afb6739afcd33ca9ad9
| 15,689
|
cpp
|
C++
|
Source/API/Vulkan/RenderPassVk.cpp
|
KawBuma/Buma3D
|
73b1c7a99c979492f072d4ead89f2d357d5e048a
|
[
"MIT"
] | 5
|
2020-11-25T05:05:13.000Z
|
2022-02-09T09:35:21.000Z
|
Source/API/Vulkan/RenderPassVk.cpp
|
KawBuma/Buma3D
|
73b1c7a99c979492f072d4ead89f2d357d5e048a
|
[
"MIT"
] | 5
|
2020-11-11T09:52:59.000Z
|
2021-12-15T13:27:37.000Z
|
Source/API/Vulkan/RenderPassVk.cpp
|
KawBuma/Buma3D
|
73b1c7a99c979492f072d4ead89f2d357d5e048a
|
[
"MIT"
] | null | null | null |
#include "Buma3DPCH.h"
#include "RenderPassVk.h"
namespace buma3d
{
B3D_APIENTRY RenderPassVk::RenderPassVk()
: ref_count { 1 }
, name {}
, device {}
, desc {}
, vkdevice {}
, inspfn {}
, devpfn {}
, render_pass{}
{
}
B3D_APIENTRY RenderPassVk::~RenderPassVk()
{
Uninit();
}
BMRESULT
B3D_APIENTRY RenderPassVk::Init(DeviceVk* _device, const RENDER_PASS_DESC& _desc)
{
(device = _device)->AddRef();
vkdevice = device->GetVkDevice();
inspfn = &device->GetInstancePFN();
devpfn = &device->GetDevicePFN();
CopyDesc(_desc);
B3D_RET_IF_FAILED(CreateRenderPass());
return BMRESULT_SUCCEED;
}
void
B3D_APIENTRY RenderPassVk::CopyDesc(const RENDER_PASS_DESC& _desc)
{
desc = _desc;
auto Create = [](auto _src, auto _count, auto& _vec, auto& _dst)
{
if (_count != 0)
{
_vec.resize(_count);
util::MemCopyArray(_vec.data(), _src, _count);
_dst = _vec.data();
}
else
{
_dst = nullptr;
}
};
Create(_desc.attachments , _desc.num_attachments , desc_data.attachments , desc.attachments);
Create(_desc.dependencies , _desc.num_dependencies , desc_data.dependencies , desc.dependencies);
Create(_desc.correlated_view_masks, _desc.num_correlated_view_masks, desc_data.correlated_view_masks, desc.correlated_view_masks);
Create(_desc.subpasses , _desc.num_subpasses , desc_data.subpasses , desc.subpasses);
desc_data.subpasses_data.resize(desc.num_subpasses);
for (uint32_t i = 0; i < desc.num_subpasses; i++)
{
auto&& dst_data = desc_data.subpasses_data[i];
auto&& dst_desc = desc_data.subpasses[i];
auto&& _src = _desc.subpasses[i];
Create(_src.input_attachments , _src.num_input_attachments , dst_data.input_attachments , dst_desc.input_attachments);
Create(_src.color_attachments , _src.num_color_attachments , dst_data.color_attachments , dst_desc.color_attachments);
if (_src.resolve_attachments)// 解決アタッチメントが存在すると定義されるのは、nullptrでない場合のみです。
Create(_src.resolve_attachments, _src.num_color_attachments, dst_data.resolve_attachments, dst_desc.resolve_attachments);
if (_src.depth_stencil_attachment)
{
dst_data.depth_stencil_attachment = B3DMakeUniqueArgs(ATTACHMENT_REFERENCE, *_src.depth_stencil_attachment);
dst_desc.depth_stencil_attachment = dst_data.depth_stencil_attachment.get();
}
Create(_src.preserve_attachments, _src.num_preserve_attachment , dst_data.preserve_attachments , dst_desc.preserve_attachments);
if (_src.shading_rate_attachment)
{
dst_data.shading_rate_attachment = B3DMakeUniqueArgs(SHADING_RATE_ATTACHMENT, *_src.shading_rate_attachment);
dst_desc.shading_rate_attachment = dst_data.shading_rate_attachment.get();
if (_src.shading_rate_attachment->shading_rate_attachment)
{
dst_data.shading_rate_attachment_ref = B3DMakeUniqueArgs(ATTACHMENT_REFERENCE, *_src.shading_rate_attachment->shading_rate_attachment);
dst_data.shading_rate_attachment->shading_rate_attachment = dst_data.shading_rate_attachment_ref.get();
}
}
}
}
BMRESULT
B3D_APIENTRY RenderPassVk::PrepareCreateInfo(VkRenderPassCreateInfo2* _ci, DESC_DATA_VK* _ci_data)
{
auto&& ci = *_ci;
auto&& ci_data = *_ci_data;
auto Create = [](auto _count, auto& _vec, auto& _dst_count, auto& _dst, auto _stype_or_preserve)
{
if (_count != 0)
{
if constexpr (std::is_same_v<decltype(_stype_or_preserve), VkStructureType>)
_vec.resize(_count, { _stype_or_preserve });
else
_vec.resize(_count);
_dst = _vec.data();
_dst_count = _count;
}
else
{
_dst_count = 0;
_dst = nullptr;
}
};
// ビューマスクは流用
ci.correlatedViewMaskCount = desc.num_correlated_view_masks;
ci.pCorrelatedViewMasks = desc_data.correlated_view_masks.data();
Create(desc.num_attachments , ci_data.attachments , ci.attachmentCount , ci.pAttachments , VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2);
Create(desc.num_dependencies , ci_data.dependencies , ci.dependencyCount , ci.pDependencies , VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2);
Create(desc.num_subpasses , ci_data.subpasses , ci.subpassCount , ci.pSubpasses , VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2);
ci_data.subpasses_data.resize(desc.num_subpasses);
for (uint32_t i = 0; i < desc.num_subpasses; i++)
{
auto&& dst_data = ci_data.subpasses_data[i];
auto&& dst_desc = ci_data.subpasses[i];
auto&& src = desc.subpasses[i];
Create(src.num_input_attachments , dst_data.input_attachments , dst_desc.inputAttachmentCount , dst_desc.pInputAttachments , VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2);
Create(src.num_color_attachments , dst_data.color_attachments , dst_desc.colorAttachmentCount , dst_desc.pColorAttachments , VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2);
if (src.resolve_attachments)// 解決アタッチメントが存在すると定義されるのは、nullptrでない場合のみです。
Create(src.num_color_attachments , dst_data.resolve_attachments , dst_desc.colorAttachmentCount , dst_desc.pColorAttachments , VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2);
Create(src.num_preserve_attachment , dst_data.preserve_attachments , dst_desc.preserveAttachmentCount , dst_desc.pPreserveAttachments , 0/*uint32_t*/);
if (src.depth_stencil_attachment)
{
dst_data.depth_stencil_attachment = B3DMakeUniqueArgs(VkAttachmentReference2, VkAttachmentReference2{ VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 });
dst_desc.pDepthStencilAttachment = dst_data.depth_stencil_attachment.get();
}
if (src.shading_rate_attachment)
{
auto&& sravk = *(dst_data.shading_rate_attachment = B3DMakeUniqueArgs(VkFragmentShadingRateAttachmentInfoKHR, { VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR }));
util::ConnectPNextChains(dst_desc, sravk);
if (src.shading_rate_attachment->shading_rate_attachment)
{
dst_data.shading_rate_attachment_ref = B3DMakeUniqueArgs(VkAttachmentReference2, { VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 });
sravk.pFragmentShadingRateAttachment = dst_data.shading_rate_attachment_ref.get();
}
}
}
// VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM
ci.flags = 0;
// ATTACHMENT_DESC => VkAttachmentDescription2
for (uint32_t i = 0; i < ci.attachmentCount; i++)
{
auto&& at = desc_data.attachments[i];
auto&& atvk = ci_data.attachments[i];
atvk.flags = util::GetNativeAttachmentFlags (at.flags);
atvk.format = util::GetNativeFormat (at.format);
atvk.samples = util::GetNativeSampleCount (at.sample_count);
atvk.loadOp = util::GetNativeLoadOp (at.load_op);
atvk.storeOp = util::GetNativeStoreOp (at.store_op);
atvk.stencilLoadOp = util::GetNativeLoadOp (at.stencil_load_op);
atvk.stencilStoreOp = util::GetNativeStoreOp (at.stencil_store_op);
if (util::IsDepthStencilFormat(at.format))
{
// 深度、またはステンシルプレーンどちらかのみをアタッチメントとして扱った場合に必要です(各プレーンのレイアウトをそれぞれ決める必要があるため)。
if (at.stencil_begin_state != RESOURCE_STATE_UNDEFINED)
{
atvk.initialLayout = util::GetNativeResourceStateForLayout(at.begin_state, TEXTURE_ASPECT_FLAG_DEPTH);
atvk.finalLayout = util::GetNativeResourceStateForLayout(at.end_state , TEXTURE_ASPECT_FLAG_DEPTH);
auto&& atsvk = *ci_data.attachments_stencil_layout.emplace_back(B3DMakeUniqueArgs(VkAttachmentDescriptionStencilLayout, { VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT }));
atsvk.stencilInitialLayout = util::GetNativeResourceStateForLayout(at.stencil_begin_state, TEXTURE_ASPECT_FLAG_STENCIL);
atsvk.stencilFinalLayout = util::GetNativeResourceStateForLayout(at.stencil_end_state , TEXTURE_ASPECT_FLAG_STENCIL);
util::ConnectPNextChains(atvk, atsvk);
}
else
{
atvk.initialLayout = util::GetNativeResourceStateForLayout(at.begin_state, TEXTURE_ASPECT_FLAG_DEPTH | TEXTURE_ASPECT_FLAG_STENCIL);
atvk.finalLayout = util::GetNativeResourceStateForLayout(at.end_state , TEXTURE_ASPECT_FLAG_DEPTH | TEXTURE_ASPECT_FLAG_STENCIL);
}
}
else
{
atvk.initialLayout = util::GetNativeResourceStateForLayout(at.begin_state);
atvk.finalLayout = util::GetNativeResourceStateForLayout(at.end_state);
}
}
// SUBPASS_DESC => VkSubpassDescription2
for (uint32_t i = 0; i < ci.subpassCount; i++)
{
auto&& sp = desc_data.subpasses_data[i];
auto&& spvk = ci_data.subpasses_data[i];
uint32_t count;
auto SetReferenceStencilLayout = [&](const ATTACHMENT_REFERENCE& _ar, VkAttachmentReference2& _arvk)
{
auto&& arsvk = *spvk.stencil_layout.emplace_back(B3DMakeUniqueArgs(VkAttachmentReferenceStencilLayout, { VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT }));
arsvk.stencilLayout = util::GetNativeResourceStateForLayout(_ar.stencil_state_at_pass, TEXTURE_ASPECT_FLAG_STENCIL);
util::ConnectPNextChains(_arvk, arsvk);
};
auto SetReference = [&](const ATTACHMENT_REFERENCE& _ar, VkAttachmentReference2& _arvk)
{
_arvk.aspectMask = util::GetNativeAspectFlags(_ar.input_attachment_aspect_mask);
_arvk.attachment = _ar.attachment_index;
_arvk.layout = util::GetNativeResourceStateForLayout(_ar.state_at_pass);
};
auto SetReferences = [&](const ATTACHMENT_REFERENCE& _ar, VkAttachmentReference2& _arvk)
{
SetReference(_ar, _arvk);
if (util::IsDepthStencilFormat(desc_data.attachments[i].format))
{
if (_ar.stencil_state_at_pass != RESOURCE_STATE_UNDEFINED)
{
_arvk.layout = util::GetNativeResourceStateForLayout(_ar.state_at_pass, TEXTURE_ASPECT_FLAG_DEPTH);
SetReferenceStencilLayout(_ar, _arvk);
}
}
};
count = 0;
for (auto& ia : sp.input_attachments)
{
auto&& iavk = spvk.input_attachments[count++];
SetReferences(ia, iavk);
}
count = 0;
for (auto& ca : sp.color_attachments)
{
auto&& cavk = spvk.color_attachments[count++];
SetReferences(ca, cavk);
}
count = 0;
for (auto& ra : sp.resolve_attachments)
{
auto&& ravk = spvk.resolve_attachments[count++];
SetReferences(ra, ravk);
}
if (sp.depth_stencil_attachment)
{
auto&& dsa = *sp.depth_stencil_attachment;
auto&& dsavk = *spvk.depth_stencil_attachment;
SetReferences(dsa, dsavk);
}
count = 0;
for (auto& pa : sp.preserve_attachments)
{
auto&& pavk = spvk.preserve_attachments[count++];
pavk = pa;
}
if (sp.shading_rate_attachment)
{
auto&& sra = *sp.shading_rate_attachment;
auto&& sravk = *spvk.shading_rate_attachment;
sravk.shadingRateAttachmentTexelSize.width = sra.shading_rate_attachment_texel_size.width;
sravk.shadingRateAttachmentTexelSize.height = sra.shading_rate_attachment_texel_size.height;
if (sra.shading_rate_attachment)
{
SetReferences(*sra.shading_rate_attachment, *spvk.shading_rate_attachment_ref);
}
}
}
// SUBPASS_DEPENDENCY => VkSubpassDependency2
for (uint32_t i = 0; i < ci.dependencyCount; i++)
{
auto&& dp = desc_data.dependencies[i];
auto&& dpvk = ci_data.dependencies[i];
dpvk.srcSubpass = dp.src_subpass;
dpvk.dstSubpass = dp.dst_subpass;
dpvk.srcStageMask = util::GetNativePipelineStageFlags(dp.src_stage_mask);
dpvk.dstStageMask = util::GetNativePipelineStageFlags(dp.dst_stage_mask);
dpvk.srcAccessMask = util::GetNativeResourceAccessFlags(dp.src_access);
dpvk.dstAccessMask = util::GetNativeResourceAccessFlags(dp.dst_access);
dpvk.dependencyFlags = dp.dependency_flags;
dpvk.viewOffset = dp.view_offset;
// TODO: D3D12と違い、ViewportArrayIndexが指定出来ないが、shaderOutputLayer機能が有効な場合、頂点バッファからSV_ViewportArrayIndexと同等の値を指定出来るので互換性があるか検証。(SV_ViewportArrayIndexの仕様上、そもそもDXC側で対応してくれない気はする。)
}
return BMRESULT_SUCCEED;
}
BMRESULT
B3D_APIENTRY RenderPassVk::CreateRenderPass()
{
VkRenderPassCreateInfo2 ci { VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 };
DESC_DATA_VK ci_data{};
B3D_RET_IF_FAILED(PrepareCreateInfo(&ci, &ci_data));
auto vkr = vkCreateRenderPass2(vkdevice, &ci, B3D_VK_ALLOC_CALLBACKS, &render_pass);
B3D_RET_IF_FAILED(VKR_TRACE_IF_FAILED(vkr));
return BMRESULT_SUCCEED;
}
void
B3D_APIENTRY RenderPassVk::Uninit()
{
name.reset();
desc = {};
if (render_pass)
vkDestroyRenderPass(vkdevice, render_pass, B3D_VK_ALLOC_CALLBACKS);
render_pass = VK_NULL_HANDLE;
hlp::SafeRelease(device);
}
BMRESULT
B3D_APIENTRY RenderPassVk::Create(DeviceVk* _device, const RENDER_PASS_DESC& _desc, RenderPassVk** _dst)
{
util::Ptr<RenderPassVk> ptr;
ptr.Attach(B3DCreateImplementationClass(RenderPassVk));
B3D_RET_IF_FAILED(ptr->Init(_device, _desc));
*_dst = ptr.Detach();
return BMRESULT_SUCCEED;
}
void
B3D_APIENTRY RenderPassVk::AddRef()
{
++ref_count;
B3D_REFCOUNT_DEBUG(ref_count);
}
uint32_t
B3D_APIENTRY RenderPassVk::Release()
{
B3D_REFCOUNT_DEBUG(ref_count - 1);
auto count = --ref_count;
if (count == 0)
B3DDestroyImplementationClass(this);
return count;
}
uint32_t
B3D_APIENTRY RenderPassVk::GetRefCount() const
{
return ref_count;
}
const char*
B3D_APIENTRY RenderPassVk::GetName() const
{
return name ? name->c_str() : nullptr;
}
BMRESULT
B3D_APIENTRY RenderPassVk::SetName(const char* _name)
{
if (!util::IsEnabledDebug(this))
return BMRESULT_FAILED;
if (render_pass)
B3D_RET_IF_FAILED(device->SetVkObjectName(render_pass, _name));
if (name && !_name)
name.reset();
else
name = B3DMakeUniqueArgs(util::NameableObjStr, _name);
return BMRESULT_SUCCEED;
}
IDevice*
B3D_APIENTRY RenderPassVk::GetDevice() const
{
return device;
}
const VkAllocationCallbacks*
B3D_APIENTRY RenderPassVk::GetVkAllocationCallbacks() const
{
return device->GetVkAllocationCallbacks();
}
const InstancePFN&
B3D_APIENTRY RenderPassVk::GetIsntancePFN() const
{
return *inspfn;
}
const DevicePFN&
B3D_APIENTRY RenderPassVk::GetDevicePFN() const
{
return *devpfn;
}
const RENDER_PASS_DESC&
B3D_APIENTRY RenderPassVk::GetDesc() const
{
return desc;
}
VkRenderPass
B3D_APIENTRY RenderPassVk::GetVkRenderPass() const
{
return render_pass;
}
}// namespace buma3d
| 36.401392
| 198
| 0.668494
|
KawBuma
|
7780a2bb3fadcf96cff5553681afeb03cd2d908c
| 4,260
|
hpp
|
C++
|
include/doll/Core/Defs.hpp
|
axia-sw/Doll
|
a5846a6553d9809e9a0ea50db2dc18b95eb21921
|
[
"Zlib"
] | 1
|
2021-07-19T14:40:15.000Z
|
2021-07-19T14:40:15.000Z
|
include/doll/Core/Defs.hpp
|
axia-sw/Doll
|
a5846a6553d9809e9a0ea50db2dc18b95eb21921
|
[
"Zlib"
] | null | null | null |
include/doll/Core/Defs.hpp
|
axia-sw/Doll
|
a5846a6553d9809e9a0ea50db2dc18b95eb21921
|
[
"Zlib"
] | null | null | null |
#pragma once
#include "../AxlibConfig.h"
#include "ax_intdatetime.h"
#include "ax_platform.h"
#include "ax_types.h"
#include "ax_printf.h"
#include "ax_string.h"
#include "ax_logger.h"
#include "ax_assert.h"
#include "ax_thread.h"
#include "ax_memory.h"
#include "ax_time.h"
#include "ax_thread.h"
//#include "ax_fiber.h"
#include "ax_config.h"
#include "ax_typetraits.hpp"
#include "ax_manager.hpp"
#include "ax_list.hpp"
#include "ax_array.hpp"
#include "ax_dictionary.hpp"
#ifdef DOLL__BUILD
# include "Private/Variants.hpp"
# ifndef DOLL__SECURE_LIB
# if defined( _MSC_VER ) && defined( __STDC_WANT_SECURE_LIB__ )
# define DOLL__SECURE_LIB __STDC_WANT_SECURE_LIB__
# else
# define DOLL__SECURE_LIB 0
# endif
# endif
// When building we use a different internal logging channel
# ifndef DOLL_TRACE_FACILITY
# define DOLL_TRACE_FACILITY doll::kLog_Internal
# endif
#endif
// Temporary hack
#ifndef DOLL__USE_GLFW
# ifdef _WIN32
# define DOLL__USE_GLFW 0
# else
# define DOLL__USE_GLFW 1
# endif
#endif
#define DOLL_RGBA(R_,G_,B_,A_)\
(\
( U32((A_)&0xFF)<<24 ) |\
( U32((B_)&0xFF)<<16 ) |\
( U32((G_)&0xFF)<< 8 ) |\
( U32((R_)&0xFF)<< 0 )\
)
#define DOLL_RGB(R_,G_,B_)\
DOLL_RGBA((R_),(G_),(B_),0xFF)
#define DOLL_COLOR_R(RGBA_)\
( ( U32(RGBA_)&0x000000FF )>>0 )
#define DOLL_COLOR_G(RGBA_)\
( ( U32(RGBA_)&0x0000FF00 )>>8 )
#define DOLL_COLOR_B(RGBA_)\
( ( U32(RGBA_)&0x00FF0000 )>>16 )
#define DOLL_COLOR_A(RGBA_)\
( ( U32(RGBA_)&0xFF000000 )>>24 )
#ifndef DOLL_DX_AVAILABLE
# if defined( _WIN32 ) || defined( _XBOX )
# define DOLL_DX_AVAILABLE 1
# else
# define DOLL_DX_AVAILABLE 0
# endif
#endif
namespace doll
{
using namespace ax;
enum EResult
{
kSuccess = 1,
kError_OutOfMemory = -4096,
kError_InvalidParameter,
kError_InvalidOperation,
kError_Overflow,
kError_Underflow
};
DOLL_FUNC Bool DOLL_API app_getPath( Str &dst );
inline Str DOLL_API app_getPath()
{
Str r;
return app_getPath( r ), r;
}
inline Str DOLL_API app_getDir()
{
return app_getPath().getDirectory();
}
inline Str DOLL_API app_getName()
{
const Str x = app_getPath().getBasename();
if( x.caseEndsWith( "dbg" ) ) {
return x.drop( 3 );
}
return x;
}
AX_CONSTEXPR_INLINE U32 doll_rgb( F32 r, F32 g, F32 b, F32 a = 1.0f )
{
return
DOLL_RGBA
(
U32((r < 0.0f ? 0.0f : r > 1.0f ? 1.0f : r)*255.0f),
U32((g < 0.0f ? 0.0f : g > 1.0f ? 1.0f : g)*255.0f),
U32((b < 0.0f ? 0.0f : b > 1.0f ? 1.0f : b)*255.0f),
U32((a < 0.0f ? 0.0f : a > 1.0f ? 1.0f : a)*255.0f)
);
}
template< typename T, UPtr tNum >
inline Bool isOneOf( const T x, const T( &buf )[ tNum ] )
{
for( const T &y : buf ) {
if( x == y ) {
return true;
}
}
return false;
}
template< typename T, typename... Args >
inline Bool isOneOf( const T &x, Args... args ) {
const T buf[] = { args... };
for( const T &y : buf ) {
if( x == y ) {
return true;
}
}
return false;
}
template< typename T >
inline U16 countBits( T x )
{
U16 n = 0;
while( x ) {
++n;
x &= x - 1;
}
return n;
}
inline Bool takeFlag( U32 &uFlags, U32 uCheck )
{
if( ~uFlags & uCheck ) {
return false;
}
uFlags &= ~uCheck;
return true;
}
template< class Functor >
class TScopeGuard
{
public:
inline TScopeGuard( const Functor &func )
: mFunc( func )
, mState( EState::Valid )
{
}
inline TScopeGuard( TScopeGuard< Functor > &&r )
: mFunc( r.mFunc )
, mState( r.mState )
{
r.commit();
}
inline ~TScopeGuard()
{
call();
}
inline void commit()
{
mState = EState::Committed;
}
inline void call()
{
if( mState != EState::Valid ) {
return;
}
mFunc();
commit();
}
inline void operator()()
{
call();
}
private:
enum class EState
{
Valid,
Committed
};
const Functor mFunc;
EState mState;
};
template< class Functor >
inline TScopeGuard< Functor > makeScopeGuard( const Functor &func )
{
return forward< TScopeGuard< Functor > >( func );
}
}
| 18.283262
| 71
| 0.594131
|
axia-sw
|
7781058b8b8d65e96ddce388b2d90d175d7d9928
| 2,858
|
hpp
|
C++
|
include/core/p_render/PRender.hpp
|
jabronicus/P-Engine
|
7786c2f97d19bd2913b706f6afe5087a392b1a3c
|
[
"MIT"
] | null | null | null |
include/core/p_render/PRender.hpp
|
jabronicus/P-Engine
|
7786c2f97d19bd2913b706f6afe5087a392b1a3c
|
[
"MIT"
] | null | null | null |
include/core/p_render/PRender.hpp
|
jabronicus/P-Engine
|
7786c2f97d19bd2913b706f6afe5087a392b1a3c
|
[
"MIT"
] | 1
|
2021-08-24T05:43:01.000Z
|
2021-08-24T05:43:01.000Z
|
#pragma once
#include "./backend/wsi/WindowSystem.hpp"
#include "../../core/thread_pool/job_queue/JobQueue.hpp"
// gui
#include "./backend/gui/VulkanGUIHandler.hpp"
// render graph
#include "./render_graph/RenderGraph.hpp"
// scene (TODO)
#include "./scene/Scene.hpp"
#include "../../imgui/imgui.h"
#include "../../imgui/imgui_impl_vulkan.h"
#include "../../imgui/imgui_impl_win32.h"
#include "../../core/p_render/backend/Context.hpp"
// VMA
#include "../../vulkan_memory_allocator/vk_mem_alloc.h"
// GLM
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include "../../glm/glm.hpp"
#include "../../glm/gtc/quaternion.hpp"
#include "../../glm/gtc/matrix_transform.hpp"
#include "../../glm/vec3.hpp"
// VULKAN LIMITS
// should probably move these elsewhere
// just gonna use the limits that Themaister's Granite uses, since i don't know how to judge
// what reasonable limits are, and i also like the idea of keeping things compact
#define VULKAN_NUM_DESCRIPTOR_SETS 4
#define VULKAN_NUM_ATTACHMENTS 8
#define VULKAN_NUM_BINDINGS 32
#define VULKAN_NUM_VERTEX_ATTRIBUTES 16
#define VULKAN_NUM_VERTEX_BUFFERS 4
#define VULKAN_PUSH_CONSTANT_SIZE 128
#define VULKAN_MAX_UBO_SIZE 16 * 1024
#pragma region PRENDER_DEFINITION
class PEngine;
class VulkanGUIHandler;
namespace backend {
class Context;
class FrameContext;
}
namespace scene {
class Scene;
}
class PRender {
public:
PRender(PEngine *engineCore);
~PRender();
/* RENDER INTERFACE */
std::shared_ptr<backend::Context> &renderContext();
// render graph interface
std::shared_ptr<RenderGraph> registerRenderGraph(const std::string &name);
std::shared_ptr<RenderGraph> getRenderGraph(const std::string &name);
VmaAllocator &getVMAllocator() {
return allocator_;
}
// gui interface
void registerGUIComponent(std::function<void()> call);
void clearGUIComponents();
/* RENDER INTERFACE */
void renderFrame(const std::string &renderGraphName = "default");
private:
/* render state */
PEngine *core_ = nullptr;
VmaAllocator allocator_;
/* RENDER STATE */
// SCENES (TODO)
// GRAPHS
std::vector<std::shared_ptr<RenderGraph>> renderGraphs_;
std::unordered_map<std::string, unsigned int> renderGraphNames_;
// maintain a simple vector of FrameContexts, which should manage all the data for rendering one frame in one particular swapchain image
std::vector<std::shared_ptr<backend::FrameContext>> frameContexts_;
unsigned int activeFrameContext_;
// gui handler
std::shared_ptr<VulkanGUIHandler> gui_;
/* BACKEND */
std::shared_ptr<backend::Context> context_;
void setupImGui();
void setupIMGUIResources();
void submitCommandBuffers(backend::FrameContext &frameContext);
};
#pragma endregion PRENDER_DEFINITION
| 25.070175
| 140
| 0.719384
|
jabronicus
|
77865066b102246f82e4fae912b640f51938294d
| 5,145
|
cpp
|
C++
|
src/PihaTime.cpp
|
jbitoniau/Piha
|
9f346066bf09a93abc5753b5dd996c7f598c9d38
|
[
"MIT"
] | null | null | null |
src/PihaTime.cpp
|
jbitoniau/Piha
|
9f346066bf09a93abc5753b5dd996c7f598c9d38
|
[
"MIT"
] | null | null | null |
src/PihaTime.cpp
|
jbitoniau/Piha
|
9f346066bf09a93abc5753b5dd996c7f598c9d38
|
[
"MIT"
] | null | null | null |
#include "PihaTime.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <cstddef> // For NULL
//#include <sys/time.h>
#include <time.h>
#endif
#include <assert.h>
namespace Piha
{
#ifdef _WIN32
/*
TimeInternals (Windows platform)
On Windows, there are many time functions available.
- the standard ftime function (sys/timeb.h). Millisecond resolution but 15ms accuracy
- GetSystemTimeAsFileTime(). Millisecond resolution but 15ms accuracy
- GetTickCount(). Millisecond resolution but up to 50 ms accuracy (to double check)
The only high resolution/accuracy one I found is the Performance counter but it seems not
very reliable on multi-core machines see http:www.virtualdub.org/blog/pivot/entry.php?id=106
Anyway, I'm using it for now. I think this can be improved:
http:msdn.microsoft.com/en-us/magazine/cc163996.aspx
*/
class TimeInternals
{
public:
TimeInternals();
unsigned long long int getTickFrequency() const { return mTickFrequency; }
unsigned long long int getTickCount() const;
unsigned int getTimeAsMilliseconds() const;
static TimeInternals& getInstance() { return mTimeInternals; }
private:
static unsigned long long int internalGetTickFrequency();
static unsigned long long int internalGetTickCount();
unsigned long long int mTickFrequency;
unsigned long long int mInitialTickCount;
static TimeInternals mTimeInternals;
};
/*
TimeInternals (Windows platform)
*/
TimeInternals TimeInternals::mTimeInternals;
TimeInternals::TimeInternals()
{
mTickFrequency = internalGetTickFrequency(); // Cache the tick frequency as it doesn't change during the application lifetime
mInitialTickCount = internalGetTickCount();
}
unsigned long long int TimeInternals::getTickCount() const
{
unsigned long long int tickCount = internalGetTickCount();
tickCount -= mInitialTickCount;
return tickCount;
}
unsigned int TimeInternals::getTimeAsMilliseconds() const
{
unsigned int time = static_cast<unsigned int>( (getTickCount()*1000) / getTickFrequency() );
return time;
}
unsigned long long int TimeInternals::internalGetTickFrequency()
{
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
return frequency.QuadPart;
}
unsigned long long int TimeInternals::internalGetTickCount()
{
LARGE_INTEGER counter;
QueryPerformanceCounter(&counter);
return counter.QuadPart;
}
#else
/*
TimeInternals (non-Windows platform)
This implementation relies on the monotonic version of clock_gettime() function.
Changing the system date/time won't affect this time.
See http://code-factor.blogspot.fr/2009/11/monotonic-timers.html
*/
class TimeInternals
{
public:
TimeInternals();
unsigned int getTimeAsMilliseconds() const;
static TimeInternals& getInstance() { return mTimeInternals; }
private:
struct timespec mInitialTime;
static TimeInternals mTimeInternals;
};
/*
TimeInternals (non-Windows platform)
*/
TimeInternals TimeInternals::mTimeInternals;
TimeInternals::TimeInternals()
{
int ret = clock_gettime( CLOCK_MONOTONIC, &mInitialTime );
assert( ret==0 );
}
unsigned int TimeInternals::getTimeAsMilliseconds() const
{
struct timespec theTime;
int ret = clock_gettime( CLOCK_MONOTONIC, &theTime );
assert( ret==0 );
time_t numSeconds = theTime.tv_sec;
long numNanoSeconds = theTime.tv_nsec; // 1ns = 10^-9 seconds
unsigned int milliseconds = static_cast<unsigned int>(numSeconds - mInitialTime.tv_sec) * 1000 +
static_cast<unsigned int>(numNanoSeconds / 1000000) -
static_cast<unsigned int>(mInitialTime.tv_nsec / 1000000);
return milliseconds;
}
/*
TimeInternals (non-Windows platform)
This is obsolete!
Here we use the gettimeofday function (http://man7.org/linux/man-pages/man2/gettimeofday.2.html)
This can lead to dramatic results if the system time is changed behind the application's back!
See
http://tldp.org/HOWTO/Clock-2.html
http://linuxcommand.org/man_pages/adjtimex8.html
http://stackoverflow.com/questions/588307/c-obtaining-milliseconds-time-on-linux-clock-doesnt-seem-to-work-properl
http://linux.die.net/man/3/clock_gettime
*/
/*
class TimeInternals
{
public:
TimeInternals();
unsigned int getTimeAsMilliseconds() const;
static TimeInternals& getInstance() { return mTimeInternals; }
private:
timeval mInitialTime;
static TimeInternals mTimeInternals;
};
*/
/*
TimeInternals (non-Windows platform)
*/
/*
TimeInternals TimeInternals::mTimeInternals;
TimeInternals::TimeInternals()
{
gettimeofday( &mInitialTime, NULL );
}
unsigned int TimeInternals::getTimeAsMilliseconds() const
{
struct timeval theTime;
gettimeofday(&theTime, NULL);
time_t numSeconds = theTime.tv_sec;
suseconds_t numMicroSeconds = theTime.tv_usec;
unsigned int milliseconds = static_cast<unsigned int>(numSeconds - mInitialTime.tv_sec) * 1000 +
static_cast<unsigned int>(numMicroSeconds) / 1000 -
static_cast<unsigned int>(mInitialTime.tv_usec) / 1000;
return milliseconds;
}
*/
#endif
/*
Time
*/
unsigned int Time::getTimeAsMilliseconds()
{
unsigned int milliseconds = TimeInternals::getInstance().getTimeAsMilliseconds();
return milliseconds;
}
}
| 25.097561
| 126
| 0.762488
|
jbitoniau
|
778ac59364ca39996a94bab0a60e012c55311fb2
| 3,865
|
cc
|
C++
|
build/x86/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py.cc
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
build/x86/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py.cc
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
build/x86/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py.cc
|
billionshang/gem5
|
18cc4294f32315595f865d07d1f33434e92b06b2
|
[
"BSD-3-Clause"
] | null | null | null |
#include "sim/init.hh"
namespace {
const uint8_t data_m5_objects_GarnetLink_d[] = {
120,156,205,86,89,111,211,64,16,30,59,247,1,173,80,27,
110,225,7,30,44,164,96,14,21,132,4,8,81,33,132,132,
0,185,8,137,188,88,142,119,147,56,241,17,121,183,77,242,
192,83,249,13,252,93,152,25,219,105,10,5,193,83,201,49,
153,253,118,215,187,243,205,183,179,9,160,120,85,240,251,194,
2,80,223,208,17,248,49,32,2,248,88,120,70,238,153,16,
153,16,155,48,48,193,160,118,5,162,10,196,85,24,84,33,
174,193,160,134,104,21,164,9,35,3,68,13,190,2,28,3,
124,30,212,65,212,65,214,25,109,172,209,6,136,38,200,42,
163,173,53,218,4,209,6,89,99,180,179,70,91,32,186,112,
96,95,192,173,133,223,241,101,27,232,105,50,119,114,151,122,
246,163,52,152,73,241,126,56,149,129,182,77,130,187,104,94,
250,42,12,222,36,250,109,152,204,78,128,87,203,28,160,137,
239,164,94,164,217,140,218,158,8,54,9,121,73,132,124,65,
71,2,12,12,162,5,35,71,62,6,21,218,249,180,70,81,
77,27,196,203,49,146,210,96,176,201,96,139,200,33,176,189,
49,178,3,72,15,129,157,13,176,75,84,17,120,97,3,188,
72,148,17,184,5,238,129,221,192,29,184,85,52,234,49,154,
88,198,78,118,56,92,57,73,190,111,103,236,103,232,58,163,
112,41,69,127,30,206,101,20,38,210,57,21,213,221,201,68,
209,83,176,103,102,133,66,117,75,63,242,181,76,130,149,186,
141,192,81,152,233,67,63,178,130,137,159,36,50,82,214,92,
102,86,9,22,139,169,107,56,48,57,140,135,216,149,142,126,
233,229,238,98,190,181,8,133,158,88,207,158,89,195,133,53,
242,3,157,102,246,54,101,165,137,198,243,18,63,150,158,167,
219,220,136,83,113,24,81,147,162,212,171,185,100,60,88,46,
189,137,244,133,204,116,13,155,31,252,204,143,53,229,5,211,
169,235,57,34,209,45,35,243,112,65,130,247,87,65,36,85,
14,231,241,233,50,96,111,19,56,10,148,135,49,122,71,184,
125,125,18,152,151,142,188,34,48,175,12,76,183,10,130,8,
81,154,226,24,250,137,224,16,189,60,56,214,82,17,187,199,
29,54,233,232,196,168,41,26,39,78,180,51,25,143,148,115,
48,193,221,31,76,100,226,140,101,188,215,79,179,112,28,38,
125,165,253,97,36,251,15,238,221,223,235,63,233,63,116,84,
22,56,127,153,241,215,140,22,9,159,175,88,49,148,87,181,
131,166,110,208,123,23,223,93,163,85,124,153,132,253,76,138,
80,255,36,126,163,20,255,206,153,226,71,77,210,249,114,119,
233,233,143,254,94,147,155,107,161,36,109,218,161,75,169,117,
41,109,46,235,188,121,138,179,115,33,142,194,186,71,235,86,
11,226,244,22,58,249,168,162,146,156,85,40,190,158,201,213,
24,168,60,174,143,54,214,179,99,3,140,95,218,13,152,214,
105,84,81,75,154,60,175,5,178,197,227,218,235,113,63,183,
113,94,155,70,21,229,166,67,185,97,90,123,255,152,155,83,
36,96,185,32,53,143,210,108,225,103,194,162,147,163,212,117,
22,125,48,99,104,20,165,139,126,144,38,58,75,163,188,223,
238,254,38,155,124,100,147,72,241,217,244,231,115,153,8,214,
166,238,160,249,36,233,236,228,71,155,150,44,54,233,241,35,
121,102,16,41,206,8,171,53,96,5,229,189,231,172,18,34,
120,239,212,241,170,212,205,109,115,219,184,100,230,191,27,170,
41,174,155,255,95,53,55,255,27,213,184,151,201,92,41,175,
62,247,42,25,42,210,238,245,178,244,184,55,206,191,86,16,
97,111,254,164,130,119,54,93,101,124,127,196,123,119,231,36,
116,197,87,32,181,178,116,185,114,141,178,159,255,153,208,163,
93,174,174,149,117,236,187,229,129,230,229,206,55,98,222,251,
211,252,194,126,126,139,214,191,136,166,109,180,141,109,163,103,
246,186,189,90,111,231,7,183,171,114,78,
};
EmbeddedPython embedded_m5_objects_GarnetLink_d(
"m5/objects/GarnetLink_d.py",
"/mnt/hgfs/ShareShen/gem5-origin-stable-2015-9-3/src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py",
"m5.objects.GarnetLink_d",
data_m5_objects_GarnetLink_d,
891,
2646);
} // anonymous namespace
| 52.945205
| 113
| 0.670634
|
billionshang
|
778af2c718d92503d298664a4dc92c936eed001b
| 7,306
|
cpp
|
C++
|
tests/AnimationManagerTests.cpp
|
longhorndude08/dhorn
|
d5a4c26ad1ee5f461fffe6db625d652cd94472cd
|
[
"MIT"
] | null | null | null |
tests/AnimationManagerTests.cpp
|
longhorndude08/dhorn
|
d5a4c26ad1ee5f461fffe6db625d652cd94472cd
|
[
"MIT"
] | null | null | null |
tests/AnimationManagerTests.cpp
|
longhorndude08/dhorn
|
d5a4c26ad1ee5f461fffe6db625d652cd94472cd
|
[
"MIT"
] | 1
|
2019-06-22T02:39:23.000Z
|
2019-06-22T02:39:23.000Z
|
/*
* Duncan Horn
*
* UnitsTests.cpp
*
* Tests for the animation_manager.h types/functions
*/
#include "stdafx.h"
#include <dhorn/experimental/animation_manager.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace dhorn
{
namespace tests
{
TEST_CLASS(AnimationManagerTests)
{
// Test animation instance
class test_animation :
public dhorn::experimental::animation
{
public:
test_animation() :
_nextState(dhorn::experimental::animation_state::running)
{
}
virtual ~test_animation()
{
if (this->_onDestroy)
{
this->_onDestroy();
}
}
// animation
virtual dhorn::experimental::animation_state on_update(duration /*delta*/) override
{
if (this->_onUpdate)
{
this->_onUpdate();
}
return this->_nextState;
}
// Test functions
void set_next_state(dhorn::experimental::animation_state state)
{
this->_nextState = state;
}
void on_destroy(std::function<void(void)> fn)
{
this->_onDestroy = std::move(fn);
}
void on_update(std::function<void(void)> fn)
{
this->_onUpdate = std::move(fn);
}
private:
dhorn::experimental::animation_state _nextState;
std::function<void(void)> _onDestroy;
std::function<void(void)> _onUpdate;
};
TEST_METHOD(QueryStateFailureTest)
{
dhorn::experimental::animation_manager mgr;
test_animation *anim = new test_animation();
auto handle = mgr.submit(anim);
// Querying the animation state on a different animation_manager instance should throw
try
{
dhorn::experimental::animation_manager mgr2;
mgr2.query_state(handle.get());
Assert::Fail(L"Expected an exception");
}
catch (std::out_of_range& /*e*/)
{
}
}
TEST_METHOD(CancelTest)
{
dhorn::experimental::animation_manager mgr;
test_animation *anim = new test_animation();
auto handle = mgr.submit(anim);
mgr.cancel(handle.get());
// Should either be in the canceled or completed state; we don't really care
ASSERT_TRUE(dhorn::experimental::details::is_complete(mgr.query_state(handle.get())));
// After update, it should definitely be completed
mgr.update();
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::completed);
// Animations should be able to cancel themselves (and immediately transition to completed
anim = new test_animation();
anim->set_next_state(dhorn::experimental::animation_state::canceled);
handle = mgr.submit(anim);
mgr.update();
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::completed);
}
TEST_METHOD(DestroyTest)
{
dhorn::experimental::animation_manager mgr;
test_animation *anim = new test_animation();
anim->set_next_state(dhorn::experimental::animation_state::completed);
int x = 0;
anim->on_destroy([&]()
{
x = 42;
});
{ // Let the handle fall out of scope
auto handle = mgr.submit(anim);
ASSERT_EQ(0, x);
}
// Handle is destroyed; shouldn't destroy the animation yet since it is still running
ASSERT_EQ(0, x);
// After update, the animation will complete and will be destroyed
mgr.update();
ASSERT_EQ(42, x);
x = 0;
anim = new test_animation();
anim->set_next_state(dhorn::experimental::animation_state::completed);
anim->on_destroy([&]()
{
x = 42;
});
{ // Let the handle fall out of scope
auto handle = mgr.submit(anim);
mgr.update();
// Animation is complete, but hasn't fallen out of scope
ASSERT_EQ(0, x);
}
// NOTE: The animation won't be destroyed yet since we defer the remove until the next call to update
mgr.update();
ASSERT_EQ(42, x);
}
TEST_METHOD(PauseResumeTest)
{
dhorn::experimental::animation_manager mgr;
test_animation *anim = new test_animation();
auto handle = mgr.submit(anim);
mgr.pause(handle.get());
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::paused);
// Update shouldn't impact animations
int x = 0;
anim->on_update([&]() { x = 42; });
mgr.update();
ASSERT_EQ(0, x);
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::paused);
mgr.resume(handle.get());
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::running);
// Animations should be able to transition themselves to paused
anim->set_next_state(dhorn::experimental::animation_state::paused);
mgr.update();
ASSERT_TRUE(mgr.query_state(handle.get()) == dhorn::experimental::animation_state::paused);
}
TEST_METHOD(DestructorTest)
{
// There's not much that we can easily test here, so just go with the simplest and make sure the
// animation instance is cleaned up. Go ahead and test the std::shared_ptr version of submit too
int x = 0;
int y = 0;
test_animation *anim = new test_animation();
std::shared_ptr<test_animation> anim2 = std::make_shared<test_animation>();
{
anim->on_destroy([&]() { x = 42; });
anim2->on_destroy([&]() { y = 8;} );
dhorn::experimental::animation_manager mgr;
auto handle = mgr.submit(anim);
auto handle2 = mgr.submit(anim2);
}
ASSERT_EQ(42, x);
ASSERT_EQ(0, y);
}
};
}
}
| 35.294686
| 117
| 0.48905
|
longhorndude08
|
7792740acaea29b5e23cd242afb692f3945686af
| 498
|
hpp
|
C++
|
visualisation/sensors/gyroscope.hpp
|
kwikius/ArduIMU
|
e741d2896425fa398c9a7ee19b986d1f6b31418f
|
[
"CC0-1.0"
] | null | null | null |
visualisation/sensors/gyroscope.hpp
|
kwikius/ArduIMU
|
e741d2896425fa398c9a7ee19b986d1f6b31418f
|
[
"CC0-1.0"
] | null | null | null |
visualisation/sensors/gyroscope.hpp
|
kwikius/ArduIMU
|
e741d2896425fa398c9a7ee19b986d1f6b31418f
|
[
"CC0-1.0"
] | 1
|
2021-12-22T07:01:16.000Z
|
2021-12-22T07:01:16.000Z
|
#ifndef ARDUIMU_VISUALISATION_GYROSCOPE_HPP_INCLUDED
#define ARDUIMU_VISUALISATION_GYROSCOPE_HPP_INCLUDED
#include <quan/three_d/vect.hpp>
#include <quan/reciprocal_time.hpp>
#include <quan/angle.hpp>
quan::three_d::vect<
quan::reciprocal_time_<
quan::angle::deg
>::per_s
> get_gyroscope();
void set_gyroscope(
quan::three_d::vect<
quan::reciprocal_time_<
quan::angle::deg
>::per_s
> const & v
);
#endif // ARDUIMU_VISUALISATION_GYROSCOPE_HPP_INCLUDED
| 21.652174
| 54
| 0.726908
|
kwikius
|