blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
18a9005e42c68a50e3517d7ab65c61c876241803
ef8e9b616a01b05dede8791e72e1ebfbf0a744a6
/proj2/gaspump.cpp
26e84bdef290cf7ae03d0c4bd29800e2db9ee1a6
[]
no_license
StevenCzar/cs3110
f7056ba5f1ce45395a9c6e8ab1f9d47f830cad7e
8edfc02862856ad3e43e4e354621d8ffbff98f2b
refs/heads/master
2022-04-23T07:01:09.401295
2020-04-24T03:40:57
2020-04-24T03:40:57
236,827,992
0
0
null
null
null
null
UTF-8
C++
false
false
1,377
cpp
gaspump.cpp
/* Steven Czarnecki CSCI 3110 - 001 Project #2 Due: 2/11/20 */ #include "gaspump.h" #include <iostream> //constructor to set gaspump init values GasPump::GasPump(std::string s, double cap, double price) { gas_type = s; fuel_cap = cap; ppg = price; turn_away = false; fuel_oh = fuel_cap; tot_amt_fuel = 0; tot_amt_sales = 0; } //puts fuel onhand back to the cap void GasPump::replenish() { fuel_oh = fuel_cap; return; } //Dispenses fuel and determines if it needs to refuel void GasPump::dispenseFuel(double *a, double amt) { //convert to amount of gallons amt = amt/ppg; //if the pump is replenishing, allow next customer to go if(turn_away) { a[0] = amt*ppg; a[1] = 0; replenish(); turn_away = false; return; } //if the pump is ready for use... else { //if the amount is greater than onhands... if(amt > fuel_oh) { a[0] = amt*ppg; //give them the rest amt = fuel_oh; a[1] = amt*ppg; fuel_oh = 0; //update pump stats tot_amt_fuel += amt; tot_amt_sales += (amt*ppg); } //if the amount is within onhands else { a[0] = amt*ppg; a[1] = amt*ppg; //give them the amount they want fuel_oh -= amt; //update pump stats tot_amt_fuel += amt; tot_amt_sales += (amt*ppg); } //check to see if it needs to be replenished if(fuel_oh < (fuel_cap*.10)) { turn_away = true; } } return; }
903a9dbb031e86ea4cffb4b31c2a5ce13974f11b
9c3f4c5b72c9616ba8519dfcf9b84ff67917b160
/Exchange_Excube.ino
a939a1f75ecb294c9bfbbfc610b9c73cdc1f8bd2
[ "MIT" ]
permissive
upat/Exchange_Excube
d0c51463f2b76c831683a4a567ce6e57dde741fc
dbdef55528c12e7c7bee961e15d72faedb1fda26
refs/heads/master
2023-04-19T12:09:40.835795
2021-05-04T18:02:51
2021-05-04T18:02:51
361,438,539
0
0
null
null
null
null
UTF-8
C++
false
false
5,904
ino
Exchange_Excube.ino
#include "DigiKeyboard.h" /* 上記で定義されていないキーを定義 */ #define KEY_ESC 0x29 /* ESCAPE */ #define KEY_ARROW_RIGHT 0x4F /* 右矢印キー */ #define KEY_RESERVE 0x00 /* 未定義キー(Shiftのみ入力用) */ #define TRADE_COUNT 30 /* 交換ループ回数(1スタック=交換上限33個*30回+9個*1回) */ #define KEY_COUNT 16 /* 入力キー数 */ #define KEY_LAST_COUNT 24 /* 入力キー数(最後) */ #define DELAY_LONG 900 /* ディレイ時間 900ms */ #define DELAY_SHORT 250 /* ディレイ時間 250ms(250ms未満は稀に抜けるため) */ #define DEBUG_FLAG 1 // ◆動作条件 // ・過密ブロックで行わないこと(読込時間が長くなり、想定外のディレイが必要になるため) // ・エクスキューブ交換ショップ店員に話しかけられる位置にいること // ・アイテム画面はグラインダーのページを開いた状態で閉じてあること // ・グラインダーより上に表示されるアイテムを所持していないこと(カジノコインパスなど) // ・基本倉庫に十分な空きがあること // ・Scroll Lockがオフになっていること(Enter押下後にチャットが打てる状態) // ・キーバインドが初期設定のものと同等であること(話しかける時など) // ◆使い方 // ・TRADE_COUNTを設定(キューブ1スタックなら30回) // ・digisparkにこのスケッチを書き込む(終了後キー入力が実行されるので注意) // ・動作条件を満たした状態でUSB端子にdigisparkを差し込む // ◆参考 // https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf (P53以降) /* 一度だけ動作させるためのフラグ */ uint8_t one_flag = 0; /* 操作テーブル①(33個単位の交換) */ const byte KEYS[KEY_COUNT] = { KEY_E, /* 話かける(画面遷移時間を考慮すること) */ KEY_ENTER, /* エクスキューブ交換ショップを選択(読込時間を考慮すること) */ KEY_ARROW_LEFT, /* グラインダー33個選択 */ KEY_ENTER, KEY_ENTER, /* 交換確認:はい */ KEY_ENTER, /* 交換に成功しました:はい */ KEY_ESC, /* エクスキューブ交換ショップ閉じる */ KEY_ESC, KEY_ESC, /* メニュー開く */ KEY_ENTER, /* アイテム選択 */ KEY_RESERVE, /* グラインダー全選択 */ KEY_ENTER, KEY_ENTER, /* 倉庫にあずける */ KEY_ENTER, /* 基本倉庫を選択 */ KEY_ESC, /* メニューを閉じる */ KEY_ESC }; /* 操作テーブル②(最後の9個分の交換) */ const uint16_t KEYS_LAST[KEY_LAST_COUNT] = { KEY_E, /* 話かける(画面遷移時間を考慮すること) */ KEY_ENTER, /* エクスキューブ交換ショップを選択(読込時間を考慮すること) */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ARROW_RIGHT, /* グラインダー選択数+1 */ KEY_ENTER, KEY_ENTER, /* 交換確認:はい */ KEY_ENTER, /* 交換に成功しました:はい */ KEY_ESC, /* エクスキューブ交換ショップ閉じる */ KEY_ESC, KEY_ESC, /* メニュー開く */ KEY_ENTER, /* アイテム選択 */ KEY_RESERVE, /* グラインダー全選択 */ KEY_ENTER, KEY_ENTER, /* 倉庫にあずける */ KEY_ENTER, /* 基本倉庫を選択 */ KEY_ESC, /* メニューを閉じる */ KEY_ESC }; void setup() { /* 何もしない */ } void loop() { /* 既に動作済み? */ if( 0 == one_flag ) { /* TRADE_COUNTの設定回数ループ処理 */ for( uint8_t loop_cnt = 0; loop_cnt < TRADE_COUNT; loop_cnt++ ) { /* 操作テーブルのループ処理(33個単位の交換) */ for( uint8_t loop_key = 0; loop_key < KEY_COUNT; loop_key++ ) { /* 未定義キー? */ if( KEY_RESERVE == KEYS[loop_key] ) { /* Shiftのみ入力 */ DigiKeyboard.sendKeyStroke( KEY_RESERVE, MOD_SHIFT_LEFT ); } else { /* それ以外の入力 */ DigiKeyboard.sendKeyStroke( KEYS[loop_key] ); } /* 初回ディレイ? */ if( 2 > loop_key ) { /* ディレイ 900ms */ DigiKeyboard.delay( DELAY_LONG ); } else { /* ディレイ 250ms */ DigiKeyboard.delay( DELAY_SHORT ); } } } #if DEBUG_FLAG /* 操作テーブルのループ処理(最後の9個分の交換) */ for( uint8_t loop_key = 0; loop_key < KEY_LAST_COUNT; loop_key++ ) { /* 未定義キー? */ if( KEY_RESERVE == KEYS_LAST[loop_key] ) { /* Shiftのみ入力 */ DigiKeyboard.sendKeyStroke( KEY_RESERVE, MOD_SHIFT_LEFT ); } else { /* それ以外の入力 */ DigiKeyboard.sendKeyStroke( KEYS_LAST[loop_key] ); } /* 初回ディレイ? */ if( 2 > loop_key ) { /* ディレイ 900ms */ DigiKeyboard.delay( DELAY_LONG ); } else { /* ディレイ 250ms */ DigiKeyboard.delay( DELAY_SHORT ); } } #endif one_flag++; } DigiKeyboard.delay( 5000 ); }
64770caaca03599d8e8dda47b813b04fbda2d8b8
31475b58b676a174d89b3130f869656366dc3078
/fm_model/action_set.h
c07d4a8aedca483e53c1fbb2697031fb95beaf76
[]
no_license
cooper-zhzhang/engine
ed694d15b5d065d990828e43e499de9fa141fc47
b19b45316220fae2a1d00052297957268c415045
refs/heads/master
2021-06-21T07:09:37.355174
2017-07-18T14:51:45
2017-07-18T14:51:45
null
0
0
null
null
null
null
GB18030
C++
false
false
3,122
h
action_set.h
//-------------------------------------------------------------------- // 文件名: action_set.h // 内 容: // 说 明: // 创建日期: 2010年7月13日 // 创建人: 陆利民 // 版权所有: 苏州蜗牛电子有限公司 //-------------------------------------------------------------------- #ifndef _ACTION_SET_H #define _ACTION_SET_H #include "../public/macros.h" #include "../public/fast_str.h" #include "../public/core_mem.h" #include "../public/core_type.h" #include "../visual/i_res_base.h" #include "skeleton_data.h" // 动作集 class IRender; class IResLoader; class CResManager; struct action_set_t; class CActionSet: public IResBase { public: enum STATE_ENUM { STATE_INIT, // 初始状态 STATE_LOADING, // 正在加载 STATE_READY, // 就绪 STATE_FAILED, // 加载失败 }; enum { RES_CATEGORY_ACTION_SET, // 动作集数据 }; long time; public: static CActionSet* NewInstance(); public: CActionSet(); virtual ~CActionSet(); // 释放 virtual void Release(); // 销毁 void Destroy(); // 是否就绪 bool IsReady() { return (m_nState == STATE_READY); } // 是否加载结束(成功或失败) bool IsLoadComplete() { return (m_nState == STATE_READY) || (m_nState == STATE_FAILED); } // 获得动作集数据 action_set_t* GetActionSet() const { return m_pActionSet; } // 设置名称 void SetName(const char* value) { Assert(value != NULL); m_strName = value; } // 获得名称 const char* GetName() const { return m_strName.c_str(); } // 状态 void SetState(int value) { m_nState = value; } int GetState() const { return m_nState; } // 同步加载 bool Create(); // 是否可以异步加载 bool CanAsync(); // 开始异步创建 bool BeginCreate(); // 结束异步创建 bool EndCreate(int category, bool succeed); // 获得异步加载器 IResLoader* GetLoader(); // 创建 bool Build(action_set_t* pActionSet, skeleton_t* pMainSkeleton); // 根据名字获得动作的索引值 int GetActionIndex(const char* action_name); // 添加动作名索引 bool AddActionIndex(const char* action_name, int action_index); // 移除动作名索引 bool RemoveActionIndex(const char* action_name, int action_index); // 移除动作的最后使用时间 bool RemoveActionLastUse(int action_index); // 更新动作的最后使用时间 bool UpdateActionLastUse(int action_index); // 回收长时间未使用的动作数据 int CollectUnuseAction(unsigned int cur_tick, unsigned int ms); // 设置管理器 void SetManager(CResManager* value) { m_pManager = value; } // 获得管理器 CResManager* GetManager() const { return m_pManager; } // 设置附加资源路径名 void SetAppendPath(const char* value) { m_strAppendPath = value; } const char* GetAppendPath() const { return m_strAppendPath.c_str(); } private: CActionSet(const CActionSet&); CActionSet& operator=(const CActionSet&); private: CResManager* m_pManager; IResLoader* m_pLoader; core_string m_strAppendPath; core_string m_strName; int m_nState; action_set_t* m_pActionSet; }; #endif // _ACTION_SET_H
1520d28bb749216cac7f3f2b74ab1f9520f06d95
03804f83573a75c80932bb562ce0ee2a106ae462
/LX_AVRecord.cpp
b9db144143d2154cb2775af2d52cb8448a660c6f
[]
no_license
luxiangchangzhou/RecordScreen
d16a55f98b911f61ffa2e4e33f80695e8407934b
3eaf98ef768baa44d3e624ef2f441d15602c73cc
refs/heads/main
2023-02-17T03:34:43.566861
2021-01-19T08:40:19
2021-01-19T08:40:19
330,913,537
0
0
null
null
null
null
GB18030
C++
false
false
5,298
cpp
LX_AVRecord.cpp
#include "LX_AVRecord.h" #include <windows.h> #pragma comment(lib, "Winmm.lib") #include <iostream> #include <assert.h> using namespace std; #include <opencv2/highgui.hpp> using namespace cv; LX_AVRecord::LX_AVRecord() { QueryPerformanceFrequency((LARGE_INTEGER*)&frequency); assert(frequency != 0); } bool LX_AVRecord::init(char * outUrl, bool isScreen, int camIndex) { this->isScreen = isScreen; this->camIndex = camIndex; if (outUrl == 0) { this->outUrl = "test.mp4"; } else { this->outUrl = outUrl; } if (isScreen == true)//选择屏幕录像机 { //.................. inWidth = cam_scr.width; inHeight = cam_scr.height; fps = 25; } else { if (cam.open(camIndex) == false) { cout << "cam open failed!" << endl; return false; } cout << " cam open success" << endl; inWidth = cam.width; inHeight = cam.height; fps = cam.fps; } //初始化格式转换上下文 if (video_scale.InitScaleFromBGR24ToYUV420P(inWidth, inHeight, inWidth, inHeight) == false) { cout << "video_scale.InitScaleFromBGR24ToYUV420P failed!" << endl; return false; } //初始化编码上下文 if (video_encoder.InitVideoCodecH264(inWidth, inHeight, fps) == false) { cout << "video_encoder.InitVideoCodecH264 failed!" << endl; return false; } bool ret = resample.Init_FromS16ToFLTP(channels, sampleRate); if (ret == false) { cout << "音频重采样 上下文初始化 failed!" << endl; return false; } cout << "音频重采样 上下文初始化成功!" << endl; ret = audio_encoder.InitAudioCodecAAC(channels, sampleRate); if (ret == false) { cout << "audio_encoder.InitAudioCodecAAC failed!" << endl; return 0; } cout << "audio_encoder.InitAudioCodecAAC成功!" << endl; ret = make_mp4.Init(outUrl); if (ret == false) { cout << "make_mp4.Init(outUrl) failed" << endl; return false; } ret = make_mp4.AddStream(audio_encoder.ac); if (ret == false) { cout << "make_mp4.AddStream(audio_encoder.ac) failed" << endl; return false; } ret = make_mp4.AddStream(video_encoder.vc); if (ret == false) { cout << "make_mp4.AddStream(video_encoder.vc) failed" << endl; return false; } ret = make_mp4.open(); if (ret == false) { cout << "make_mp4.open() failed" << endl; return false; } ret = make_mp4.SendHead(); if (ret == false) { cout << "make_mp4.SendHead() failed" << endl; return false; } QAudioFormat fmt; fmt.setSampleRate(sampleRate); fmt.setChannelCount(channels); fmt.setSampleSize(sampleByte * 8); fmt.setCodec("audio/pcm"); fmt.setByteOrder(QAudioFormat::LittleEndian); fmt.setSampleType(QAudioFormat::UnSignedInt); QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); if (!info.isFormatSupported(fmt)) { cout << "Audio format not support!" << endl; fmt = info.nearestFormat(fmt); } input = new QAudioInput(fmt); return true; } void LX_AVRecord::startRecord() { isExit = false; //开始录制视频 QueryPerformanceCounter((LARGE_INTEGER*)&start_time); if (isScreen == true) { cam_scr.Start(start_time); } else { cam.Start(start_time); } //开始录制音频 io = input->start(); this->start();//开启线程 } void LX_AVRecord::stop() { if (isScreen == true) { cam_scr.Stop(); } else { cam.Stop(); } isExit = true; wait(); } void LX_AVRecord::clear() { cam_scr.close(); cam_scr.Clear(); cam.close(); cam.Clear(); video_scale.Close(); video_encoder.Close(); resample.close(); audio_encoder.Close(); make_mp4.Close(); input->stop(); delete input; } void LX_AVRecord::run() { //视频帧 Mat frame; //一次读取一帧音频的字节数 int readSize = 1024 * channels*sampleByte; char *buf = new char[readSize]; for (;isExit!=true;) { Image_Data img; if (isScreen == true) { img = cam_scr.Pop(); } else { img = cam.Pop(); } //读视频帧 if (img.data != 0) { AVFrame * yuvframe = allocYUV420pFrame(inWidth, inHeight); int h = video_scale.ScaleFromBGR24ToYUV420P((unsigned char*)img.data, yuvframe); if (h > 0) { AVPacket *pkt = video_encoder.EncodeVideo(yuvframe, make_mp4.indexOfVideo, img.pts, frequency); freeFrame(yuvframe); if (pkt != 0) { make_mp4.SendPacket(pkt); } } else { freeFrame(yuvframe); } img.Drop(); } //一次读取一帧音频 if (input->bytesReady() < readSize) { QThread::msleep(1); continue; } int size = 0; while (size != readSize) { int len = io->read(buf + size, readSize - size); if (len < 0)break; size += len; } if (size != readSize)continue; LARGE_INTEGER large_interger; QueryPerformanceCounter(&large_interger); AVFrame *pcm = allocFLTP_PCMFrame(channels, 1024); resample.Resample_FromS16ToFLTP(buf, pcm); AVPacket*pkt = audio_encoder.EncodeAudio(pcm, make_mp4.indexOfAudio, large_interger.QuadPart - start_time, frequency); freeFrame(pcm); if (pkt == 0) continue; make_mp4.SendPacket(pkt); } make_mp4.SendEnd(); delete buf; } LX_AVRecord::~LX_AVRecord() { }
a20ac5761eb57f23774c76e3ec03d1dedd33990b
efcf3fbd748814c211ed298edcb2371cbc5abd56
/c++/src/week3/FractionalKnapsack.h
1093097094609e082d992efeff439a4a18ab2b5b
[]
no_license
hockeyj85/CITS3001-2016-Algorithms-Agents-and-AI
d23a8e9ec27394a8a94cff230e5a9bc80f80025d
e5e502ca7943945a464ee348e58c0f28b3bcfe70
refs/heads/master
2021-01-10T10:06:25.300691
2016-04-05T06:24:30
2016-04-05T06:24:30
53,408,271
0
0
null
null
null
null
UTF-8
C++
false
false
301
h
FractionalKnapsack.h
// // Created by james on 23/03/16. // #ifndef CITS3001_FRACTIONALKNAPSACK_H #define CITS3001_FRACTIONALKNAPSACK_H #include <vector> #include <algorithm> double fractionalKnapsack(const std::vector<int> values, const std::vector<int> weights, int capacity); #endif //CITS3001_FRACTIONALKNAPSACK_H
6155e6a16852e51b19138a0585ed617a2eca7495
61af2d058ff5b90cbb5a00b5d662c29c8696c8cc
/EZOJ/Contests/1174/C.cpp
a76829aca29144241365bf4126cd71e5981dc698
[ "MIT" ]
permissive
sshockwave/Online-Judge-Solutions
eac6963be485ab0f40002f0a85d0fd65f38d5182
9d0bc7fd68c3d1f661622929c1cb3752601881d3
refs/heads/master
2021-01-24T11:45:39.484179
2020-03-02T04:02:40
2020-03-02T04:02:40
69,444,295
7
4
null
null
null
null
UTF-8
C++
false
false
2,440
cpp
C.cpp
#include <iostream> #include <cstdio> #include <cstring> #include <cassert> #include <cctype> using namespace std; typedef long long lint; #define cout cerr #define ni (next_num<int>()) template<class T>inline T next_num(){ T i=0;char c; while(!isdigit(c=getchar())&&c!='-'); bool flag=c=='-'; flag?(c=getchar()):0; while(i=i*10-'0'+c,isdigit(c=getchar())); return flag?-i:i; } template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){ if(b<a){ a=b; } } const int N=100010,MOD=1000000007; inline int add(const int &a,const int &b){ return (a+b)%MOD; } inline int sub(const int &a,const int &b){ return add(a,MOD-b); } inline int mul(const int &a,const int &b){ return (lint)a*b%MOD; } inline void apadd(int &a,const int &b){ a=add(a,b); } inline void apmul(int &a,const int &b){ a=mul(a,b); } inline int fpow(int x,int n){ int ret=1; for(;n;n>>=1,apmul(x,x)){ if(n&1){ apmul(ret,x); } } return ret; } inline int inv(int x){ return fpow(x,MOD-2); } int pval[N]; namespace G{ const int E=400010; int to[E],bro[E],head[N],e=0; int dfn[N],low[N]; bool vis[N]; inline void init(){ memset(head,-1,sizeof(head)); memset(dfn,0,sizeof(dfn)); memset(vis,0,sizeof(vis)); } inline void ae(int u,int v){ to[e]=v,bro[e]=head[u],head[u]=e++; } inline void add(int u,int v){ ae(u,v),ae(v,u); } int div[N],cont[N]; int tim=0; int tarjan(int x,int fa){ int prod=pval[x]; div[x]=inv(pval[x]),cont[x]=0; dfn[x]=low[x]=++tim; for(int i=head[x],v;~i;i=bro[i]){ if(dfn[v=to[i]]){ apmin(low[x],dfn[v]); }else{ int t=tarjan(v,x); apmul(prod,t); if(low[v]==dfn[x]){ apadd(cont[x],t); apmul(div[x],inv(t)); }else{ apmin(low[x],low[v]); } } } if(fa==-1){ div[x]=0; } return prod; } int ans[N]; void dfs2(int x,int prod){ vis[x]=true; ans[x]=sub(::add(mul(prod,div[x]),cont[x]),prod); for(int i=head[x],v;~i;i=bro[i]){ if(!vis[v=to[i]]){ dfs2(v,prod); } } } } int main(){ #ifndef ONLINE_JUDGE freopen("fantasia.in","r",stdin); freopen("fantasia.out","w",stdout); #endif G::init(); int n=ni,tot=ni; for(int i=1;i<=n;i++){ pval[i]=ni; } while(tot--){ G::add(ni,ni); } int sum=0; for(int i=1;i<=n;i++){ if(G::dfn[i]==0){ int prod=G::tarjan(i,-1); G::dfs2(i,prod); apadd(sum,prod); } } int ans=0; for(int i=1;i<=n;i++){ apadd(ans,mul(i,add(sum,G::ans[i]))); } printf("%d\n",ans); return 0; }
a2ef7aef93b1c4b752d5fe24e93b5f966c750d30
a7edd259fd4a669b576cd6e2691df948efea7552
/Genetic Ecosystem/SFML_TEST/Source.cpp
0f24c7e7bf11b19571d94caad05a95502903c927
[]
no_license
Greg-Balbirnie/Code-Projects
1b73a49f44e6a4eee500253d0f3c32ef90fdb85f
7f53b0e090ca482c9d444df77b5163853eb49e6f
refs/heads/main
2023-06-04T01:12:08.451793
2021-06-20T16:00:46
2021-06-20T16:00:46
378,665,155
0
0
null
null
null
null
UTF-8
C++
false
false
5,417
cpp
Source.cpp
#include <SFML/Graphics.hpp> #include <Windows.h> #include "Collision.h" #include <iostream> #include "Genetic.h" #include <SFML/System/Vector2.hpp> #include "Creature.h" #include <ctime> // Function Prototypes void init(); void update(); void render(); void render_debug_text(); void finished(); // Variables sf::RenderWindow window(sf::VideoMode(1000, 700), "The Genetic Ecosystem"); sf::CircleShape food(50.0f); Collision collision_manager; Genetic genetic_manager; sf::Font main_font; clock_t start; double duration; clock_t death_clock; double lifetime; float speed_modifier; void main() { // Initialise variables init(); // Start timers start = clock(); death_clock = clock(); // Loop until window is closed while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } // Call update update(); // Render images //render(); // Set duration lifetime = (clock() - death_clock) / (double)CLOCKS_PER_SEC; // Check duration if (lifetime >= 15 / speed_modifier) { // Create children genetic_manager.Evaluate_Fitness(); // Loop through all creatures for (int i = 0; i < genetic_manager.population.size(); i++) { // Create creature pointer sf::Creature* this_c = &genetic_manager.population[i]; // Check creature is alive if (this_c->Is_Alive()) { // Reset food this_c->Reset_Food(); // Check for max speed if (this_c->Get_Speed_Chromosome()->Get_Fitness() == 16) { // Finish the algorithm finished(); } } // Delete pointer TODO //delete(&this_c); } // Reset time death_clock = clock(); } } } void init() { // Generate the creatures genetic_manager.Generate_Population(); // Set the colour of the food food.setFillColor(sf::Color::Red); food.setPosition(200, 200); // Text main_font.loadFromFile("../Font/Lato-Regular.ttf"); // Set speed modifier speed_modifier = 5.0f; } void update() { //Close the app if (GetKeyState(VK_ESCAPE) & 0x0800) { window.close(); } // Loop through all creatures for (int i = 0; i < genetic_manager.population.size(); i++) { // Create creature pointer sf::Creature* this_c = &genetic_manager.population[i]; // Check creature is alive if (this_c->Is_Alive()) { //Find closest food source TODO // Find direction to food source sf::Vector2f dir = food.getPosition() + sf::Vector2f(food.getRadius(), food.getRadius()) - this_c->Get_Centre(); // Find magnitude of direction float dist = sqrt(pow(dir.x, 2) + pow(dir.y, 2)); if (dist != 0) { // Divide dir by dist to get unit vector dir /= dist; } else { // Set dir to 0 dir = sf::Vector2f(0.0f, 0.0f); } // Set creature direction to food source this_c->Set_Direction(dir); // Move creature this_c->move(this_c->Get_Speed() * (speed_modifier / 100) * dir.x, this_c->Get_Speed() * (speed_modifier / 100) * dir.y); this_c->Set_Centre(); // Check if collided if (collision_manager.collide(*this_c, food)) { // Make food pile smaller food.setRadius(food.getRadius() - 1 * (speed_modifier / 100)); food.move(sf::Vector2f(speed_modifier / 100, speed_modifier / 100)); // If food is depleted if (food.getRadius() <= 0) { // remove food pile // TODO food.setRadius(50.0f); food.setPosition(rand() % 500, rand() % 350); } // Add food to creature this_c->Add_Food(0.01); } } // Delete pointer TODO //delete(&this_c); } } void render() { // Clear the previous frame window.clear(); // render the circle //window.draw(test_creature); window.draw(food); // Create text for the food gathered sf::Text display_text; // Set up display text display_text.setFont(main_font); display_text.setFillColor(sf::Color::White); display_text.setCharacterSize(15); for (int i = 0; i < genetic_manager.population.size(); i++) { // Create creature pointer sf::Creature* this_c = &genetic_manager.population[i]; // Check creature is alive if (this_c->Is_Alive()) { // Draw Creature TODO window.draw(*this_c); // Show food text display_text.setString("Food: " + to_string((int)this_c->Get_Food())); display_text.setPosition(this_c->getPosition() + sf::Vector2f(0.0f, -35.0f)); window.draw(display_text); // Show speed text display_text.setString("Speed: " + to_string((int)this_c->Get_Speed_Chromosome()->Get_Fitness())); display_text.setPosition(this_c->getPosition() + sf::Vector2f(0.0f, -20.0f)); window.draw(display_text); } // Delete pointer TODO //delete(&this_c); } //render_debug_text(); // Show the window window.display(); } void render_debug_text() { // Create text for the food gathered sf::Text debug_text; // Set display text debug_text.setFont(main_font); debug_text.setFillColor(sf::Color::White); for (int i = 0; i < genetic_manager.population.size(); i++) { debug_text.setString(to_string(genetic_manager.population[i].getPosition().x)); debug_text.setPosition(sf::Vector2f(0.0f, (float)i * 25)); window.draw(debug_text); } } void finished() { cout << "Done in " << (clock() - start) / 1000.0f << " seconds" << endl; cout << "Generation: " << genetic_manager.population.back().Get_Speed_Chromosome()->Get_Generation(); while (true) { // Hang } }
673e86486bf5fcaae7b33ccc5beed2cea8c7b6c4
e41ac5363851c78620e6f6c2dcf4e50e0812c96a
/Engine/Code/Engine/Renderer/DrawInstruction.cpp
16f1da9fc873151c03644a58209b191a9c966812
[ "MIT" ]
permissive
cugone/Abrams2019
b9dd9d674cfbc131543e696e60a4c7b977964ed9
cf1fb435cbe712fc149e02496bdc7462710cbf28
refs/heads/master
2021-11-11T01:18:13.295349
2021-11-08T17:42:52
2021-11-08T17:42:52
184,484,215
1
2
MIT
2019-05-01T21:56:32
2019-05-01T21:29:25
C++
UTF-8
C++
false
false
333
cpp
DrawInstruction.cpp
#include "Engine/Renderer/DrawInstruction.hpp" #include "Engine/Renderer/Material.hpp" [[nodiscard]] bool DrawInstruction::operator==(const DrawInstruction& rhs) { return material == rhs.material && type == rhs.type; } [[nodiscard]] bool DrawInstruction::operator!=(const DrawInstruction& rhs) { return !(*this == rhs); }
42a79fd95f11deadcbee0af540629db167481462
c3ae8e21953f20c4ff5b103e3ac6c19056e48f07
/LineManager.cpp
1ec9a40ce2aeb0b1bce76987a136619cbb8c0463
[]
no_license
menghif/OOP-assembly-line
c27d25a6e96b3c46cdb0b877080b2881491940ac
e73cd6961cf3495c732f016963e26194d9f2f16c
refs/heads/main
2023-05-24T17:39:06.662594
2021-06-03T23:01:30
2021-06-03T23:01:30
373,657,331
0
0
null
null
null
null
UTF-8
C++
false
false
3,651
cpp
LineManager.cpp
// Name: Francesco Menghi // Date of completion: Nov 28, 2020 // // I confirm that I am the only author of this file // and the content was created entirely by me. #include <iostream> #include <fstream> #include <string> #include <vector> #include <queue> #include <utility> #include <algorithm> #include "LineManager.h" LineManager::LineManager(const std::string &filename, std::vector<Workstation *> &stations, std::vector<CustomerOrder> &orders) { std::ifstream file(filename); if (!file) throw std::string("Unable to open [") + filename + "] file."; std::string record; while (!file.eof()) { Utilities util; size_t next_pos = 0; bool more = true; std::getline(file, record); std::string stationName = util.extractToken(record, next_pos, more); auto it = std::find_if(stations.begin(), stations.end(), [=](const Workstation *stn) { return stn->getItemName() == stationName; }); auto stationIdx = std::distance(stations.begin(), it); if (more) { std::string nextStationName = util.extractToken(record, next_pos, more); it = std::find_if(stations.begin(), stations.end(), [=](const Workstation *stn) { return stn->getItemName() == nextStationName; }); auto nextStationIdx = std::distance(stations.begin(), it); stations[stationIdx]->setNextStation(*stations[nextStationIdx]); } } file.close(); std::move(begin(orders), end(orders), back_inserter(ToBeFilled)); m_cntCustomerOrder = ToBeFilled.size(); AssemblyLine = stations; initialIdx = getFirstStationIdx(); cnt = 0; } size_t LineManager::getFirstStationIdx() const { size_t idx = 0; for (size_t i = 0; i < AssemblyLine.size(); i++) { auto it = std::find_if(AssemblyLine.begin(), AssemblyLine.end(), [=](const Workstation *stn) { return stn->getNextStation() == AssemblyLine[i]; }); if (it == AssemblyLine.end()) idx = i; } return idx; } bool LineManager::run(std::ostream &os) { os << "Line Manager Iteration: " << ++cnt << std::endl; size_t idx = initialIdx; if (!ToBeFilled.empty()) { // move the order at the front of the queue onto the starting point of the assembly line *AssemblyLine[idx] += std::move(ToBeFilled.front()); ToBeFilled.pop_front(); } for (auto &station : AssemblyLine) station->runProcess(os); // run one cycle of the station's process for (auto &station : AssemblyLine) { station->moveOrder(); // move the order down the line CustomerOrder complete; if (station->getIfCompleted(complete)) Completed.push_back(std::move(complete)); } return !(Completed.size() < m_cntCustomerOrder); } void LineManager::displayCompletedOrders(std::ostream &os) const { for (const auto &order : Completed) order.display(std::cout); } void LineManager::displayStations() const { for (const Workstation *station : AssemblyLine) station->display(std::cout); } void LineManager::displayStationsSorted() const { size_t idx = initialIdx; for (size_t i = 0; i < AssemblyLine.size(); i++) { AssemblyLine[idx]->display(std::cout); bool found = false; for (size_t j = 0; j < AssemblyLine.size() && !found; j++) { if (AssemblyLine[j] == AssemblyLine[idx]->getNextStation()) { idx = j; found = true; } } } }
6c270a2d57f4766742bd4333d360bc34d780a02a
a182a138008a80aef43084a3f9338a80ea8e16cd
/self-assess06.cpp
9171fd95b9d83faf8ed7ca817b2e58e62c9688fc
[]
no_license
mivehk/replC
7f6cc2182812d385398109105e995196dbb3f6a7
8d03cb75fde935613ce5324348ff0abddec3c864
refs/heads/master
2022-12-17T14:30:01.553864
2020-09-16T17:09:08
2020-09-16T17:09:08
271,383,655
0
0
null
null
null
null
UTF-8
C++
false
false
2,144
cpp
self-assess06.cpp
#include <fstream> #include <iostream> #include <cstdlib> #include <cctype> using namespace std; double average(ifstream& in_st_par); void initialize(ofstream& out_st_par); void new_line(); int main(){ using namespace std; ifstream in_str; ofstream out_str; ofstream outfi_num; char out_file[16]; cout << endl; cout<< " This program asks a few numbers from you \n" << " then calculate their average and save it in the file you name.\n"; outfi_num.open("input06.txt"); if (outfi_num.fail()){ cout << " Error occurred while opening collection file"; } double number; int ccount = 0; char ans; do { cout << " Now tell me numbers you want to add: " ; cin >> number; ccount++; outfi_num << static_cast<double>(number) ; initialize(outfi_num); cout << " Is this your last number? (Yes/No):"; cin >> ans; new_line(); } while(( ans !='Y' ) && ( ans !='y' )); cout <<" Now tell me the name of output file with max 15 characters: "; cin>>out_file ; in_str.open("input06.txt"); if (in_str.fail()){ cout << " Error occurred while reading infile stream"; exit(1); } out_str.open(out_file , ios::app); if (out_str.fail()){ cout << " Error occurred while reading outfile stream"; exit(1); } out_str.setf(ios::showpoint); out_str.precision(3); cout.setf(ios::showpoint); cout.precision(3); double avg; avg = average(in_str) ; out_str << avg; initialize(out_str); cout << avg << endl; in_str.close(); out_str.close(); outfi_num.close(); return 0; } double average(ifstream& in_st_par){ using namespace std; double next ; int count = 0; double sum =0; while (in_st_par >> next){ sum = sum + next; count++; } return(sum/count); } void initialize(ofstream& out_st_par){ using namespace std; out_st_par << endl; return; } void new_line(){ char symbol; do{ cin.get(symbol); } while (! isspace(symbol)); }
d68963f0c9e59da54984adac440ced3e80270a51
cd7cf59291e435f66387f91ae603f1f604045eef
/map.cpp
f65f5cd516f4426f75f2151237749df86d543e02
[]
no_license
willow-wind/tiandou
8601009e001189e3a858d0eba62dc6d94486f0f0
fd8b6ce1e6bb4d2c4f8d55771dfcece6eab20271
refs/heads/main
2023-06-19T00:00:50.619748
2021-07-19T01:46:24
2021-07-19T01:46:24
387,306,609
2
0
null
null
null
null
UTF-8
C++
false
false
507
cpp
map.cpp
#include "map.h" #include "config.h" Map::Map() { m_map1.load(MAP_PATH); m_map2.load(MAP_PATH);//初始化加载地图对象 m_map1_posY=-GAME_HEIGHT; m_map2_posY=0; m_scroll_speed=MAP_SCROLL_SPEED; } void Map::mapPosition(){ m_map1_posY+=MAP_SCROLL_SPEED; if(m_map1_posY>=0){ m_map1_posY=-GAME_HEIGHT; }//处理第一张图片滚动 m_map2_posY+=MAP_SCROLL_SPEED; if(m_map2_posY>=GAME_HEIGHT){ m_map2_posY=0; }//处理第二张图片滚动 }
f7fec00d8f885c7c02d02ae7bf285b6188eaaf1d
a48af61e00af9f60795490ef35bcadf8ddadaeba
/software_development/c++/c++_primer_5th-lippman_etc/ch_02/solution_27.cpp
716529af9ced251237b39ab2880f69e29b3b2e77
[]
no_license
HatlessFox/self-study
3fcc8a559d5dad389ef1617fda5f86e70a8fe9f6
0246781ecccf946e697e0b077d9c80d287cd33b9
refs/heads/master
2022-03-23T14:48:24.679273
2019-11-17T16:26:58
2019-11-17T16:26:58
44,395,118
1
0
null
null
null
null
UTF-8
C++
false
false
726
cpp
solution_27.cpp
/* * Exercise 2.27, p. 64. * * Which of the following initializations are legal? */ int main(int, char**) { //int i = -1, &r = 0; // (a) - illegal, literal -> non-const ref is forbidden. { const int i2 = -1; //int *const p2 = &i2; // (b) - illegal, ptr to const -> ptr to non-const } const int i = -1, &r = 0; // (c) - legal, literal -> const ref is ok. { const int i2 = -1; const int *const p3 = &i2; // (d) - legal, ptr2const -> const ptr2const } { const int i2 = -1; const int *p1 = &i2; // (e) - legal, ptr2const -> ptr2const } //const int &const r2; // (f) - illegal, ref must be initialized { int i = -1; const int i2 = i, &r = i; //(g) - legal } return 0; }
a76976bb0ef271e6269884ae9e99e29f5abc9e93
f6244209f8ecff355822843f64d6368281266143
/898.BitwiseORsofSubarrays.h
0d0985792990ea4a50d9574a64a60b09d2c3fcd3
[]
no_license
seesealonely/old-leetcode
5711fc0d583ca15c14cb8fb3a241e860e6d6fcd4
28e4bc6e28ba8c36e90a05a6214c7c716fe03431
refs/heads/master
2022-04-26T10:18:43.770677
2020-04-28T21:20:35
2020-04-28T21:20:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,543
h
898.BitwiseORsofSubarrays.h
/* We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of all the elements in B, obtaining a result A[i] | A[i+1] | ... | A[j]. Return the number of possible results. (Results that occur more than once are only counted once in the final answer.) Example 1: Input: [0] Output: 1 Explanation: There is only one possible result: 0. Example 2: Input: [1,1,2] Output: 3 Explanation: The possible subarrays are [1], [1], [2], [1, 1], [1, 2], [1, 1, 2]. These yield the results 1, 1, 2, 1, 3, 3. There are 3 unique values, so the answer is 3. Example 3: Input: [1,2,4] Output: 6 Explanation: The possible results are 1, 2, 3, 4, 6, and 7. Note: 1 <= A.length <= 50000 0 <= A[i] <= 10^9 */ #include"head.h" class Solution { public: int subarrayBitwiseORs(vector<int>& A) { // return originDp(A); return dp(A); } int originDp(vector<int>& A) { if(A.empty())return 0; map<int,int> m; int res=1; m[A[0]]=1; for(int i=1;i<A.size();i++) { if((!m[A[i]])) {res++;m[A[i]]=1;} for(int j=i-1;j>=0;j--) { A[j]|=A[j+1]; if(!m[A[j]]) {res++;m[A[j]]=1;} } } return res; } int dp(vector<int>& A) { if(A.empty()) return 0; int res=1; vector<int> subOR; sort(A.begin(),A.end()); subOR.push_back(A[0]); for(int i=1;i<A.size();i++) { if((A[i]|subOR.back())!=subOR.back()) { subOR.push_back(A[i]|=subOR.back()); res+=subOR.size(); } } return res; } };
a6d04453e39dc6c71819ea1ce5f57ec4c41d2989
3b96d7afd9dd83bcad64bc5df1260216b9270b20
/texture.h
4bdb648f85eb73724b274c5fbe883e881eaa07b1
[]
no_license
boksajak/raytracingthenextweek
3fe111d56f2f2798e8f942c9b113135c44101dd3
8b1646f7874a04a4cced05841ef98b1675ecdbd1
refs/heads/master
2020-03-18T21:32:32.444627
2018-05-31T20:34:48
2018-05-31T20:34:48
135,285,742
10
0
null
null
null
null
UTF-8
C++
false
false
1,377
h
texture.h
#ifndef TEXTUREH #define TEXTUREH #include "perlin.h" class texture { public: virtual vec3 value(float u, float v, const vec3& p) const = 0; }; class constant_texture : public texture { public: constant_texture() { } constant_texture(vec3 c) : color(c) { } virtual vec3 value(float u, float v, const vec3& p) const { return color; } vec3 color; }; class checker_texture : public texture { public: checker_texture() { } checker_texture(texture *t0, texture *t1): even(t0), odd(t1) { } virtual vec3 value(float u, float v, const vec3& p) const { float sines = sin(10*p.x())*sin(10*p.y())*sin(10*p.z()); if (sines < 0) return odd->value(u, v, p); else return even->value(u, v, p); } texture *odd; texture *even; }; class noise_texture : public texture { public: noise_texture() {} noise_texture(float sc) : scale(sc) {} virtual vec3 value(float u, float v, const vec3& p) const { // return vec3(1,1,1)*0.5*(1 + noise.turb(scale * p)); // return vec3(1,1,1)*noise.turb(scale * p); return vec3(1,1,1)*0.5*(1 + sin(scale*p.x() + 5*noise.turb(scale*p))) ; } perlin noise; float scale; }; #endif
85f24afa253571b89db0465a3ca4bf0429e188fa
85ea38998dd8e36f4ce4fc5485f84175fcc77f33
/evaluation/evaluation/PCA_Evalution.h
aeef28b56f65d09fbeda263f8fef0b860015c80f
[]
no_license
moogle0927/PCA
a022468efc6e327b044634418115c919f4a3c14c
dc1cb981ccba4fa31b4a169bc76543180a4ab3e3
refs/heads/master
2021-01-10T06:09:41.584840
2016-02-17T10:06:09
2016-02-17T10:06:09
51,046,295
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
5,967
h
PCA_Evalution.h
/* このヘッダファイルは, ・Generalization ・Specificity を求めるプログラムが格納されています. このヘッダファイルを使用する際は ・random.h(NumericalRecipesの正規乱数を使用するため) ・JI.h(一致度算出) をincludeしてください. */ #include "other/narimhd.h" //投影・逆投影 template<class T, class T2> void Projection_Back_Projection( T &X, T &myu, T2 &U, T &X_out, int pe, int te){ //pe:PCA前の軸数 //te:PCA後の軸数 //投影 nari::vector<double> Z( te, 0.0); #ifdef _OPENMP //std::cout << "Projection?" << std::endl; #pragma omp parallel for schedule(static) #endif for( int t = 0; t < te; t++){ for( int p = 0; p < pe; p++){ Z[t] += U( p, t) * ( X[p] - myu[p]); } } //逆投影 nari::vector<double> UUtX( pe, 0.0); #ifdef _OPENMP //std::cout << "Back Projection?" << std::endl; #pragma omp parallel for schedule(static) #endif for( int p = 0; p < pe; p++){ for( int t = 0; t < te; t++){ UUtX[p] += Z[t] * U( p, t); } X_out[p] = UUtX[p] + myu[p]; } } template<class T, class T2> void Back_Projection( T &Z, T &myu, T2 &U, T &X_out, int pe, int te){ //pe:PCA前の軸数 //te:PCA後の軸数 //逆投影 nari::vector<double> UUtX( pe, 0.0); for( int p = 0; p < pe; p++){ for( int t = 0; t < te; t++){ UUtX[p] += Z[t] * U( p, t); } X_out[p] = UUtX[p] + myu[p]; } } template<class T, class T2> void Projection( T &X, T &myu, T2 &U, T &Z, int pe, int te){ //pe:PCA前の軸数 //te:PCA後の軸数 //投影 for( int t = 0; t < te; t++){ for( int p = 0; p < pe; p++){ Z[t] += U( p, t) * ( X[p] - myu[p]); } } } //ランダムな任意形状の生成 template<class T, class T2, class T3, class T4> void Arbitrarily_Shaped_Object( T &myu, T2 &U, T3 &evalue, T4 &X_out, int pe, int te, long *idum){ //pe:PCA前の軸数 //te:PCA後の軸数 nari::vector<double> Z( te, 0.0); for( int t = 0; t < te; t++){ Z[t] = sqrt(evalue[t]) * normal( idum); } nari::vector<double> UUtX( pe, 0.0); #ifdef _OPENMP //std::cout << "Back Projection?" << std::endl; #pragma omp parallel for schedule(static) #endif for( int p = 0; p < pe; p++){ for( int t = 0; t < te; t++){ UUtX[p] += Z[t] * U( p, t); } X_out[p] = UUtX[p] + myu[p]; } } //generalization template<class T1, class T2, class T3> void generalization( T1 &X, T2 &myu, T3 &U, int pe, int te, int ncase, std::string outDir){ int se = pe; int cross = 0; int join = 0; double ji = 0.0; double generalization = 0.0; nari::vector<double> Xi(se,0.0); nari::vector<double> Xi_out(se,0.0); nari::vector<unsigned char> Xi_label(se,0); nari::vector<unsigned char> Xi_(se,0); if(!nari::system::directry_is_exist( outDir)) { nari::system::make_directry( outDir); std::cout << "Directry was generated : " << outDir << std::endl; } FILE *fp; std::ostringstream output; std::string i_fn = outDir + "Generalization.csv"; fp = fopen( i_fn.c_str(), "w"); fprintf( fp, "症例番号,J.I.\n"); for( int j = 0; j < ncase; j++){ for( int p = 0; p < pe; p++) Xi[p] = X( p, j); Projection_Back_Projection( Xi, myu, U, Xi_out, pe, te); //一致度の算出 //cross = 0; //join = 0; //for( int i = 0; i < se; i++){ // if( Xi_out[i] < 0.0 || Xi[i] < 0.0){ // cross++; // if( Xi_out[i] < 0.0 && Xi[i] < 0.0) join++; // } //} //ji = (double)join / (double)cross; for( int i = 0; i < se; i++){ if( Xi_out[i] < 0.0) Xi_[i] = 1; else Xi_[i] = 0; if( Xi[i] < 0.0) Xi_label[i] = 1; else Xi_label[i] = 0; } ji = JI( Xi_.ptr(), Xi_label.ptr(), se); //逆投影後の形状出力 output << outDir << "test" << j << ".raw"; Xi_.save_file_bin( output.str()); output.str(""); fprintf( fp, "%d,%f\n", j+1, ji); generalization += ji; std::cout << "generalization" << j+1 << " = " << ji << std::endl; } generalization /= (double)ncase; fprintf( fp, "Generalization,%f\n", generalization); fclose( fp); } //specificity template<class T1, class T2, class T3, class T4> void specificity( T1 &X, T2 &myu, T3 &U, T4 &evalue, int pe, int te, int ncase, int ngene, long idum, std::string outDir){ int se = pe; double ji = 0.0; double case_max_ji = -1.0; double max_ji = -1.0; double min_ji = 2.0; double specificity = 0.0; int cross = 0; int join = 0; nari::vector<double> Xi(se,0.0); nari::vector<double> Xi_out(se,0.0); nari::vector<unsigned char> Xi_label(se,0); nari::vector<unsigned char> Xi_(se,0); if(!nari::system::directry_is_exist( outDir)) { nari::system::make_directry( outDir); std::cout << "Directry was generated : " << outDir << std::endl; } std::string i_fn = outDir + "specificity.csv"; FILE *fp; fp = fopen( i_fn.c_str(), "w"); fprintf( fp, "number of times,J.I,specificity\n"); for( int i = 0; i < ngene; i++){ Arbitrarily_Shaped_Object( myu, U, evalue, Xi_out, pe, te, &idum); ////任意形状の出力 //i_fn << outDir << "test" << i << ".raw"; //Xi_.save_file_bin( i_fn.str()); //i_fn.str(""); case_max_ji = 0.0; for( int n = 0; n < ncase; n++){ cross = 0; join = 0; for( int p = 0; p < pe; p++){ if( X( p, n) < 0.0 || Xi_out[p] < 0.0){ join++; if( X( p, n) < 0.0 && Xi_out[p] < 0.0) cross++; } } ji = double(cross)/(double)join; if( ji > case_max_ji) case_max_ji = ji; } specificity += case_max_ji; if( case_max_ji > max_ji) max_ji = case_max_ji; if( case_max_ji < min_ji) min_ji = case_max_ji; //std::cout << "case_max_ji = " << case_max_ji << std::endl; fprintf( fp, "%d,%f,%f\n", i + 1 , case_max_ji, specificity / (double)(i+1)); std::cout << "specificity" << i + 1 << " = " << specificity / (double)(i+1) << std::endl; } specificity /= (double)ngene; fprintf( fp, "max_J.I.,%f\n", max_ji); fprintf( fp, "min_J.I.,%f\n", min_ji); fprintf( fp, "specificity,%f\n", specificity); std::cout << "specificity = " << specificity << std::endl; fclose(fp); }
273bc446000b7d3a1951075f4cca6debd2859bdf
5499e8b91353ef910d2514c8a57a80565ba6f05b
/src/connectivity/wlan/drivers/wlanif/test/impl_unittest.cc
99e323a450dc442f44bd5eccdb274044d6dca542
[ "BSD-3-Clause" ]
permissive
winksaville/fuchsia
410f451b8dfc671f6372cb3de6ff0165a2ef30ec
a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f
refs/heads/master
2022-11-01T11:57:38.343655
2019-11-01T17:06:19
2019-11-01T17:06:19
223,695,500
3
2
BSD-3-Clause
2022-10-13T13:47:02
2019-11-24T05:08:59
C++
UTF-8
C++
false
false
644
cc
impl_unittest.cc
// Copyright 2019 The Fuchsia Authors. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include <string.h> #include <ddk/protocol/wlanif.h> #include <gtest/gtest.h> TEST(WlanifImplUnittest, WlanifMlmeStats) { // Verify that union members of wlanif_mlme_stats do not overwrite each other. wlanif_mlme_stats_t stats = {}; stats.tag = 0x1; memset(&stats.stats.client_mlme_stats, 0x2, sizeof(stats.stats.client_mlme_stats)); EXPECT_EQ(stats.tag, 0x1); memset(&stats.stats.ap_mlme_stats, 0x3, sizeof(stats.stats.ap_mlme_stats)); EXPECT_EQ(stats.tag, 0x1); }
7fdf710944e274adabd9fc7848a353368a0c11d2
25150dc0633b56a22422527353a4ab72120169e8
/HW6/heap/heap.cpp
0f0500009c873a9b4768182bd2c5dfd6055064dd
[]
no_license
kazemicode/CST370
5e91f4baae98157d2e1270acb3d0d6e6fda8da6d
9c0c59b52a80000e118bbf04f1274e589f162266
refs/heads/master
2022-07-11T04:18:06.891636
2020-05-16T04:25:53
2020-05-16T04:25:53
232,287,913
0
0
null
null
null
null
UTF-8
C++
false
false
3,653
cpp
heap.cpp
/* * Title: heap.cpp * Abstract: Implements heap operations using the bottom-up heap construction algorithm * Creates a heap based on a set of numbers supplied from a user * Name: Sara Kazemi * Date: 02/25/2020 */ #include <iostream> using namespace std; bool heapBottomUp(int arr[], int n) { bool wasHeap = true; // will determine if input was heap originally for(int i = n/2; i > 0; i--) { int k = i; int temp = arr[k]; bool isHeap = false; while(!isHeap && 2*k <= n) { int j = 2*k; if(j < n) // 2 children { if (arr[j] < arr[j + 1]) { j = j + 1; // check biggest child } } if(temp >= arr[j]) { isHeap = true; //this part is heap } else{ wasHeap = false; // original input was not a heap! // promote child arr[k] = arr[j]; k = j; } } arr[k] = temp; // old parent becomes child } return wasHeap; } void copyArray( int arr[], int target[], int n) { for(int i = 1; i <= n; i++) { target[i] = arr[i]; } } void printHeap(int arr[], int n) { for(int i = 1; i <= n; i++) { cout << arr[i] << ' '; } cout << endl; } void printMenu() { cout << "Select an operation" << endl; cout << "1: Insert a number" << endl; cout << "2: Delete the max" << endl; cout << "3: Heapsort & Quit" << endl; } int main() { int n; // number of nodes in heap int selection; // menu selection cout << "Input size: "; cin >> n; int *arr; arr = new int[n+1](); // initialize array of size n+1 to hold input values from user cout << "Enter " << n << " numbers: "; for (int i = 1; i <= n; i++){ cin >> arr[i]; } // Determine if Heap if(heapBottomUp(arr, n)) cout << "This is a heap." << endl; else { cout << "This is NOT a heap!" << endl; cout << "Heap constructed: "; printHeap(arr, n); } // Program loop with menu prompt while(selection != 3){ printMenu(); cin >> selection; if(selection == 1) { // Insert new value and heapify n = n + 1; int *temp; temp = new int[n+1](); // copy existing heap copyArray(arr, temp, n); // Request new value and insert as next empty leaf int newValue; cout << "Enter a number: "; cin >> newValue; temp[n] = newValue; // copy arr = new int[n+1](); copyArray(temp, arr, n); heapBottomUp(arr, n); cout << "Updated heap: "; printHeap(arr, n); } else if(selection == 2) { // Delete max key int tempValue = arr[n]; // swap max key with last key arr[n] = arr[0]; arr[1] = tempValue; // Decrease heap size by 1 n = n - 1; int *temp; temp = new int[n+1](); // copy existing heap copyArray(arr, temp, n); // copy arr = new int[n+1](); copyArray(temp, arr, n); // Heapify smaller tree heapBottomUp(arr, n); cout << "Updated heap: "; printHeap(arr, n); } } // Heapsort and Bye! cout << "Heapsort: "; printHeap(arr, n); cout << "Bye!"; return 0; }
46ec796b07b0521f03aa18532e57953d61f4d334
d9515eaa3014daad9188d0ae04e53d8340221350
/Graph/Flood_Fill.cpp
1ee23884de4e6121b0df1239dcdb8d1ed0d64e0e
[]
no_license
KnifeParty12/LeetCode_Solutions
f5489d3e3323d21e6b51bbe4343ad26499ff901d
f630f8a7e33e75523f3d109c9a305b4e755d71cd
refs/heads/main
2023-02-04T04:16:32.967996
2020-12-28T08:02:26
2020-12-28T08:02:26
301,473,672
0
0
null
null
null
null
UTF-8
C++
false
false
1,037
cpp
Flood_Fill.cpp
/* https://leetcode.com/problems/flood-fill/ */ vector<pair<int,int>> dir = {{0,1},{0,-1},{1,0},{-1,0}}; int m,n; class Solution { public: void dfs(vector<vector<int>>& image,int x,int y,vector<vector<bool>> & visited){ visited[x][y] = true; for(int i = 0; i<4; i++){ int nx = x + dir[i].first; int ny = y + dir[i].second; if(nx < 0 || nx == m || ny < 0 || ny == n) continue; if(!visited[nx][ny] && image[nx][ny] == image[x][y]) dfs(image,nx,ny,visited); } } vector<vector<int>> floodFill(vector<vector<int>>& image, int sr, int sc, int newColor) { m = image.size(); n = image[0].size(); vector<vector<bool>> visited(m,vector<bool>(n,false)); dfs(image,sr,sc,visited); for(int i = 0; i<m; i++){ for(int j = 0; j<n; j++){ if(visited[i][j])image[i][j] = newColor; } } return image; } };
04683da41895028e9cebfd7b42ca0a48e62cc6eb
5a64c7cea7398dac095fd86395f90116919ebf99
/Util.h
263d828978915e00c6b134802ddf636ea090d525
[]
no_license
worldcreate/rastrigin
501852114f07abd65c25c72ad07e8c412a1cbf02
767b5e03d0c6106e76e718c7ce4af2b529dbe999
refs/heads/master
2021-01-20T22:25:47.936785
2015-07-10T12:29:13
2015-07-10T12:29:13
38,749,445
0
0
null
null
null
null
UTF-8
C++
false
false
424
h
Util.h
#ifndef _UTIL_H_ #define _UTIL_H_ #include <vector> #include <iostream> using namespace std; class Util{ public: static int getRand(int,int); static void setSeed(int ); template <typename T> static void removeVector(vector<T> &vec,int idx){ typename vector<T>::iterator it=vec.begin(); for(int i=0;i<vec.size();i++,it++){ if(i==idx){ vec.erase(it); break; } } } }; #endif
d96eb88234cacbd17be9ee90c58951805074e06e
51635684d03e47ebad12b8872ff469b83f36aa52
/external/gcc-12.1.0/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/less.cc
5061e995cc9807b85c8f03c9ee44f3c9f6e32fa7
[ "Zlib", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "GPL-3.0-only", "GCC-exception-3.1", "GPL-2.0-only", "LGPL-3.0-only", "LGPL-2.0-or-later" ]
permissive
zhmu/ananas
8fb48ddfe3582f85ff39184fc7a3c58725fe731a
30850c1639f03bccbfb2f2b03361792cc8fae52e
refs/heads/master
2022-06-25T10:44:46.256604
2022-06-12T17:04:40
2022-06-12T17:04:40
30,108,381
59
8
Zlib
2021-09-26T17:30:30
2015-01-31T09:44:33
C
UTF-8
C++
false
false
2,271
cc
less.cc
// { dg-do run { target c++11 } } // Copyright (C) 2008-2022 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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, 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 General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. // 20.8.13.2 Template class shared_ptr [util.smartptr.shared] #include <memory> #include <testsuite_hooks.h> struct A { }; namespace std { template<> struct less<A*> { static int count; bool operator()(A* l, A* r) { ++count; return l < r; } }; int less<A*>::count = 0; } // 20.8.13.2.7 shared_ptr comparison [util.smartptr.shared.cmp] int test01() { std::less<std::shared_ptr<A>> less; // test empty shared_ptrs compare equivalent std::shared_ptr<A> p1; std::shared_ptr<A> p2; VERIFY( !less(p1, p2) && !less(p2, p1) ); #ifndef __cpp_lib_three_way_comparison // In C++20 std::less<std::shared_ptr<A>> uses the operator< synthesized // from operator<=>, which uses std::compare_three_way not std::less<A*>. VERIFY( std::less<A*>::count == 2 ); #endif return 0; } // Construction from pointer int test02() { std::less<std::shared_ptr<A>> less; std::shared_ptr<A> empty; std::shared_ptr<A> p1(new A); std::shared_ptr<A> p2(new A); VERIFY( less(p1, p2) || less(p2, p1) ); VERIFY( !(less(p1, p2) && less(p2, p1)) ); p1.reset(); VERIFY( !less(p1, empty) && !less(empty, p1) ); p2.reset(); VERIFY( !less(p1, p2) && !less(p2, p1) ); return 0; } // Aliasing int test03() { std::less<std::shared_ptr<A>> less; A a; std::shared_ptr<A> p1(new A); std::shared_ptr<A> p2(p1, &a); VERIFY( less(p1, p2) || less(p2, p1) ); return 0; } int main() { test01(); test02(); test03(); return 0; }
d356024d8183c995c827fdb39bd8fe2a469d3fcb
8e5202116dda09b2b43b6a87ea61265ed78e9dcf
/rmf_traffic/thirdparty/fcl/include/fcl/math/geometry-inl.h
626a8953e6d5cf3854ad9870cad1df130883ac52
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
CLOBOT-Co-Ltd/rmf_traffic
2391c465f9d20dbc646eb519a99df76fb5e81df0
f1432d8db96db9d69246e10f4c1fe3593f2ed069
refs/heads/main
2023-08-19T14:29:29.265096
2021-09-02T06:18:37
2021-09-02T06:18:37
404,172,946
2
0
Apache-2.0
2021-09-14T06:59:09
2021-09-08T01:29:17
null
UTF-8
C++
false
false
36,362
h
geometry-inl.h
/* * Software License Agreement (BSD License) * * Copyright (c) 2011-2014, Willow Garage, Inc. * Copyright (c) 2014-2016, Open Source Robotics Foundation * 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 Open Source Robotics Foundation 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. */ /** @author Jia Pan */ #ifndef FCL_BV_DETAIL_UTILITY_INL_H #define FCL_BV_DETAIL_UTILITY_INL_H #include "fcl/math/geometry.h" #include "fcl/math/constants.h" namespace fcl { //============================================================================== extern template void normalize(Vector3d& v, bool* signal); //============================================================================== extern template void hat(Matrix3d& mat, const Vector3d& vec); //============================================================================== extern template void eigen(const Matrix3d& m, Vector3d& dout, Matrix3d& vout); //============================================================================== extern template void eigen_old(const Matrix3d& m, Vector3d& dout, Matrix3d& vout); //============================================================================== extern template void axisFromEigen( const Matrix3d& eigenV, const Vector3d& eigenS, Matrix3d& axis); //============================================================================== extern template void axisFromEigen(const Matrix3d& eigenV, const Vector3d& eigenS, Transform3d& tf); //============================================================================== extern template Matrix3d generateCoordinateSystem(const Vector3d& x_axis); //============================================================================== extern template void getRadiusAndOriginAndRectangleSize( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3d& axis, Vector3d& origin, double l[2], double& r); //============================================================================== extern template void getRadiusAndOriginAndRectangleSize( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, Transform3d& tf, double l[2], double& r); //============================================================================== extern template void circumCircleComputation( const Vector3d& a, const Vector3d& b, const Vector3d& c, Vector3d& center, double& radius); //============================================================================== extern template double maximumDistance( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, const Vector3d& query); //============================================================================== extern template void getExtentAndCenter( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3d& axis, Vector3d& center, Vector3d& extent); //============================================================================== extern template void getCovariance( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, Matrix3d& M); //============================================================================== namespace detail { //============================================================================== //============================================================================== template <typename S> FCL_EXPORT S maximumDistance_mesh( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, const Vector3<S>& query) { bool indirect_index = true; if(!indices) indirect_index = false; S maxD = 0; for(int i = 0; i < n; ++i) { unsigned int index = indirect_index ? indices[i] : i; const Triangle& t = ts[index]; for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps[point_id]; S d = (p - query).squaredNorm(); if(d > maxD) maxD = d; } if(ps2) { for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps2[point_id]; S d = (p - query).squaredNorm(); if(d > maxD) maxD = d; } } } return std::sqrt(maxD); } //============================================================================== template <typename S> FCL_EXPORT S maximumDistance_pointcloud( const Vector3<S>* const ps, const Vector3<S>* const ps2, unsigned int* indices, int n, const Vector3<S>& query) { bool indirect_index = true; if(!indices) indirect_index = false; S maxD = 0; for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Vector3<S>& p = ps[index]; S d = (p - query).squaredNorm(); if(d > maxD) maxD = d; if(ps2) { const Vector3<S>& v = ps2[index]; S d = (v - query).squaredNorm(); if(d > maxD) maxD = d; } } return std::sqrt(maxD); } //============================================================================== /// @brief Compute the bounding volume extent and center for a set or subset of /// points. The bounding volume axes are known. template <typename S> FCL_EXPORT void getExtentAndCenter_pointcloud( const Vector3<S>* const ps, const Vector3<S>* const ps2, unsigned int* indices, int n, const Matrix3<S>& axis, Vector3<S>& center, Vector3<S>& extent) { bool indirect_index = true; if(!indices) indirect_index = false; auto real_max = std::numeric_limits<S>::max(); Vector3<S> min_coord = Vector3<S>::Constant(real_max); Vector3<S> max_coord = Vector3<S>::Constant(-real_max); for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Vector3<S>& p = ps[index]; Vector3<S> proj( axis.col(0).dot(p), axis.col(1).dot(p), axis.col(2).dot(p)); for(int j = 0; j < 3; ++j) { if(proj[j] > max_coord[j]) max_coord[j] = proj[j]; if(proj[j] < min_coord[j]) min_coord[j] = proj[j]; } if(ps2) { const Vector3<S>& v = ps2[index]; Vector3<S> proj( axis.col(0).dot(v), axis.col(1).dot(v), axis.col(2).dot(v)); for(int j = 0; j < 3; ++j) { if(proj[j] > max_coord[j]) max_coord[j] = proj[j]; if(proj[j] < min_coord[j]) min_coord[j] = proj[j]; } } } const Vector3<S> o = (max_coord + min_coord) / 2; center.noalias() = axis * o; extent.noalias() = (max_coord - min_coord) * 0.5; } //============================================================================== /// @brief Compute the bounding volume extent and center for a set or subset of /// points. The bounding volume axes are known. template <typename S> FCL_EXPORT void getExtentAndCenter_mesh( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3<S>& axis, Vector3<S>& center, Vector3<S>& extent) { bool indirect_index = true; if(!indices) indirect_index = false; auto real_max = std::numeric_limits<S>::max(); Vector3<S> min_coord = Vector3<S>::Constant(real_max); Vector3<S> max_coord = Vector3<S>::Constant(-real_max); for(int i = 0; i < n; ++i) { unsigned int index = indirect_index? indices[i] : i; const Triangle& t = ts[index]; for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps[point_id]; Vector3<S> proj( axis.col(0).dot(p), axis.col(1).dot(p), axis.col(2).dot(p)); for(int k = 0; k < 3; ++k) { if(proj[k] > max_coord[k]) max_coord[k] = proj[k]; if(proj[k] < min_coord[k]) min_coord[k] = proj[k]; } } if(ps2) { for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps2[point_id]; Vector3<S> proj( axis.col(0).dot(p), axis.col(1).dot(p), axis.col(2).dot(p)); for(int k = 0; k < 3; ++k) { if(proj[k] > max_coord[k]) max_coord[k] = proj[k]; if(proj[k] < min_coord[k]) min_coord[k] = proj[k]; } } } } const Vector3<S> o = (max_coord + min_coord) / 2; center.noalias() = axis * o; extent.noalias() = (max_coord - min_coord) / 2; } //============================================================================== extern template double maximumDistance_mesh( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, const Vector3d& query); //============================================================================== extern template double maximumDistance_pointcloud( const Vector3d* const ps, const Vector3d* const ps2, unsigned int* indices, int n, const Vector3d& query); //============================================================================== extern template void getExtentAndCenter_pointcloud( const Vector3d* const ps, const Vector3d* const ps2, unsigned int* indices, int n, const Matrix3d& axis, Vector3d& center, Vector3d& extent); //============================================================================== extern template void getExtentAndCenter_mesh( const Vector3d* const ps, const Vector3d* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3d& axis, Vector3d& center, Vector3d& extent); //============================================================================== } // namespace detail //============================================================================== //============================================================================== template <typename S> FCL_EXPORT void normalize(Vector3<S>& v, bool* signal) { S sqr_length = v.squaredNorm(); if (sqr_length > 0) { v /= std::sqrt(sqr_length); *signal = true; } else { *signal = false; } } //============================================================================== template <typename Derived> FCL_EXPORT typename Derived::RealScalar triple(const Eigen::MatrixBase<Derived>& x, const Eigen::MatrixBase<Derived>& y, const Eigen::MatrixBase<Derived>& z) { return x.dot(y.cross(z)); } //============================================================================== template <typename S, int M, int N> FCL_EXPORT VectorN<S, M+N> combine( const VectorN<S, M>& v1, const VectorN<S, N>& v2) { VectorN<S, M+N> v; v << v1, v2; return v; } //============================================================================== template <typename S> FCL_EXPORT void hat(Matrix3<S>& mat, const Vector3<S>& vec) { mat << 0, -vec[2], vec[1], vec[2], 0, -vec[0], -vec[1], vec[0], 0; } //============================================================================== template<typename S> FCL_EXPORT void eigen(const Matrix3<S>& m, Vector3<S>& dout, Matrix3<S>& vout) { // We assume that m is symmetric matrix. Eigen::SelfAdjointEigenSolver<Matrix3<S>> eigensolver(m); if (eigensolver.info() != Eigen::Success) { std::cerr << "[eigen] Failed to compute eigendecomposition.\n"; return; } dout = eigensolver.eigenvalues(); vout = eigensolver.eigenvectors(); } //============================================================================== template<typename S> FCL_EXPORT void eigen_old(const Matrix3<S>& m, Vector3<S>& dout, Matrix3<S>& vout) { Matrix3<S> R(m); int n = 3; int j, iq, ip, i; S tresh, theta, tau, t, sm, s, h, g, c; int nrot; S b[3]; S z[3]; S v[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; S d[3]; for(ip = 0; ip < n; ++ip) { b[ip] = d[ip] = R(ip, ip); z[ip] = 0; } nrot = 0; for(i = 0; i < 50; ++i) { sm = 0; for(ip = 0; ip < n; ++ip) for(iq = ip + 1; iq < n; ++iq) sm += std::abs(R(ip, iq)); if(sm == 0.0) { vout.col(0) << v[0][0], v[0][1], v[0][2]; vout.col(1) << v[1][0], v[1][1], v[1][2]; vout.col(2) << v[2][0], v[2][1], v[2][2]; dout[0] = d[0]; dout[1] = d[1]; dout[2] = d[2]; return; } if(i < 3) tresh = 0.2 * sm / (n * n); else tresh = 0.0; for(ip = 0; ip < n; ++ip) { for(iq= ip + 1; iq < n; ++iq) { g = 100.0 * std::abs(R(ip, iq)); if(i > 3 && std::abs(d[ip]) + g == std::abs(d[ip]) && std::abs(d[iq]) + g == std::abs(d[iq])) R(ip, iq) = 0.0; else if(std::abs(R(ip, iq)) > tresh) { h = d[iq] - d[ip]; if(std::abs(h) + g == std::abs(h)) t = (R(ip, iq)) / h; else { theta = 0.5 * h / (R(ip, iq)); t = 1.0 /(std::abs(theta) + std::sqrt(1.0 + theta * theta)); if(theta < 0.0) t = -t; } c = 1.0 / std::sqrt(1 + t * t); s = t * c; tau = s / (1.0 + c); h = t * R(ip, iq); z[ip] -= h; z[iq] += h; d[ip] -= h; d[iq] += h; R(ip, iq) = 0.0; for(j = 0; j < ip; ++j) { g = R(j, ip); h = R(j, iq); R(j, ip) = g - s * (h + g * tau); R(j, iq) = h + s * (g - h * tau); } for(j = ip + 1; j < iq; ++j) { g = R(ip, j); h = R(j, iq); R(ip, j) = g - s * (h + g * tau); R(j, iq) = h + s * (g - h * tau); } for(j = iq + 1; j < n; ++j) { g = R(ip, j); h = R(iq, j); R(ip, j) = g - s * (h + g * tau); R(iq, j) = h + s * (g - h * tau); } for(j = 0; j < n; ++j) { g = v[j][ip]; h = v[j][iq]; v[j][ip] = g - s * (h + g * tau); v[j][iq] = h + s * (g - h * tau); } nrot++; } } } for(ip = 0; ip < n; ++ip) { b[ip] += z[ip]; d[ip] = b[ip]; z[ip] = 0.0; } } std::cerr << "eigen: too many iterations in Jacobi transform." << std::endl; return; } //============================================================================== template <typename S> FCL_EXPORT void axisFromEigen(const Matrix3<S>& eigenV, const Vector3<S>& eigenS, Matrix3<S>& axis) { int min, mid, max; if(eigenS[0] > eigenS[1]) { max = 0; min = 1; } else { min = 0; max = 1; } if(eigenS[2] < eigenS[min]) { mid = min; min = 2; } else if(eigenS[2] > eigenS[max]) { mid = max; max = 2; } else { mid = 2; } axis.col(0) = eigenV.row(max); axis.col(1) = eigenV.row(mid); axis.col(2).noalias() = axis.col(0).cross(axis.col(1)); } //============================================================================== template <typename S> FCL_EXPORT void axisFromEigen(const Matrix3<S>& eigenV, const Vector3<S>& eigenS, Transform3<S>& tf) { int min, mid, max; if(eigenS[0] > eigenS[1]) { max = 0; min = 1; } else { min = 0; max = 1; } if(eigenS[2] < eigenS[min]) { mid = min; min = 2; } else if(eigenS[2] > eigenS[max]) { mid = max; max = 2; } else { mid = 2; } tf.linear().col(0) = eigenV.col(max); tf.linear().col(1) = eigenV.col(mid); tf.linear().col(2).noalias() = tf.linear().col(0).cross(tf.linear().col(1)); } //============================================================================== template <typename S> FCL_EXPORT Matrix3<S> generateCoordinateSystem(const Vector3<S>& x_axis) { Matrix3<S> axis; axis.col(0).noalias() = x_axis.normalized(); axis.col(1).noalias() = axis.col(0).unitOrthogonal(); axis.col(2).noalias() = axis.col(0).cross(axis.col(1)).normalized(); return axis; } //============================================================================== template <typename DerivedA, typename DerivedB, typename DerivedC, typename DerivedD> FCL_EXPORT void relativeTransform( const Eigen::MatrixBase<DerivedA>& R1, const Eigen::MatrixBase<DerivedB>& t1, const Eigen::MatrixBase<DerivedA>& R2, const Eigen::MatrixBase<DerivedB>& t2, Eigen::MatrixBase<DerivedC>& R, Eigen::MatrixBase<DerivedD>& t) { EIGEN_STATIC_ASSERT( DerivedA::RowsAtCompileTime == 3 && DerivedA::ColsAtCompileTime == 3, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); EIGEN_STATIC_ASSERT( DerivedB::RowsAtCompileTime == 3 && DerivedB::ColsAtCompileTime == 1, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); EIGEN_STATIC_ASSERT( DerivedC::RowsAtCompileTime == 3 && DerivedC::ColsAtCompileTime == 3, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); EIGEN_STATIC_ASSERT( DerivedD::RowsAtCompileTime == 3 && DerivedD::ColsAtCompileTime == 1, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); R.noalias() = R1.transpose() * R2; t.noalias() = R1.transpose() * (t2 - t1); } //============================================================================== template <typename S, typename DerivedA, typename DerivedB> FCL_EXPORT void relativeTransform( const Transform3<S>& T1, const Transform3<S>& T2, Eigen::MatrixBase<DerivedA>& R, Eigen::MatrixBase<DerivedB>& t) { EIGEN_STATIC_ASSERT( DerivedA::RowsAtCompileTime == 3 && DerivedA::ColsAtCompileTime == 3, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); EIGEN_STATIC_ASSERT( DerivedB::RowsAtCompileTime == 3 && DerivedB::ColsAtCompileTime == 1, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE); R.noalias() = T1.linear().transpose() * T2.linear(); t.noalias() = T1.linear().transpose() * (T2.translation() - T1.translation()); } //============================================================================== template <typename S> FCL_EXPORT void getRadiusAndOriginAndRectangleSize( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3<S>& axis, Vector3<S>& origin, S l[2], S& r) { bool indirect_index = true; if(!indices) indirect_index = false; int size_P = ((ps2) ? 2 : 1) * ((ts) ? 3 : 1) * n; std::vector<Vector3<S>> P(size_P); int P_id = 0; if(ts) { for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Triangle& t = ts[index]; for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps[point_id]; P[P_id][0] = axis.col(0).dot(p); P[P_id][1] = axis.col(1).dot(p); P[P_id][2] = axis.col(2).dot(p); P_id++; } if(ps2) { for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps2[point_id]; P[P_id][0] = axis.col(0).dot(p); P[P_id][1] = axis.col(1).dot(p); P[P_id][2] = axis.col(2).dot(p); P_id++; } } } } else { for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Vector3<S>& p = ps[index]; P[P_id][0] = axis.col(0).dot(p); P[P_id][1] = axis.col(1).dot(p); P[P_id][2] = axis.col(2).dot(p); P_id++; if(ps2) { const Vector3<S>& v = ps2[index]; P[P_id][0] = axis.col(0).dot(v); P[P_id][1] = axis.col(1).dot(v); P[P_id][2] = axis.col(2).dot(v); P_id++; } } } S minx, maxx, miny, maxy, minz, maxz; S cz, radsqr; minz = maxz = P[0][2]; for(int i = 1; i < size_P; ++i) { S z_value = P[i][2]; if(z_value < minz) minz = z_value; else if(z_value > maxz) maxz = z_value; } r = (S)0.5 * (maxz - minz); radsqr = r * r; cz = (S)0.5 * (maxz + minz); // compute an initial length of rectangle along x direction // find minx and maxx as starting points int minindex, maxindex; minindex = maxindex = 0; S mintmp, maxtmp; mintmp = maxtmp = P[0][0]; for(int i = 1; i < size_P; ++i) { S x_value = P[i][0]; if(x_value < mintmp) { minindex = i; mintmp = x_value; } else if(x_value > maxtmp) { maxindex = i; maxtmp = x_value; } } S x, dz; dz = P[minindex][2] - cz; minx = P[minindex][0] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); dz = P[maxindex][2] - cz; maxx = P[maxindex][0] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); // grow minx for(int i = 0; i < size_P; ++i) { if(P[i][0] < minx) { dz = P[i][2] - cz; x = P[i][0] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(x < minx) minx = x; } } // grow maxx for(int i = 0; i < size_P; ++i) { if(P[i][0] > maxx) { dz = P[i][2] - cz; x = P[i][0] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(x > maxx) maxx = x; } } // compute an initial length of rectangle along y direction // find miny and maxy as starting points minindex = maxindex = 0; mintmp = maxtmp = P[0][1]; for(int i = 1; i < size_P; ++i) { S y_value = P[i][1]; if(y_value < mintmp) { minindex = i; mintmp = y_value; } else if(y_value > maxtmp) { maxindex = i; maxtmp = y_value; } } S y; dz = P[minindex][2] - cz; miny = P[minindex][1] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); dz = P[maxindex][2] - cz; maxy = P[maxindex][1] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); // grow miny for(int i = 0; i < size_P; ++i) { if(P[i][1] < miny) { dz = P[i][2] - cz; y = P[i][1] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(y < miny) miny = y; } } // grow maxy for(int i = 0; i < size_P; ++i) { if(P[i][1] > maxy) { dz = P[i][2] - cz; y = P[i][1] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(y > maxy) maxy = y; } } // corners may have some points which are not covered - grow lengths if necessary // quite conservative (can be improved) S dx, dy, u, t; S a = std::sqrt((S)0.5); for(int i = 0; i < size_P; ++i) { if(P[i][0] > maxx) { if(P[i][1] > maxy) { dx = P[i][0] - maxx; dy = P[i][1] - maxy; u = dx * a + dy * a; t = (a*u - dx)*(a*u - dx) + (a*u - dy)*(a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { maxx += u*a; maxy += u*a; } } else if(P[i][1] < miny) { dx = P[i][0] - maxx; dy = P[i][1] - miny; u = dx * a - dy * a; t = (a*u - dx)*(a*u - dx) + (-a*u - dy)*(-a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { maxx += u*a; miny -= u*a; } } } else if(P[i][0] < minx) { if(P[i][1] > maxy) { dx = P[i][0] - minx; dy = P[i][1] - maxy; u = dy * a - dx * a; t = (-a*u - dx)*(-a*u - dx) + (a*u - dy)*(a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { minx -= u*a; maxy += u*a; } } else if(P[i][1] < miny) { dx = P[i][0] - minx; dy = P[i][1] - miny; u = -dx * a - dy * a; t = (-a*u - dx)*(-a*u - dx) + (-a*u - dy)*(-a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if (u > 0) { minx -= u*a; miny -= u*a; } } } } origin = axis.col(0) * minx + axis.col(1) * miny + axis.col(2) * cz; l[0] = maxx - minx; if(l[0] < 0) l[0] = 0; l[1] = maxy - miny; if(l[1] < 0) l[1] = 0; } //============================================================================== template <typename S> FCL_EXPORT void getRadiusAndOriginAndRectangleSize( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, Transform3<S>& tf, S l[2], S& r) { bool indirect_index = true; if(!indices) indirect_index = false; int size_P = ((ps2) ? 2 : 1) * ((ts) ? 3 : 1) * n; std::vector<Vector3<S>> P(size_P); int P_id = 0; if(ts) { for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Triangle& t = ts[index]; for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps[point_id]; P[P_id][0] = tf.linear().col(0).dot(p); P[P_id][1] = tf.linear().col(1).dot(p); P[P_id][2] = tf.linear().col(2).dot(p); P_id++; } if(ps2) { for(int j = 0; j < 3; ++j) { int point_id = t[j]; const Vector3<S>& p = ps2[point_id]; P[P_id][0] = tf.linear().col(0).dot(p); P[P_id][1] = tf.linear().col(1).dot(p); P[P_id][2] = tf.linear().col(2).dot(p); P_id++; } } } } else { for(int i = 0; i < n; ++i) { int index = indirect_index ? indices[i] : i; const Vector3<S>& p = ps[index]; P[P_id][0] = tf.linear().col(0).dot(p); P[P_id][1] = tf.linear().col(1).dot(p); P[P_id][2] = tf.linear().col(2).dot(p); P_id++; if(ps2) { P[P_id][0] = tf.linear().col(0).dot(ps2[index]); P[P_id][1] = tf.linear().col(1).dot(ps2[index]); P[P_id][2] = tf.linear().col(2).dot(ps2[index]); P_id++; } } } S minx, maxx, miny, maxy, minz, maxz; S cz, radsqr; minz = maxz = P[0][2]; for(int i = 1; i < size_P; ++i) { S z_value = P[i][2]; if(z_value < minz) minz = z_value; else if(z_value > maxz) maxz = z_value; } r = (S)0.5 * (maxz - minz); radsqr = r * r; cz = (S)0.5 * (maxz + minz); // compute an initial length of rectangle along x direction // find minx and maxx as starting points int minindex, maxindex; minindex = maxindex = 0; S mintmp, maxtmp; mintmp = maxtmp = P[0][0]; for(int i = 1; i < size_P; ++i) { S x_value = P[i][0]; if(x_value < mintmp) { minindex = i; mintmp = x_value; } else if(x_value > maxtmp) { maxindex = i; maxtmp = x_value; } } S x, dz; dz = P[minindex][2] - cz; minx = P[minindex][0] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); dz = P[maxindex][2] - cz; maxx = P[maxindex][0] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); // grow minx for(int i = 0; i < size_P; ++i) { if(P[i][0] < minx) { dz = P[i][2] - cz; x = P[i][0] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(x < minx) minx = x; } } // grow maxx for(int i = 0; i < size_P; ++i) { if(P[i][0] > maxx) { dz = P[i][2] - cz; x = P[i][0] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(x > maxx) maxx = x; } } // compute an initial length of rectangle along y direction // find miny and maxy as starting points minindex = maxindex = 0; mintmp = maxtmp = P[0][1]; for(int i = 1; i < size_P; ++i) { S y_value = P[i][1]; if(y_value < mintmp) { minindex = i; mintmp = y_value; } else if(y_value > maxtmp) { maxindex = i; maxtmp = y_value; } } S y; dz = P[minindex][2] - cz; miny = P[minindex][1] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); dz = P[maxindex][2] - cz; maxy = P[maxindex][1] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); // grow miny for(int i = 0; i < size_P; ++i) { if(P[i][1] < miny) { dz = P[i][2] - cz; y = P[i][1] + std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(y < miny) miny = y; } } // grow maxy for(int i = 0; i < size_P; ++i) { if(P[i][1] > maxy) { dz = P[i][2] - cz; y = P[i][1] - std::sqrt(std::max<S>(radsqr - dz * dz, 0)); if(y > maxy) maxy = y; } } // corners may have some points which are not covered - grow lengths if necessary // quite conservative (can be improved) S dx, dy, u, t; S a = std::sqrt((S)0.5); for(int i = 0; i < size_P; ++i) { if(P[i][0] > maxx) { if(P[i][1] > maxy) { dx = P[i][0] - maxx; dy = P[i][1] - maxy; u = dx * a + dy * a; t = (a*u - dx)*(a*u - dx) + (a*u - dy)*(a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { maxx += u*a; maxy += u*a; } } else if(P[i][1] < miny) { dx = P[i][0] - maxx; dy = P[i][1] - miny; u = dx * a - dy * a; t = (a*u - dx)*(a*u - dx) + (-a*u - dy)*(-a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { maxx += u*a; miny -= u*a; } } } else if(P[i][0] < minx) { if(P[i][1] > maxy) { dx = P[i][0] - minx; dy = P[i][1] - maxy; u = dy * a - dx * a; t = (-a*u - dx)*(-a*u - dx) + (a*u - dy)*(a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if(u > 0) { minx -= u*a; maxy += u*a; } } else if(P[i][1] < miny) { dx = P[i][0] - minx; dy = P[i][1] - miny; u = -dx * a - dy * a; t = (-a*u - dx)*(-a*u - dx) + (-a*u - dy)*(-a*u - dy) + (cz - P[i][2])*(cz - P[i][2]); u = u - std::sqrt(std::max<S>(radsqr - t, 0)); if (u > 0) { minx -= u*a; miny -= u*a; } } } } tf.translation().noalias() = tf.linear().col(0) * minx; tf.translation().noalias() += tf.linear().col(1) * miny; tf.translation().noalias() += tf.linear().col(2) * cz; l[0] = maxx - minx; if(l[0] < 0) l[0] = 0; l[1] = maxy - miny; if(l[1] < 0) l[1] = 0; } //============================================================================== template <typename S> FCL_EXPORT void circumCircleComputation( const Vector3<S>& a, const Vector3<S>& b, const Vector3<S>& c, Vector3<S>& center, S& radius) { Vector3<S> e1 = a - c; Vector3<S> e2 = b - c; S e1_len2 = e1.squaredNorm(); S e2_len2 = e2.squaredNorm(); Vector3<S> e3 = e1.cross(e2); S e3_len2 = e3.squaredNorm(); radius = e1_len2 * e2_len2 * (e1 - e2).squaredNorm() / e3_len2; radius = std::sqrt(radius) * 0.5; center = c; center.noalias() += (e2 * e1_len2 - e1 * e2_len2).cross(e3) * (0.5 * 1 / e3_len2); } //============================================================================== template <typename S> FCL_EXPORT S maximumDistance( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, const Vector3<S>& query) { if(ts) return detail::maximumDistance_mesh(ps, ps2, ts, indices, n, query); else return detail::maximumDistance_pointcloud(ps, ps2, indices, n, query); } //============================================================================== template <typename S> FCL_EXPORT void getExtentAndCenter( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, const Matrix3<S>& axis, Vector3<S>& center, Vector3<S>& extent) { if(ts) detail::getExtentAndCenter_mesh(ps, ps2, ts, indices, n, axis, center, extent); else detail::getExtentAndCenter_pointcloud(ps, ps2, indices, n, axis, center, extent); } //============================================================================== template <typename S> FCL_EXPORT void getCovariance( const Vector3<S>* const ps, const Vector3<S>* const ps2, Triangle* ts, unsigned int* indices, int n, Matrix3<S>& M) { Vector3<S> S1 = Vector3<S>::Zero(); Vector3<S> S2[3] = { Vector3<S>::Zero(), Vector3<S>::Zero(), Vector3<S>::Zero() }; if(ts) { for(int i = 0; i < n; ++i) { const Triangle& t = (indices) ? ts[indices[i]] : ts[i]; const Vector3<S>& p1 = ps[t[0]]; const Vector3<S>& p2 = ps[t[1]]; const Vector3<S>& p3 = ps[t[2]]; S1 += (p1 + p2 + p3).eval(); S2[0][0] += (p1[0] * p1[0] + p2[0] * p2[0] + p3[0] * p3[0]); S2[1][1] += (p1[1] * p1[1] + p2[1] * p2[1] + p3[1] * p3[1]); S2[2][2] += (p1[2] * p1[2] + p2[2] * p2[2] + p3[2] * p3[2]); S2[0][1] += (p1[0] * p1[1] + p2[0] * p2[1] + p3[0] * p3[1]); S2[0][2] += (p1[0] * p1[2] + p2[0] * p2[2] + p3[0] * p3[2]); S2[1][2] += (p1[1] * p1[2] + p2[1] * p2[2] + p3[1] * p3[2]); if(ps2) { const Vector3<S>& p1 = ps2[t[0]]; const Vector3<S>& p2 = ps2[t[1]]; const Vector3<S>& p3 = ps2[t[2]]; S1 += (p1 + p2 + p3).eval(); S2[0][0] += (p1[0] * p1[0] + p2[0] * p2[0] + p3[0] * p3[0]); S2[1][1] += (p1[1] * p1[1] + p2[1] * p2[1] + p3[1] * p3[1]); S2[2][2] += (p1[2] * p1[2] + p2[2] * p2[2] + p3[2] * p3[2]); S2[0][1] += (p1[0] * p1[1] + p2[0] * p2[1] + p3[0] * p3[1]); S2[0][2] += (p1[0] * p1[2] + p2[0] * p2[2] + p3[0] * p3[2]); S2[1][2] += (p1[1] * p1[2] + p2[1] * p2[2] + p3[1] * p3[2]); } } } else { for(int i = 0; i < n; ++i) { const Vector3<S>& p = (indices) ? ps[indices[i]] : ps[i]; S1 += p; S2[0][0] += (p[0] * p[0]); S2[1][1] += (p[1] * p[1]); S2[2][2] += (p[2] * p[2]); S2[0][1] += (p[0] * p[1]); S2[0][2] += (p[0] * p[2]); S2[1][2] += (p[1] * p[2]); if(ps2) // another frame { const Vector3<S>& p = (indices) ? ps2[indices[i]] : ps2[i]; S1 += p; S2[0][0] += (p[0] * p[0]); S2[1][1] += (p[1] * p[1]); S2[2][2] += (p[2] * p[2]); S2[0][1] += (p[0] * p[1]); S2[0][2] += (p[0] * p[2]); S2[1][2] += (p[1] * p[2]); } } } int n_points = ((ps2) ? 2 : 1) * ((ts) ? 3 : 1) * n; M(0, 0) = S2[0][0] - S1[0]*S1[0] / n_points; M(1, 1) = S2[1][1] - S1[1]*S1[1] / n_points; M(2, 2) = S2[2][2] - S1[2]*S1[2] / n_points; M(0, 1) = S2[0][1] - S1[0]*S1[1] / n_points; M(1, 2) = S2[1][2] - S1[1]*S1[2] / n_points; M(0, 2) = S2[0][2] - S1[0]*S1[2] / n_points; M(1, 0) = M(0, 1); M(2, 0) = M(0, 2); M(2, 1) = M(1, 2); } } // namespace fcl #endif
90af37ce4bd2707af14ccc13db6ba85e06d1cc74
0bb777c544c48a5940080fbfe88261d8aed95fda
/Libs/Generic/Logger.cpp
d51bd2a0263bf97a27e67d4e2520d2131017ca92
[]
no_license
ktd2004/Game_Server
7908678c13635fbb7585afca0ba35603528a6b3f
f9c5831f75a46697ab2d1f94107ea241005dcd7d
refs/heads/master
2021-01-20T10:00:13.552028
2017-08-28T07:54:14
2017-08-28T07:54:14
101,618,429
0
0
null
null
null
null
UHC
C++
false
false
6,094
cpp
Logger.cpp
/* Copyright 2013 by Lee yong jun * All rights reserved * * Distribute freely, except: don't remove my name from the source or * documentation (don't take credit for my work), mark your changes (don't * get me blamed for your possible bugs), don't alter or remove this * notice. May be sold if buildable source is provided to buyer. No * warrantee of any kind, express or implied, is included with this * software; use at your own risk, responsibility for damages (if any) to * anyone resulting from the use of this software rests entirely with the * user. * * Send bug reports, bug fixes, enhancements, requests, flames, etc., and * I'll try to keep a version up to date. I can be reached as follows: * Lee yong jun iamhere01@naver.com */ #include "stdafx.h" #include <MacroFunc.h> #include <StringUtil.h> #include <FileUtil.h> #include <TimeUtil.h> #include <Logger.h> #define INF_TAG "INF" #define ERR_TAG "ERR" #define DBG_TAG "DBG" #define SND_TAG "SND" #define SYS_TAG "SYS" namespace { static char *pszLevel[] = { INF_TAG,ERR_TAG, DBG_TAG, SND_TAG, SYS_TAG, nullptr }; const uint32 MIN_LOG_SIZE = 1024 * 512; // 512KB const uint32 MAX_LOG_SIZE = 4294967295; // 4GB } #undef INF_TAG #undef ERR_TAG #undef DBG_TAG #undef SND_TAG #undef SYS_TAG Logger* Logger::instance() { static Logger inst; return &inst; } Logger::Logger() : m_File(0) , m_pCallback(nullptr) , m_iMaxSize(0) , m_iCurrSize(0) , m_bWrite(false) , m_iBit(eLOG_BIT_STDOUT) , m_tLastTm(0) , m_pThread(nullptr) , m_iLogBufs(0) , m_iMaxLogBufs(1000) , m_bLoop(true) { m_szOutputPath[0] = 0; m_szFileName[0] = 0; } Logger::~Logger() { if (m_File) { ::fclose(m_File); } } void Logger::SetCallback( LogWriteCallback *pCallback ) { m_pCallback = pCallback; } void Logger::SetRedirect( uint32 iBit ) { set_bit(m_iBit,iBit); } void Logger::ClrRedirect( uint32 iBit ) { clr_bit(m_iBit,iBit); } void Logger::WriteFile( uint32 iLevel, const char* szFmt, va_list arg ) { LogData* pData = nullptr; Guard lock(m_Mutex); if ( m_LogPool.empty() ) { pData = new LogData; m_iLogBufs++; } else { pData = m_LogPool.front(); m_LogPool.pop_front(); } if ( !m_pThread ) { m_pThread = CREATE_THREAD_V0( this, &Logger::Running, 0 ); m_pThread->Resume(); } vsprintf_s(pData->pText, sizeof(pData->pText), szFmt, arg); m_LogQ.push_back( pData ); m_Evt.Wakeup(); } void Logger::Write( uint32 iLevel, const char* szFmt, ... ) { char* p = pszLevel[0]; #define case_tag(x, y) case x : p = pszLevel[y]; break; switch ( iLevel ) { case_tag(eLOG_INFO, 0); case_tag(eLOG_ERROR, 1); case_tag(eLOG_DEBUG, 2); case_tag(eLOG_SEND, 3); case_tag(eLOG_SYS, 4); } #undef case_tag if (iLevel == eLOG_SYS && !is_bit_on(m_iBit,eLOG_BIT_SYSTEM)) { return; } const std::string sTm = util::to_char( ::time(NULL), "HH:MI:SS"); va_list arg; va_start(arg, szFmt); char szBufStd[2048]; int iLen = sprintf_s( szBufStd, sizeof(szBufStd), "%s-%s: %s\n", p, sTm.c_str(), szFmt ); if ( is_bit_on(m_iBit,eLOG_BIT_STDOUT)) { // eLOG_SEND는 콘솔에 출력하지 않도록 함 if( iLevel != eLOG_SEND ) { vprintf( szBufStd, arg ); } } if ( is_bit_on(m_iBit,eLOG_BIT_FILE) ) { WriteFile( iLevel, szBufStd, arg ); } if ( m_pCallback ) { LogWriteCallback* pCur = m_pCallback; while (pCur) { szBufStd[iLen-1] = 0; // 개행문자 제거 pCur->OnWrite( iLevel, szBufStd, arg ); pCur = pCur->m_pNext; } } va_end(arg); } void Logger::SetFile( const std::string& sOutPath, uint32 iSize, uint32 iMaxLogBufs ) { Guard lock(m_Mutex); char szExe[MAX_PATH]; GetModuleFileName(nullptr, szExe, sizeof(szExe)); std::string s = basename(szExe); strcpy( m_szProgName, cstr(s) ); m_iMaxSize = iSize; m_iMaxLogBufs = iMaxLogBufs; strcpy( m_szOutputPath, cstr(sOutPath) ); int32 iRet = util::isfolder( m_szOutputPath ); if( iRet != util::eFolder ) { util::makedir( m_szOutputPath ); } if( m_iMaxSize < MIN_LOG_SIZE ) { m_iMaxSize = MIN_LOG_SIZE; } if( m_iMaxLogBufs > 1000 ) { m_iMaxLogBufs = 1000; } } void Logger::Running( void ) { while (m_bLoop) { if ( m_Evt.Wait(1000) == false ) { continue; } // 성능 향상을 위해서 lock 최소화 LogQ Que; { Guard lock(m_Mutex); Que.merge( m_LogQ ); } if ( Que.size() == 0 ) { continue; } // 하루에 파일 1개씩 생성되게 time_t tCurr = util::maketime(0, "YYYYMMDD"); if ( m_File && access(m_szFileName, 0) != 0 ) { ::fclose(m_File); m_iCurrSize = 0; m_File = nullptr; } if ( m_File == nullptr || m_iCurrSize > m_iMaxSize || tCurr != m_tLastTm ) { sprintf_s( m_szFileName, sizeof(m_szFileName), "%s\\%s_D%s_%d.log", m_szOutputPath, m_szProgName, util::to_char(::time(NULL), "YYMMDD_HHMISS").c_str(), ::GetCurrentProcessId() ); if ( m_File ) { ::fclose(m_File); m_File = nullptr; } if ( nullptr == (m_File = fopen(m_szFileName, "w+")) ) { return; } m_iCurrSize = 0; m_tLastTm = tCurr; } while( !Que.empty() ) { LogData* pData = Que.front(); Que.pop_front(); m_iCurrSize += fprintf(m_File, "%s",pData->pText ); } fflush(m_File); // 로그버퍼 풀 정리 if ( m_iLogBufs > m_iMaxLogBufs ) { Guard lock(m_Mutex); m_LogPool.merge( Que ); while ( !m_LogPool.empty() && m_iLogBufs > m_iMaxLogBufs*0.1 ) { LogData* pData = m_LogPool.front(); m_LogPool.pop_front(); delete pData; m_iLogBufs--; } } } printf( "log thread exit\n" ); } void Logger::Stop( void ) { if ( m_pThread ) { locked_exchange(m_bLoop, false); HANDLE hThread = m_pThread->GetHandle(); while ( ::WaitForSingleObject(hThread, 500) == WAIT_TIMEOUT ) { m_Evt.Wakeup(); m_pThread->Terminate(); } } }
4d323169055a7395a089f43e6f80adba9fb7e39c
8a3a9fbc5ebacce805eca7f75c79ece791c8be3a
/KUKA201804191703/Decode/common/macro.cpp
aa8480505e6789796fbb5250f05d6de1560ab145
[]
no_license
jan-kun/GitProject
7abd583d3e0663440c1464cdb811e11eca3dc5b6
cf0add8d35414eba32e1d1f36952f0af765327ac
refs/heads/master
2020-03-15T04:40:11.013631
2018-05-07T08:06:17
2018-05-07T08:06:17
131,970,975
0
1
null
null
null
null
UTF-8
C++
false
false
4,805
cpp
macro.cpp
/******************************************************************************* * GPCNC * The General-Purposed CNC Software Develop Environment * (c) Copyright 2004-2013, Automation Depatment of NJIT * All Rights Reserved * *-----------------------文件信息----------------------------------------------- * 文件名: .c * 描 述: * * 创建人: * 版 本: * 日 期: * * 修改人: * 版 本: * 日 期: * 修改信息: * * 说明: * *... ******************************************************************************/ #include "macro.h" char DECL[5] = "DECL"; char INT_[4] = "INT"; char BASIS_SUGG_T[13] = "BASIS_SUGG_T"; char E6POS_[6] = "E6POS"; char PDAT_[5] = "PDAT"; char FDAT_[5] = "FDAT"; char LDAT_[5] = "LDAT"; char TQM_TQDAT_T[12] = "TQM_TQDAT_T"; char T11[4] = "T11"; char T12[4] = "T12"; char T13[4] = "T13"; char T14[4] = "T14"; char T15[4] = "T15"; char T16[4] = "T16"; char T21[4] = "T21"; char T22[4] = "T22"; char T23[4] = "T23"; char T24[4] = "T24"; char T25[4] = "T25"; char T26[4] = "T26"; char K1[3] = "K1"; char K2[3] = "K2"; char K3[3] = "K3"; char K4[3] = "K4"; char K5[3] = "K5"; char K6[3] = "K6"; char o1[3] = "o1"; char o2[3] = "o2"; char ID[3] = "ID"; char OVM[4] = "OVM"; char TMF[4] = "TMF"; char VEL[4] = "VEL"; char ACC[4] = "ACC"; char APO_MODE[9] = "APO_MODE"; char APO_DIST[9] = "APO_DIST"; char CDIS[6] = "#CDIS"; char TOOL_NO[8] = "TOOL_NO"; char BASE_NO[8] = "BASE_NO"; char IPO_FRAME[10] = "IPO_FRAME"; char BASE[6] = "#BASE"; char TCP[5] = "#TCP"; char POINT2[9] = "POINT2[]"; char TQ_STATE[9] = "TQ_STATE"; char TRUE_[5] = "TRUE"; char FALSE_[6] = "FALSE"; char APO_FAC[8] = "APO_FAC"; char AXIS_VEL[9] = "AXIS_VEL"; char AXIS_ACC[9] = "AXIS_ACC"; char ORI_TYP[8] = "ORI_TYP"; char VAR[5] = "#VAR"; char JOINT[7] = "#JOINT"; char CONSTANT[10] = "#CONSTANT"; char CIRC_TYP[9] = "CIRC_TYP"; char JERK_FAC[9] = "JERK_FAC"; char GEAR_JERK[10] = "GEAR_JERK"; char EXAX_IGN[9] = "EXAX_IGN"; /*-------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------*/ /*代码源文件*****************************************************************************/ char INI[4] = "INI"; char _FOLD[6] = ";FOLD"; char _ENDFOLD[9] = ";ENDFOLD"; char _BWDSTART[10] = "$BWDSTART"; char PDAT_ACT[9] = "PDAT_ACT"; char LDAT_ACT[9] = "LDAT_ACT"; char FDAT_ACT[9] = "FDAT_ACT"; char BAS[4] = "BAS"; char _H_POS[7] = "$H_POS"; char PTP_[4] = "PTP"; char LIN_[4] = "LIN"; char CIRC_[5] = "CIRC"; char LOOP[5] = "LOOP"; char ENDLOOP[8] = "ENDLOOP"; char EXIT[5] = "Exit"; char WHILE[6] = "WHILE"; char ENDWHILE[9] = "ENDWHILE"; char IF[3] = "IF"; char ELSE[5] = "ELSE"; char ENDIF[6] = "ENDIF"; char FOR[4] = "FOR"; char ENDFOR[7] = "ENDFOR"; char DEF[4] = "DEF"; char END[4] = "END"; char _IN[4] = "$IN"; char _OUT[5] = "$OUT"; /*默认得参数*****************************************************************************/ char PDEFAULT[9] = "PDEFAULT"; /* PDAT_ACT */ char FHOME[6] = "FHOME"; /* FDAT_ACT */ char XHOME[6] = "XHOME"; /* PTP */ /* 关键字的字符识别 */ size_t SizeVel = strlen(VEL); size_t SizeAcc = strlen(ACC); size_t SizeApoDist = strlen(APO_DIST); size_t SizeApoFac = strlen(APO_FAC); size_t SizeAxisVel = strlen(AXIS_VEL); size_t SizeAxisAcc = strlen(AXIS_ACC); size_t SizeOriTyp = strlen(ORI_TYP); size_t SizeCircTyp = strlen(CIRC_TYP); size_t SizeJerkFac = strlen(JERK_FAC); size_t SizeGearJerk = strlen(GEAR_JERK); size_t SizeExaxIgn = strlen(EXAX_IGN); size_t SizeApoMode = strlen(APO_MODE); size_t SizeToolNo = strlen(TOOL_NO); size_t SizeBaseNo = strlen(BASE_NO); size_t SizeIpoFrame = strlen(IPO_FRAME); size_t SizePoint2 = strlen(POINT2); size_t SizeTqState = strlen(TQ_STATE); size_t SizeTxx = strlen(T11); size_t SizeKx = strlen(K1); size_t SizeOvm = strlen(OVM);
183eadb2015e9bb31a2340805b3736067e54de05
b588cb851a14eb6d594c21e8e88469af0247a199
/engine/memory/WHEvent.h
10ba5dd0db805768e01bbd48f425dc006068c5dd
[]
no_license
Egor2001/whirl
cd94a155870998923cb8fa58edefb5f64d49c5f1
e4bc65f6e62838b296f7caab242a19140170a1cc
refs/heads/master
2021-01-23T01:18:50.400397
2017-09-06T04:46:46
2017-09-06T04:46:46
85,899,839
0
0
null
null
null
null
UTF-8
C++
false
false
1,817
h
WHEvent.h
#pragma once #include "cuda.h" #include "cuda_runtime.h" #include "../logger/WHLogger.h" namespace whirl { class WHEvent final { public: WHEvent(unsigned int flags = cudaEventDefault) noexcept : event_handle_{nullptr} { WHIRL_CUDA_CALL(cudaEventCreateWithFlags(&event_handle_, flags)); } WHEvent (const WHEvent&) = delete; WHEvent& operator = (const WHEvent&) = delete; WHEvent(WHEvent&& move_event) noexcept : event_handle_(move_event.event_handle_) { move_event.event_handle_ = nullptr; } WHEvent& operator = (WHEvent&& move_event) noexcept { event_handle_ = move_event.event_handle_; move_event.event_handle_ = nullptr; } ~WHEvent() { WHIRL_CUDA_CALL(cudaEventDestroy(event_handle_)); event_handle_ = nullptr; } void reset(unsigned int flags = cudaEventDefault) { if (event_handle_) WHIRL_CUDA_CALL(cudaEventDestroy(event_handle_)); WHIRL_CUDA_CALL(cudaEventCreateWithFlags(&event_handle_, flags)); } void record(cudaStream_t stream = nullptr) const noexcept { WHIRL_CUDA_CALL(cudaEventRecord(event_handle_, stream)); } bool query() const noexcept { return WHIRL_CUDA_CALL(cudaEventQuery(event_handle_)) == cudaSuccess; } void synchronize() const noexcept { WHIRL_CUDA_CALL(cudaEventSynchronize(event_handle_)); } float elapsed_time(cudaEvent_t end_event) const noexcept { float result = 0.0f; WHIRL_CUDA_CALL(cudaEventElapsedTime(&result, event_handle_, end_event)); return result; } cudaEvent_t get_event_handle() const noexcept { return event_handle_; } private: cudaEvent_t event_handle_; }; }//namespace whirl
e5277879241c71dfd3b267bf249b5a6b8d526a99
0cbf33215e73fd3d4f250faeea9b357ebaea7f34
/src/global_vars.cpp
e875f85260705952332e30c4157c76c2e02369ed
[]
no_license
ThomasFiller/Rambo2_FW_ESP32
94d0d0f8c95293db14dc9bfc126413711716e114
80b074717e54c137af305dc36a4cd4949c8860b7
refs/heads/master
2023-06-23T18:14:04.846485
2021-07-23T10:34:32
2021-07-23T10:34:32
364,560,977
0
0
null
null
null
null
UTF-8
C++
false
false
6,372
cpp
global_vars.cpp
//#pragma SYMBOLS #include "global_vars.h" //*******************************Flag STM8 guiFlags bool FLAG_CHANGE_SETUP_REQUIRED ; bool FLAG_SAVE_SETUP_REQUIRED ; bool FLAG_READ_ADC_AND_SWITCH_REQUIRED ; bool FLAG_SET_I_LAS_REQUIRED ; bool FLAG_READ_ALL_ICHTP_REGISTERS ; bool FLAG_SET_DCO_REQUIRED ; bool FLAG_SET_TEMP_REQUIRED ; bool FLAG_SET_DAC_B_REQUIRED ; bool FLAG_SET_DAC_C_REQUIRED ; bool FLAG_SET_DAC_D_REQUIRED ; bool FLAG_BLINK_LED_REQUIRED ; bool FLAG_CHANGE_TRIGGER_FUNCTION_REQUIRED ; uint8_t gucSetupNo; uint8_t gucTriggerFunction; //Triggerfunktion: 0-interner Trigger, 1-extern rising edge, 2-extern falling edge, 3-extern state typUnsignedWord gstInternalTriggerFrequency; uint8_t gucLaserToSet = 0; uint8_t gu8DcoToSet = 0; uint8_t au8_I2cData[4]; uint8_t au8_I2cReadData[0x20]; uint8_t au8_IchtpRegisters[0x20]; uint8_t gu8_NoOfIchtpToRead; bool bSetAllLaser = (bool)1; bool bSetAllDco = (bool)1; bool bPwrSourcesJustEnabled=(bool)0; uint8_t IO_PULL_EN_LAS[NO_OF_LASERS]= {IO_PULL_EN_LAS0,IO_PULL_EN_LAS1,IO_PULL_EN_LAS2,IO_PULL_EN_LAS3,IO_PULL_EN_LAS4,IO_PULL_EN_LAS5,IO_PULL_EN_LAS6,IO_PULL_EN_LAS7,IO_PULL_EN_LAS8,IO_PULL_EN_LAS9,IO_PULL_EN_LAS10,IO_PULL_EN_LAS11 }; uint8_t IO_PRG0_LAS [NO_OF_LASERS]= {IO_PRG0_LAS0 ,IO_PRG0_LAS1 ,IO_PRG0_LAS2 ,IO_PRG0_LAS3 ,IO_PRG0_LAS4 ,IO_PRG0_LAS5 ,IO_PRG0_LAS6 ,IO_PRG0_LAS7 ,IO_PRG0_LAS8 ,IO_PRG0_LAS9 ,IO_PRG0_LAS10 ,IO_PRG0_LAS11 }; uint8_t IC_LAS [NO_OF_LASERS]= {IC_LAS0 ,IC_LAS1 ,IC_LAS2 ,IC_LAS3 ,IC_LAS4 ,IC_LAS5 ,IC_LAS6 ,IC_LAS7 ,IC_LAS8 ,IC_LAS9 ,IC_LAS10 ,IC_LAS11 }; //uint8_t EN_LAS_PIN [NO_OF_LASERS] = { EN_LAS0_PIN, EN_LAS1_PIN, EN_LAS2_PIN, EN_LAS3_PIN, EN_LAS4_PIN, EN_LAS5_PIN, EN_LAS6_PIN, EN_LAS7_PIN, EN_LAS8_PIN, EN_LAS9_PIN }; uint8_t I2C_LAS_ADDRESS[NO_OF_LASERS + NO_OF_HEATERS] = {I2C_ADDRESS_LAS_DRV_E, I2C_ADDRESS_LAS_DRV_E, I2C_ADDRESS_LAS_DRV_D, I2C_ADDRESS_LAS_DRV_D, I2C_ADDRESS_LAS_DRV_C, I2C_ADDRESS_LAS_DRV_C, I2C_ADDRESS_LAS_DRV_B, I2C_ADDRESS_LAS_DRV_B, I2C_ADDRESS_LAS_DRV_A, I2C_ADDRESS_LAS_DRV_A, I2C_ADDRESS_HEAT_DRV_0, I2C_ADDRESS_HEAT_DRV_1, I2C_ADDRESS_HEAT_DRV_2, I2C_ADDRESS_HEAT_DRV_3}; uint8_t I2C_LAS_CHANNEL[NO_OF_LASERS + NO_OF_HEATERS] = {SCL1, SCL1, SCL1, SCL1, SCL1, SCL1, SCL2, SCL2, SCL2, SCL2, SCL3, SCL3, SCL3, SCL3}; uint8_t OFFSET_REG0x15[NO_OF_LASERS + NO_OF_HEATERS] = {0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x0F}; uint8_t I2C_DCO_CHANNEL[2 + NO_OF_HEATERS] = {SCL1, SCL1, SCL3, SCL3, SCL3, SCL3}; uint8_t gu8Dco[2 + NO_OF_HEATERS + 1] = {0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,0x3F}; uint8_t LASER_OF_DCO[2 + NO_OF_HEATERS]= {0, 4, 10, 11, 12, 13}; uint8_t IO_EN_PWR[2 + NO_OF_HEATERS]={ IO_EN_LASER_PWR_HI,IO_EN_LASER_PWR_LO ,IO_EN_HEATER_PWR,IO_EN_HEATER_PWR,IO_EN_HEATER_PWR,IO_EN_HEATER_PWR}; uint8_t DCO[NO_OF_LASERS + NO_OF_HEATERS] ={0,0,0,0,1,1,1,1,1,1,2,2,3,3}; iCHTP LaserDriver[NO_OF_LASERS + NO_OF_HEATERS]; HDC2080 TempHumSensor(I2C_ADDRESS_TEMP_HUM_SENSOR, I2C_CHAN_TEMP_HUM_SENSOR); LTC2635 TecDac(I2C_ADDRESS_DAC_TEC, I2C_CHAN_DAC_TEC); Adafruit_ADS1015 TecAdc(I2C_ADDRESS_ADC_TEC, I2C_CHAN_ADC_TEC); Adafruit_ADS1015 LiaAdc(I2C_ADDRESS_ADC_Lia, I2C_CHAN_INTER_BOARD); PCF8575 GpioExpanderIc94(I2C_ADDRESS_GPIO_EXPANDER_UCBOARD_IC94, I2C_CHAN_INTER_BOARD); PCF8575 GpioExpanderIc91(I2C_ADDRESS_GPIO_EXPANDER_UCBOARD_IC91, I2C_CHAN_INTER_BOARD); PCF8575 GpioExpanderTia(I2C_ADDRESS_GPIO_EXPANDER_Tia, I2C_CHAN_INTER_BOARD); PCF8575 GpioExpanderLia(I2C_ADDRESS_GPIO_EXPANDER_Lia, I2C_CHAN_INTER_BOARD); uint8_t u8AvailableI2c = 0; typUnsignedWord gstTecTemperature; typUnsignedWord gstTecVoltage; typSigned32 gstLiaVoltage; typUnsignedWord gstAvailableIchtp; typUnsignedWord gstDAC[NO_OF_DACS]; typUnsignedWord gstIlas[NO_OF_LASERS + NO_OF_HEATERS + NO_OF_300mALASERS]; uint8_t gucEnLas[NO_OF_LASERS + NO_OF_300mALASERS + NO_OF_HEATERS]; typUnsignedWord gstBoardTemperature; typUnsignedWord gstBoardHumidity; typUnsignedWord gstAdcValue[NO_OF_LASERS + NO_OF_HEATERS][5]; bool bMapc[NO_OF_LASERS + NO_OF_HEATERS]; typUnsignedWord gstTemperature; typUnsignedWord gstItec; typUnsignedWord gstVtec; typUnsignedWord gstTec5V; typUnsignedWord gstTiaDigital; typUnsignedWord gstLiaDigital; uint8_t u8LiaAnalogRange = (ADS1015_REG_CONFIG_PGA_1_024V >> 8); uint8_t u8LiaAnalogAvgDepth; uint8_t DataDirection; uint16_t guiCurrentADChannel; uint8_t gucDeviceState=STATE_OFF; uint8_t gucDeviceStateShadow=STATE_OFF; volatile uint8_t i2c_err_save; // I2C1->SR2 copy in case of error //EEPROM - Parameterablage const int eeucSetupNo = 0; const int eeucStorageBytes[NO_OF_STORAGE_BYTES] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}; const int eeucCheckFirstCall={26}; const int eeucDacLowByte[NO_OF_DACS][NO_OF_SETUPS]={27,28,29,30,31,32,33,34}; const int eeucDacHighByte[NO_OF_DACS][NO_OF_SETUPS]={35,36,37,38,39,40,41,42}; const int eeucIlasLowByte[NO_OF_LASERS+NO_OF_HEATERS+NO_OF_300mALASERS][NO_OF_SETUPS]={43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74}; const int eeucIlasHighByte[NO_OF_LASERS+NO_OF_HEATERS+NO_OF_300mALASERS][NO_OF_SETUPS]={75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106}; const int eeucEnLas[NO_OF_LASERS][NO_OF_SETUPS]={107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126}; const int eeucIntTrigFreqLowByte[NO_OF_SETUPS]={127,128}; const int eeucIntTrigFreqHighByte[NO_OF_SETUPS]={129,130}; const int eeucTriggerFunction[NO_OF_SETUPS]={131,132}; const int eeucDco[2+NO_OF_HEATERS+1][NO_OF_SETUPS]={133,134,135,136,137,138,139, 140,141,142,143,144,145,146}; const int eeucTiaDigital[NO_OF_SETUPS]={147,148}; const int eeucLiaDigitalLowByte[NO_OF_SETUPS]={149,1502}; const int eeucLiaDigitalHighByte[NO_OF_SETUPS]={151, 152}; const int eeucLiaAnalogRange[NO_OF_SETUPS]={153,154}; const int eeucLiaAnalogAvgDepth[NO_OF_SETUPS]={155,156}; const size_t eepromSize = 200;
3cd86d75fb408ac6483efe2781b753d6a4deb709
3a598b1d2bb08f8de979e8c6b7cce7f40b4ac101
/readTree.h
cca02a655853289ad1681d06c9211ab6793b07a7
[]
no_license
a95101303/Nick
5a399c7a20cec3c0379e34484b907a690999ad1a
99439b1ad3c662f8018f67579d5c5ef0da917efd
refs/heads/master
2021-01-13T16:07:52.201694
2017-05-11T03:04:06
2017-05-11T03:04:06
81,727,263
0
0
null
null
null
null
UTF-8
C++
false
false
6,768
h
readTree.h
////////////////////////////////////////////////////////// // This class has been automatically generated on // Mon May 8 22:32:51 2017 by ROOT version 6.08/04 // from TTree t1065/t1065_tree // found on file: electrons_100_GeV_5_7_X0.root ////////////////////////////////////////////////////////// #ifndef readTree_h #define readTree_h #include <TROOT.h> #include <TChain.h> #include <TFile.h> // Header file for the classes stored in the TTree if any. class readTree { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Fixed size dimensions of array or collections stored in the TTree if any. // Declaration of leaf types UInt_t event; UInt_t ngroups; UInt_t nsamples; UInt_t nchannels; UShort_t tc[4]; UShort_t b_c[36864]; Short_t raw[36][1024]; Int_t t[36864]; Short_t channel[36][1024]; Short_t channelCorrected[36][1024]; Int_t t0[1024]; Float_t time[4][1024]; Float_t xmin[36]; Float_t amp[36]; Float_t base[36]; Float_t int[36]; Float_t intfull[36]; Float_t risetime[36]; Float_t gauspeak[36]; Float_t linearTime0[36]; Float_t linearTime15[36]; Float_t linearTime30[36]; Float_t linearTime45[36]; Float_t linearTime60[36]; Float_t TDCx; Float_t TDCy; // List of branches TBranch *b_event; //! TBranch *b_ngroups; //! TBranch *b_nsamples; //! TBranch *b_nchannels; //! TBranch *b_tc; //! TBranch *b_b_c; //! TBranch *b_raw; //! TBranch *b_t; //! TBranch *b_channel; //! TBranch *b_channelCorrected; //! TBranch *b_t0; //! TBranch *b_time; //! TBranch *b_xmin; //! TBranch *b_amp; //! TBranch *b_base; //! TBranch *b_int; //! TBranch *b_intfull; //! TBranch *b_risetime; //! TBranch *b_gauspeak; //! TBranch *b_linearTime0; //! TBranch *b_linearTime15; //! TBranch *b_linearTime30; //! TBranch *b_linearTime45; //! TBranch *b_linearTime60; //! TBranch *b_TDCx; //! TBranch *b_TDCy; //! readTree(TTree *tree=0); virtual ~readTree(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; #endif #ifdef readTree_cxx readTree::readTree(TTree *tree) : fChain(0) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("electrons_100_GeV_5_7_X0.root"); if (!f || !f->IsOpen()) { f = new TFile("electrons_100_GeV_5_7_X0.root"); } f->GetObject("t1065",tree); } Init(tree); } readTree::~readTree() { if (!fChain) return; delete fChain->GetCurrentFile(); } Int_t readTree::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t readTree::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->GetTreeNumber() != fCurrent) { fCurrent = fChain->GetTreeNumber(); Notify(); } return centry; } void readTree::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("event", &event, &b_event); fChain->SetBranchAddress("ngroups", &ngroups, &b_ngroups); fChain->SetBranchAddress("nsamples", &nsamples, &b_nsamples); fChain->SetBranchAddress("nchannels", &nchannels, &b_nchannels); fChain->SetBranchAddress("tc", tc, &b_tc); fChain->SetBranchAddress("b_c", b_c, &b_b_c); fChain->SetBranchAddress("raw", raw, &b_raw); fChain->SetBranchAddress("t", t, &b_t); fChain->SetBranchAddress("channel", channel, &b_channel); fChain->SetBranchAddress("channelCorrected", channelCorrected, &b_channelCorrected); fChain->SetBranchAddress("t0", t0, &b_t0); fChain->SetBranchAddress("time", time, &b_time); fChain->SetBranchAddress("xmin", xmin, &b_xmin); fChain->SetBranchAddress("amp", amp, &b_amp); fChain->SetBranchAddress("base", base, &b_base); fChain->SetBranchAddress("int", int, &b_int); fChain->SetBranchAddress("intfull", intfull, &b_intfull); fChain->SetBranchAddress("risetime", risetime, &b_risetime); fChain->SetBranchAddress("gauspeak", gauspeak, &b_gauspeak); fChain->SetBranchAddress("linearTime0", linearTime0, &b_linearTime0); fChain->SetBranchAddress("linearTime15", linearTime15, &b_linearTime15); fChain->SetBranchAddress("linearTime30", linearTime30, &b_linearTime30); fChain->SetBranchAddress("linearTime45", linearTime45, &b_linearTime45); fChain->SetBranchAddress("linearTime60", linearTime60, &b_linearTime60); fChain->SetBranchAddress("TDCx", &TDCx, &b_TDCx); fChain->SetBranchAddress("TDCy", &TDCy, &b_TDCy); Notify(); } Bool_t readTree::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } void readTree::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t readTree::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef readTree_cxx
1170914c74d672a492d3bf31e35196e761f71791
59864cbd213b5da6f50d6255b0a021564b3d5bd4
/challenges/pizza_ordering_system/src/cgc_topping.h
bbabfc6d73b7cfa48954717472ff68472053f55d
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-unknown", "BSD-2-Clause" ]
permissive
trailofbits/cb-multios
8af96a4fbc3b34644367faa135347f88e0e0d0a3
810d7b24b1f62f56ef49b148fe155b0d0629cad2
refs/heads/master
2023-09-05T03:56:20.229403
2022-12-27T15:47:54
2022-12-27T15:47:54
41,688,943
522
133
MIT
2023-06-29T02:47:13
2015-08-31T17:04:31
C
UTF-8
C++
false
false
470
h
cgc_topping.h
#ifndef TOPPING_H_ #define TOPPING_H_ class Topping { protected: const char *name; int calories; int carbs; public: virtual ~Topping(); const char *get_topping_name() { return name; } int get_calories() { return calories; } int get_carbs() { return carbs; } bool operator==(const Topping &rhs) const; bool operator!=(const Topping &rhs) const; virtual bool is_vegetarian() = 0; virtual bool contains_pork() = 0; }; #endif
678a09dbfcadd722c125bbd29666aee423c40e84
6b36bc1a420de327d58a0c2637d271d94da3c290
/Chapter15/Disc_quote.h
a81c770567cd7acc6b18cce789d19e1ee4299c68
[ "MIT" ]
permissive
FrogLu/CPPP
db92e8ee8908e87f9a204019b7548cdbdb8bc292
0ee4632c12b287957739e2061fd6b02234465346
refs/heads/master
2020-04-02T22:08:43.678829
2019-05-22T09:50:44
2019-05-22T09:50:44
154,822,971
0
0
null
null
null
null
UTF-8
C++
false
false
1,943
h
Disc_quote.h
#pragma once #ifndef _DISC_QUOTE_H_ #define _DISC_QUOTE_H_ #include "Quote.h" class Disc_quote : public Quote { public: Disc_quote() = default; // comment this constructor, and I declare another constructor, // then this constructor won't be created by compiler, throw E1790 Disc_quote(const std::string& book, double price, std::size_t qty, double disc) : Quote(book, price), quantity(qty), discount(disc) {} Disc_quote(const Disc_quote&); Disc_quote(Disc_quote&&)noexcept; Disc_quote& operator=(const Disc_quote&); Disc_quote& operator=(Disc_quote&&)noexcept; double net_price(std::size_t)const override = 0; // it (a pure virtual) // cause Disc_quote is an abstract class type virtual ~Disc_quote(); protected: std::size_t quantity = 0; double discount = 0.0; }; inline Disc_quote::Disc_quote(const Disc_quote& dsqt) : Quote(dsqt) { quantity = dsqt.quantity; discount = dsqt.discount; std::cout << "Disc_quote::Disc_quote(const Disc_quote& dsqt)" << std::endl; } inline Disc_quote::Disc_quote(Disc_quote&& dsqt)noexcept : Quote(std::move(dsqt)) { quantity = std::move(dsqt.quantity); discount = std::move(dsqt.discount); std::cout << "Disc_quote::Disc_quote(Disc_quote&& dsqt)" << std::endl; } inline Disc_quote& Disc_quote::operator=(const Disc_quote& rhs) { Quote::operator=(rhs); quantity = rhs.quantity; discount = rhs.discount; std::cout << "Disc_quote::operator=(const Disc_quote& rhs)" << std::endl; return *this; } inline Disc_quote& Disc_quote::operator=(Disc_quote&& rhs)noexcept { Quote::operator=(rhs); quantity = std::move(rhs.quantity); discount = std::move(rhs.discount); std::cout << "Disc_quote::operator=(Disc_quote&& rhs)" << std::endl; return *this; } #endif // !_DISC_QUOTE_H_
072885eb22631abf47ac540b945f256ef2788e35
6106cd1c216c4e9727a6712dc547abd4bd5f2fe2
/chat_client/source/logindialog.cpp
4b2a6688146ea70fa528101f3a60b78124c9cc56
[]
no_license
Borelset/chat
72361dce50c9c8909fc5ff92860f13cde42f32d8
5f5074885a204cadfdc8a131d1769a1201f03d50
refs/heads/master
2021-01-20T01:12:01.105993
2017-04-26T09:23:58
2017-04-26T09:23:58
89,235,284
0
0
null
null
null
null
UTF-8
C++
false
false
2,073
cpp
logindialog.cpp
#include <QLineEdit> #include <QString> #include <QMessageBox> #include "logindialog.h" #include "ui_logindialog.h" #include "network.h" using namespace std; extern network conn; LoginDialog::LoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LoginDialog) { ui->setupUi(this); } LoginDialog::~LoginDialog() { delete ui; } void LoginDialog::on_loginBtn_clicked() { QString q_usrn = ui->usrEdit->text(); QString q_pswd = ui->pswEdit->text(); if(q_usrn.isEmpty() || q_pswd.isEmpty()) { return; } string usrn = q_usrn.toStdString(); string pswd = q_pswd.toStdString(); int result = conn.login(usrn.c_str(), pswd.c_str()); if(result == 1) { conn.confirm_port(); accept(); } else if(result == -1) { QMessageBox::warning(this, tr("log error"), tr("This user has already login ..."), QMessageBox::Yes); } else if(result == -2) { QMessageBox::warning(this, tr("log error"), tr("Wrong username or password ..."), QMessageBox::Yes); } else if(result == -90) { QMessageBox::warning(this, tr("log error"), tr("Cannot connect to server ..."), QMessageBox::Yes); } else { QMessageBox::warning(this, tr("log error"), tr("Unknown error ..."), QMessageBox::Yes); } } void LoginDialog::on_pushButton_clicked() { QString q_usrn = ui->usrEdit->text(); QString q_pswd = ui->pswEdit->text(); if(q_usrn.isEmpty() || q_pswd.isEmpty()) { return; } string usrn = q_usrn.toStdString(); string pswd = q_pswd.toStdString(); int result = conn.regist(usrn.c_str(), pswd.c_str()); if(result == 1) { QMessageBox::warning(this, tr("regist"), tr("Success regist a new count ..."), QMessageBox::Yes); } else if(result == -1) { QMessageBox::warning(this, tr("regist error"), tr("Already used username ..."), QMessageBox::Yes); } else { QMessageBox::warning(this, tr("regist error"), tr("Unknown error ..."), QMessageBox::Yes); } }
56af16b54a48df4b416c157b13a9826c7ef195bd
31aa0bd1eaad4cd452d0e2c367d8905f8ed44ba3
/algorithms/palindromePermutationII/palindromePermutationII.cpp
fbe263daf5afe97ecdfde88b24e9d2c8a3d5aac7
[]
no_license
Sean-Lan/leetcode
0bb0bfaf3a63d483794a0e5213a983db3bbe6ef6
1583c1b81c30140df78d188c327413a351d8c0af
refs/heads/master
2021-04-19T02:49:33.572569
2021-01-04T01:40:06
2021-01-04T01:40:06
33,580,092
3
0
null
null
null
null
UTF-8
C++
false
false
1,750
cpp
palindromePermutationII.cpp
/** * * Sean * 2017-06-08 * * https://leetcode.com/problems/palindrome-permutation-ii/#/description * * Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form. * * For example: * * Given s = "aabb", return ["abba", "baab"]. * * Given s = "abc", return []. * */ #include <iostream> #include <unordered_map> #include <string> #include <vector> #include <algorithm> using namespace std; // iterative solution with `next_permutation` class Solution { vector<string> getPermutations(string s) { vector<string> res; sort(s.begin(), s.end()); do { res.push_back(s); } while(next_permutation(s.begin(), s.end())); return res; } public: vector<string> generatePalindromes(string s) { if (s.empty()) return {}; unordered_map<char, int> table; char odd = -1; for (auto c : s) ++ table[c]; string possible; for (auto &aPair : table) { if (aPair.second & 1) { if (odd != -1) return {}; odd = aPair.first; } for (int i=0; i<aPair.second/2; ++i) { possible.push_back(aPair.first); } } vector<string> res = getPermutations(possible); for (auto &p : res) { string reversed(p.rbegin(), p.rend()); if (odd != -1) { p += odd; } p += reversed; } return res; } }; int main() { Solution solution; string s = "aab"; auto res = solution.generatePalindromes(s); for (auto &s : res) cout << s << endl; return 0; }
1204bb4b768a9aff98b3c3c24048bf5be147eaca
8e4a69c6f04f25a498677e41e8e1667e99846502
/blocksvector.h
dbb49e19c1db3faac0cf8df6456a9d6d812c3e7c
[]
no_license
Kristopher38/SE-blueprint-lib
e7ddfce8454911e16813b68b3f0ee7f0ba8d4194
9ec5e334e9907a2eae7e9419c93e810d5bdc2a50
refs/heads/master
2022-12-29T02:26:03.698667
2017-05-13T19:35:54
2017-05-13T19:35:54
299,999,129
0
0
null
null
null
null
UTF-8
C++
false
false
2,984
h
blocksvector.h
#ifndef H_BLOCKSVECTOR #define H_BLOCKSVECTOR #include <memory> #include <vector> template <typename T> using Blockptr = std::shared_ptr<T>; template <typename T> using BlockptrVec = std::vector<Blockptr<T>>; template <class BlockT> class BlocksVector : public BlockptrVec<BlockT> { public: template <typename T> T* AddBlock(const T& cubeblock) { BlockptrVec<BlockT>::push_back(cubeblock.clone()); return dynamic_cast<T*>(BlockptrVec<BlockT>::back().get()); } template <typename T> T* AddBlock(T* const cubeblock) { if (cubeblock) { BlockptrVec<BlockT>::push_back(std::shared_ptr<BlockT>(cubeblock, [](BlockT*){})); // empty deleter to avoid deleting pointer when shared_ptr deletes - memory management relies on user with pointers return dynamic_cast<T*>(BlockptrVec<BlockT>::back().get()); } else return nullptr; } template <typename T> std::size_t RemoveBlocks(T& cubeblock, bool remove_all = true, std::size_t offset = 0) { std::size_t removed_count = 0; for (typename BlockptrVec<BlockT>::iterator it = BlockptrVec<BlockT>::begin()+offset; it != BlockptrVec<BlockT>::end(); ++it) { T* vectorblock = dynamic_cast<T*>(it->get()); if (vectorblock) { if (cubeblock == *vectorblock) { BlockptrVec<BlockT>::erase(it); removed_count++; if (!remove_all) break; } } } return removed_count; } template <typename T> BlocksVector<T> GetBlocks(T& cubeblock, std::size_t amount = 0) { BlocksVector<T> matching_blocks; if (amount) BlockptrVec<BlockT>::reserve(amount); for (typename BlockptrVec<BlockT>::iterator it = BlockptrVec<BlockT>::begin(); it != BlockptrVec<BlockT>::end(); ++it) { T* vectorblock = dynamic_cast<T*>(it->get()); if (vectorblock) { if (cubeblock == *vectorblock) { matching_blocks.push_back(std::dynamic_pointer_cast<T>(*it)); if (amount && matching_blocks.size() == amount) break; } } } return matching_blocks; } template <typename T> BlocksVector<T> GetBlocks(std::string name) { T cubeblock; cubeblock.CustomName = name; return this->GetBlocks<T>(cubeblock); } template <typename T> BlocksVector<T> GetBlocks(int x, int y, int z) { T cubeblock; cubeblock.Coords.x = x; cubeblock.Coords.y = y; cubeblock.Coords.z = z; return this->GetBlocks<T>(cubeblock); } template <typename T> BlocksVector<T> GetBlocks() { T cubeblock; return this->GetBlocks<T>(cubeblock); } }; #endif // H_BLOCKSVECTOR
3fe5f698e8dd26595d9c728e5be32747663866c7
05dee134ef4e552fecd0d39dea5d6cdc3a82965c
/CodeForces/CodeForces-1148B.cpp
27050b3a59fb70c73a4c409a3605cf40a28564cf
[]
no_license
yliu-cs/ACM
35239420f36baf336e17a5c45d2c7a5ae9317413
f67ca3e6de900afabe38201e19c74d0e1c6a40a3
refs/heads/master
2022-03-20T10:10:25.787434
2019-12-05T16:30:29
2019-12-05T16:30:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
710
cpp
CodeForces-1148B.cpp
// Author: Tony5t4rk Time: 2019-10-22 15:55:32 #include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); long long n, m, ta, tb, k; std::cin >> n >> m >> ta >> tb >> k; if (k >= n || k >= m) { std::cout << -1 << '\n'; return 0; } std::vector<int> a(n); for (auto &v : a) std::cin >> v; std::vector<int> b(m); for (auto &v : b) std::cin >> v; long long ans = 0; for (int i = 0; i <= k; ++i) { int idx = std::lower_bound(b.begin(), b.end(), a[i] + ta) - b.begin(); if (idx + k - i >= m) { std::cout << -1 << '\n'; return 0; } ans = std::max(ans, b[idx + k - i] + tb); } std::cout << ans << '\n'; return 0; }
3886fcd3ade961bfbbcb19259039ad27154286ad
f3f32cc6adb662d0ba30c9f5fc005d5c35afd181
/36-ValidSudoku.cpp
832d7c141c3759522df83e9c5074e7668d7046f7
[]
no_license
rranjik/ideal-octo-barnacle
675934f1e86591bb393ebb4ccde0f2cc40f7efd8
104f190cf3f4414578cc521886c914f0037e36ab
refs/heads/master
2023-09-01T11:51:02.653672
2023-08-26T02:24:03
2023-08-26T02:24:03
159,698,415
1
3
null
null
null
null
UTF-8
C++
false
false
1,536
cpp
36-ValidSudoku.cpp
class Solution { public: bool valid(int x, int y, const vector<vector<int>>& b){ vector<bool> seen(9, false); for(int i = 0; i<9; i++){ if(b[x][i]){ if(seen[b[x][i]-1]) return false; seen[b[x][i]-1] = true; } } seen = vector<bool>(9, false); for(int i = 0; i<9; i++){ if(b[i][y]){ if(seen[b[i][y]-1]) return false; seen[b[i][y]-1] = true; } } seen = vector<bool>(9, false); auto bx = (x/3)*3; auto by = (y/3)*3; for(int i = 0; i<3; i++){ for(int j = 0; j<3; j++){ if(b[bx+i][by+j]){ if(seen[b[bx+i][by+j]-1]) return false; seen[b[bx+i][by+j]-1] = true; } } } return true; } bool isValidSudoku(vector<vector<char>>& board) { vector<vector<int>> b(9, vector<int>(9, 0)); for(int i = 0; i<9; i++){ for(int j = 0; j<9; j++){ if(board[i][j]!='.'){ b[i][j] = board[i][j]-'0'; } } } auto res = true; for(int i = 0; i<9; i++){ for(int j = 0; j<9; j++){ if(b[i][j]) { auto r = valid(i, j, b); if(!r) cout<<"i = "<<i<<"; j = "<<j<<" is not valid "<<endl; res&=r; } } } return res; } };
97fcb493d00e4049e10cd45a5aafac378e87732f
2ea09d5f08acddba89e7c1dfc975e6ca0dbfd504
/armstrong.cpp
d9e228c7177daa9e76d3965abb0e313290a8db98
[]
no_license
pravinkumarkg/codekata
b2ea0987223591e6a1ac369d4c82c53ab5187246
63fbfa1c93274c9befd6bca266c2e53bc719f0d0
refs/heads/master
2020-06-16T17:26:43.884489
2019-07-09T17:12:00
2019-07-09T17:12:00
195,650,370
0
0
null
null
null
null
UTF-8
C++
false
false
253
cpp
armstrong.cpp
#include <iostream> using namespace std; int main() { int num,rem,orig,sum=0; cin>>orig; num=orig; while(num!=0) { rem=num%10; sum=sum+rem*rem*rem; num=num/10; } if(sum==orig) { cout<<"yes"; } else { cout<<"no"; } return 0; }
caf542510261aa8a10c0acd6b23c53d12657c853
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/google_apis/credentials_mode.cc
54cf67c4237136ec38316e2e29c9304056002bdc
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
837
cc
credentials_mode.cc
// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "google_apis/credentials_mode.h" #include "base/feature_list.h" #include "services/network/public/mojom/fetch_api.mojom.h" namespace google_apis { namespace { BASE_FEATURE(kGaiaCredentialsModeOmitBug_775438_Workaround, "GaiaCredentialsModeOmitBug_775438_Workaround", base::FEATURE_ENABLED_BY_DEFAULT); } // namespace network::mojom::CredentialsMode GetOmitCredentialsModeForGaiaRequests() { return base::FeatureList::IsEnabled( kGaiaCredentialsModeOmitBug_775438_Workaround) ? network::mojom::CredentialsMode::kOmitBug_775438_Workaround : network::mojom::CredentialsMode::kOmit; } } // namespace google_apis
bc81595cc62938e03a63c2cbb737c947be6e1e0a
72d9009d19e92b721d5cc0e8f8045e1145921130
/rpf/src/m2.cpp
41f5a5736ba92f536307e329b25bf91c8bd95bd3
[]
no_license
akhikolla/TestedPackages-NoIssues
be46c49c0836b3f0cf60e247087089868adf7a62
eb8d498cc132def615c090941bc172e17fdce267
refs/heads/master
2023-03-01T09:10:17.227119
2021-01-25T19:44:44
2021-01-25T19:44:44
332,027,727
1
0
null
null
null
null
UTF-8
C++
false
false
2,355
cpp
m2.cpp
#include "rpf.h" // M2 is not implemented yet struct ch2012 { ifaGroup grp; bool pearson; double stat; double weightSum; std::vector<bool> rowMask; ch2012(bool twotier, SEXP Rgrp); void run(const char *method); void accumulate(double observed, double expected); }; ch2012::ch2012(bool twotier, SEXP Rgrp) : grp(twotier) { grp.quad.setNumThreads(1); grp.import(Rgrp); rowMask.reserve(grp.getNumUnique()); for (int rx=0; rx < grp.getNumUnique(); ++rx) { bool missing = false; for (int cx=0; cx < (int) grp.dataColumns.size(); ++cx) { if (grp.dataColumns[cx][rx] == NA_INTEGER) { missing = true; break; } } rowMask.push_back(!missing); } } void ch2012::accumulate(double observed, double expected) { if (pearson) { double diff = observed-expected; stat += (diff*diff) / expected; } else { stat += 2 * observed * (log(observed) - log(expected)); } checkUserInterrupt(); // could loop for a long time } void ch2012::run(const char *method) { /* std::vector<int> &itemOutcomes = grp.itemOutcomes; int numFirstOrder = 0; for (int ix=0; ix < grp.numItems(); ++ix) { numFirstOrder += itemOutcomes[ix] - 1; } int numSecondOrder = 0; for (int i1=1; i1 < grp.numItems(); ++i1) { for (int i2=0; i2 < i1; ++i2) { numSecondOrder += (itemOutcomes[i1] - 1) * (itemOutcomes[i2] - 1); } } */ if (strEQ(method, "pearson")) { pearson = true; } else if (strEQ(method, "lr")) { pearson = false; } else { stop("Unknown method '%s'", method); } // Data need to be compressed TODO //if (!grp.rowWeight) stop("weightColumn required"); ?? TODO ba81NormalQuad &quad = grp.quad; weightSum = 0; for (int rx=0; rx < grp.getNumUnique(); ++rx) { if (!rowMask[rx]) continue; weightSum += grp.getRowWeight(rx); } stat = 0; quad.cacheOutcomeProb(grp.param, false); quad.allocBuffers(); for (int px=0; px < grp.getNumUnique(); ++px) { if (!rowMask[px]) continue; double patternLik1 = quad.computePatternLik(0, px); accumulate(grp.getRowWeight(px), patternLik1 * weightSum); } } // [[Rcpp::export]] List CaiHansen2012_cpp(SEXP Rgrp, const CharacterVector &Rmethod, bool twotier) { ch2012 engine(twotier, Rgrp); engine.run(Rmethod[0]); //obMargin1(col); //obMargin2(col1, col2); return List::create(_["stat"] = wrap(engine.stat), _["n"] = wrap(engine.weightSum)); }
441bc35e82f9674e99eedddf4a2f850b158dce04
f80d19d58816c14cf51b6457d017ccb1b01918ea
/src/guis/guitexture.cpp
89e4e97fbb97ae381bad7c5780218491b243a872
[]
no_license
piochelepiotr/minecraftClone
378a277d88d35ab36f1ef517598800b99355e6c5
c4389f5f4f7a8164658e7943050119a0508dcd00
refs/heads/master
2021-05-11T02:53:44.298323
2018-11-03T02:24:20
2018-11-03T02:24:20
117,897,006
0
1
null
null
null
null
UTF-8
C++
false
false
355
cpp
guitexture.cpp
#include "guitexture.h" GuiTexture::GuiTexture(GLuint id, const glm::vec2 &scale, const glm::vec2 &position) : m_id(id), m_scale(scale), m_position(position) { } GLuint GuiTexture::id() const { return m_id; } glm::vec2 GuiTexture::scale() const { return m_scale; } glm::vec2 GuiTexture::position() const { return m_position; }
6b0486a0e658d810a6a105d31b284f6d4f10de73
0ef832d8eaedc16253cc220bc704a52597d248fe
/model_server/cmd/include/cmd_shell.h
755d12968c1f4290686db66f46ff0a022ccc2242
[ "BSD-2-Clause" ]
permissive
radtek/software-emancipation-discover
9c0474b1abe1a8a3f91be899a834868ee0edfc18
bec6f4ef404d72f361d91de954eae9a3bd669ce3
refs/heads/master
2020-05-24T19:03:26.967346
2015-11-21T22:23:54
2015-11-21T22:23:54
187,425,106
1
0
BSD-2-Clause
2019-05-19T02:26:08
2019-05-19T02:26:07
null
UTF-8
C++
false
false
7,247
h
cmd_shell.h
/************************************************************************* * Copyright (c) 2015, Synopsys, Inc. * * 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. * *************************************************************************/ // File cmd_shell.h // //------------------------------------------ // synopsis: // function declarations and classes for Command Journal // // description: // ... //------------------------------------------ // // Restrictions: // ... //------------------------------------------ // include files #ifndef _CMD_SHELL_H_ #define _CMD_SHELL_H_ #define CMD_BROWSER_SHELL 1 #define CMD_VIEWER_SHELL 2 #define CMD_PROJECT_SHELL 3 #define CMD_FILE_BROWSER_SHELL 4 class viewerShell; extern "C" { // Menus / buttons --------------------------- Widget cmd_push_named_menu_button ( char *TopShellName, char *button_name ); Widget cmd_push_menubar_button ( Widget curr_top_shell, char *button_name ); Widget cmd_push_submenu_button ( Widget parent_button, char *button_name ); // patterns to be selected follow n_items argument // (example: cmd_select_in_list(dd, 3, "abc", "proj1", "proj2");) void cmd_select_in_list ( Widget curr_dialog, int n_items, ...); void cmd_select_in_named_list ( Widget curr_top_shell, char *dialog_name, int n_items, ...); void cmd_select_in_proj ( Widget top_shell, int column_numb, int n_items, ...); void cmd_select_pos_in_proj ( Widget top_shell, int column_numb, int n_items, ...); // integer positions of items to be selected follow n_items argument // (example: cmd_select_pos_in_list(dd, 2, 8,9); ) void cmd_select_pos_in_list ( Widget curr_dialog, int n_items, ...); // ViewerShell Window operations --------------- int cmd_select_in_view ( viewerShell *v_shell, char *pattern, int occur_numb = 1, int n_select = 1); int cmd_select_pattern ( viewerShell *v_shell, char *pattern, int occur_numb = 1, int n_select = 1); int cmd_select_word ( viewerShell *v_shell, char *pattern, int occur_numb = 1, int n_select = 1); int cmd_select_from_to ( viewerShell *curr_window, char *pattern1, int occurr_numb1, char *pattern2, int occurr_numb2 ); void cmd_unselect_all ( viewerShell *curr_window); void cmd_replace_text ( viewerShell *curr_vs, char *old_text, char *new_text, int occur_numb = 1, int n_select = 1); void cmd_insert_text_after ( viewerShell *curr_window, char *pattern, char *insert_text, int occurr_numb = 1); void cmd_click_MB1 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_click_MB2 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_click_MB3 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_dbl_click_MB1 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_dbl_click_MB2 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_dbl_click_MB3 ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_collapse ( viewerShell *curr_window, appTreePtr sel_obj ); void cmd_explode ( viewerShell *curr_window, appTreePtr sel_obj ); // Ste related calls int cmd_ste_search_word (viewerShell *vs, char * c_string); // Getting internal name char *cmd_lookup(char *names[], int n_names, int *return_flag); // Currency handling void cmd_make_current(int shell_type, Widget shell_widget); Widget cmd_get_current (int shell_type); void cmd_show_current(); void cmd_set_control(char *func_call); char *cmd_get_control(); } /* START-LOG------------------------------------------- $Log: cmd_shell.h $ Revision 1.1 1993/07/29 10:31:58EDT builder made from unix file * Revision 1.11 1993/01/26 22:55:53 sergey * Removed dead code ( ... _dialog_... ). * * Revision 1.10 1993/01/26 18:42:33 sergey * Added cmd_select_in_view() declaration; removed obsolete cmd_look_up(). * * Revision 1.9 1993/01/15 20:41:49 sergey * Changed return value of cmd_select_from_to from void to int. * * Revision 1.8 1993/01/10 20:46:31 sergey * Changed arguments at text handling routines (removed rep_type). * * Revision 1.7 1993/01/05 21:15:35 sergey * Added flag argument to cmd_lookup(). * * Revision 1.6 1992/12/21 21:52:09 sergey * Added cmd_lookup() and removed CMD_MAX_NAME_LEN. * * Revision 1.4 1992/12/12 00:14:23 sergey * *** empty log message *** * * Revision 1.3 1992/12/08 00:19:26 sergey * Added dialog types to deal with same names for dialogs and buttons. * * Revision 1.2 1992/12/03 19:37:39 sergey * Added cmd_set_control declaration. * * Revision 1.1 1992/12/03 19:18:55 sergey * Initial revision * END-LOG--------------------------------------------- */ #endif
8df32e7cbc57169bd3b28b17588778de1d7b0567
5b5602db16e9c68d6428a78a66a4207f742582ec
/KerSem.cpp
ad6c9d79b1b1e84620c6643986c1704e72799281
[]
no_license
nikolakrstic99/x8086-Kernel
eb278852fe9005b2d1dedcbb1bcac0bf7bfba9bd
0b42b88949e8f29d37b92568a51361d56e72f145
refs/heads/main
2022-12-26T11:25:47.495081
2020-10-15T15:21:08
2020-10-15T15:21:08
304,350,483
1
0
null
null
null
null
UTF-8
C++
false
false
1,880
cpp
KerSem.cpp
#include "KerSem.h" #include "PCB.h" #include "schedule.h" #include "Const.h" #include "ListaSem.h" #include "Red.h" #include "thread.h" ListaSem KernelSem::allSems; KernelSem::KernelSem(int i) { lock(); allSems.push(this); if(i<0)i=0; vrednost = i; unlock(); } KernelSem::~KernelSem() { lock(); allSems.pop(this); for(int i=0;i<waitOnSem.size();i++) deblock(); unlock(); } int KernelSem::wait(Time maxTimeToWait) { --vrednost; if(vrednost>=0)return 1; else{ int i; if(maxTimeToWait==0)PCB::running->waitOrNo=0;//nije vremenski ogranicena else PCB::running->waitOrNo=1; //vremenski ogranicena lock(); Red::Elem *elem; PCB::running->timeToWait=maxTimeToWait; elem = new Red::Elem(PCB::running); waitOnSem.push(elem); PCB::running->status=BLOCKED; unlock(); dispatch(); int time=elem->pcb->timeToWait; delete elem; if(maxTimeToWait && time==0)return 0; else return 1; } } int KernelSem::signal(int i) { if(i<0)return i; else if(i==0){ if(vrednost++<0){ deblock(); return 0; } }else{ //i>0 lock(); int j; for(j=0;waitOnSem.size()>0 && j<i;j++) deblock(); vrednost+=i; unlock(); return j; } return 0;//nikad nece } void KernelSem::deblock(){ PCB* pcb=waitOnSem.getPCB(); pcb->status=READY; Scheduler::put(pcb); } void KernelSem::tick() { ListaSem::Elem *cur = allSems.first; for(int i=0;i<allSems.n;i++){ Red::Elem *e = cur->sem->waitOnSem.first; while(e) { if(e->pcb->timeToWait>0)e->pcb->timeToWait--; if(e->pcb->timeToWait==0 && e->pcb->waitOrNo==1){ lock(); cur->sem->waitOnSem.pop(e); cur->sem->vrednost++; e->pcb->status = READY; Scheduler::put(e->pcb); unlock(); } e = e->next; } cur = cur->next; } }
c482498ef62193b7e4fd5317ce6ac709925c4518
4d0fd4fa3ae08b2d42b0293588dc9fc4c7ddc2e3
/topcoder/aseries.cpp
cd5134e8fd750ab55093ec17f68f5e9b352df2b1
[]
no_license
phytoporg/competitiveprogramming
b5dddc1426ac1c8338870d908cfb00704523b3b3
add6f467f6c7cdad3e771970f816931bed90a1e0
refs/heads/master
2020-08-03T10:47:57.472472
2020-05-15T17:05:36
2020-05-15T17:05:36
211,724,223
0
0
null
null
null
null
UTF-8
C++
false
false
1,312
cpp
aseries.cpp
#include <bits/stdc++.h> using namespace std; #define PRINTVAR(x) (cout << #x << " is " << x << endl) using ull = unsigned long long; array<ull, 64> colmasks{}; array<ull, 64> rowmasks{}; int longest(vector<int> values) { size_t n{values.size()}; sort(begin(values), end(values)); map<int, int> freqs; for (size_t i = 0; i < n - 1; ++i) { for (size_t j = i + 1; j < n; ++j) { int diff = values[j] - values[i]; bool counted{false}; if (!freqs.count(diff)) { freqs[diff] = 1; colmasks[diff] |= (1 << j); rowmasks[diff] |= (1 << i); counted = true; } else if (!(colmasks[diff] & (1 << j)) && !(rowmasks[diff] & (1 << i))) { freqs[diff]++; colmasks[diff] |= (1 << j); rowmasks[diff] |= (1 << i); counted = true; } } } int maxFreq{0}; for (auto& [v, freq] : freqs) { if (freq > maxFreq) { maxFreq = freq; } } return maxFreq + 1; } int main() { vector<int> values; int v; while (cin >> v) { values.push_back(v); } cout << longest(values) << endl; return 0; }
2ad4875d1f63bbc6decc146299f2f5a6966bfbb9
52ca17dca8c628bbabb0f04504332c8fdac8e7ea
/boost/atomic/detail/ops_extending_cas_based.hpp
b58eefa9ebae227ccd34ef717230fb1393233af2
[]
no_license
qinzuoyan/thirdparty
f610d43fe57133c832579e65ca46e71f1454f5c4
bba9e68347ad0dbffb6fa350948672babc0fcb50
refs/heads/master
2021-01-16T17:47:57.121882
2015-04-21T06:59:19
2015-04-21T06:59:19
33,612,579
0
0
null
2015-04-08T14:39:51
2015-04-08T14:39:51
null
UTF-8
C++
false
false
83
hpp
ops_extending_cas_based.hpp
#include "thirdparty/boost_1_58_0/boost/atomic/detail/ops_extending_cas_based.hpp"
14340b9afd024426f84b0c54328f55f3e959e47a
e7d31066f4dbdfc71011371d634e1db622c5fe29
/galditu.ino
abac4448e537b4b75111c707b3463c8808903df8
[]
no_license
sagarrabanana/Galditu
66acc08e9db25bd2f3ac7c5fc599ca347873a807
0336de1ff7c69ec6bc72bb45af35e270f5427b11
refs/heads/master
2020-03-12T09:54:11.625507
2018-04-22T11:56:16
2018-04-22T11:56:16
130,561,909
0
0
null
null
null
null
UTF-8
C++
false
false
11,706
ino
galditu.ino
/* _ _ _ _ _ _ _| || |_ __ _ __ _| | __| (_) |_ _ _ |_ .. _|/ _` |/ _` | |/ _` | | __| | | | |_ _| (_| | (_| | | (_| | | |_| |_| | |_||_| \__, |\__,_|_|\__,_|_|\__|\__,_| |___/ sagarrabanana@bizkaia.eu asier@komunikatik.com 10/06/2015 */ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Librerias, constantes (define) y variables // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include <GSM.h> /Librera FRM de Arduino // Datos de acceso APN para laa conexion de daatos #define GPRS_APN "sm2ms.movilforum.es" // indicar el APN del proveedor GPRS #define GPRS_LOGIN "" // indicar el login del proveedor GPRS #define GPRS_PASSWORD "" // indicar password del proveedor GPRS #define PINNUMBER "" // en blanco si la SIM no tiene PIN // Se inicializa la librera GSM de Arduino http://arduino.cc/en/Reference/GSM GSMClient client; GPRS gprs; GSM gsmAccess; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Variables // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Variables de configuracion: // // =========================== // // GPRS_APN = APN de proveedor de servicios // // tiempoInstalacion = Tiempo de margen tras el encendido para comenzar a contar // // servidor = Sitio web que almacena la informaicion de las detecciones // // panel_info = Nombre del panel informatvo // // intervaloEnvio = Ciclo de tiempo para realizar envios // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //============ Variables personalizables ============ unsigned long tiempoInstalacion=300000; // Disponemos de 5 minutos para ajustar el sensor antes de que comience a realizar detecciones long intervaloEnvio=37200000; // ciclo de tiempo para enviar valor del contador char servidor[] = "www.??????.com"; // Direccion de la plataforma IoT Web char panel_info[]= "Galditu"; // <= ENTRE COMILLAS INDICAMOS EL NOMBRE DEL PANEL CADA VEZ QUE CAMBIEMOS DE SITIO A GALDITU //============ Variables para control del sensor ============ long ultimoEnvio=0; // Ultimo envio long unsigned int lowIn; // Es el tiempo en el que el sensor detecta movimiento long unsigned int pausa = 5000; // Es el tiempo de pausa que el sensor inhibe lecturas boolean lockLow = true; boolean takeLowTime; //============ Variables para indicar URL y fichero de comprobacion de envio ============ int contador=0; String path = "/??????.php?variable1="; //============ Variables para control de pines en Arduino ============ int pirPin = 9; // Ees el pin que se conecta con el sensor PIR int boton=10; // boton para enviar datos antes de apagar int ledEnvio=12; // Led blanco (se enciende durante el envio) int ledPIR = 13; // Led rojo (aviso de deteccion) boolean estadoBoton=LOW; boolean estadoBotonCambio=LOW; boolean sensorEscucha=false; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Setup // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void setup() { Serial.begin(9600); pinMode(boton,INPUT); // Inicializa pin de boton de envio, en modo entrada pinMode(ledEnvio,OUTPUT); // Inicializa pin del led de envio en modo salida pinMode(ledPIR,OUTPUT); // Inicializa pin del led del sensor PIR en modo salida } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Conectar a internet // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void conectar() { Serial.println("*******************************************"); Serial.println("* Levantando comunicaciones GSM *"); digitalWrite(2,HIGH); // Apaga Modem digitalWrite(3,HIGH); // Enciende modem char myGsmAccess=gsmAccess.begin(PINNUMBER,true,false); digitalWrite(ledEnvio,HIGH); // Enciende led para indicar envio delay(15000); digitalWrite(ledPIR,HIGH); // Enciende led para indicar envio delay(15000); Serial.println("* Levantando comunicaciones GPRS *"); char myGprs=gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD); delay(10000); digitalWrite(ledPIR,LOW); // Enciende led para indicar envio } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Enviar valor del contador // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void enviar() { /////////////////////////////////////////////////////////////////////////////////// // Comenzamos la concatenacion de URL y parametros que enviamos a la plataforma IoT /////////////////////////////////////////////////////////////////////////////////// path=("/?????.php?variable1="); path.concat(contador); path.concat("&variable2="); path.concat(panel_info); boolean envioOk = false; // retorna resultado del envio /////////////////////////////////////////////////////////////////////////////////// // Se el resultado de la conexion http es correcto, continuamos con el envio if (client.connect(servidor, 80)) { Serial.println(" ======================================"); // Envia contenido de variable de contador de actividad Serial.println(" = Inicio de llamada HTTP ="); client.print("GET "); client.print(path); client.println(" HTTP/1.1"); client.print("Host: "); client.println(servidor); delay(1000); client.println("Connection: close"); client.println(); } /////////////////////////////////////////////////////////////////////////////////// // Bucle de lectura de la respuesta del servidor /////////////////////////////////////////////////////////////////////////////////// while(client.available() || client.connected()) { char c = client.read(); if (c == '@') // En la plataforma IoT se ha definido este caracter para confirma la entrada correcta en la base de datos { envioOk = true; } } if (envioOk == true) { Serial.println(" = Alta confirmada ="); contador = 0; } else { Serial.println(" = Alta no confirmada ="); } /////////////////////////////////////////////////////////////////////////////////// // Cierra la conexion GSM /////////////////////////////////////////////////////////////////////////////////// client.stop(); // Detiene conexion gsm delay(5000); gsmAccess.shutdown(); delay (1000); digitalWrite(2,LOW); // Apaga Modem digitalWrite(3,LOW); // Apaga Modem digitalWrite(ledEnvio,LOW); // Apaga led para indicar envio Serial.println(" = Fin de conexion ="); Serial.println(" ======================================"); Serial.println("*******************************************"); /////////////////////////////////////////////////////////////////////////////////// } void loop() { /////////////////////////////////////////////////////////////////////////////////// // En esta parte determinamos si estamos en el tiempo de instalacion del sensor /////////////////////////////////////////////////////////////////////////////////// if (millis() <= tiempoInstalacion) { Serial.println("Ajusta sensor"); } else { if (sensorEscucha == false) { Serial.println("*******************************************"); Serial.println("* Sensor a la escucha *"); Serial.println("*******************************************"); sensorEscucha = true; } } /////////////////////////////////////////////////////////////////////////////////// if(digitalRead(pirPin) == HIGH) // Si el recibimos señal del PIR encenemos el led de deteccin (el Rojo). { if (sensorEscucha == false) { digitalWrite(ledPIR, HIGH); // enciende el LED de deteccion (ROJO) y no acumula } else { if(lockLow) { //makes sure we wait for a transition to LOW before any further output is made: lockLow = false; Serial.println(" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); Serial.print(" Inicio de actividad a los "); contador++; Serial.print(millis()/1000); Serial.println(" segundos"); delay(50); } takeLowTime = true; } } if(digitalRead(pirPin) == LOW) digitalWrite(ledPIR, LOW); // apaga el LED de deteccion (ROJO) { if(takeLowTime) { lowIn = millis(); //guardar el momento de la transición de HIGH a LOW takeLowTime = false; //se asegura de que esto sólo se hace en el inicio de una fase LOW } //if the sensor is low for more than the given pausa, //we assume that no more motion is going to happen if(!lockLow && millis() - lowIn > pausa) { lockLow = true; Serial.print(" fin de actividad a los "); Serial.print((millis() - pausa)/1000); Serial.println(" segundos"); Serial.print(" Total detecciones: "); Serial.println(contador); Serial.println(" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); delay(50); } } // Lee entrada digital para detectar cambio en estado del boton de envio estadoBoton=digitalRead(boton); // Si se ha superado el ciclo de envio, activa variable de pulsacion de boton para enviar de nuevo if (millis()- ultimoEnvio >= intervaloEnvio) { ultimoEnvio=millis(); estadoBoton=HIGH; } // Detecta cambio en valor del boton pulsado y ademas detecta cambio a encendido if ((estadoBoton!=estadoBotonCambio) && (estadoBoton==HIGH)) { // Envia contenido de variable de contador de actividad Serial.println("*******************************************"); Serial.println("* Boton de envio pulsado, inicia conexion *"); conectar(); enviar(); } // Guarda variable aanterior para poder detectar cambio de valor en la pulsacion del boton estadoBotonCambio=estadoBoton; }
28823cd458712c6d2aee448acaee919129319802
337d0d76c2002efeed1638de0bdc82f3dec8c67f
/StormPieces/StormLibraryTester/Storm.h
5cc7d62f1e1e5436c67f0bbcc8a151a2e74c950a
[]
no_license
yaksplat/Storm
b8d8722b7d8007129a0f78786c1e7b3dd227497f
662c634334fb4979a0b411d359d8f632479676a6
refs/heads/main
2023-03-08T19:57:32.511269
2021-02-27T17:16:44
2021-02-27T17:16:44
338,464,157
0
1
null
null
null
null
UTF-8
C++
false
false
1,872
h
Storm.h
#ifndef STORM_H #define STORM_H #include <math.h> #include <Arduino.h> class Storm { private: unsigned long StartTime; unsigned long CurrentTime; public: float Diameter; float MovementSpeed; float DistanceX; float DistanceY; float CurrentX; float CurrentY; bool done; float NearestEdge; long ElapsedTime; int CurrentQuadrant; float CurrentAngle; int CurrentRing; float CurrentDistance; float CurrentViewAngle1; float CurrentViewAngle2; float CurrentViewLimitSpan; float yE1, yE2, yW1, yW2, xN1, xN2, xS1, xS2; int Nstart, Nend, Wstart, Wend, Sstart, Send, Estart, Eend; int StartingAngle; bool AllFour; struct point { float x; float y; }; struct points { float x1; float y1; float x2; float y2; }; struct quadrants { bool one; bool two; bool three; bool four; }; struct projection { float intersectionPoint; char direction; float mapping; }; Storm(); void SetParams(float _diameter, float _speed, float _distanceX, float _distanceY); void Start(long _startTime); struct point GetCurrentLocation(long _currentTime); int GetQuadrant(float x, float y); float GetDistance(float x, float y); float GetAngle(float x, float y); float GetAngleRad(float x, float y); struct quadrants WhichQuadrants(float x, float y); int GetRing(float x, float y); void Update(long _currentTime, bool debug); struct points GetIntersections(); void CalcViewLimits(); void CalcViewAngles(); float GetViewLimitSpan(); float RadToDegrees(float rad); float DegreesToRad(float degrees); void CalculateStartsAndEnds(); struct projection CalcMappingForAngle(float angle); }; #endif
44bdf72e1d08a5ccdab68771779caccfdf49e997
4e65ae914237a086d6ad44b05053c06251623cb4
/data_structure_2/HEAP/Heap.cpp
ab44d0f2bdd3455d0e3888af5a1a0c95eff7c12c
[]
no_license
atrlkwqr/Data-Structure
2b9934b73b454f19cb6ae2cc9205aec5625e5145
b4d7ec4e1ba866ffafc1e82a0fe4977532887dc3
refs/heads/master
2023-04-08T00:49:05.516734
2019-12-11T04:47:40
2019-12-11T04:47:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
615
cpp
Heap.cpp
#include "Heap.h" void down_heap(int *heap, int size, int i) { int left = 2 * i + 1; int right = 2 * i + 2; int minist = i; if (left < size && heap[left] < heap[minist]) minist = left; if (right < size && heap[right] < heap[minist]) minist = right; if (minist != i) { int tmp = heap[i]; heap[i] = heap[minist]; heap[minist] = tmp; down_heap(heap, size, minist); } } void build_heap(int *heap, int size) { for (int i = size / 2 - 1; i >= 0; i--) down_heap(heap, size, i); } int remove_heap(int * A, int size) { int tmp = A[0]; A[0] = A[size - 1]; down_heap(A, size, 0); return tmp; }
c10723569fb3164751ad9d4c9da3355ca8c7ebfb
6d5bcfc49ee7159c2847f9afb8ff895dded5db78
/frameworks/av/media/libstagefright/codecs/m4v_h263/enc/src/mp4enc_api.cpp
7ab8f451e7434574255efca7ebd4d246710c1de4
[ "Apache-2.0", "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
aksqcy/Android-7.0
3ccf332ad9c95eac1fa9476154e6bd6782c56eb9
e65af741a5cd5ac6e49e8735b00b456d00f6c0d0
refs/heads/master
2023-03-15T22:06:03.169815
2019-12-08T14:17:10
2019-12-08T14:17:10
535,748,893
1
0
MIT
2022-09-12T16:12:26
2022-09-12T16:12:25
null
UTF-8
C++
false
false
128,662
cpp
mp4enc_api.cpp
/* ------------------------------------------------------------------ * Copyright (C) 1998-2009 PacketVideo * * 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 "mp4enc_lib.h" #include "bitstream_io.h" #include "rate_control.h" #include "m4venc_oscl.h" #ifndef INT32_MAX #define INT32_MAX 0x7fffffff #endif #ifndef SIZE_MAX #define SIZE_MAX ((size_t) -1) #endif /* Inverse normal zigzag */ const static Int zigzag_i[NCOEFF_BLOCK] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 }; /* INTRA */ const static Int mpeg_iqmat_def[NCOEFF_BLOCK] = { 8, 17, 18, 19, 21, 23, 25, 27, 17, 18, 19, 21, 23, 25, 27, 28, 20, 21, 22, 23, 24, 26, 28, 30, 21, 22, 23, 24, 26, 28, 30, 32, 22, 23, 24, 26, 28, 30, 32, 35, 23, 24, 26, 28, 30, 32, 35, 38, 25, 26, 28, 30, 32, 35, 38, 41, 27, 28, 30, 32, 35, 38, 41, 45 }; /* INTER */ const static Int mpeg_nqmat_def[64] = { 16, 17, 18, 19, 20, 21, 22, 23, 17, 18, 19, 20, 21, 22, 23, 24, 18, 19, 20, 21, 22, 23, 24, 25, 19, 20, 21, 22, 23, 24, 26, 27, 20, 21, 22, 23, 25, 26, 27, 28, 21, 22, 23, 24, 26, 27, 28, 30, 22, 23, 24, 26, 27, 28, 30, 31, 23, 24, 25, 27, 28, 30, 31, 33 }; /* Profiles and levels */ /* Simple profile(level 0-3) and Core profile (level 1-2) */ /* {SPL0, SPL1, SPL2, SPL3, CPL1, CPL2, CPL2, CPL2} , SPL0: Simple Profile@Level0, CPL1: Core Profile@Level1, the last two are redundant for easy table manipulation */ const static Int profile_level_code[8] = { 0x08, 0x01, 0x02, 0x03, 0x21, 0x22, 0x22, 0x22 }; const static Int profile_level_max_bitrate[8] = { 64000, 64000, 128000, 384000, 384000, 2000000, 2000000, 2000000 }; const static Int profile_level_max_packet_size[8] = { 2048, 2048, 4096, 8192, 4096, 8192, 8192, 8192 }; const static Int profile_level_max_mbsPerSec[8] = { 1485, 1485, 5940, 11880, 5940, 23760, 23760, 23760 }; const static Int profile_level_max_VBV_size[8] = { 163840, 163840, 655360, 655360, 262144, 1310720, 1310720, 1310720 }; /* Simple scalable profile (level 0-2) and Core scalable profile (level 1-3) */ /* {SSPL0, SSPL1, SSPL2, SSPL2, CSPL1, CSPL2, CSPL3, CSPL3} , SSPL0: Simple Scalable Profile@Level0, CSPL1: Core Scalable Profile@Level1, the fourth is redundant for easy table manipulation */ const static Int scalable_profile_level_code[8] = { 0x10, 0x11, 0x12, 0x12, 0xA1, 0xA2, 0xA3, 0xA3 }; const static Int scalable_profile_level_max_bitrate[8] = { 128000, 128000, 256000, 256000, 768000, 1500000, 4000000, 4000000 }; /* in bits */ const static Int scalable_profile_level_max_packet_size[8] = { 2048, 2048, 4096, 4096, 4096, 4096, 16384, 16384 }; const static Int scalable_profile_level_max_mbsPerSec[8] = { 1485, 7425, 23760, 23760, 14850, 29700, 120960, 120960 }; const static Int scalable_profile_level_max_VBV_size[8] = { 163840, 655360, 655360, 655360, 1048576, 1310720, 1310720, 1310720 }; /* H263 profile 0 @ level 10-70 */ const static Int h263Level[8] = {0, 10, 20, 30, 40, 50, 60, 70}; const static float rBR_bound[8] = {0, 1, 2, 6, 32, 64, 128, 256}; const static float max_h263_framerate[2] = {(float)30000 / (float)2002, (float)30000 / (float)1001 }; const static Int max_h263_width[2] = {176, 352}; const static Int max_h263_height[2] = {144, 288}; /* 6/2/2001, newly added functions to make PVEncodeVop more readable. */ Int DetermineCodingLayer(VideoEncData *video, Int *nLayer, ULong modTime); void DetermineVopType(VideoEncData *video, Int currLayer); Int UpdateSkipNextFrame(VideoEncData *video, ULong *modTime, Int *size, PV_STATUS status); Bool SetProfile_BufferSize(VideoEncData *video, float delay, Int bInitialized); #ifdef PRINT_RC_INFO extern FILE *facct; extern int tiTotalNumBitsGenerated; extern int iStuffBits; #endif #ifdef PRINT_EC extern FILE *fec; #endif /* ======================================================================== */ /* Function : PVGetDefaultEncOption() */ /* Date : 12/12/2005 */ /* Purpose : */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetDefaultEncOption(VideoEncOptions *encOption, Int encUseCase) { VideoEncOptions defaultUseCase = {H263_MODE, profile_level_max_packet_size[SIMPLE_PROFILE_LEVEL0] >> 3, SIMPLE_PROFILE_LEVEL0, PV_OFF, 0, 1, 1000, 33, {144, 144}, {176, 176}, {15, 30}, {64000, 128000}, {10, 10}, {12, 12}, {0, 0}, CBR_1, 0.0, PV_OFF, -1, 0, PV_OFF, 16, PV_OFF, 0, PV_ON }; OSCL_UNUSED_ARG(encUseCase); // unused for now. Later we can add more defaults setting and use this // argument to select the right one. /* in the future we can create more meaningful use-cases */ if (encOption == NULL) { return PV_FALSE; } M4VENC_MEMCPY(encOption, &defaultUseCase, sizeof(VideoEncOptions)); return PV_TRUE; } /* ======================================================================== */ /* Function : PVInitVideoEncoder() */ /* Date : 08/22/2000 */ /* Purpose : Initialization of MP4 Encoder and VO bitstream */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : 5/21/01, allocate only yChan and assign uChan & vChan */ /* 12/12/05, add encoding option as input argument */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVInitVideoEncoder(VideoEncControls *encoderControl, VideoEncOptions *encOption) { Bool status = PV_TRUE; Int nLayers, idx, i, j; Int max = 0, max_width = 0, max_height = 0, pitch, offset; Int size = 0, nTotalMB = 0; VideoEncData *video; Vol *pVol; VideoEncParams *pEncParams; Int temp_w, temp_h, mbsPerSec; /******************************************/ /* this part use to be PVSetEncode() */ Int profile_table_index, *profile_level_table; Int profile_level = encOption->profile_level; Int PacketSize = encOption->packetSize << 3; Int timeInc, timeIncRes; float profile_max_framerate; VideoEncParams *encParams; if (encoderControl->videoEncoderData) /* this has been called */ { if (encoderControl->videoEncoderInit) /* check if PVInitVideoEncoder() has been called */ { PVCleanUpVideoEncoder(encoderControl); encoderControl->videoEncoderInit = 0; } M4VENC_FREE(encoderControl->videoEncoderData); encoderControl->videoEncoderData = NULL; } encoderControl->videoEncoderInit = 0; /* reset this value */ video = (VideoEncData *)M4VENC_MALLOC(sizeof(VideoEncData)); /* allocate memory for encData */ if (video == NULL) return PV_FALSE; M4VENC_MEMSET(video, 0, sizeof(VideoEncData)); encoderControl->videoEncoderData = (void *) video; /* set up pointer in VideoEncData structure */ video->encParams = (VideoEncParams *)M4VENC_MALLOC(sizeof(VideoEncParams)); if (video->encParams == NULL) goto CLEAN_UP; M4VENC_MEMSET(video->encParams, 0, sizeof(VideoEncParams)); encParams = video->encParams; encParams->nLayers = encOption->numLayers; /* Check whether the input packetsize is valid (Note: put code here (before any memory allocation) in order to avoid memory leak */ if ((Int)profile_level < (Int)(SIMPLE_SCALABLE_PROFILE_LEVEL0)) /* non-scalable profile */ { profile_level_table = (Int *)profile_level_max_packet_size; profile_table_index = (Int)profile_level; if (encParams->nLayers != 1) { goto CLEAN_UP; } encParams->LayerMaxMbsPerSec[0] = profile_level_max_mbsPerSec[profile_table_index]; } else /* scalable profile */ { profile_level_table = (Int *)scalable_profile_level_max_packet_size; profile_table_index = (Int)profile_level - (Int)(SIMPLE_SCALABLE_PROFILE_LEVEL0); if (encParams->nLayers < 2) { goto CLEAN_UP; } for (i = 0; i < encParams->nLayers; i++) { encParams->LayerMaxMbsPerSec[i] = scalable_profile_level_max_mbsPerSec[profile_table_index]; } } /* cannot have zero size packet with these modes */ if (PacketSize == 0) { if (encOption->encMode == DATA_PARTITIONING_MODE) { goto CLEAN_UP; } if (encOption->encMode == COMBINE_MODE_WITH_ERR_RES) { encOption->encMode = COMBINE_MODE_NO_ERR_RES; } } if (encOption->gobHeaderInterval == 0) { if (encOption->encMode == H263_MODE_WITH_ERR_RES) { encOption->encMode = H263_MODE; } if (encOption->encMode == SHORT_HEADER_WITH_ERR_RES) { encOption->encMode = SHORT_HEADER; } } if (PacketSize > profile_level_table[profile_table_index]) goto CLEAN_UP; /* Initial Defaults for all Modes */ encParams->SequenceStartCode = 1; encParams->GOV_Enabled = 0; encParams->RoundingType = 0; encParams->IntraDCVlcThr = PV_MAX(PV_MIN(encOption->intraDCVlcTh, 7), 0); encParams->ACDCPrediction = ((encOption->useACPred == PV_ON) ? TRUE : FALSE); encParams->RC_Type = encOption->rcType; encParams->Refresh = encOption->numIntraMB; encParams->ResyncMarkerDisable = 0; /* Enable Resync Marker */ for (i = 0; i < encOption->numLayers; i++) { #ifdef NO_MPEG_QUANT encParams->QuantType[i] = 0; #else encParams->QuantType[i] = encOption->quantType[i]; /* H263 */ #endif if (encOption->pQuant[i] >= 1 && encOption->pQuant[i] <= 31) { encParams->InitQuantPvop[i] = encOption->pQuant[i]; } else { goto CLEAN_UP; } if (encOption->iQuant[i] >= 1 && encOption->iQuant[i] <= 31) { encParams->InitQuantIvop[i] = encOption->iQuant[i]; } else { goto CLEAN_UP; } } encParams->HalfPel_Enabled = 1; encParams->SearchRange = encOption->searchRange; /* 4/16/2001 */ encParams->FullSearch_Enabled = 0; #ifdef NO_INTER4V encParams->MV8x8_Enabled = 0; #else encParams->MV8x8_Enabled = 0;// comment out for now!! encOption->mv8x8Enable; #endif encParams->H263_Enabled = 0; encParams->GOB_Header_Interval = 0; // need to be reset to 0 encParams->IntraPeriod = encOption->intraPeriod; /* Intra update period update default*/ encParams->SceneChange_Det = encOption->sceneDetect; encParams->FineFrameSkip_Enabled = 0; encParams->NoFrameSkip_Enabled = encOption->noFrameSkipped; encParams->NoPreSkip_Enabled = encOption->noFrameSkipped; encParams->GetVolHeader[0] = 0; encParams->GetVolHeader[1] = 0; encParams->ResyncPacketsize = encOption->packetSize << 3; encParams->LayerMaxBitRate[0] = 0; encParams->LayerMaxBitRate[1] = 0; encParams->LayerMaxFrameRate[0] = (float)0.0; encParams->LayerMaxFrameRate[1] = (float)0.0; encParams->VBV_delay = encOption->vbvDelay; /* 2sec VBV buffer size */ switch (encOption->encMode) { case SHORT_HEADER: case SHORT_HEADER_WITH_ERR_RES: /* From Table 6-26 */ encParams->nLayers = 1; encParams->QuantType[0] = 0; /*H263 */ encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */ encParams->DataPartitioning = 0; /* Combined Mode */ encParams->ReversibleVLC = 0; /* Disable RVLC */ encParams->RoundingType = 0; encParams->IntraDCVlcThr = 7; /* use_intra_dc_vlc = 0 */ encParams->MV8x8_Enabled = 0; encParams->GOB_Header_Interval = encOption->gobHeaderInterval; encParams->H263_Enabled = 2; encParams->GOV_Enabled = 0; encParams->TimeIncrementRes = 30000; /* timeIncrementRes for H263 */ break; case H263_MODE: case H263_MODE_WITH_ERR_RES: /* From Table 6-26 */ encParams->nLayers = 1; encParams->QuantType[0] = 0; /*H263 */ encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */ encParams->DataPartitioning = 0; /* Combined Mode */ encParams->ReversibleVLC = 0; /* Disable RVLC */ encParams->RoundingType = 0; encParams->IntraDCVlcThr = 7; /* use_intra_dc_vlc = 0 */ encParams->MV8x8_Enabled = 0; encParams->H263_Enabled = 1; encParams->GOV_Enabled = 0; encParams->TimeIncrementRes = 30000; /* timeIncrementRes for H263 */ break; #ifndef H263_ONLY case DATA_PARTITIONING_MODE: encParams->DataPartitioning = 1; /* Base Layer Data Partitioning */ encParams->ResyncMarkerDisable = 0; /* Resync Marker */ #ifdef NO_RVLC encParams->ReversibleVLC = 0; #else encParams->ReversibleVLC = (encOption->rvlcEnable == PV_ON); /* RVLC when Data Partitioning */ #endif encParams->ResyncPacketsize = PacketSize; break; case COMBINE_MODE_WITH_ERR_RES: encParams->DataPartitioning = 0; /* Combined Mode */ encParams->ResyncMarkerDisable = 0; /* Resync Marker */ encParams->ReversibleVLC = 0; /* No RVLC */ encParams->ResyncPacketsize = PacketSize; break; case COMBINE_MODE_NO_ERR_RES: encParams->DataPartitioning = 0; /* Combined Mode */ encParams->ResyncMarkerDisable = 1; /* Disable Resync Marker */ encParams->ReversibleVLC = 0; /* No RVLC */ break; #endif default: goto CLEAN_UP; } /* Set the constraints (maximum values) according to the input profile and level */ /* Note that profile_table_index is already figured out above */ /* base layer */ encParams->profile_table_index = profile_table_index; /* Used to limit the profile and level in SetProfile_BufferSize() */ /* check timeIncRes */ timeIncRes = encOption->timeIncRes; timeInc = encOption->tickPerSrc; if ((timeIncRes >= 1) && (timeIncRes <= 65536) && (timeInc < timeIncRes) && (timeInc != 0)) { if (!encParams->H263_Enabled) { encParams->TimeIncrementRes = timeIncRes; } else { encParams->TimeIncrementRes = 30000; // video->FrameRate = 30000/(float)1001; /* fix it to 29.97 fps */ } video->FrameRate = timeIncRes / ((float)timeInc); } else { goto CLEAN_UP; } /* check frame dimension */ if (encParams->H263_Enabled) { switch (encOption->encWidth[0]) { case 128: if (encOption->encHeight[0] != 96) /* source_format = 1 */ goto CLEAN_UP; break; case 176: if (encOption->encHeight[0] != 144) /* source_format = 2 */ goto CLEAN_UP; break; case 352: if (encOption->encHeight[0] != 288) /* source_format = 2 */ goto CLEAN_UP; break; case 704: if (encOption->encHeight[0] != 576) /* source_format = 2 */ goto CLEAN_UP; break; case 1408: if (encOption->encHeight[0] != 1152) /* source_format = 2 */ goto CLEAN_UP; break; default: goto CLEAN_UP; } } for (i = 0; i < encParams->nLayers; i++) { encParams->LayerHeight[i] = encOption->encHeight[i]; encParams->LayerWidth[i] = encOption->encWidth[i]; } /* check frame rate */ for (i = 0; i < encParams->nLayers; i++) { encParams->LayerFrameRate[i] = encOption->encFrameRate[i]; } if (encParams->nLayers > 1) { if (encOption->encFrameRate[0] == encOption->encFrameRate[1] || encOption->encFrameRate[0] == 0. || encOption->encFrameRate[1] == 0.) /* 7/31/03 */ goto CLEAN_UP; } /* set max frame rate */ for (i = 0; i < encParams->nLayers; i++) { /* Make sure the maximum framerate is consistent with the given profile and level */ nTotalMB = ((encParams->LayerWidth[i] + 15) / 16) * ((encParams->LayerHeight[i] + 15) / 16); if (nTotalMB > 0) profile_max_framerate = (float)encParams->LayerMaxMbsPerSec[i] / (float)nTotalMB; else profile_max_framerate = (float)30.0; encParams->LayerMaxFrameRate[i] = PV_MIN(profile_max_framerate, encParams->LayerFrameRate[i]); } /* check bit rate */ /* set max bit rate */ for (i = 0; i < encParams->nLayers; i++) { encParams->LayerBitRate[i] = encOption->bitRate[i]; encParams->LayerMaxBitRate[i] = encOption->bitRate[i]; } if (encParams->nLayers > 1) { if (encOption->bitRate[0] == encOption->bitRate[1] || encOption->bitRate[0] == 0 || encOption->bitRate[1] == 0) /* 7/31/03 */ goto CLEAN_UP; } /* check rate control and vbv delay*/ encParams->RC_Type = encOption->rcType; if (encOption->vbvDelay == 0.0) /* set to default */ { switch (encOption->rcType) { case CBR_1: case CBR_2: encParams->VBV_delay = (float)2.0; /* default 2sec VBV buffer size */ break; case CBR_LOWDELAY: encParams->VBV_delay = (float)0.5; /* default 0.5sec VBV buffer size */ break; case VBR_1: case VBR_2: encParams->VBV_delay = (float)10.0; /* default 10sec VBV buffer size */ break; default: break; } } else /* force this value */ { encParams->VBV_delay = encOption->vbvDelay; } /* check search range */ if (encParams->H263_Enabled && encOption->searchRange > 16) { encParams->SearchRange = 16; /* 4/16/2001 */ } /*****************************************/ /* checking for conflict between options */ /*****************************************/ if (video->encParams->RC_Type == CBR_1 || video->encParams->RC_Type == CBR_2 || video->encParams->RC_Type == CBR_LOWDELAY) /* if CBR */ { #ifdef _PRINT_STAT if (video->encParams->NoFrameSkip_Enabled == PV_ON || video->encParams->NoPreSkip_Enabled == PV_ON) /* don't allow frame skip*/ printf("WARNING!!!! CBR with NoFrameSkip\n"); #endif } else if (video->encParams->RC_Type == CONSTANT_Q) /* constant_Q */ { video->encParams->NoFrameSkip_Enabled = PV_ON; /* no frame skip */ video->encParams->NoPreSkip_Enabled = PV_ON; /* no frame skip */ #ifdef _PRINT_STAT printf("Turn on NoFrameSkip\n"); #endif } if (video->encParams->NoFrameSkip_Enabled == PV_ON) /* if no frame skip */ { video->encParams->FineFrameSkip_Enabled = PV_OFF; #ifdef _PRINT_STAT printf("NoFrameSkip !!! may violate VBV_BUFFER constraint.\n"); printf("Turn off FineFrameSkip\n"); #endif } /******************************************/ /******************************************/ nLayers = video->encParams->nLayers; /* Number of Layers to be encoded */ /* Find the maximum width*height for memory allocation of the VOPs */ for (idx = 0; idx < nLayers; idx++) { temp_w = video->encParams->LayerWidth[idx]; temp_h = video->encParams->LayerHeight[idx]; if ((temp_w*temp_h) > max) { max = temp_w * temp_h; max_width = ((temp_w + 15) >> 4) << 4; max_height = ((temp_h + 15) >> 4) << 4; if (((uint64_t)max_width * max_height) > (uint64_t)INT32_MAX || temp_w > INT32_MAX - 15 || temp_h > INT32_MAX - 15) { goto CLEAN_UP; } nTotalMB = ((max_width * max_height) >> 8); } /* Check if the video size and framerate(MBsPerSec) are vald */ mbsPerSec = (Int)(nTotalMB * video->encParams->LayerFrameRate[idx]); if (mbsPerSec > video->encParams->LayerMaxMbsPerSec[idx]) status = PV_FALSE; } /****************************************************/ /* Set Profile and Video Buffer Size for each layer */ /****************************************************/ if (video->encParams->RC_Type == CBR_LOWDELAY) video->encParams->VBV_delay = 0.5; /* For CBR_LOWDELAY, we set 0.5sec buffer */ status = SetProfile_BufferSize(video, video->encParams->VBV_delay, 1); if (status != PV_TRUE) goto CLEAN_UP; /****************************************/ /* memory allocation and initialization */ /****************************************/ if (video == NULL) goto CLEAN_UP; /* cyclic reference for passing through both structures */ video->videoEncControls = encoderControl; //video->currLayer = 0; /* Set current Layer to 0 */ //video->currFrameNo = 0; /* Set current frame Number to 0 */ video->nextModTime = 0; video->nextEncIVop = 0; /* Sets up very first frame to be I-VOP! */ video->numVopsInGOP = 0; /* counter for Vops in Gop, 2/8/01 */ //video->frameRate = video->encParams->LayerFrameRate[0]; /* Set current layer frame rate */ video->QPMB = (UChar *) M4VENC_MALLOC(nTotalMB * sizeof(UChar)); /* Memory for MB quantizers */ if (video->QPMB == NULL) goto CLEAN_UP; video->headerInfo.Mode = (UChar *) M4VENC_MALLOC(sizeof(UChar) * nTotalMB); /* Memory for MB Modes */ if (video->headerInfo.Mode == NULL) goto CLEAN_UP; video->headerInfo.CBP = (UChar *) M4VENC_MALLOC(sizeof(UChar) * nTotalMB); /* Memory for CBP (Y and C) of each MB */ if (video->headerInfo.CBP == NULL) goto CLEAN_UP; /* Allocating motion vector space and interpolation memory*/ if ((size_t)nTotalMB > SIZE_MAX / sizeof(MOT *)) { goto CLEAN_UP; } video->mot = (MOT **)M4VENC_MALLOC(sizeof(MOT *) * nTotalMB); if (video->mot == NULL) goto CLEAN_UP; for (idx = 0; idx < nTotalMB; idx++) { video->mot[idx] = (MOT *)M4VENC_MALLOC(sizeof(MOT) * 8); if (video->mot[idx] == NULL) { goto CLEAN_UP; } } video->intraArray = (UChar *)M4VENC_MALLOC(sizeof(UChar) * nTotalMB); if (video->intraArray == NULL) goto CLEAN_UP; video->sliceNo = (UChar *) M4VENC_MALLOC(nTotalMB); /* Memory for Slice Numbers */ if (video->sliceNo == NULL) goto CLEAN_UP; /* Allocating space for predDCAC[][8][16], Not that I intentionally */ /* increase the dimension of predDCAC from [][6][15] to [][8][16] */ /* so that compilers can generate faster code to indexing the */ /* data inside (by using << instead of *). 04/14/2000. */ /* 5/29/01, use decoder lib ACDC prediction memory scheme. */ if ((size_t)nTotalMB > SIZE_MAX / sizeof(typeDCStore)) { goto CLEAN_UP; } video->predDC = (typeDCStore *) M4VENC_MALLOC(nTotalMB * sizeof(typeDCStore)); if (video->predDC == NULL) goto CLEAN_UP; if (!video->encParams->H263_Enabled) { if ((size_t)((max_width >> 4) + 1) > SIZE_MAX / sizeof(typeDCACStore)) { goto CLEAN_UP; } video->predDCAC_col = (typeDCACStore *) M4VENC_MALLOC(((max_width >> 4) + 1) * sizeof(typeDCACStore)); if (video->predDCAC_col == NULL) goto CLEAN_UP; /* element zero will be used for storing vertical (col) AC coefficients */ /* the rest will be used for storing horizontal (row) AC coefficients */ video->predDCAC_row = video->predDCAC_col + 1; /* ACDC */ if ((size_t)nTotalMB > SIZE_MAX / sizeof(Int)) { goto CLEAN_UP; } video->acPredFlag = (Int *) M4VENC_MALLOC(nTotalMB * sizeof(Int)); /* Memory for acPredFlag */ if (video->acPredFlag == NULL) goto CLEAN_UP; } video->outputMB = (MacroBlock *) M4VENC_MALLOC(sizeof(MacroBlock)); /* Allocating macroblock space */ if (video->outputMB == NULL) goto CLEAN_UP; M4VENC_MEMSET(video->outputMB->block[0], 0, (sizeof(Short) << 6)*6); M4VENC_MEMSET(video->dataBlock, 0, sizeof(Short) << 7); /* Allocate (2*packetsize) working bitstreams */ video->bitstream1 = BitStreamCreateEnc(2 * 4096); /*allocate working stream 1*/ if (video->bitstream1 == NULL) goto CLEAN_UP; video->bitstream2 = BitStreamCreateEnc(2 * 4096); /*allocate working stream 2*/ if (video->bitstream2 == NULL) goto CLEAN_UP; video->bitstream3 = BitStreamCreateEnc(2 * 4096); /*allocate working stream 3*/ if (video->bitstream3 == NULL) goto CLEAN_UP; /* allocate overrun buffer */ // this buffer is used when user's buffer is too small to hold one frame. // It is not needed for slice-based encoding. if (nLayers == 1) { video->oBSize = encParams->BufferSize[0] >> 3; } else { video->oBSize = PV_MAX((encParams->BufferSize[0] >> 3), (encParams->BufferSize[1] >> 3)); } if (video->oBSize > DEFAULT_OVERRUN_BUFFER_SIZE || encParams->RC_Type == CONSTANT_Q) // set limit { video->oBSize = DEFAULT_OVERRUN_BUFFER_SIZE; } video->overrunBuffer = (UChar*) M4VENC_MALLOC(sizeof(UChar) * video->oBSize); if (video->overrunBuffer == NULL) goto CLEAN_UP; video->currVop = (Vop *) M4VENC_MALLOC(sizeof(Vop)); /* Memory for Current VOP */ if (video->currVop == NULL) goto CLEAN_UP; /* add padding, 09/19/05 */ if (video->encParams->H263_Enabled) /* make it conditional 11/28/05 */ { pitch = max_width; offset = 0; } else { pitch = max_width + 32; offset = (pitch << 4) + 16; max_height += 32; } if (((uint64_t)pitch * max_height) > (uint64_t)INT32_MAX) { goto CLEAN_UP; } size = pitch * max_height; if (size > INT32_MAX - (size >> 1) || (size_t)(size + (size >> 1)) > SIZE_MAX / sizeof(PIXEL)) { goto CLEAN_UP; } video->currVop->allChan = video->currVop->yChan = (PIXEL *)M4VENC_MALLOC(sizeof(PIXEL) * (size + (size >> 1))); /* Memory for currVop Y */ if (video->currVop->yChan == NULL) goto CLEAN_UP; video->currVop->uChan = video->currVop->yChan + size;/* Memory for currVop U */ video->currVop->vChan = video->currVop->uChan + (size >> 2);/* Memory for currVop V */ /* shift for the offset */ if (offset) { video->currVop->yChan += offset; /* offset to the origin.*/ video->currVop->uChan += (offset >> 2) + 4; video->currVop->vChan += (offset >> 2) + 4; } video->forwardRefVop = video->currVop; /* Initialize forwardRefVop */ video->backwardRefVop = video->currVop; /* Initialize backwardRefVop */ video->prevBaseVop = (Vop *) M4VENC_MALLOC(sizeof(Vop)); /* Memory for Previous Base Vop */ if (video->prevBaseVop == NULL) goto CLEAN_UP; video->prevBaseVop->allChan = video->prevBaseVop->yChan = (PIXEL *) M4VENC_MALLOC(sizeof(PIXEL) * (size + (size >> 1))); /* Memory for prevBaseVop Y */ if (video->prevBaseVop->yChan == NULL) goto CLEAN_UP; video->prevBaseVop->uChan = video->prevBaseVop->yChan + size; /* Memory for prevBaseVop U */ video->prevBaseVop->vChan = video->prevBaseVop->uChan + (size >> 2); /* Memory for prevBaseVop V */ if (offset) { video->prevBaseVop->yChan += offset; /* offset to the origin.*/ video->prevBaseVop->uChan += (offset >> 2) + 4; video->prevBaseVop->vChan += (offset >> 2) + 4; } if (0) /* If B Frames */ { video->nextBaseVop = (Vop *) M4VENC_MALLOC(sizeof(Vop)); /* Memory for Next Base Vop */ if (video->nextBaseVop == NULL) goto CLEAN_UP; video->nextBaseVop->allChan = video->nextBaseVop->yChan = (PIXEL *) M4VENC_MALLOC(sizeof(PIXEL) * (size + (size >> 1))); /* Memory for nextBaseVop Y */ if (video->nextBaseVop->yChan == NULL) goto CLEAN_UP; video->nextBaseVop->uChan = video->nextBaseVop->yChan + size; /* Memory for nextBaseVop U */ video->nextBaseVop->vChan = video->nextBaseVop->uChan + (size >> 2); /* Memory for nextBaseVop V */ if (offset) { video->nextBaseVop->yChan += offset; /* offset to the origin.*/ video->nextBaseVop->uChan += (offset >> 2) + 4; video->nextBaseVop->vChan += (offset >> 2) + 4; } } if (nLayers > 1) /* If enhancement layers */ { video->prevEnhanceVop = (Vop *) M4VENC_MALLOC(sizeof(Vop)); /* Memory for Previous Enhancement Vop */ if (video->prevEnhanceVop == NULL) goto CLEAN_UP; video->prevEnhanceVop->allChan = video->prevEnhanceVop->yChan = (PIXEL *) M4VENC_MALLOC(sizeof(PIXEL) * (size + (size >> 1))); /* Memory for Previous Ehancement Y */ if (video->prevEnhanceVop->yChan == NULL) goto CLEAN_UP; video->prevEnhanceVop->uChan = video->prevEnhanceVop->yChan + size; /* Memory for Previous Enhancement U */ video->prevEnhanceVop->vChan = video->prevEnhanceVop->uChan + (size >> 2); /* Memory for Previous Enhancement V */ if (offset) { video->prevEnhanceVop->yChan += offset; /* offset to the origin.*/ video->prevEnhanceVop->uChan += (offset >> 2) + 4; video->prevEnhanceVop->vChan += (offset >> 2) + 4; } } video->numberOfLayers = nLayers; /* Number of Layers */ video->sumMAD = 0; /* 04/09/01, for Vops in the use multipass processing */ for (idx = 0; idx < nLayers; idx++) { video->pMP[idx] = (MultiPass *)M4VENC_MALLOC(sizeof(MultiPass)); if (video->pMP[idx] == NULL) goto CLEAN_UP; M4VENC_MEMSET(video->pMP[idx], 0, sizeof(MultiPass)); video->pMP[idx]->encoded_frames = -1; /* forget about the very first I frame */ /* RDInfo **pRDSamples */ video->pMP[idx]->pRDSamples = (RDInfo **)M4VENC_MALLOC(30 * sizeof(RDInfo *)); if (video->pMP[idx]->pRDSamples == NULL) goto CLEAN_UP; for (i = 0; i < 30; i++) { video->pMP[idx]->pRDSamples[i] = (RDInfo *)M4VENC_MALLOC(32 * sizeof(RDInfo)); if (video->pMP[idx]->pRDSamples[i] == NULL) goto CLEAN_UP; for (j = 0; j < 32; j++) M4VENC_MEMSET(&(video->pMP[idx]->pRDSamples[i][j]), 0, sizeof(RDInfo)); } video->pMP[idx]->frameRange = (Int)(video->encParams->LayerFrameRate[idx] * 1.0); /* 1.0s time frame*/ video->pMP[idx]->frameRange = PV_MAX(video->pMP[idx]->frameRange, 5); video->pMP[idx]->frameRange = PV_MIN(video->pMP[idx]->frameRange, 30); video->pMP[idx]->framePos = -1; } /* /// End /////////////////////////////////////// */ if ((size_t)nLayers > SIZE_MAX / sizeof(Vol *)) { goto CLEAN_UP; } video->vol = (Vol **)M4VENC_MALLOC(nLayers * sizeof(Vol *)); /* Memory for VOL pointers */ /* Memory allocation and Initialization of Vols and writing of headers */ if (video->vol == NULL) goto CLEAN_UP; for (idx = 0; idx < nLayers; idx++) { video->volInitialize[idx] = 1; video->refTick[idx] = 0; video->relLayerCodeTime[idx] = 1000; video->vol[idx] = (Vol *)M4VENC_MALLOC(sizeof(Vol)); if (video->vol[idx] == NULL) goto CLEAN_UP; pVol = video->vol[idx]; pEncParams = video->encParams; M4VENC_MEMSET(video->vol[idx], 0, sizeof(Vol)); /* Initialize some VOL parameters */ pVol->volID = idx; /* Set VOL ID */ pVol->shortVideoHeader = pEncParams->H263_Enabled; /*Short Header */ pVol->GOVStart = pEncParams->GOV_Enabled; /* GOV Header */ pVol->timeIncrementResolution = video->encParams->TimeIncrementRes; pVol->nbitsTimeIncRes = 1; while (pVol->timeIncrementResolution > (1 << pVol->nbitsTimeIncRes)) { pVol->nbitsTimeIncRes++; } /* timing stuff */ pVol->timeIncrement = 0; pVol->moduloTimeBase = 0; pVol->fixedVopRate = 0; /* No fixed VOP rate */ pVol->stream = (BitstreamEncVideo *)M4VENC_MALLOC(sizeof(BitstreamEncVideo)); /* allocate BitstreamEncVideo Instance */ if (pVol->stream == NULL) goto CLEAN_UP; pVol->width = pEncParams->LayerWidth[idx]; /* Layer Width */ pVol->height = pEncParams->LayerHeight[idx]; /* Layer Height */ // pVol->intra_acdcPredDisable = pEncParams->ACDCPrediction; /* ACDC Prediction */ pVol->ResyncMarkerDisable = pEncParams->ResyncMarkerDisable; /* Resync Marker Mode */ pVol->dataPartitioning = pEncParams->DataPartitioning; /* Data Partitioning */ pVol->useReverseVLC = pEncParams->ReversibleVLC; /* RVLC */ if (idx > 0) /* Scalability layers */ { pVol->ResyncMarkerDisable = 1; pVol->dataPartitioning = 0; pVol->useReverseVLC = 0; /* No RVLC */ } pVol->quantType = pEncParams->QuantType[idx]; /* Quantizer Type */ /* no need to init Quant Matrices */ pVol->scalability = 0; /* Vol Scalability */ if (idx > 0) pVol->scalability = 1; /* Multiple layers => Scalability */ /* Initialize Vol to Temporal scalability. It can change during encoding */ pVol->scalType = 1; /* Initialize reference Vol ID to the base layer = 0 */ pVol->refVolID = 0; /* Initialize layer resolution to same as the reference */ pVol->refSampDir = 0; pVol->horSamp_m = 1; pVol->horSamp_n = 1; pVol->verSamp_m = 1; pVol->verSamp_n = 1; pVol->enhancementType = 0; /* We always enhance the entire region */ pVol->nMBPerRow = (pVol->width + 15) / 16; pVol->nMBPerCol = (pVol->height + 15) / 16; pVol->nTotalMB = pVol->nMBPerRow * pVol->nMBPerCol; if (pVol->nTotalMB >= 1) pVol->nBitsForMBID = 1; if (pVol->nTotalMB >= 3) pVol->nBitsForMBID = 2; if (pVol->nTotalMB >= 5) pVol->nBitsForMBID = 3; if (pVol->nTotalMB >= 9) pVol->nBitsForMBID = 4; if (pVol->nTotalMB >= 17) pVol->nBitsForMBID = 5; if (pVol->nTotalMB >= 33) pVol->nBitsForMBID = 6; if (pVol->nTotalMB >= 65) pVol->nBitsForMBID = 7; if (pVol->nTotalMB >= 129) pVol->nBitsForMBID = 8; if (pVol->nTotalMB >= 257) pVol->nBitsForMBID = 9; if (pVol->nTotalMB >= 513) pVol->nBitsForMBID = 10; if (pVol->nTotalMB >= 1025) pVol->nBitsForMBID = 11; if (pVol->nTotalMB >= 2049) pVol->nBitsForMBID = 12; if (pVol->nTotalMB >= 4097) pVol->nBitsForMBID = 13; if (pVol->nTotalMB >= 8193) pVol->nBitsForMBID = 14; if (pVol->nTotalMB >= 16385) pVol->nBitsForMBID = 15; if (pVol->nTotalMB >= 32769) pVol->nBitsForMBID = 16; if (pVol->nTotalMB >= 65537) pVol->nBitsForMBID = 17; if (pVol->nTotalMB >= 131073) pVol->nBitsForMBID = 18; if (pVol->shortVideoHeader) { switch (pVol->width) { case 128: if (pVol->height == 96) /* source_format = 1 */ { pVol->nGOBinVop = 6; pVol->nMBinGOB = 8; } else status = PV_FALSE; break; case 176: if (pVol->height == 144) /* source_format = 2 */ { pVol->nGOBinVop = 9; pVol->nMBinGOB = 11; } else status = PV_FALSE; break; case 352: if (pVol->height == 288) /* source_format = 2 */ { pVol->nGOBinVop = 18; pVol->nMBinGOB = 22; } else status = PV_FALSE; break; case 704: if (pVol->height == 576) /* source_format = 2 */ { pVol->nGOBinVop = 18; pVol->nMBinGOB = 88; } else status = PV_FALSE; break; case 1408: if (pVol->height == 1152) /* source_format = 2 */ { pVol->nGOBinVop = 18; pVol->nMBinGOB = 352; } else status = PV_FALSE; break; default: status = PV_FALSE; break; } } } /***************************************************/ /* allocate and initialize rate control parameters */ /***************************************************/ /* BEGIN INITIALIZATION OF ANNEX L RATE CONTROL */ if (video->encParams->RC_Type != CONSTANT_Q) { for (idx = 0; idx < nLayers; idx++) /* 12/25/00 */ { video->rc[idx] = (rateControl *)M4VENC_MALLOC(sizeof(rateControl)); if (video->rc[idx] == NULL) goto CLEAN_UP; M4VENC_MEMSET(video->rc[idx], 0, sizeof(rateControl)); } if (PV_SUCCESS != RC_Initialize(video)) { goto CLEAN_UP; } /* initialization for 2-pass rate control */ } /* END INITIALIZATION OF ANNEX L RATE CONTROL */ /********** assign platform dependent functions ***********************/ /* 1/23/01 */ /* This must be done at run-time not a compile time */ video->functionPointer = (FuncPtr*) M4VENC_MALLOC(sizeof(FuncPtr)); if (video->functionPointer == NULL) goto CLEAN_UP; video->functionPointer->ComputeMBSum = &ComputeMBSum_C; video->functionPointer->SAD_MB_HalfPel[0] = NULL; video->functionPointer->SAD_MB_HalfPel[1] = &SAD_MB_HalfPel_Cxh; video->functionPointer->SAD_MB_HalfPel[2] = &SAD_MB_HalfPel_Cyh; video->functionPointer->SAD_MB_HalfPel[3] = &SAD_MB_HalfPel_Cxhyh; #ifndef NO_INTER4V video->functionPointer->SAD_Blk_HalfPel = &SAD_Blk_HalfPel_C; video->functionPointer->SAD_Block = &SAD_Block_C; #endif video->functionPointer->SAD_Macroblock = &SAD_Macroblock_C; video->functionPointer->ChooseMode = &ChooseMode_C; video->functionPointer->GetHalfPelMBRegion = &GetHalfPelMBRegion_C; // video->functionPointer->SAD_MB_PADDING = &SAD_MB_PADDING; /* 4/21/01 */ encoderControl->videoEncoderInit = 1; /* init done! */ return PV_TRUE; CLEAN_UP: PVCleanUpVideoEncoder(encoderControl); return PV_FALSE; } /* ======================================================================== */ /* Function : PVCleanUpVideoEncoder() */ /* Date : 08/22/2000 */ /* Purpose : Deallocates allocated memory from InitVideoEncoder() */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : 5/21/01, free only yChan in Vop */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVCleanUpVideoEncoder(VideoEncControls *encoderControl) { Int idx, i; VideoEncData *video = (VideoEncData *)encoderControl->videoEncoderData; int nTotalMB; int max_width, offset; #ifdef PRINT_RC_INFO if (facct != NULL) { fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "TOTAL NUM BITS GENERATED %d\n", tiTotalNumBitsGenerated); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "TOTAL NUMBER OF FRAMES CODED %d\n", video->encParams->rc[0]->totalFrameNumber); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "Average BitRate %d\n", (tiTotalNumBitsGenerated / (90 / 30))); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "TOTAL NUMBER OF STUFF BITS %d\n", (iStuffBits + 10740)); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "TOTAL NUMBER OF BITS TO NETWORK %d\n", (35800*90 / 30));; fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "SUM OF STUFF BITS AND GENERATED BITS %d\n", (tiTotalNumBitsGenerated + iStuffBits + 10740)); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fprintf(facct, "UNACCOUNTED DIFFERENCE %d\n", ((35800*90 / 30) - (tiTotalNumBitsGenerated + iStuffBits + 10740))); fprintf(facct, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); fclose(facct); } #endif #ifdef PRINT_EC fclose(fec); #endif if (video != NULL) { if (video->QPMB) M4VENC_FREE(video->QPMB); if (video->headerInfo.Mode)M4VENC_FREE(video->headerInfo.Mode); if (video->headerInfo.CBP)M4VENC_FREE(video->headerInfo.CBP); if (video->mot) { nTotalMB = video->vol[0]->nTotalMB; for (idx = 1; idx < video->currLayer; idx++) if (video->vol[idx]->nTotalMB > nTotalMB) nTotalMB = video->vol[idx]->nTotalMB; for (idx = 0; idx < nTotalMB; idx++) { if (video->mot[idx]) M4VENC_FREE(video->mot[idx]); } M4VENC_FREE(video->mot); } if (video->intraArray) M4VENC_FREE(video->intraArray); if (video->sliceNo)M4VENC_FREE(video->sliceNo); if (video->acPredFlag)M4VENC_FREE(video->acPredFlag); // if(video->predDCAC)M4VENC_FREE(video->predDCAC); if (video->predDC) M4VENC_FREE(video->predDC); video->predDCAC_row = NULL; if (video->predDCAC_col) M4VENC_FREE(video->predDCAC_col); if (video->outputMB)M4VENC_FREE(video->outputMB); if (video->bitstream1)BitstreamCloseEnc(video->bitstream1); if (video->bitstream2)BitstreamCloseEnc(video->bitstream2); if (video->bitstream3)BitstreamCloseEnc(video->bitstream3); if (video->overrunBuffer) M4VENC_FREE(video->overrunBuffer); max_width = video->encParams->LayerWidth[0]; max_width = (((max_width + 15) >> 4) << 4); /* 09/19/05 */ if (video->encParams->H263_Enabled) { offset = 0; } else { offset = ((max_width + 32) << 4) + 16; } if (video->currVop) { if (video->currVop->allChan) { M4VENC_FREE(video->currVop->allChan); } M4VENC_FREE(video->currVop); } if (video->nextBaseVop) { if (video->nextBaseVop->allChan) { M4VENC_FREE(video->nextBaseVop->allChan); } M4VENC_FREE(video->nextBaseVop); } if (video->prevBaseVop) { if (video->prevBaseVop->allChan) { M4VENC_FREE(video->prevBaseVop->allChan); } M4VENC_FREE(video->prevBaseVop); } if (video->prevEnhanceVop) { if (video->prevEnhanceVop->allChan) { M4VENC_FREE(video->prevEnhanceVop->allChan); } M4VENC_FREE(video->prevEnhanceVop); } /* 04/09/01, for Vops in the use multipass processing */ for (idx = 0; idx < video->encParams->nLayers; idx++) { if (video->pMP[idx]) { if (video->pMP[idx]->pRDSamples) { for (i = 0; i < 30; i++) { if (video->pMP[idx]->pRDSamples[i]) M4VENC_FREE(video->pMP[idx]->pRDSamples[i]); } M4VENC_FREE(video->pMP[idx]->pRDSamples); } M4VENC_MEMSET(video->pMP[idx], 0, sizeof(MultiPass)); M4VENC_FREE(video->pMP[idx]); } } /* // End /////////////////////////////////////// */ if (video->vol) { for (idx = 0; idx < video->encParams->nLayers; idx++) { if (video->vol[idx]) { if (video->vol[idx]->stream) M4VENC_FREE(video->vol[idx]->stream); M4VENC_FREE(video->vol[idx]); } } M4VENC_FREE(video->vol); } /***************************************************/ /* stop rate control parameters */ /***************************************************/ /* ANNEX L RATE CONTROL */ if (video->encParams->RC_Type != CONSTANT_Q) { RC_Cleanup(video->rc, video->encParams->nLayers); for (idx = 0; idx < video->encParams->nLayers; idx++) { if (video->rc[idx]) M4VENC_FREE(video->rc[idx]); } } if (video->functionPointer) M4VENC_FREE(video->functionPointer); /* If application has called PVCleanUpVideoEncoder then we deallocate */ /* If PVInitVideoEncoder class it, then we DO NOT deallocate */ if (video->encParams) { M4VENC_FREE(video->encParams); } M4VENC_FREE(video); encoderControl->videoEncoderData = NULL; /* video */ } encoderControl->videoEncoderInit = 0; return PV_TRUE; } /* ======================================================================== */ /* Function : PVGetVolHeader() */ /* Date : 7/17/2001, */ /* Purpose : */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetVolHeader(VideoEncControls *encCtrl, UChar *volHeader, Int *size, Int layer) { VideoEncData *encData; PV_STATUS EncodeVOS_Start(VideoEncControls *encCtrl); encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; encData->currLayer = layer; /* Set Layer */ /*pv_status = */ EncodeVOS_Start(encCtrl); /* Encode VOL Header */ encData->encParams->GetVolHeader[layer] = 1; /* Set usage flag: Needed to support old method*/ /* Copy bitstream to buffer and set the size */ if (*size > encData->bitstream1->byteCount) { *size = encData->bitstream1->byteCount; M4VENC_MEMCPY(volHeader, encData->bitstream1->bitstreamBuffer, *size); } else return PV_FALSE; /* Reset bitstream1 buffer parameters */ BitstreamEncReset(encData->bitstream1); return PV_TRUE; } /* ======================================================================== */ /* Function : PVGetOverrunBuffer() */ /* Purpose : Get the overrun buffer ` */ /* In/out : */ /* Return : Pointer to overrun buffer. */ /* Modified : */ /* ======================================================================== */ OSCL_EXPORT_REF UChar* PVGetOverrunBuffer(VideoEncControls *encCtrl) { VideoEncData *video = (VideoEncData *)encCtrl->videoEncoderData; Int currLayer = video->currLayer; Vol *currVol = video->vol[currLayer]; if (currVol->stream->bitstreamBuffer != video->overrunBuffer) // not used { return NULL; } return video->overrunBuffer; } /* ======================================================================== */ /* Function : EncodeVideoFrame() */ /* Date : 08/22/2000 */ /* Purpose : Encode video frame and return bitstream */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* 02.14.2001 */ /* Finishing new timestamp 32-bit input */ /* Applications need to take care of wrap-around */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVEncodeVideoFrame(VideoEncControls *encCtrl, VideoEncFrameIO *vid_in, VideoEncFrameIO *vid_out, ULong *nextModTime, UChar *bstream, Int *size, Int *nLayer) { Bool status = PV_TRUE; PV_STATUS pv_status; VideoEncData *video = (VideoEncData *)encCtrl->videoEncoderData; VideoEncParams *encParams = video->encParams; Vol *currVol; Vop *tempForwRefVop = NULL; Int tempRefSelCode = 0; PV_STATUS EncodeVOS_Start(VideoEncControls *encCtrl); Int width_16, height_16; Int width, height; Vop *temp; Int encodeVop = 0; void PaddingEdge(Vop *padVop); Int currLayer = -1; //Int nLayers = encParams->nLayers; ULong modTime = vid_in->timestamp; #ifdef RANDOM_REFSELCODE /* add random selection of reference Vop */ Int random_val[30] = {0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0}; static Int rand_idx = 0; #endif /*******************************************************/ /* Determine Next Vop to encode, if any, and nLayer */ /*******************************************************/ //i = nLayers-1; if (video->volInitialize[0]) /* first vol to code */ { video->nextModTime = video->modTimeRef = ((modTime) - ((modTime) % 1000)); } encodeVop = DetermineCodingLayer(video, nLayer, modTime); currLayer = *nLayer; if ((currLayer < 0) || (currLayer > encParams->nLayers - 1)) return PV_FALSE; /******************************************/ /* If post-skipping still effective --- return */ /******************************************/ if (!encodeVop) /* skip enh layer, no base layer coded --- return */ { #ifdef _PRINT_STAT printf("No frame coded. Continue to next frame."); #endif /* expected next code time, convert back to millisec */ *nextModTime = video->nextModTime; #ifdef ALLOW_VOP_NOT_CODED if (video->vol[0]->shortVideoHeader) /* Short Video Header = 1 */ { *size = 0; *nLayer = -1; } else { *nLayer = 0; EncodeVopNotCoded(video, bstream, size, modTime); *size = video->vol[0]->stream->byteCount; } #else *size = 0; *nLayer = -1; #endif return status; } //ENCODE_VOP_AGAIN: /* 12/30/00 */ /**************************************************************/ /* Initialize Vol stream structure with application bitstream */ /**************************************************************/ currVol = video->vol[currLayer]; currVol->stream->bitstreamBuffer = bstream; currVol->stream->bufferSize = *size; BitstreamEncReset(currVol->stream); BitstreamSetOverrunBuffer(currVol->stream, video->overrunBuffer, video->oBSize, video); /***********************************************************/ /* Encode VOS and VOL Headers on first call for each layer */ /***********************************************************/ if (video->volInitialize[currLayer]) { video->currVop->timeInc = 0; video->prevBaseVop->timeInc = 0; if (!video->encParams->GetVolHeader[currLayer]) pv_status = EncodeVOS_Start(encCtrl); } /***************************************************/ /* Copy Input Video Frame to Internal Video Buffer */ /***************************************************/ /* Determine Width and Height of Vop Layer */ width = encParams->LayerWidth[currLayer]; /* Get input width */ height = encParams->LayerHeight[currLayer]; /* Get input height */ /* Round Up to nearest multiple of 16 : MPEG-4 Standard */ width_16 = ((width + 15) / 16) * 16; /* Round up to nearest multiple of 16 */ height_16 = ((height + 15) / 16) * 16; /* Round up to nearest multiple of 16 */ video->input = vid_in; /* point to the frame input */ /*// End ////////////////////////////// */ /**************************************/ /* Determine VOP Type */ /* 6/2/2001, separate function */ /**************************************/ DetermineVopType(video, currLayer); /****************************/ /* Initialize VOP */ /****************************/ video->currVop->volID = currVol->volID; video->currVop->width = width_16; video->currVop->height = height_16; if (video->encParams->H263_Enabled) /* 11/28/05 */ { video->currVop->pitch = width_16; } else { video->currVop->pitch = width_16 + 32; } video->currVop->timeInc = currVol->timeIncrement; video->currVop->vopCoded = 1; video->currVop->roundingType = 0; video->currVop->intraDCVlcThr = encParams->IntraDCVlcThr; if (currLayer == 0 #ifdef RANDOM_REFSELCODE /* add random selection of reference Vop */ || random_val[rand_idx] || video->volInitialize[currLayer] #endif ) { tempForwRefVop = video->forwardRefVop; /* keep initial state */ if (tempForwRefVop != NULL) tempRefSelCode = tempForwRefVop->refSelectCode; video->forwardRefVop = video->prevBaseVop; video->forwardRefVop->refSelectCode = 1; } #ifdef RANDOM_REFSELCODE else { tempForwRefVop = video->forwardRefVop; /* keep initial state */ if (tempForwRefVop != NULL) tempRefSelCode = tempForwRefVop->refSelectCode; video->forwardRefVop = video->prevEnhanceVop; video->forwardRefVop->refSelectCode = 0; } rand_idx++; rand_idx %= 30; #endif video->currVop->refSelectCode = video->forwardRefVop->refSelectCode; video->currVop->gobNumber = 0; video->currVop->gobFrameID = video->currVop->predictionType; video->currVop->temporalRef = (modTime * 30 / 1001) % 256; video->currVop->temporalInterval = 0; if (video->currVop->predictionType == I_VOP) video->currVop->quantizer = encParams->InitQuantIvop[currLayer]; else video->currVop->quantizer = encParams->InitQuantPvop[currLayer]; /****************/ /* Encode Vop */ /****************/ video->slice_coding = 0; pv_status = EncodeVop(video); #ifdef _PRINT_STAT if (video->currVop->predictionType == I_VOP) printf(" I-VOP "); else printf(" P-VOP (ref.%d)", video->forwardRefVop->refSelectCode); #endif /************************************/ /* Update Skip Next Frame */ /************************************/ *nLayer = UpdateSkipNextFrame(video, nextModTime, size, pv_status); if (*nLayer == -1) /* skip current frame */ { /* make sure that pointers are restored to the previous state */ if (currLayer == 0) { video->forwardRefVop = tempForwRefVop; /* For P-Vop base only */ video->forwardRefVop->refSelectCode = tempRefSelCode; } return status; } /* If I-VOP was encoded, reset IntraPeriod */ if ((currLayer == 0) && (encParams->IntraPeriod > 0) && (video->currVop->predictionType == I_VOP)) video->nextEncIVop = encParams->IntraPeriod; /* Set HintTrack Information */ if (currLayer != -1) { if (currVol->prevModuloTimeBase) video->hintTrackInfo.MTB = 1; else video->hintTrackInfo.MTB = 0; video->hintTrackInfo.LayerID = (UChar)currVol->volID; video->hintTrackInfo.CodeType = (UChar)video->currVop->predictionType; video->hintTrackInfo.RefSelCode = (UChar)video->currVop->refSelectCode; } /************************************************/ /* Determine nLayer and timeInc for next encode */ /* 12/27/00 always go by the highest layer*/ /************************************************/ /**********************************************************/ /* Copy Reconstructed Buffer to Output Video Frame Buffer */ /**********************************************************/ vid_out->yChan = video->currVop->yChan; vid_out->uChan = video->currVop->uChan; vid_out->vChan = video->currVop->vChan; if (video->encParams->H263_Enabled) { vid_out->height = video->currVop->height; /* padded height */ vid_out->pitch = video->currVop->width; /* padded width */ } else { vid_out->height = video->currVop->height + 32; /* padded height */ vid_out->pitch = video->currVop->width + 32; /* padded width */ } //video_out->timestamp = video->modTime; vid_out->timestamp = (ULong)(((video->prevFrameNum[currLayer] * 1000) / encParams->LayerFrameRate[currLayer]) + video->modTimeRef + 0.5); /*// End /////////////////////// */ /***********************************/ /* Update Ouput bstream byte count */ /***********************************/ *size = currVol->stream->byteCount; /****************************************/ /* Swap Vop Pointers for Base Layer */ /****************************************/ if (currLayer == 0) { temp = video->prevBaseVop; video->prevBaseVop = video->currVop; video->prevBaseVop->padded = 0; /* not padded */ video->currVop = temp; video->forwardRefVop = video->prevBaseVop; /* For P-Vop base only */ video->forwardRefVop->refSelectCode = 1; } else { temp = video->prevEnhanceVop; video->prevEnhanceVop = video->currVop; video->prevEnhanceVop->padded = 0; /* not padded */ video->currVop = temp; video->forwardRefVop = video->prevEnhanceVop; video->forwardRefVop->refSelectCode = 0; } /****************************************/ /* Modify the intialize flag at the end.*/ /****************************************/ if (video->volInitialize[currLayer]) video->volInitialize[currLayer] = 0; return status; } #ifndef NO_SLICE_ENCODE /* ======================================================================== */ /* Function : PVEncodeFrameSet() */ /* Date : 04/18/2000 */ /* Purpose : Enter a video frame and perform front-end time check plus ME */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVEncodeFrameSet(VideoEncControls *encCtrl, VideoEncFrameIO *vid_in, ULong *nextModTime, Int *nLayer) { Bool status = PV_TRUE; VideoEncData *video = (VideoEncData *)encCtrl->videoEncoderData; VideoEncParams *encParams = video->encParams; Vol *currVol; PV_STATUS EncodeVOS_Start(VideoEncControls *encCtrl); Int width_16, height_16; Int width, height; Int encodeVop = 0; void PaddingEdge(Vop *padVop); Int currLayer = -1; //Int nLayers = encParams->nLayers; ULong modTime = vid_in->timestamp; #ifdef RANDOM_REFSELCODE /* add random selection of reference Vop */ Int random_val[30] = {0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0}; static Int rand_idx = 0; #endif /*******************************************************/ /* Determine Next Vop to encode, if any, and nLayer */ /*******************************************************/ video->modTime = modTime; //i = nLayers-1; if (video->volInitialize[0]) /* first vol to code */ { video->nextModTime = video->modTimeRef = ((modTime) - ((modTime) % 1000)); } encodeVop = DetermineCodingLayer(video, nLayer, modTime); currLayer = *nLayer; /******************************************/ /* If post-skipping still effective --- return */ /******************************************/ if (!encodeVop) /* skip enh layer, no base layer coded --- return */ { #ifdef _PRINT_STAT printf("No frame coded. Continue to next frame."); #endif *nLayer = -1; /* expected next code time, convert back to millisec */ *nextModTime = video->nextModTime;; return status; } /**************************************************************/ /* Initialize Vol stream structure with application bitstream */ /**************************************************************/ currVol = video->vol[currLayer]; currVol->stream->bufferSize = 0; BitstreamEncReset(currVol->stream); /***********************************************************/ /* Encode VOS and VOL Headers on first call for each layer */ /***********************************************************/ if (video->volInitialize[currLayer]) { video->currVop->timeInc = 0; video->prevBaseVop->timeInc = 0; } /***************************************************/ /* Copy Input Video Frame to Internal Video Buffer */ /***************************************************/ /* Determine Width and Height of Vop Layer */ width = encParams->LayerWidth[currLayer]; /* Get input width */ height = encParams->LayerHeight[currLayer]; /* Get input height */ /* Round Up to nearest multiple of 16 : MPEG-4 Standard */ width_16 = ((width + 15) / 16) * 16; /* Round up to nearest multiple of 16 */ height_16 = ((height + 15) / 16) * 16; /* Round up to nearest multiple of 16 */ video->input = vid_in; /* point to the frame input */ /*// End ////////////////////////////// */ /**************************************/ /* Determine VOP Type */ /* 6/2/2001, separate function */ /**************************************/ DetermineVopType(video, currLayer); /****************************/ /* Initialize VOP */ /****************************/ video->currVop->volID = currVol->volID; video->currVop->width = width_16; video->currVop->height = height_16; if (video->encParams->H263_Enabled) /* 11/28/05 */ { video->currVop->pitch = width_16; } else { video->currVop->pitch = width_16 + 32; } video->currVop->timeInc = currVol->timeIncrement; video->currVop->vopCoded = 1; video->currVop->roundingType = 0; video->currVop->intraDCVlcThr = encParams->IntraDCVlcThr; if (currLayer == 0 #ifdef RANDOM_REFSELCODE /* add random selection of reference Vop */ || random_val[rand_idx] || video->volInitialize[currLayer] #endif ) { video->tempForwRefVop = video->forwardRefVop; /* keep initial state */ if (video->tempForwRefVop != NULL) video->tempRefSelCode = video->tempForwRefVop->refSelectCode; video->forwardRefVop = video->prevBaseVop; video->forwardRefVop->refSelectCode = 1; } #ifdef RANDOM_REFSELCODE else { video->tempForwRefVop = video->forwardRefVop; /* keep initial state */ if (video->tempForwRefVop != NULL) video->tempRefSelCode = video->tempForwRefVop->refSelectCode; video->forwardRefVop = video->prevEnhanceVop; video->forwardRefVop->refSelectCode = 0; } rand_idx++; rand_idx %= 30; #endif video->currVop->refSelectCode = video->forwardRefVop->refSelectCode; video->currVop->gobNumber = 0; video->currVop->gobFrameID = video->currVop->predictionType; video->currVop->temporalRef = ((modTime) * 30 / 1001) % 256; video->currVop->temporalInterval = 0; if (video->currVop->predictionType == I_VOP) video->currVop->quantizer = encParams->InitQuantIvop[currLayer]; else video->currVop->quantizer = encParams->InitQuantPvop[currLayer]; /****************/ /* Encode Vop */ /****************/ video->slice_coding = 1; /*pv_status =*/ EncodeVop(video); #ifdef _PRINT_STAT if (video->currVop->predictionType == I_VOP) printf(" I-VOP "); else printf(" P-VOP (ref.%d)", video->forwardRefVop->refSelectCode); #endif /* Set HintTrack Information */ if (currVol->prevModuloTimeBase) video->hintTrackInfo.MTB = 1; else video->hintTrackInfo.MTB = 0; video->hintTrackInfo.LayerID = (UChar)currVol->volID; video->hintTrackInfo.CodeType = (UChar)video->currVop->predictionType; video->hintTrackInfo.RefSelCode = (UChar)video->currVop->refSelectCode; return status; } #endif /* NO_SLICE_ENCODE */ #ifndef NO_SLICE_ENCODE /* ======================================================================== */ /* Function : PVEncodePacket() */ /* Date : 04/18/2002 */ /* Purpose : Encode one packet and return bitstream */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVEncodeSlice(VideoEncControls *encCtrl, UChar *bstream, Int *size, Int *endofFrame, VideoEncFrameIO *vid_out, ULong *nextModTime) { PV_STATUS pv_status; VideoEncData *video = (VideoEncData *)encCtrl->videoEncoderData; VideoEncParams *encParams = video->encParams; Vol *currVol; PV_STATUS EncodeVOS_Start(VideoEncControls *encCtrl); Vop *temp; void PaddingEdge(Vop *padVop); Int currLayer = video->currLayer; Int pre_skip; Int pre_size; /**************************************************************/ /* Initialize Vol stream structure with application bitstream */ /**************************************************************/ currVol = video->vol[currLayer]; currVol->stream->bitstreamBuffer = bstream; pre_size = currVol->stream->byteCount; currVol->stream->bufferSize = pre_size + (*size); /***********************************************************/ /* Encode VOS and VOL Headers on first call for each layer */ /***********************************************************/ if (video->volInitialize[currLayer]) { if (!video->encParams->GetVolHeader[currLayer]) pv_status = EncodeVOS_Start(encCtrl); } /****************/ /* Encode Slice */ /****************/ pv_status = EncodeSlice(video); *endofFrame = 0; if (video->mbnum >= currVol->nTotalMB && !video->end_of_buf) { *endofFrame = 1; /************************************/ /* Update Skip Next Frame */ /************************************/ pre_skip = UpdateSkipNextFrame(video, nextModTime, size, pv_status); /* modified such that no pre-skipped */ if (pre_skip == -1) /* error */ { *endofFrame = -1; /* make sure that pointers are restored to the previous state */ if (currLayer == 0) { video->forwardRefVop = video->tempForwRefVop; /* For P-Vop base only */ video->forwardRefVop->refSelectCode = video->tempRefSelCode; } return pv_status; } /* If I-VOP was encoded, reset IntraPeriod */ if ((currLayer == 0) && (encParams->IntraPeriod > 0) && (video->currVop->predictionType == I_VOP)) video->nextEncIVop = encParams->IntraPeriod; /**********************************************************/ /* Copy Reconstructed Buffer to Output Video Frame Buffer */ /**********************************************************/ vid_out->yChan = video->currVop->yChan; vid_out->uChan = video->currVop->uChan; vid_out->vChan = video->currVop->vChan; if (video->encParams->H263_Enabled) { vid_out->height = video->currVop->height; /* padded height */ vid_out->pitch = video->currVop->width; /* padded width */ } else { vid_out->height = video->currVop->height + 32; /* padded height */ vid_out->pitch = video->currVop->width + 32; /* padded width */ } //vid_out->timestamp = video->modTime; vid_out->timestamp = (ULong)(((video->prevFrameNum[currLayer] * 1000) / encParams->LayerFrameRate[currLayer]) + video->modTimeRef + 0.5); /*// End /////////////////////// */ /****************************************/ /* Swap Vop Pointers for Base Layer */ /****************************************/ if (currLayer == 0) { temp = video->prevBaseVop; video->prevBaseVop = video->currVop; video->prevBaseVop->padded = 0; /* not padded */ video->currVop = temp; video->forwardRefVop = video->prevBaseVop; /* For P-Vop base only */ video->forwardRefVop->refSelectCode = 1; } else { temp = video->prevEnhanceVop; video->prevEnhanceVop = video->currVop; video->prevEnhanceVop->padded = 0; /* not padded */ video->currVop = temp; video->forwardRefVop = video->prevEnhanceVop; video->forwardRefVop->refSelectCode = 0; } } /***********************************/ /* Update Ouput bstream byte count */ /***********************************/ *size = currVol->stream->byteCount - pre_size; /****************************************/ /* Modify the intialize flag at the end.*/ /****************************************/ if (video->volInitialize[currLayer]) video->volInitialize[currLayer] = 0; return pv_status; } #endif /* NO_SLICE_ENCODE */ /* ======================================================================== */ /* Function : PVGetH263ProfileLevelID() */ /* Date : 02/05/2003 */ /* Purpose : Get H.263 Profile ID and level ID for profile 0 */ /* In/out : Profile ID=0, levelID is what we want */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* Note : h263Level[8], rBR_bound[8], max_h263_framerate[2] */ /* max_h263_width[2], max_h263_height[2] are global */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetH263ProfileLevelID(VideoEncControls *encCtrl, Int *profileID, Int *levelID) { VideoEncData *encData; Int width, height; float bitrate_r, framerate; /* For this version, we only support H.263 profile 0 */ *profileID = 0; *levelID = 0; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; if (!encData->encParams->H263_Enabled) return PV_FALSE; /* get image width, height, bitrate and framerate */ width = encData->encParams->LayerWidth[0]; height = encData->encParams->LayerHeight[0]; bitrate_r = (float)(encData->encParams->LayerBitRate[0]) / (float)64000.0; framerate = encData->encParams->LayerFrameRate[0]; if (!width || !height || !(bitrate_r > 0 && framerate > 0)) return PV_FALSE; /* This is the most frequent case : level 10 */ if (bitrate_r <= rBR_bound[1] && framerate <= max_h263_framerate[0] && (width <= max_h263_width[0] && height <= max_h263_height[0])) { *levelID = h263Level[1]; return PV_TRUE; } else if (bitrate_r > rBR_bound[4] || (width > max_h263_width[1] || height > max_h263_height[1]) || framerate > max_h263_framerate[1]) /* check the highest level 70 */ { *levelID = h263Level[7]; return PV_TRUE; } else /* search level 20, 30, 40 */ { /* pick out level 20 */ if (bitrate_r <= rBR_bound[2] && ((width <= max_h263_width[0] && height <= max_h263_height[0] && framerate <= max_h263_framerate[1]) || (width <= max_h263_width[1] && height <= max_h263_height[1] && framerate <= max_h263_framerate[0]))) { *levelID = h263Level[2]; return PV_TRUE; } else /* width, height and framerate are ok, now choose level 30 or 40 */ { *levelID = (bitrate_r <= rBR_bound[3] ? h263Level[3] : h263Level[4]); return PV_TRUE; } } } /* ======================================================================== */ /* Function : PVGetMPEG4ProfileLevelID() */ /* Date : 26/06/2008 */ /* Purpose : Get MPEG4 Level after initialized */ /* In/out : profile_level according to interface */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetMPEG4ProfileLevelID(VideoEncControls *encCtrl, Int *profile_level, Int nLayer) { VideoEncData* video; Int i; video = (VideoEncData *)encCtrl->videoEncoderData; if (nLayer == 0) { for (i = 0; i < 8; i++) { if (video->encParams->ProfileLevel[0] == profile_level_code[i]) { break; } } *profile_level = i; } else { for (i = 0; i < 8; i++) { if (video->encParams->ProfileLevel[0] == scalable_profile_level_code[i]) { break; } } *profile_level = i + SIMPLE_SCALABLE_PROFILE_LEVEL0; } return true; } #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVUpdateEncFrameRate */ /* Date : 04/08/2002 */ /* Purpose : Update target frame rates of the encoded base and enhance */ /* layer(if any) while encoding operation is ongoing */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVUpdateEncFrameRate(VideoEncControls *encCtrl, float *frameRate) { VideoEncData *encData; Int i;// nTotalMB, mbPerSec; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; /* Update the framerates for all the layers */ for (i = 0; i < encData->encParams->nLayers; i++) { /* New check: encoding framerate should be consistent with the given profile and level */ //nTotalMB = (((encData->encParams->LayerWidth[i]+15)/16)*16)*(((encData->encParams->LayerHeight[i]+15)/16)*16)/(16*16); //mbPerSec = (Int)(nTotalMB * frameRate[i]); //if(mbPerSec > encData->encParams->LayerMaxMbsPerSec[i]) return PV_FALSE; if (frameRate[i] > encData->encParams->LayerMaxFrameRate[i]) return PV_FALSE; /* set by users or profile */ encData->encParams->LayerFrameRate[i] = frameRate[i]; } return RC_UpdateBXRCParams((void*) encData); } #endif #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVUpdateBitRate */ /* Date : 04/08/2002 */ /* Purpose : Update target bit rates of the encoded base and enhance */ /* layer(if any) while encoding operation is ongoing */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVUpdateBitRate(VideoEncControls *encCtrl, Int *bitRate) { VideoEncData *encData; Int i; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; /* Update the bitrates for all the layers */ for (i = 0; i < encData->encParams->nLayers; i++) { if (bitRate[i] > encData->encParams->LayerMaxBitRate[i]) /* set by users or profile */ { return PV_FALSE; } encData->encParams->LayerBitRate[i] = bitRate[i]; } return RC_UpdateBXRCParams((void*) encData); } #endif #ifndef LIMITED_API /* ============================================================================ */ /* Function : PVUpdateVBVDelay() */ /* Date : 4/23/2004 */ /* Purpose : Update VBV buffer size(in delay) */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ============================================================================ */ Bool PVUpdateVBVDelay(VideoEncControls *encCtrl, float delay) { VideoEncData *encData; Int total_bitrate, max_buffer_size; int index; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; /* Check whether the input delay is valid based on the given profile */ total_bitrate = (encData->encParams->nLayers == 1 ? encData->encParams->LayerBitRate[0] : encData->encParams->LayerBitRate[1]); index = encData->encParams->profile_table_index; max_buffer_size = (encData->encParams->nLayers == 1 ? profile_level_max_VBV_size[index] : scalable_profile_level_max_VBV_size[index]); if (total_bitrate*delay > (float)max_buffer_size) return PV_FALSE; encData->encParams->VBV_delay = delay; return PV_TRUE; } #endif #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVUpdateIFrameInterval() */ /* Date : 04/10/2002 */ /* Purpose : updates the INTRA frame refresh interval while encoding */ /* is ongoing */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVUpdateIFrameInterval(VideoEncControls *encCtrl, Int aIFramePeriod) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; encData->encParams->IntraPeriod = aIFramePeriod; return PV_TRUE; } #endif #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVSetNumIntraMBRefresh() */ /* Date : 08/05/2003 */ /* Purpose : */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVUpdateNumIntraMBRefresh(VideoEncControls *encCtrl, Int numMB) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; encData->encParams->Refresh = numMB; return PV_TRUE; } #endif #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVIFrameRequest() */ /* Date : 04/10/2002 */ /* Purpose : encodes the next base frame as an I-Vop */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVIFrameRequest(VideoEncControls *encCtrl) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; encData->nextEncIVop = 1; return PV_TRUE; } #endif #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVGetEncMemoryUsage() */ /* Date : 10/17/2000 */ /* Purpose : */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Int PVGetEncMemoryUsage(VideoEncControls *encCtrl) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; return encData->encParams->MemoryUsage; } #endif /* ======================================================================== */ /* Function : PVGetHintTrack() */ /* Date : 1/17/2001, */ /* Purpose : */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetHintTrack(VideoEncControls *encCtrl, MP4HintTrack *info) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; info->MTB = encData->hintTrackInfo.MTB; info->LayerID = encData->hintTrackInfo.LayerID; info->CodeType = encData->hintTrackInfo.CodeType; info->RefSelCode = encData->hintTrackInfo.RefSelCode; return PV_TRUE; } /* ======================================================================== */ /* Function : PVGetMaxVideoFrameSize() */ /* Date : 7/17/2001, */ /* Purpose : Function merely returns the maximum buffer size */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetMaxVideoFrameSize(VideoEncControls *encCtrl, Int *maxVideoFrameSize) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; *maxVideoFrameSize = encData->encParams->BufferSize[0]; if (encData->encParams->nLayers == 2) if (*maxVideoFrameSize < encData->encParams->BufferSize[1]) *maxVideoFrameSize = encData->encParams->BufferSize[1]; *maxVideoFrameSize >>= 3; /* Convert to Bytes */ if (*maxVideoFrameSize <= 4000) *maxVideoFrameSize = 4000; return PV_TRUE; } #ifndef LIMITED_API /* ======================================================================== */ /* Function : PVGetVBVSize() */ /* Date : 4/15/2002 */ /* Purpose : Function merely returns the maximum buffer size */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ OSCL_EXPORT_REF Bool PVGetVBVSize(VideoEncControls *encCtrl, Int *VBVSize) { VideoEncData *encData; encData = (VideoEncData *)encCtrl->videoEncoderData; if (encData == NULL) return PV_FALSE; if (encData->encParams == NULL) return PV_FALSE; *VBVSize = encData->encParams->BufferSize[0]; if (encData->encParams->nLayers == 2) *VBVSize += encData->encParams->BufferSize[1]; return PV_TRUE; } #endif /* ======================================================================== */ /* Function : EncodeVOS_Start() */ /* Date : 08/22/2000 */ /* Purpose : Encodes the VOS,VO, and VOL or Short Headers */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ PV_STATUS EncodeVOS_Start(VideoEncControls *encoderControl) { VideoEncData *video = (VideoEncData *)encoderControl->videoEncoderData; Vol *currVol = video->vol[video->currLayer]; PV_STATUS status = PV_SUCCESS; //int profile_level=0x01; BitstreamEncVideo *stream = video->bitstream1; int i, j; /********************************/ /* Check for short_video_header */ /********************************/ if (currVol->shortVideoHeader == 1) return status; else { /* Short Video Header or M4V */ /**************************/ /* VisualObjectSequence ()*/ /**************************/ status = BitstreamPutGT16Bits(stream, 32, SESSION_START_CODE); /* Determine profile_level */ status = BitstreamPutBits(stream, 8, video->encParams->ProfileLevel[video->currLayer]); /******************/ /* VisualObject() */ /******************/ status = BitstreamPutGT16Bits(stream, 32, VISUAL_OBJECT_START_CODE); status = BitstreamPut1Bits(stream, 0x00); /* visual object identifier */ status = BitstreamPutBits(stream, 4, 0x01); /* visual object Type == "video ID" */ status = BitstreamPut1Bits(stream, 0x00); /* no video signal type */ /*temp = */ BitstreamMpeg4ByteAlignStuffing(stream); status = BitstreamPutGT16Bits(stream, 27, VO_START_CODE);/* byte align: should be 2 bits */ status = BitstreamPutBits(stream, 5, 0x00);/* Video ID = 0 */ /**********************/ /* VideoObjectLayer() */ /**********************/ if (currVol->shortVideoHeader == 0) { /* M4V else Short Video Header */ status = BitstreamPutGT16Bits(stream, VOL_START_CODE_LENGTH, VOL_START_CODE); status = BitstreamPutBits(stream, 4, currVol->volID);/* video_object_layer_id */ status = BitstreamPut1Bits(stream, 0x00);/* Random Access = 0 */ if (video->currLayer == 0) status = BitstreamPutBits(stream, 8, 0x01);/* Video Object Type Indication = 1 ... Simple Object Type */ else status = BitstreamPutBits(stream, 8, 0x02);/* Video Object Type Indication = 2 ... Simple Scalable Object Type */ status = BitstreamPut1Bits(stream, 0x00);/* is_object_layer_identifer = 0 */ status = BitstreamPutBits(stream, 4, 0x01); /* aspect_ratio_info = 1 ... 1:1(Square) */ status = BitstreamPut1Bits(stream, 0x00);/* vol_control_parameters = 0 */ status = BitstreamPutBits(stream, 2, 0x00);/* video_object_layer_shape = 00 ... rectangular */ status = BitstreamPut1Bits(stream, 0x01);/* marker bit */ status = BitstreamPutGT8Bits(stream, 16, currVol->timeIncrementResolution);/* vop_time_increment_resolution */ status = BitstreamPut1Bits(stream, 0x01);/* marker bit */ status = BitstreamPut1Bits(stream, currVol->fixedVopRate);/* fixed_vop_rate = 0 */ /* For Rectangular VO layer shape */ status = BitstreamPut1Bits(stream, 0x01);/* marker bit */ status = BitstreamPutGT8Bits(stream, 13, currVol->width);/* video_object_layer_width */ status = BitstreamPut1Bits(stream, 0x01);/* marker bit */ status = BitstreamPutGT8Bits(stream, 13, currVol->height);/* video_object_layer_height */ status = BitstreamPut1Bits(stream, 0x01);/*marker bit */ status = BitstreamPut1Bits(stream, 0x00);/*interlaced = 0 */ status = BitstreamPut1Bits(stream, 0x01);/* obmc_disable = 1 */ status = BitstreamPut1Bits(stream, 0x00);/* sprite_enable = 0 */ status = BitstreamPut1Bits(stream, 0x00);/* not_8_bit = 0 */ status = BitstreamPut1Bits(stream, currVol->quantType);/* quant_type */ if (currVol->quantType) { status = BitstreamPut1Bits(stream, currVol->loadIntraQuantMat); /* Intra quant matrix */ if (currVol->loadIntraQuantMat) { for (j = 63; j >= 1; j--) if (currVol->iqmat[*(zigzag_i+j)] != currVol->iqmat[*(zigzag_i+j-1)]) break; if ((j == 1) && (currVol->iqmat[*(zigzag_i+j)] == currVol->iqmat[*(zigzag_i+j-1)])) j = 0; for (i = 0; i < j + 1; i++) BitstreamPutBits(stream, 8, currVol->iqmat[*(zigzag_i+i)]); if (j < 63) BitstreamPutBits(stream, 8, 0); } else { for (j = 0; j < 64; j++) currVol->iqmat[j] = mpeg_iqmat_def[j]; } status = BitstreamPut1Bits(stream, currVol->loadNonIntraQuantMat); /* Non-Intra quant matrix */ if (currVol->loadNonIntraQuantMat) { for (j = 63; j >= 1; j--) if (currVol->niqmat[*(zigzag_i+j)] != currVol->niqmat[*(zigzag_i+j-1)]) break; if ((j == 1) && (currVol->niqmat[*(zigzag_i+j)] == currVol->niqmat[*(zigzag_i+j-1)])) j = 0; for (i = 0; i < j + 1; i++) BitstreamPutBits(stream, 8, currVol->niqmat[*(zigzag_i+i)]); if (j < 63) BitstreamPutBits(stream, 8, 0); } else { for (j = 0; j < 64; j++) currVol->niqmat[j] = mpeg_nqmat_def[j]; } } status = BitstreamPut1Bits(stream, 0x01); /* complexity_estimation_disable = 1 */ status = BitstreamPut1Bits(stream, currVol->ResyncMarkerDisable);/* Resync_marker_disable */ status = BitstreamPut1Bits(stream, currVol->dataPartitioning);/* Data partitioned */ if (currVol->dataPartitioning) status = BitstreamPut1Bits(stream, currVol->useReverseVLC); /* Reversible_vlc */ if (currVol->scalability) /* Scalability*/ { status = BitstreamPut1Bits(stream, currVol->scalability);/* Scalability = 1 */ status = BitstreamPut1Bits(stream, currVol->scalType);/* hierarchy _type ... Spatial= 0 and Temporal = 1 */ status = BitstreamPutBits(stream, 4, currVol->refVolID);/* ref_layer_id */ status = BitstreamPut1Bits(stream, currVol->refSampDir);/* ref_layer_sampling_direc*/ status = BitstreamPutBits(stream, 5, currVol->horSamp_n);/*hor_sampling_factor_n*/ status = BitstreamPutBits(stream, 5, currVol->horSamp_m);/*hor_sampling_factor_m*/ status = BitstreamPutBits(stream, 5, currVol->verSamp_n);/*vert_sampling_factor_n*/ status = BitstreamPutBits(stream, 5, currVol->verSamp_m);/*vert_sampling_factor_m*/ status = BitstreamPut1Bits(stream, currVol->enhancementType);/* enhancement_type*/ } else /* No Scalability */ status = BitstreamPut1Bits(stream, currVol->scalability);/* Scalability = 0 */ /*temp = */ BitstreamMpeg4ByteAlignStuffing(stream); /* Byte align Headers for VOP */ } } return status; } /* ======================================================================== */ /* Function : VOS_End() */ /* Date : 08/22/2000 */ /* Purpose : Visual Object Sequence End */ /* In/out : */ /* Return : PV_TRUE if successed, PV_FALSE if failed. */ /* Modified : */ /* */ /* ======================================================================== */ PV_STATUS VOS_End(VideoEncControls *encoderControl) { PV_STATUS status = PV_SUCCESS; VideoEncData *video = (VideoEncData *)encoderControl->videoEncoderData; Vol *currVol = video->vol[video->currLayer]; BitstreamEncVideo *stream = currVol->stream; status = BitstreamPutBits(stream, SESSION_END_CODE, 32); return status; } /* ======================================================================== */ /* Function : DetermineCodingLayer */ /* Date : 06/02/2001 */ /* Purpose : Find layer to code based on current mod time, assuming that it's time to encode enhanced layer. */ /* In/out : */ /* Return : Number of layer to code. */ /* Modified : */ /* */ /* ======================================================================== */ Int DetermineCodingLayer(VideoEncData *video, Int *nLayer, ULong modTime) { Vol **vol = video->vol; VideoEncParams *encParams = video->encParams; Int numLayers = encParams->nLayers; UInt modTimeRef = video->modTimeRef; float *LayerFrameRate = encParams->LayerFrameRate; UInt frameNum[4], frameTick; ULong frameModTime, nextFrmModTime; #ifdef REDUCE_FRAME_VARIANCE /* To limit how close 2 frames can be */ float frameInterval; #endif float srcFrameInterval; Int frameInc; Int i, extra_skip; Int encodeVop = 0; i = numLayers - 1; if (modTime - video->nextModTime > ((ULong)(-1)) >> 1) /* next time wrapped around */ return 0; /* not time to code it yet */ video->relLayerCodeTime[i] -= 1000; video->nextEncIVop--; /* number of Vops in highest layer resolution. */ video->numVopsInGOP++; /* from this point frameModTime and nextFrmModTime are internal */ frameNum[i] = (UInt)((modTime - modTimeRef) * LayerFrameRate[i] + 500) / 1000; if (video->volInitialize[i]) { video->prevFrameNum[i] = frameNum[i] - 1; } else if (frameNum[i] <= video->prevFrameNum[i]) { return 0; /* do not encode this frame */ } /**** this part computes expected next frame *******/ frameModTime = (ULong)(((frameNum[i] * 1000) / LayerFrameRate[i]) + modTimeRef + 0.5); /* rec. time */ nextFrmModTime = (ULong)((((frameNum[i] + 1) * 1000) / LayerFrameRate[i]) + modTimeRef + 0.5); /* rec. time */ srcFrameInterval = 1000 / video->FrameRate; video->nextModTime = nextFrmModTime - (ULong)(srcFrameInterval / 2.) - 1; /* between current and next frame */ #ifdef REDUCE_FRAME_VARIANCE /* To limit how close 2 frames can be */ frameInterval = 1000 / LayerFrameRate[i]; /* next rec. time */ delta = (Int)(frameInterval / 4); /* empirical number */ if (video->nextModTime - modTime < (ULong)delta) /* need to move nextModTime further. */ { video->nextModTime += ((delta - video->nextModTime + modTime)); /* empirical formula */ } #endif /****************************************************/ /* map frame no.to tick from modTimeRef */ /*frameTick = (frameNum[i]*vol[i]->timeIncrementResolution) ; frameTick = (UInt)((frameTick + (encParams->LayerFrameRate[i]/2))/encParams->LayerFrameRate[i]);*/ /* 11/16/01, change frameTick to be the closest tick from the actual modTime */ /* 12/12/02, add (double) to prevent large number wrap-around */ frameTick = (Int)(((double)(modTime - modTimeRef) * vol[i]->timeIncrementResolution + 500) / 1000); /* find timeIncrement to be put in the bitstream */ /* refTick is second boundary reference. */ vol[i]->timeIncrement = frameTick - video->refTick[i]; vol[i]->moduloTimeBase = 0; while (vol[i]->timeIncrement >= vol[i]->timeIncrementResolution) { vol[i]->timeIncrement -= vol[i]->timeIncrementResolution; vol[i]->moduloTimeBase++; /* do not update refTick and modTimeRef yet, do it after encoding!! */ } if (video->relLayerCodeTime[i] <= 0) /* no skipping */ { encodeVop = 1; video->currLayer = *nLayer = i; video->relLayerCodeTime[i] += 1000; /* takes care of more dropped frame than expected */ extra_skip = -1; frameInc = (frameNum[i] - video->prevFrameNum[i]); extra_skip += frameInc; if (extra_skip > 0) { /* update rc->Nr, rc->B, (rc->Rr)*/ video->nextEncIVop -= extra_skip; video->numVopsInGOP += extra_skip; if (encParams->RC_Type != CONSTANT_Q) { RC_UpdateBuffer(video, i, extra_skip); } } } /* update frame no. */ video->prevFrameNum[i] = frameNum[i]; /* go through all lower layer */ for (i = (numLayers - 2); i >= 0; i--) { video->relLayerCodeTime[i] -= 1000; /* find timeIncrement to be put in the bitstream */ vol[i]->timeIncrement = frameTick - video->refTick[i]; if (video->relLayerCodeTime[i] <= 0) /* time to encode base */ { /* 12/27/00 */ encodeVop = 1; video->currLayer = *nLayer = i; video->relLayerCodeTime[i] += (Int)((1000.0 * encParams->LayerFrameRate[numLayers-1]) / encParams->LayerFrameRate[i]); vol[i]->moduloTimeBase = 0; while (vol[i]->timeIncrement >= vol[i]->timeIncrementResolution) { vol[i]->timeIncrement -= vol[i]->timeIncrementResolution; vol[i]->moduloTimeBase++; /* do not update refTick and modTimeRef yet, do it after encoding!! */ } /* takes care of more dropped frame than expected */ frameNum[i] = (UInt)((frameModTime - modTimeRef) * encParams->LayerFrameRate[i] + 500) / 1000; if (video->volInitialize[i]) video->prevFrameNum[i] = frameNum[i] - 1; extra_skip = -1; frameInc = (frameNum[i] - video->prevFrameNum[i]); extra_skip += frameInc; if (extra_skip > 0) { /* update rc->Nr, rc->B, (rc->Rr)*/ if (encParams->RC_Type != CONSTANT_Q) { RC_UpdateBuffer(video, i, extra_skip); } } /* update frame no. */ video->prevFrameNum[i] = frameNum[i]; } } #ifdef _PRINT_STAT if (encodeVop) printf(" TI: %d ", vol[*nLayer]->timeIncrement); #endif return encodeVop; } /* ======================================================================== */ /* Function : DetermineVopType */ /* Date : 06/02/2001 */ /* Purpose : The name says it all. */ /* In/out : */ /* Return : void . */ /* Modified : */ /* */ /* ======================================================================== */ void DetermineVopType(VideoEncData *video, Int currLayer) { VideoEncParams *encParams = video->encParams; // Vol *currVol = video->vol[currLayer]; if (encParams->IntraPeriod == 0) /* I-VOPs only */ { if (video->currLayer > 0) video->currVop->predictionType = P_VOP; else { video->currVop->predictionType = I_VOP; if (video->numVopsInGOP >= 132) video->numVopsInGOP = 0; } } else if (encParams->IntraPeriod == -1) /* IPPPPP... */ { /* maintain frame type if previous frame is pre-skipped, 06/02/2001 */ if (encParams->RC_Type == CONSTANT_Q || video->rc[currLayer]->skip_next_frame != -1) video->currVop->predictionType = P_VOP; if (video->currLayer == 0) { if (/*video->numVopsInGOP>=132 || */video->volInitialize[currLayer]) { video->currVop->predictionType = I_VOP; video->numVopsInGOP = 0; /* force INTRA update every 132 base frames*/ video->nextEncIVop = 1; } else if (video->nextEncIVop == 0 || video->currVop->predictionType == I_VOP) { video->numVopsInGOP = 0; video->nextEncIVop = 1; } } } else /* IntraPeriod>0 : IPPPPPIPPPPPI... */ { /* maintain frame type if previous frame is pre-skipped, 06/02/2001 */ if (encParams->RC_Type == CONSTANT_Q || video->rc[currLayer]->skip_next_frame != -1) video->currVop->predictionType = P_VOP; if (currLayer == 0) { if (video->nextEncIVop <= 0 || video->currVop->predictionType == I_VOP) { video->nextEncIVop = encParams->IntraPeriod; video->currVop->predictionType = I_VOP; video->numVopsInGOP = 0; } } } return ; } /* ======================================================================== */ /* Function : UpdateSkipNextFrame */ /* Date : 06/02/2001 */ /* Purpose : From rate control frame skipping decision, update timing related parameters. */ /* In/out : */ /* Return : Current coded layer. */ /* Modified : */ /* */ /* ======================================================================== */ Int UpdateSkipNextFrame(VideoEncData *video, ULong *modTime, Int *size, PV_STATUS status) { Int currLayer = video->currLayer; Int nLayer = currLayer; VideoEncParams *encParams = video->encParams; Int numLayers = encParams->nLayers; Vol *currVol = video->vol[currLayer]; Vol **vol = video->vol; Int num_skip, extra_skip; Int i; UInt newRefTick, deltaModTime; UInt temp; if (encParams->RC_Type != CONSTANT_Q) { if (video->volInitialize[0] && currLayer == 0) /* always encode the first frame */ { RC_ResetSkipNextFrame(video, currLayer); //return currLayer; 09/15/05 } else { if (RC_GetSkipNextFrame(video, currLayer) < 0 || status == PV_END_OF_BUF) /* Skip Current Frame */ { #ifdef _PRINT_STAT printf("Skip current frame"); #endif currVol->moduloTimeBase = currVol->prevModuloTimeBase; /*********************/ /* prepare to return */ /*********************/ *size = 0; /* Set Bitstream buffer to zero */ /* Determine nLayer and modTime for next encode */ *modTime = video->nextModTime; nLayer = -1; return nLayer; /* return immediately without updating RefTick & modTimeRef */ /* If I-VOP was attempted, then ensure next base is I-VOP */ /*if((encParams->IntraPeriod>0) && (video->currVop->predictionType == I_VOP)) video->nextEncIVop = 0; commented out by 06/05/01 */ } else if ((num_skip = RC_GetSkipNextFrame(video, currLayer)) > 0) { #ifdef _PRINT_STAT printf("Skip next %d frames", num_skip); #endif /* to keep the Nr of enh layer the same */ /* adjust relLayerCodeTime only, do not adjust layerCodeTime[numLayers-1] */ extra_skip = 0; for (i = 0; i < currLayer; i++) { if (video->relLayerCodeTime[i] <= 1000) { extra_skip = 1; break; } } for (i = currLayer; i < numLayers; i++) { video->relLayerCodeTime[i] += (num_skip + extra_skip) * ((Int)((1000.0 * encParams->LayerFrameRate[numLayers-1]) / encParams->LayerFrameRate[i])); } } }/* first frame */ } /***** current frame is encoded, now update refTick ******/ video->refTick[currLayer] += vol[currLayer]->prevModuloTimeBase * vol[currLayer]->timeIncrementResolution; /* Reset layerCodeTime every I-VOP to prevent overflow */ if (currLayer == 0) { /* 12/12/02, fix for weird targer frame rate of 9.99 fps or 3.33 fps */ if (((encParams->IntraPeriod != 0) /*&& (video->currVop->predictionType==I_VOP)*/) || ((encParams->IntraPeriod == 0) && (video->numVopsInGOP == 0))) { newRefTick = video->refTick[0]; for (i = 1; i < numLayers; i++) { if (video->refTick[i] < newRefTick) newRefTick = video->refTick[i]; } /* check to make sure that the update is integer multiple of frame number */ /* how many msec elapsed from last modTimeRef */ deltaModTime = (newRefTick / vol[0]->timeIncrementResolution) * 1000; for (i = numLayers - 1; i >= 0; i--) { temp = (UInt)(deltaModTime * encParams->LayerFrameRate[i]); /* 12/12/02 */ if (temp % 1000) newRefTick = 0; } if (newRefTick > 0) { video->modTimeRef += deltaModTime; for (i = numLayers - 1; i >= 0; i--) { video->prevFrameNum[i] -= (UInt)(deltaModTime * encParams->LayerFrameRate[i]) / 1000; video->refTick[i] -= newRefTick; } } } } *modTime = video->nextModTime; return nLayer; } #ifndef ORIGINAL_VERSION /* ======================================================================== */ /* Function : SetProfile_BufferSize */ /* Date : 04/08/2002 */ /* Purpose : Set profile and video buffer size, copied from Jim's code */ /* in PVInitVideoEncoder(.), since we have different places */ /* to reset profile and video buffer size */ /* In/out : */ /* Return : */ /* Modified : */ /* */ /* ======================================================================== */ Bool SetProfile_BufferSize(VideoEncData *video, float delay, Int bInitialized) { Int i, j, start, end; // Int BaseMBsPerSec = 0, EnhMBsPerSec = 0; Int nTotalMB = 0; Int idx, temp_w, temp_h, max = 0, max_width, max_height; Int nLayers = video->encParams->nLayers; /* Number of Layers to be encoded */ Int total_bitrate = 0, base_bitrate; Int total_packet_size = 0, base_packet_size; Int total_MBsPerSec = 0, base_MBsPerSec; Int total_VBV_size = 0, base_VBV_size, enhance_VBV_size = 0; float total_framerate, base_framerate; float upper_bound_ratio; Int bFound = 0; Int k = 0, width16, height16, index; Int lowest_level; #define MIN_BUFF 16000 /* 16k minimum buffer size */ #define BUFF_CONST 2.0 /* 2000ms */ #define UPPER_BOUND_RATIO 8.54 /* upper_bound = 1.4*(1.1+bound/10)*bitrate/framerate */ #define QCIF_WIDTH 176 #define QCIF_HEIGHT 144 index = video->encParams->profile_table_index; /* Calculate "nTotalMB" */ /* Find the maximum width*height for memory allocation of the VOPs */ for (idx = 0; idx < nLayers; idx++) { temp_w = video->encParams->LayerWidth[idx]; temp_h = video->encParams->LayerHeight[idx]; if ((temp_w*temp_h) > max) { max = temp_w * temp_h; max_width = temp_w; max_height = temp_h; nTotalMB = ((max_width + 15) >> 4) * ((max_height + 15) >> 4); } } upper_bound_ratio = (video->encParams->RC_Type == CBR_LOWDELAY ? (float)5.0 : (float)UPPER_BOUND_RATIO); /* Get the basic information: bitrate, packet_size, MBs/s and VBV_size */ base_bitrate = video->encParams->LayerBitRate[0]; if (video->encParams->LayerMaxBitRate[0] != 0) /* video->encParams->LayerMaxBitRate[0] == 0 means it has not been set */ { base_bitrate = PV_MAX(base_bitrate, video->encParams->LayerMaxBitRate[0]); } else /* if the max is not set, set it to the specified profile/level */ { video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[index]; } base_framerate = video->encParams->LayerFrameRate[0]; if (video->encParams->LayerMaxFrameRate[0] != 0) { base_framerate = PV_MAX(base_framerate, video->encParams->LayerMaxFrameRate[0]); } else /* if the max is not set, set it to the specified profile/level */ { video->encParams->LayerMaxFrameRate[0] = (float)profile_level_max_mbsPerSec[index] / nTotalMB; } base_packet_size = video->encParams->ResyncPacketsize; base_MBsPerSec = (Int)(base_framerate * nTotalMB); base_VBV_size = PV_MAX((Int)(base_bitrate * delay), (Int)(upper_bound_ratio * base_bitrate / base_framerate)); base_VBV_size = PV_MAX(base_VBV_size, MIN_BUFF); /* if the buffer is larger than maximum buffer size, we'll clip it */ if (base_VBV_size > profile_level_max_VBV_size[5]) base_VBV_size = profile_level_max_VBV_size[5]; /* Check if the buffer exceeds the maximum buffer size given the maximum profile and level */ if (nLayers == 1 && base_VBV_size > profile_level_max_VBV_size[index]) return FALSE; if (nLayers == 2) { total_bitrate = video->encParams->LayerBitRate[1]; if (video->encParams->LayerMaxBitRate[1] != 0) { total_bitrate = PV_MIN(total_bitrate, video->encParams->LayerMaxBitRate[1]); } else /* if the max is not set, set it to the specified profile/level */ { video->encParams->LayerMaxBitRate[1] = scalable_profile_level_max_bitrate[index]; } total_framerate = video->encParams->LayerFrameRate[1]; if (video->encParams->LayerMaxFrameRate[1] != 0) { total_framerate = PV_MIN(total_framerate, video->encParams->LayerMaxFrameRate[1]); } else /* if the max is not set, set it to the specified profile/level */ { video->encParams->LayerMaxFrameRate[1] = (float)scalable_profile_level_max_mbsPerSec[index] / nTotalMB; } total_packet_size = video->encParams->ResyncPacketsize; total_MBsPerSec = (Int)(total_framerate * nTotalMB); enhance_VBV_size = PV_MAX((Int)((total_bitrate - base_bitrate) * delay), (Int)(upper_bound_ratio * (total_bitrate - base_bitrate) / (total_framerate - base_framerate))); enhance_VBV_size = PV_MAX(enhance_VBV_size, MIN_BUFF); total_VBV_size = base_VBV_size + enhance_VBV_size; /* if the buffer is larger than maximum buffer size, we'll clip it */ if (total_VBV_size > scalable_profile_level_max_VBV_size[6]) { total_VBV_size = scalable_profile_level_max_VBV_size[6]; enhance_VBV_size = total_VBV_size - base_VBV_size; } /* Check if the buffer exceeds the maximum buffer size given the maximum profile and level */ if (total_VBV_size > scalable_profile_level_max_VBV_size[index]) return FALSE; } if (!bInitialized) /* Has been initialized --> profile @ level has been figured out! */ { video->encParams->BufferSize[0] = base_VBV_size; if (nLayers > 1) video->encParams->BufferSize[1] = enhance_VBV_size; return PV_TRUE; } /* Profile @ level determination */ if (nLayers == 1) { /* BASE ONLY : Simple Profile(SP) Or Core Profile(CP) */ if (base_bitrate > profile_level_max_bitrate[index] || base_packet_size > profile_level_max_packet_size[index] || base_MBsPerSec > profile_level_max_mbsPerSec[index] || base_VBV_size > profile_level_max_VBV_size[index]) return PV_FALSE; /* Beyond the bound of Core Profile @ Level2 */ /* For H263/Short header, determine k*16384 */ width16 = ((video->encParams->LayerWidth[0] + 15) >> 4) << 4; height16 = ((video->encParams->LayerHeight[0] + 15) >> 4) << 4; if (video->encParams->H263_Enabled) { k = 4; if (width16 == 2*QCIF_WIDTH && height16 == 2*QCIF_HEIGHT) /* CIF */ k = 16; else if (width16 == 4*QCIF_WIDTH && height16 == 4*QCIF_HEIGHT) /* 4CIF */ k = 32; else if (width16 == 8*QCIF_WIDTH && height16 == 8*QCIF_HEIGHT) /* 16CIF */ k = 64; video->encParams->maxFrameSize = k * 16384; /* Make sure the buffer size is limited to the top profile and level: the Core profile and level 2 */ if (base_VBV_size > (Int)(k*16384 + 4*(float)profile_level_max_bitrate[5]*1001.0 / 30000.0)) base_VBV_size = (Int)(k * 16384 + 4 * (float)profile_level_max_bitrate[5] * 1001.0 / 30000.0); if (base_VBV_size > (Int)(k*16384 + 4*(float)profile_level_max_bitrate[index]*1001.0 / 30000.0)) return PV_FALSE; } /* Search the appropriate profile@level index */ if (!video->encParams->H263_Enabled && (video->encParams->IntraDCVlcThr != 0 || video->encParams->SearchRange > 16)) { lowest_level = 1; /* cannot allow SPL0 */ } else { lowest_level = 0; /* SPL0 */ } for (i = lowest_level; i <= index; i++) { if (i != 4 && /* skip Core Profile@Level1 because the parameters in it are smaller than those in Simple Profile@Level3 */ base_bitrate <= profile_level_max_bitrate[i] && base_packet_size <= profile_level_max_packet_size[i] && base_MBsPerSec <= profile_level_max_mbsPerSec[i] && base_VBV_size <= (video->encParams->H263_Enabled ? (Int)(k*16384 + 4*(float)profile_level_max_bitrate[i]*1001.0 / 30000.0) : profile_level_max_VBV_size[i])) break; } if (i > index) return PV_FALSE; /* Nothing found!! */ /* Found out the actual profile @ level : index "i" */ if (i == 0) { /* For Simple Profile @ Level 0, we need to do one more check: image size <= QCIF */ if (width16 > QCIF_WIDTH || height16 > QCIF_HEIGHT) i = 1; /* image size > QCIF, then set SP level1 */ } video->encParams->ProfileLevel[0] = profile_level_code[i]; video->encParams->BufferSize[0] = base_VBV_size; if (video->encParams->LayerMaxBitRate[0] == 0) video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[i]; if (video->encParams->LayerMaxFrameRate[0] == 0) video->encParams->LayerMaxFrameRate[0] = PV_MIN(30, (float)profile_level_max_mbsPerSec[i] / nTotalMB); /* For H263/Short header, one special constraint for VBV buffer size */ if (video->encParams->H263_Enabled) video->encParams->BufferSize[0] = (Int)(k * 16384 + 4 * (float)profile_level_max_bitrate[i] * 1001.0 / 30000.0); } else { /* SCALABALE MODE: Simple Scalable Profile(SSP) Or Core Scalable Profile(CSP) */ if (total_bitrate > scalable_profile_level_max_bitrate[index] || total_packet_size > scalable_profile_level_max_packet_size[index] || total_MBsPerSec > scalable_profile_level_max_mbsPerSec[index] || total_VBV_size > scalable_profile_level_max_VBV_size[index]) return PV_FALSE; /* Beyond given profile and level */ /* One-time check: Simple Scalable Profile or Core Scalable Profile */ if (total_bitrate <= scalable_profile_level_max_bitrate[2] && total_packet_size <= scalable_profile_level_max_packet_size[2] && total_MBsPerSec <= scalable_profile_level_max_mbsPerSec[2] && total_VBV_size <= scalable_profile_level_max_VBV_size[2]) { start = 0; end = index; } else { start = 4; end = index; } /* Search the scalable profile */ for (i = start; i <= end; i++) { if (total_bitrate <= scalable_profile_level_max_bitrate[i] && total_packet_size <= scalable_profile_level_max_packet_size[i] && total_MBsPerSec <= scalable_profile_level_max_mbsPerSec[i] && total_VBV_size <= scalable_profile_level_max_VBV_size[i]) break; } if (i > end) return PV_FALSE; /* Search the base profile */ if (i == 0) { j = 0; bFound = 1; } else bFound = 0; for (j = start; !bFound && j <= i; j++) { if (base_bitrate <= profile_level_max_bitrate[j] && base_packet_size <= profile_level_max_packet_size[j] && base_MBsPerSec <= profile_level_max_mbsPerSec[j] && base_VBV_size <= profile_level_max_VBV_size[j]) { bFound = 1; break; } } if (!bFound) // && start == 4) return PV_FALSE; /* mis-match in the profiles between base layer and enhancement layer */ /* j for base layer, i for enhancement layer */ video->encParams->ProfileLevel[0] = profile_level_code[j]; video->encParams->ProfileLevel[1] = scalable_profile_level_code[i]; video->encParams->BufferSize[0] = base_VBV_size; video->encParams->BufferSize[1] = enhance_VBV_size; if (video->encParams->LayerMaxBitRate[0] == 0) video->encParams->LayerMaxBitRate[0] = profile_level_max_bitrate[j]; if (video->encParams->LayerMaxBitRate[1] == 0) video->encParams->LayerMaxBitRate[1] = scalable_profile_level_max_bitrate[i]; if (video->encParams->LayerMaxFrameRate[0] == 0) video->encParams->LayerMaxFrameRate[0] = PV_MIN(30, (float)profile_level_max_mbsPerSec[j] / nTotalMB); if (video->encParams->LayerMaxFrameRate[1] == 0) video->encParams->LayerMaxFrameRate[1] = PV_MIN(30, (float)scalable_profile_level_max_mbsPerSec[i] / nTotalMB); } /* end of: if(nLayers == 1) */ if (!video->encParams->H263_Enabled && (video->encParams->ProfileLevel[0] == 0x08)) /* SPL0 restriction*/ { /* PV only allow frame-based rate control, no QP change from one MB to another if(video->encParams->ACDCPrediction == TRUE && MB-based rate control) return PV_FALSE */ } return PV_TRUE; } #endif /* #ifndef ORIGINAL_VERSION */
dcbcbec250cf003b3fd72ee44d66f910568dc257
658bda92654220e5c09279de7f4a26f3b3f68192
/src/hmac.inl
b6742cc874577e80eac16713a984d018910e1a58
[ "MIT" ]
permissive
jgriffiths/libwally-embedded
45474602a918cab3c1803385390e090663832824
356dbbc398bbd100433deff92fbc9fc0a771371c
refs/heads/master
2022-06-09T07:31:02.209995
2020-05-04T20:51:02
2020-05-04T20:51:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
66
inl
hmac.inl
#include "wally_config.h" #include "../libwally-core/src/hmac.inl"
b348d8745f86012dcbb2263cb8bcede2b6611727
33f586e63328e8936628e7fc3535f078004d9b4f
/Common/ObjectData.h
dab21b96d020e2b76b61849203aa965d07c34853
[]
no_license
kani-m/OpenCampus
a752532dd4ac5106912b0bb939e867cc3b946904
2c5b01d54b3664fa2cf15d7278c072b2b89b333b
refs/heads/master
2020-03-25T16:03:44.538416
2019-07-25T07:51:07
2019-07-25T07:51:07
143,913,027
0
0
null
null
null
null
UTF-8
C++
false
false
6,468
h
ObjectData.h
#pragma once #include "Shape.h" #include "ShapeIndex.h" #include "SolidShapeIndex.h" #include "SolidShape.h" // Position of vertices of rectangle /* constexpr Object::Vertex rectangleVertex[] = { {{ -0.5f, -0.5f, 0.0f }}, {{ 0.5f, -0.5f, 0.0f }}, {{ 0.5f, 0.5f, 0.0f }}, {{ -0.5f, 0.5f, 0.0f }} }; */ // Position of vertices of octahedron /* constexpr Object::Vertex octahedronVertex[] = { {{ 0.0f, 1.0f, 0.0f }}, {{ -1.0f, 0.0f, 0.0f }}, {{ 0.0f, -1.0f, 0.0f }}, {{ 1.0f, 0.0f, 0.0f }}, {{ 0.0f, 1.0f, 0.0f }}, {{ 0.0f, 0.0f, 1.0f }}, {{ 0.0f, -1.0f, 0.0f }}, {{ 0.0f, 0.0f, -1.0f }}, {{ -1.0f, 0.0f, 0.0f }}, {{ 0.0f, 0.0f, 1.0f }}, {{ 1.0f, 0.0f, 0.0f }}, {{ 0.0f, 0.0f, -1.0f }} }; */ // Position and color of vertices of cube /* constexpr Object::Vertex cubeVertex[] = { {{ -1.0f, -1.0f, -1.0f }, {0.0f, 0.0f, 0.0f}}, {{ -1.0f, -1.0f, 1.0f }, {0.0f, 0.0f, 0.8f}}, {{ -1.0f, 1.0f, 1.0f }, {0.0f, 0.8f, 0.0f}}, {{ -1.0f, 1.0f, -1.0f }, {0.0f, 0.8f, 0.8f}}, {{ 1.0f, 1.0f, -1.0f }, {0.8f, 0.0f, 0.0f}}, {{ 1.0f, -1.0f, -1.0f }, {0.8f, 0.0f, 0.8f}}, {{ 1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.8f}} }; */ // Index of both endpoints of ridge(edge) of cube /* constexpr GLuint wireCubeIndex[] = { 1, 0, 2, 7, 3, 0, 4, 7, 5, 0, 6, 7, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 1 }; */ // Index of vertices of triangles to fill surface of cube /* constexpr GLuint solidCubeIndex[] = { 0, 1, 2, 0, 2, 3, // Left 0, 3, 4, 0, 4, 5, // Back 0, 5, 6, 0, 6, 1, // Bottom 7, 6, 5, 7, 5, 4, // Right 7, 4, 3, 7, 3, 2, // Top 7, 2, 1, 7, 1, 6 // Front }; */ // Position and color of vertices of each surface of cube /* constexpr Object::Vertex solidCubeVertex[] = { // Left {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.1f}}, {{ -1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.1f}}, {{ -1.0f, 1.0f, 1.0f }, {0.1f, 0.8f, 0.1f}}, {{ -1.0f, 1.0f, -1.0f }, {0.1f, 0.8f, 0.1f}}, // Back {{ 1.0f, -1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}}, {{ -1.0f, -1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}}, {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}}, {{ 1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}}, // Bottom {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.8f}}, {{ 1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.8f}}, {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.8f}}, {{ -1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.8f}}, // Right {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.1f, 0.8f}}, {{ 1.0f, -1.0f, -1.0f }, {0.1f, 0.1f, 0.8f}}, {{ 1.0f, 1.0f, -1.0f }, {0.1f, 0.1f, 0.8f}}, {{ 1.0f, 1.0f, 1.0f }, {0.1f, 0.1f, 0.8f}}, // Top {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.1f}}, {{ -1.0f, 1.0f, 1.0f }, {0.8f, 0.1f, 0.1f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.1f, 0.1f}}, {{ 1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.1f}}, // Front {{ -1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}}, {{ 1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}}, {{ -1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}} }; */ // Index of vertices of triangles to fill surface of cube /* constexpr GLuint solidCubeIndex[] = { 0, 1, 2, 0, 2, 3, // Left 4, 5, 6, 4, 6, 7, // Back 8, 9, 10, 8, 10, 11, // Bottom 12, 13, 14, 12, 14, 15, // Right 16, 17, 18, 16, 18, 19, // Top 20, 21, 22, 20, 22, 23 // Front }; */ // Position, color and normal of vertices of each surface of cube constexpr Object::Vertex solidCubeVertex[] = { // Left {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, {{ -1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, {{ -1.0f, 1.0f, 1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, {{ -1.0f, 1.0f, 1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, {{ -1.0f, 1.0f, -1.0f }, {0.1f, 0.8f, 0.1f}, {-1.0f, 0.0f, 0.0f}}, // Back {{ 1.0f, -1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, {{ -1.0f, -1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, {{ 1.0f, -1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, {{ 1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.8f}, { 0.0f, 0.0f, -1.0f}}, // Bottom {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, {{ 1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, {{ -1.0f, -1.0f, -1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, {{ -1.0f, -1.0f, 1.0f }, {0.1f, 0.8f, 0.8f}, { 0.0f, -1.0f, 0.0f}}, // Right {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, {{ 1.0f, -1.0f, -1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, {{ 1.0f, 1.0f, -1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, {{ 1.0f, -1.0f, 1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, {{ 1.0f, 1.0f, -1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.1f, 0.1f, 0.8f}, { 1.0f, 0.0f, 0.0f}}, // Top {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, {{ -1.0f, 1.0f, 1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, {{ -1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, {{ 1.0f, 1.0f, -1.0f }, {0.8f, 0.1f, 0.1f}, { 0.0f, 1.0f, 0.0f}}, // Front {{ -1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}}, {{ 1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}}, {{ -1.0f, -1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}}, {{ 1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}}, {{ -1.0f, 1.0f, 1.0f }, {0.8f, 0.8f, 0.1f}, { 0.0f, 0.0f, 1.0f}} }; // Index of vertices of triangles to fill surface of cube constexpr GLuint solidCubeIndex[] = { 0, 1, 2, 3, 4, 5, // Left 6, 7, 8, 9, 10, 11, // Back 12, 13, 14, 15, 16, 17, // Bottom 18, 19, 20, 21, 22, 23, // Right 24, 25, 26, 27, 28, 29, // Top 30, 31, 32, 33, 34, 35 // Front };
e7ae6d93822a273de68158648f4dcc8548256556
2c0f4a522dd26eeaf27120be429dd86419bac8f5
/Implementiation of Linked lists/deletion.cpp
a6824087d0532a9e5d04890ac579820e708087d5
[]
no_license
vishnupsingh523/scaling-structures
8b55e705007c8f512f80aa94dbd8fae65f99ae79
ad4efab8e54b47d8f8015def670ff3753d53cb24
refs/heads/master
2023-07-26T08:16:45.660063
2021-09-09T04:22:09
2021-09-09T04:22:09
289,501,238
0
0
null
null
null
null
UTF-8
C++
false
false
3,039
cpp
deletion.cpp
#include<iostream> using namespace std; // creating node struct node{ int data; struct node * next; }; node * createNewNode() { int data; cout<<"\nData: "; cin>>data; node * n = new node; n->data = data; n->next = NULL; return n; } // Insertion at the TOP of the linked list node * insertionAtTheTop(node * head){ node *n = createNewNode(); if(head == NULL) head = n; else{ n->next = head; head = n; } return head; } // Deletion at the top node * deletionAtTheTop(node * head){ node * curr; if(head == NULL) { cout<<"\nUNDERFLOW !!! The List is empty!"; return NULL; } else{ curr = head; head = head->next; cout<<"\nThe node has been deleted and its value is : "<<curr->data; delete curr; return head; } } // Deletion at the top node * deletionAtTheEnd(node * head){ node * curr; node * temp = head; if(head == NULL) { cout<<"\nUNDERFLOW !!! The List is empty!"; return NULL; } else{ while(temp->next != NULL) { curr = temp; temp = temp->next; } curr->next = temp->next; cout<<"\nThe node has been deleted and its value is : "<<temp->data; delete temp; return head; } } // Deletion from any specified position node * deletionFromSpecifiedPosition(node * head){ node * curr; node * temp = head; int pos; cout<<"\nEnter Position: "; cin>>pos; if(head == NULL) { cout<<"\nUNDERFLOW !!! The List is empty!"; return NULL; } else{ while(--pos && temp != NULL) { curr = temp; temp = temp->next; } curr->next = temp->next; temp->next = NULL; cout<<"\nThe node has been deleted and its value is : "<<temp->data; delete temp; return head; } } // print linked list void printLinkedList(node * head) { if(head == NULL) cout<<"\nThe list is empty!"; else{ while(head!=NULL) { cout<<" --> "<<head->data; head = head->next; } } } int main(){ char ch; int select; node * head = NULL; do{ cout<<"\nSelect any:\n1. Insertion\n2. Deletion at the END\n3. Deletion at the TOP\n4. Deletion at any specified position\n5. Print List\n\nEnter your choice: "; cin>>select; switch (select) { case 1: head = insertionAtTheTop(head); break; case 2: head = deletionAtTheEnd(head); break; case 3: head = deletionAtTheTop(head); break; case 4: head = deletionFromSpecifiedPosition(head); break; case 5: printLinkedList(head); break; default: cout<<"\nINVALID INPUT !!!"; break; } cout<<"\n\nWant to continue?(Y/N): "; cin>>ch; }while(ch=='y' || ch=='Y'); }
8c191961be6dcfa597d407a3519be84dd726c4b0
db3f82897530b15aa2015c527dcf40700d88be48
/Lockon/Src/Cosmos/wSunMove.h
06034772928f30faf7b84365c042f97c3a040d81
[]
no_license
VahidHeidari/ReverseEngineering
2eff32d4d49b560311c29cea06352d28d32c86ca
04f915c3009bdd59eddd53793256574c1b0b4d1b
refs/heads/master
2021-01-11T08:32:53.721706
2017-07-18T04:08:10
2017-07-18T04:08:10
76,719,008
1
0
null
null
null
null
UTF-8
C++
false
false
486
h
wSunMove.h
#ifndef WSUNMOVE_H_ #define WSUNMOVE_H_ #include "Common.h" class wSunMove { public: __thiscall wSunMove(class wSunMove const &) public: __thiscall wSunMove(void) public: virtual __thiscall ~wSunMove(void) public: class wSunMove & __thiscall operator=(class wSunMove const &) public: virtual void __thiscall NextEvent(void) const wSunMove::`vftable'{for `EagleDynamics::Common::Unknown<class EagleDynamics::Common::Serializable>'} const wSunMove::`vftable'{for `Suicide'} }; #endif
cad7d9fc5145ae3aea285f30946afed23fcab18b
4c1662d5f8203309f19fbc0c67e585ee054f26fe
/skngame/td/System.cpp
8839461398d0f27eaea9cce01e7bf2e6b2d863fa
[]
no_license
sunkening/skngame
d39378d21a4f12e2f83129dbcac36d2820f37d3d
2d567d83d31e795103d55f0519e97930f3fa638e
refs/heads/master
2021-01-24T09:39:17.817650
2017-01-07T08:58:00
2017-01-07T08:58:00
69,523,203
0
0
null
null
null
null
GB18030
C++
false
false
1,218
cpp
System.cpp
// System.cpp: implementation of the System class. // ////////////////////////////////////////////////////////////////////// #include "System.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// int GSystem::timePerFrame=TIME_PER_FRAM; int GSystem::frameCount=0; int GSystem::tickCount=GetTickCount(); int GSystem::tickCount2=GetTickCount(); int GSystem::frameCount2=0; int GSystem::secondCount=0; int GSystem::tickCount60=GetTickCount(); int GSystem::secondCount60=0; GSystem::GSystem() { } GSystem::~GSystem() { } void GSystem::waitClock() { while((GetTickCount()-tickCount)<30); } void GSystem::waitClock(int m) { while((GetTickCount()-tickCount)<m); } void GSystem::resetTickCount() { //GetTickCount() 返回从操作系统启动所经过的毫秒数,它的返回值是DWORD。 tickCount=GetTickCount(); frameCount++; frameCount2++; if((GetTickCount()-tickCount2)>1000) { tickCount2=GetTickCount(); cout<<"fps="<<frameCount2<<endl; frameCount2=0; secondCount++; } if ((GetTickCount()-tickCount60)>15) { tickCount60=GetTickCount(); secondCount60++; } }
eda232bd0c9b7f8d4c7861acfdf5fd5d8acce812
ead9f3470408d105a6ee6835f13a47cc9900b38b
/QuanLySinhVien/src/sinhvien.cpp
2f282300429e496ca4e3ab724f643d5cf5b60873
[]
no_license
dpc4f/MyApp
69e3a4e4cb116c708981b980362a5bda1e3cf26d
504fc547c6017bb13a375e2a5c127fbe5b546a5e
refs/heads/master
2022-12-12T16:25:26.470632
2020-02-08T06:46:37
2020-02-08T06:46:37
132,605,937
0
0
null
2022-12-07T22:11:33
2018-05-08T12:30:19
JavaScript
UTF-8
C++
false
false
1,315
cpp
sinhvien.cpp
#include <iostream> #include "sinhvien.h" using namespace std; CSinhVien::CSinhVien(const string& ms, const string& fname, const string& lname, const string& dob) : CNguoi(fname, lname, dob), mssv(ms) { } std::ostream& operator <<(std::ostream& os, const CSinhVien& sv) { os << sv.mssv << std::endl; os << sv.first_name << " " << sv.last_name << std::endl; os << sv.get_dob() << std::endl; for (const auto& ma_lop : sv.set_msl) { os << ma_lop << " "; } os << std::endl; return os; } void CSinhVien::dang_ky_lop(const string& ma_lop) { if (set_msl.find(ma_lop) == set_msl.end()) { set_msl.insert(ma_lop); cout << "Sinh vien dang ky thanh cong lop hoc " << ma_lop << std::endl; } else { cout << ma_lop << " da duoc dang ky!" << std::endl; } } void CSinhVien::deregister_class(const string& ma_lop) { if (set_msl.find(ma_lop) != set_msl.end()) { set_msl.erase(ma_lop); cout << "Sinh vien deregister thanh cong lop hoc " << ma_lop << std::endl; } else { cout << ma_lop << " khong tim thay hoac da duoc deregister!" << std::endl; } } string CSinhVien::get_mssv() const { return mssv; } void CSinhVien::update_khoa_ngoai(const string& ma_lop) { if (set_msl.find(ma_lop) != set_msl.end()) { cout << ma_lop << "da co trong CSDL."; } else { set_msl.insert(ma_lop); } }
56f325c5134f054ae3a4c0ee25007daf6ca7c516
d255a6c41b2d41e9351673a2b09872297ec051eb
/min_path/dijkstra_adjacency_matrix.cpp
b09837be881ecd8e91e6b6c76e02a869450d86eb
[]
no_license
wangruici/pat_doing
9080e0adfc57fed801090c2ab4edd6e36729e5e4
440090c5bbea219fd1dd56465512038488781436
refs/heads/master
2021-01-24T01:22:18.170878
2018-04-18T13:58:07
2018-04-18T13:58:07
122,806,167
3
0
null
null
null
null
UTF-8
C++
false
false
2,428
cpp
dijkstra_adjacency_matrix.cpp
#include <algorithm> using std::fill; const int MAXV=1000; const int INF=0x3fffffff; int point_num,graph[MAXV][MAXV]; int distance[MAXV]; int pre[MAXV];//表示从起点到顶点v的最短路径上v的前一个点 bool visited[MAXV]={false}; void Dijkstra(int begin_index){ fill(distance,distance+MAXV,INF);//fill函数将整个数组distance赋值为INF; distance[begin_index]=0; for(int i=0;i<point_num;++i){ int u=-1,MIN=INF;//distance[u]是中distance[i]最小的,MIN存放distance[u] for(int j=0;j<point_num;++j){ if(visited[j]==false&&distance[j]<MIN){ u=j; MIN=distance[j]; } } if(u==-1) return;//找不到未访问而且距离比INF更小的点了,说明其他点和起点都不联通 visited[u]=true;//标记为已经访问 for(int i=0;i<point_num;++i){ //如果i还没有被访问&&u能到达i&&以u为中介可以使distance[i]更优 if(visited[i]==false&&graph[u][i]!=INF&&distance[u]+graph[u][i]<distance[i]){ distance[i]=distance[u]+graph[u][i]; pre[i]=u;//记录i的前驱 } } } } void get_path_dfs(int begin_point,int end_point){ if(begin_point==end_point){ printf("%d\n",begin_point); return; } get_path_dfs(begin_point,pre[end_point]); printf("%d\n",end_point); } /********************************************************************************************/ //如果题目给出了不止一种权值,还有另外一种权值(边权),可以改进该算法 //设另外一个权值为cost ,cost[][]; void Dijkstra2(int begin_index){ fill(distance,distance+MAXV,INF);//fill函数将整个数组distance赋值为INF; distance[begin_index]=0; for(int i=0;i<point_num;++i){ int u=-1,MIN=INF;//distance[u]是中distance[i]最小的,MIN存放distance[u] for(int j=0;j<point_num;++j){ if(visited[j]==false&&distance[j]<MIN){ u=j; MIN=distance[j]; } } if(u==-1) return;//找不到未访问而且距离比INF更小的点了,说明其他点和起点都不联通 visited[u]=true;//标记为已经访问 for(int i=0;i<point_num;++i){ //如果i还没有被访问&&u能到达i&&以u为中介可以使distance[i]更优 if(visited[i]==false&&graph[u][i]!=INF){ if(distance[u]+graph[u][i]<distance[i]){ distance[i]=distance[u]+graph[u][i]; c[i]=c[u]+cost[u][i]; } else if(distance[u]+graph[u][i]==distance[i]&&c[u]+cost[u][i]<c[i]){ c[i]=c[u]+cost[u][i]; } } } } }
a3282649beddc6dc17dffb5690ea23bd16c9f358
e216bd896564c4f68c25d341c0f1be31fd30a4c8
/readtxt.h
82bbdce7d4b15745170f71af51599c360dbee6fe
[]
no_license
KongQingXin12/720GPS_complete
cf8c3c486193c7c5797e57845a601865af0715b7
d4463895ae52957bae0e224ce12b94e8a26310bd
refs/heads/master
2020-03-30T13:08:42.019977
2018-10-05T12:47:12
2018-10-05T12:47:12
151,258,696
0
0
null
null
null
null
UTF-8
C++
false
false
433
h
readtxt.h
#ifndef READTXT_H #define READTXT_H #include <iostream> #include <fstream> #include <cassert> #include <string> #include<vector> using namespace std; class readtxt { private: string r_filename; string w_filename; vector<string> ans; public: readtxt(); readtxt(string r,string w); void trans(); void deal_str(string &s); void deal_vec(vector<string>&ans); void write(); }; #endif // READTXT_H
ba828dc6fbf475730d4505a6409f781075d1c355
9bd2b92b924d65f19bc534b543f90ae63ea23637
/contest/2019徐州/E.cpp
ff46e62237ea5a28bc473477f834b2ef7304d615
[]
no_license
mooleetzi/ICPC
d5196b07e860721c8a4fe41a5ccf5b58b6362678
cd35ce7dbd340df1e652fdf2f75b35e70e70b472
refs/heads/master
2020-06-09T12:13:48.571843
2019-12-01T11:39:20
2019-12-01T11:39:20
193,435,046
3
0
null
null
null
null
UTF-8
C++
false
false
2,696
cpp
E.cpp
#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #if __cplusplus >= 201103L #include <unordered_map> #include <unordered_set> #endif #include <vector> #define lson rt << 1, l, mid #define rson rt << 1 | 1, mid + 1, r #define LONG_LONG_MAX 9223372036854775807LL #define ll LL using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int, int> P; int n, m, k; const int maxn = 5e5 + 10; template <class T> inline T read() { int f = 1; T ret = 0; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { ret = (ret << 1) + (ret << 3) + ch - '0'; ch = getchar(); } ret *= f; return ret; } template <class T> inline void write(T n) { if (n < 0) { putchar('-'); n = -n; } if (n >= 10) { write(n / 10); } putchar(n % 10 + '0'); } template <class T> inline void writeln(const T &n) { write(n); puts(""); } int a[maxn]; struct node { int l, r, maxx, rmax; } tr[maxn << 2]; int idx[maxn << 2]; void push_up(int rt) { tr[rt].maxx = max(tr[rt << 1].maxx, tr[rt << 1 | 1].maxx); } void build(int rt, int l, int r) { tr[rt].l = l; tr[rt].r = r; if (l == r) { tr[rt].maxx = a[l]; idx[l] = rt; return; } int mid = l + r >> 1; build(lson); build(rson); push_up(rt); } int query(int rt, int id, int val) { int l = tr[rt].l; int r = tr[rt].r; if (l == r) { return l - id - 1; } if (tr[rt << 1 | 1].maxx >= val) return query(rt << 1 | 1, id, val); else if (tr[rt << 1].maxx >= val) return query(rt << 1, id, val); return -1; } int rmax[maxn]; int main(int argc, char const *argv[]) { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif n = read<int>(), m = read<int>(); for (int i = 1; i <= n; i++) a[i] = read<int>(); rmax[n] = 0; for (int i = n; i >= 1; i--) rmax[i] = max(a[i + 1], rmax[i + 1]); build(1, 1, n); for (int i = 1; i <= n; i++) { if (rmax[i] < a[i] + m) { write(-1); if (i == n) puts(""); else putchar(' '); continue; } write(query(1, i, a[i] + m)); if (i == n) { puts(""); } else putchar(' '); } return 0; }
f656bb2137ef1619aa0cbd7737a6a6731717ea3b
8f2d8fc24d8401dae3841dacf48a08937308274d
/cardGame/hpp/Movement.hpp
b451027cf835239a366744819e2ef4b8d0fee291
[]
no_license
safir-medjeber/cpp_project
1a8d624b739ba40a0bb6538345c7fb575e7103fb
32ac44ff3e6595159cb12350790e51c600724688
refs/heads/master
2021-01-10T03:53:20.910620
2015-01-22T20:33:06
2015-01-22T20:33:06
47,075,316
0
0
null
null
null
null
UTF-8
C++
false
false
630
hpp
Movement.hpp
#ifndef H_MOVEMENT #define H_MOVEMENT #include <iostream> using namespace std; class Movement { private: int * cardsPos; int nbCards; int type; void isInt(string, unsigned int&); void match1(string); void match2(string, int); void match3(string, int); void match4(); bool isWhat(int); public: static const int M_ONE = 1, M_INTERVAL = 2, M_LIST = 4, M_PIOCHE = 8; Movement() {} Movement(string, int = (M_ONE | M_INTERVAL | M_LIST | M_PIOCHE)); int operator[](int); int getSize(); int getMax(); int getMin(); bool isOne(); bool isList(); bool isInterval(); bool isPioche(); }; #endif
9e5cbdaa6111686a87d56e62adfcf61d9cf4e710
45b59e4f0b2f4228cf92471ad6126bbf33cdc7d3
/examples/03-notify/03-notify.cpp
73da7d72ddf190998d8c57c822bd15458b73ae04
[ "MIT" ]
permissive
rickkas7/DebounceSwitchRK
1173b66c48ec984bedf37269e5145eac8ea2c065
79521b2eaa29cf3dff28a8933f58a2cc586e6664
refs/heads/main
2023-02-27T08:00:18.275942
2021-01-30T10:24:43
2021-01-30T10:24:43
333,813,975
0
0
null
null
null
null
UTF-8
C++
false
false
1,032
cpp
03-notify.cpp
#include "Particle.h" #include "DebounceSwitchRK.h" SYSTEM_THREAD(ENABLED); SerialLogHandler logHandler; void interruptHandler(); DebounceSwitchState *notifyHandler; pin_t TEST_PIN = D3; void setup() { // Comment this out to wait for USB serial connections to see more debug logs // waitFor(Serial.isConnected, 15000); DebounceSwitch::getInstance()->setup(); pinMode(TEST_PIN, INPUT_PULLUP); attachInterrupt(TEST_PIN, interruptHandler, CHANGE); notifyHandler = DebounceSwitch::getInstance()->addSwitch(DebounceSwitch::NOTIFY_PIN, DebounceSwitchStyle::PRESS_LOW, [](DebounceSwitchState *switchState, void *) { Log.info("state=%s", switchState->getPressStateName()); if (switchState->getPressState() == DebouncePressState::TAP) { Log.info("%d taps", switchState->getTapCount()); } }); } void loop() { } void interruptHandler() { // It's safe to call this from an ISR if (notifyHandler) { notifyHandler->notify(pinReadFast(TEST_PIN)); } }
a4f403ded0a9e6a9d01b45f440d5db6776acf90b
566de1a1b88c2b35e412ac6d656d9ee5c2da1fd1
/538. Convert BST to Greater Tree.cpp
492d10b0bb329e6d194d363f30407be4276928e6
[]
no_license
HanHoney/leetcode
ada30c82946457f0ffc1dbc5ec2a6128448d60be
81d5d80bf65c9cdfb896cd9903ab277e507f4b66
refs/heads/master
2020-04-10T22:51:08.060432
2019-05-29T08:14:09
2019-05-29T08:14:09
161,334,067
1
0
null
null
null
null
UTF-8
C++
false
false
608
cpp
538. Convert BST to Greater Tree.cpp
//538. Convert BST to Greater Tree //Easy #include <iostream> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) :val(x), left(nullptr), right(nullptr) {} }; class Solution { public: TreeNode* convertBST(TreeNode* root) { if (root == nullptr) return nullptr; int sum = 0; inorderTraversal(root, sum); return root; } void inorderTraversal(TreeNode* root, int& sum) { if (root == nullptr) return; inorderTraversal(root->right, sum); root->val += sum; sum = root->val; inorderTraversal(root->left, sum); } };
999e973578add918a07b15b2cce1d50ef8e8afc5
a8ec0b280e63eb06c9352402aaa81c4f6b06b47c
/HDU/3685.cpp
0b6738d14e3190949f67173913ecb37d1d64b7c0
[ "Unlicense" ]
permissive
CodingYue/acm-icpc
5eff1b81a50cc9f7cbcd93c38b0232ba085a0b97
667596efae998f5480819870714c37e9af0740eb
refs/heads/master
2020-05-16T21:51:33.553238
2017-02-14T11:52:05
2017-02-14T11:52:05
17,904,772
1
0
null
null
null
null
UTF-8
C++
false
false
3,264
cpp
3685.cpp
// File Name: hdu3685.cpp // Author: YangYue // Created Time: Thu Oct 3 16:06:57 2013 //headers #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <cstring> #include <cmath> #include <ctime> #include <string> #include <queue> #include <set> #include <map> #include <iostream> #include <vector> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int> PII; typedef pair<double,double> PDD; typedef pair<LL, LL>PLL; typedef pair<LL,int>PLI; #define lch(n) ((n<<1)) #define rch(n) ((n<<1)+1) #define lowbit(i) (i&-i) #define sqr(x) ((x)*(x)) #define fi first #define se second #define MP make_pair #define PB push_back const int MaxN = 200005; const double eps = 1e-8; const double DINF = 1e100; const int INF = 1000000006; const LL LINF = 1000000000000000005ll; int dcmp(double x) { return x < -eps ? -1 : x > eps; } struct Point { double x, y; Point(){} Point(double x, double y) : x(x), y(y) {} Point operator + (const Point &b) { return Point(x + b.x, y + b.y); } Point operator - (const Point &b) { return Point(x - b.x, y - b.y); } Point operator * (const double &b) { return Point(x * b, y * b); } Point operator / (const double &b) { return Point(x / b, y / b); } double operator * (const Point &b) { return x * b.y - y * b.x; } double operator % (const Point &b) { return x * b.x + y * b.y; } double len() { return sqrt(x * x + y * y); } double len2() { return x * x + y * y; } void init() { scanf("%lf%lf", &x, &y); } bool operator < (const Point &b) const { if (dcmp(x - b.x) != 0) return dcmp(x - b.x) < 0; return dcmp(y - b.y) < 0; } } p[MaxN], hull[MaxN]; Point getCenter(Point *p, int n) { p[n] = p[0]; Point res = Point(0,0); double area = 0; for (int i = 0; i < n; ++i) { area += p[i] * p[i+1] * 0.5; res = res + (p[i] + p[i+1]) * (p[i] * p[i+1] / 6.0); } return res / area; } int Graham(Point* P,Point* Hull,int n) { sort(P,P+n); int HTop = 0; for(int i = 0;i < n;i++) { // delete collinear points while(HTop > 1 && dcmp((P[i]-Hull[HTop-2])*(Hull[HTop-1]-Hull[HTop-2])) >= 0) HTop--; Hull[HTop++] = P[i]; } int LTop = HTop; for(int i = n-2;i >= 0;i--) { while(HTop > LTop && dcmp((P[i]-Hull[HTop-2])*(Hull[HTop-1]-Hull[HTop-2])) >= 0) HTop--; if(i) Hull[HTop++] = P[i]; } return HTop; } bool check(Point p, Point p1, Point p2) { if (dcmp((p - p1) % (p2 - p1)) <= 0) return 0; if (dcmp((p - p2) % (p1 - p2)) <= 0) return 0; return 1; } int count(Point center, Point *p, int n) { int res = 0; p[n] = p[0]; for (int i = 0; i < n; ++i) res += check(center, p[i], p[i+1]); return res; } int main() { //freopen("in","r",stdin); int cases; scanf("%d", &cases); while (cases--) { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) p[i].init(); Point center = getCenter(p, n); int m = Graham(p, hull, n); printf("%d\n", count(center, hull, m)); } return 0; } // hehe ~
3034b18e554d1ac1ae50685acce64609524dbb58
d8d5465332d274fb9795c1ca37d9d8436c228ff3
/3rd_semester/Struct/Aho/AC.h
2473b7bdbbfc7c22169ae505a69536083285ccb6
[ "MIT" ]
permissive
mehakun/Labs
8b651942ac99a69b99da7e979b395aec56b442af
0d42c97e8671d31b9cb49093686df7b8d4d62cfd
refs/heads/master
2021-01-12T15:11:57.273830
2018-06-09T17:07:08
2018-06-09T17:07:08
73,270,492
3
0
null
null
null
null
UTF-8
C++
false
false
643
h
AC.h
#ifndef AH_H #define AH_H #include <string> #include <vector> #include <memory> #include <map> class TFinitaAuto { private: class TNode { public: std::shared_ptr<TNode> fail; std::map<unsigned long, std::shared_ptr<TNode> > to; std::vector<int> out; TNode(); ~TNode() {}; }; std::shared_ptr<TNode> root; std::vector<int> substrLens; int withoutJoker; void InitFailFunc(); public: TFinitaAuto(); void Build(const std::vector<std::string>&); void Search(const std::vector<unsigned long>&, std::vector< std::pair<int, int> >&, const int&); ~TFinitaAuto() {}; }; #endif // AH_H
225a441eaea52940f7d13098bc164a3b78915af2
62415f89e15038010ec337364a4a31452ea73cd2
/Server/server.cpp
8b7af0d585dfa9f733f9de652a1101c3d54eeb01
[]
no_license
Gabschgi/MultiplyServer
14c33fa1a28e283633ec045dba57c15fd3cdf588
8d2cbf11d120d410f3333121a0395c3a05a26516
refs/heads/master
2021-01-21T18:39:05.405430
2016-05-23T06:03:56
2016-05-23T06:03:56
58,354,391
0
0
null
2016-05-09T06:42:31
2016-05-09T06:42:31
null
UTF-8
C++
false
false
1,092
cpp
server.cpp
#include "server.h" #include "ui_server.h" using namespace std; Server::Server(QWidget *parent) : QMainWindow(parent), ui(new Ui::Server) { ui->setupUi(this); connect(&server, SIGNAL(newConnection()), this, SLOT(acceptConnection())); server.listen(QHostAddress::Any, 12345); } Server::~Server() { delete ui; server.close(); } void Server::acceptConnection() { client = server.nextPendingConnection(); connect(client, SIGNAL(readyRead()), this, SLOT(startRead())); } void Server::startRead() { char buffer[1024]; QString bufferString(buffer); int slicePos = bufferString.indexOf("m"); QString factor2String = bufferString.right(slicePos); QString factor1String = bufferString.left(slicePos); int factor1 = factor1String.toInt(); int factor2 = factor2String.toInt(); int product = factor1 * factor2; QString productString = QString::number(product); client->read(buffer, client->bytesAvailable()); client->close(); qDebug() << factor1String << " * " << factor2String << " = " << productString; }
33d7fd245214f07ae599cb9f44cbd5b27450b4fa
46c836b09235bea75eac01ce7c21eb00157689da
/src/lib/LightTreeLib.hpp
9f0cbca7cd94a6997f606fcfbd71b0b10d58226a
[ "BSL-1.0", "MIT" ]
permissive
alex-87/HyperGraphLib
a42c486b6a0a2f661fe40f29f72537409a16bec7
20ba0e335e8c31504a489b27c7183845546dec4e
refs/heads/master
2022-08-21T13:32:11.832542
2022-08-09T17:20:53
2022-08-09T17:20:53
42,951,042
25
6
null
2017-03-05T22:30:16
2015-09-22T17:56:17
C++
UTF-8
C++
false
false
2,165
hpp
LightTreeLib.hpp
/* * MIT License * * Copyright (c) 2015 Alexis LE GOADEC * * 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. * */ /* * LightTreeLib - Small C++ Template library - Used in HypergraphLib * */ #ifndef LIGHTTREELIB_HPP_ #define LIGHTTREELIB_HPP_ #include <map> #include <boost/shared_ptr.hpp> template<typename T> class LightTree { public: LightTree(const T& t) : _t( t ) { _cnt = 0; } void setElement(const T& t) { _t = t; } void addNode(boost::shared_ptr<LightTree<T> >& lightTree) { _mapNode[_cnt] = lightTree; _cnt++; } boost::shared_ptr<LightTree<T> >& getNode(unsigned int nodeId) { return _mapNode[nodeId]; } unsigned int getCardinal() const { return _cnt; } T& getElement() { return _t; } ~LightTree() { } private: T _t; unsigned int _cnt; std::map<unsigned int, boost::shared_ptr<LightTree<T> > > _mapNode; }; #endif /* LIGHTTREELIB_HPP_ */
83c96b08741683e71767fa23403a2218ea39c9ba
2901c650fc5792566a5fb564cf842807e52890f8
/uri_1123.cpp
6eef7724c84816312ea5e049e2be46d512847d4d
[]
no_license
RichartRupolo/URI
d9cd95e75edcf04f1e92b56b6b3ec7fa891caefa
492e680f3d1943e0566f30740df31e6c6ef15a29
refs/heads/master
2022-11-07T11:08:44.054659
2020-06-23T22:43:15
2020-06-23T22:43:15
274,273,744
0
0
null
null
null
null
UTF-8
C++
false
false
1,101
cpp
uri_1123.cpp
#include <cstdio> #include <cstdlib> #include <iostream> #include <queue> #include <algorithm> #define INF 999999999 using namespace std; int n, m, c, k; int grafo[1010][1010]; int custo[1010]; queue<int> fila; void infinite() { for(int i=0; i<=n; i++){ custo[i]= INF; for(int j=0; j<=n; j++) grafo[i][j]=INF; } } int dijkstra(int ori, int dest){ custo[ori] = 0; fila.push(ori); while(!fila.empty()){ int i = fila.front(); fila.pop(); for(int j=0; j<n; j++){ if(grafo[i][j] != INF && custo[j] > custo[i] + grafo[i][j]){ custo[j] = custo[i] + grafo[i][j]; fila.push(j); } } } return custo[dest]; } int main () { while ((cin >> n >> m >> c >> k) && (n!=0 && m!=0 && c!=0 && k!=0)){ infinite(); for(int i=1; i<=m; i++){ int u, v, p; cin >> u >> v >> p; if(u>=c && v>=c){ grafo[u][v]=p; grafo[v][u]=p; } if(u>=c && v<c) grafo[u][v]=p; if(u<c && v>=c) grafo[v][u]=p; if(u<c && v<c && abs(u-v)==1){ grafo[u][v]=p; grafo[v][u]=p; } } cout << dijkstra(k, c-1) << endl; } return 0; }
7f8971cfbe814c544819bd54e7d8e6b9805d8a4d
bf0d7304a4cb72d5ad9ec7b712428f11da3ea71c
/Searching & Sorting/MaximumProductOfWordLengths.cpp
a4596fb7ba1b2206235466aaf06db849a534c88d
[]
no_license
DivonilLiquid/Data-Structure-Algorithm
2e28dde9444f4fbdf759ab9a9f66cd2e7017ad5a
f744f18d1b92ed7137a80463ca4b7dd6804983a2
refs/heads/master
2023-05-07T07:54:09.225396
2021-05-25T07:16:51
2021-05-25T07:16:51
287,464,669
1
3
null
2021-01-03T06:13:50
2020-08-14T06:50:41
C++
UTF-8
C++
false
false
1,564
cpp
MaximumProductOfWordLengths.cpp
/* Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If no such two words exist, return 0. Example 1: Input: ["abcw","baz","foo","bar","xtfn","abcdef"] Output: 16 Explanation: The two words can be "abcw", "xtfn". Example 2: Input: ["a","ab","abc","d","cd","bcd","abcd"] Output: 4 Explanation: The two words can be "ab", "cd". Example 3: Input: ["a","aa","aaa","aaaa"] Output: 0 Explanation: No such pair of words. Constraints: 0 <= words.length <= 10^3 0 <= words[i].length <= 10^3 words[i] consists only of lowercase English letters. */ class Solution { public: int maxProduct(vector<string>& words) { vector<int> mask(words.size()); int result = 0; for (int i=0; i<words.size(); ++i) { for (auto c: words[i]) { mask[i] |= 1 << (c - 'a'); } for (int j=0; j<i; ++j) { if (!(mask[i] & mask[j])) { result = max(result, int(words[i].size() * words[j].size()) ); } } } return result; } }; /* Runtime: 48 ms, faster than 97.64% of C++ online submissions for Maximum Product of Word Lengths. Memory Usage: 16.2 MB, less than 5.25% of C++ online submissions for Maximum Product of Word Lengths. */
add9e58867bcae7acb555d275c0ea058fe220eda
e6841a65c30e2ff468cf1e779559cbc03567cdb1
/Praktikum GGI 2/Lösungen/Strassenverkehr Florian Walbroel 2014/Source/Block 1/Fahrzeug.cpp
68237c1e94cac4f4a3740b2595dbbb0d6382e89f
[]
no_license
karimbouaziz95/Praktikum2_Versuch
51ceff8b20e28f1cb5fe13d0397bf75a59a56e84
092993f74a9faabbf3918ad5b1393c8b7c06f90f
refs/heads/main
2023-08-23T04:53:36.152724
2021-10-17T16:20:01
2021-10-17T16:20:01
418,179,393
0
0
null
null
null
null
UTF-8
C++
false
false
2,367
cpp
Fahrzeug.cpp
//----- Aufgabenblock_1 -----// #include "Fahrzeug.h" int Fahrzeug::p_iMaxID = 0; Fahrzeug::Fahrzeug() { p_vInitialisierung(); #ifdef DEBUG cout << "Created new Object: [" << p_iID << "] - '" << p_sName << "'" << endl; #endif } Fahrzeug::Fahrzeug(string sName) { p_vInitialisierung(); p_sName = sName; #ifdef DEBUG cout << "Created new Object: [" << p_iID << "] - '" << p_sName << "'" << endl; #endif } Fahrzeug::Fahrzeug(string sName, double dMaxGeschwindigkeit) { p_vInitialisierung(); p_sName = sName; p_dMaxGeschwindigkeit = dMaxGeschwindigkeit; #ifdef DEBUG cout << "Created new Object: [" << p_iID << "] - '" << p_sName << "'" << endl; #endif } #ifndef DISABLE_COPY //es ist unsinnig hier p_vInitialisierung aufzurufen Fahrzeug::Fahrzeug(const Fahrzeug& f) : p_dMaxGeschwindigkeit(f.p_dMaxGeschwindigkeit), p_dGesamtStrecke(f.p_dGesamtStrecke), p_dGesamtZeit(f.p_dGesamtZeit), p_dZeit(f.p_dZeit), p_sName(f.p_sName + "_copy"), p_iID(++p_iMaxID) { } Fahrzeug& Fahrzeug::operator=(const Fahrzeug& f) { p_dMaxGeschwindigkeit = f.p_dMaxGeschwindigkeit; p_dGesamtStrecke = f.p_dGesamtStrecke; p_dGesamtZeit = f.p_dGesamtZeit; p_dZeit = f.p_dZeit; return *this; } #endif Fahrzeug::~Fahrzeug() { #ifdef DEBUG cout << "Destroyed Object: [" << p_iID << "] - '" << p_sName << "'" << endl; #endif } bool Fahrzeug::operator< (const Fahrzeug& f) { if(p_dGesamtStrecke < f.p_dGesamtStrecke) return true; return false; } extern double g_dGlobaleZeit; void Fahrzeug::vAbfertigung() { if(p_dZeit >= g_dGlobaleZeit) return; p_dGesamtStrecke += (g_dGlobaleZeit-p_dZeit) * dGeschwindigkeit(); p_dGesamtZeit += (g_dGlobaleZeit-p_dZeit); p_dZeit = g_dGlobaleZeit; } string Fahrzeug::sName() { return p_sName; } void Fahrzeug::vNeuerName(string sName) { p_sName = sName; } void Fahrzeug::vAusgabe(ostream& out) const { out << resetiosflags(ios::right) << setiosflags(ios::left); out << setw(4) << p_iID << setw(7) << p_sName << setw(3) << ":" << setw(9) << dGeschwindigkeit() << setw(19) << p_dGesamtStrecke; } void Fahrzeug::p_vInitialisierung() { p_dMaxGeschwindigkeit = 0.0; p_dGesamtStrecke = 0.0; p_dGesamtZeit = 0.0; p_dZeit = 0.0; p_sName = ""; p_iMaxID++; p_iID = p_iMaxID; } ostream& operator << (ostream& out, const Fahrzeug& f) { f.vAusgabe(out); return out; }
a2c0df7e520f27159e2aee24d530ed5c67e119d0
5de39f2aabbc2bd26ecc05850ed235955270c23e
/Ctwl_ChunkSvr_Analysis/xzmo_trunk/gamesvr_s/commonBase/SysMsgToServer.cpp
b9753bf84f7708506e1c27cfc9a46b82defae58e
[]
no_license
WangcfGH/Git_Code
ecba205784826f49a6059ee7ee7cbf9996e3c7b7
db3ccddd039132669e4d9ac1c84ab156fee83eb2
refs/heads/master
2023-04-27T03:04:55.345257
2023-04-15T01:51:42
2023-04-15T01:51:42
224,375,664
1
0
null
null
null
null
GB18030
C++
false
false
14,076
cpp
SysMsgToServer.cpp
#include "stdafx.h" #include "SysMsgToServer.h" void SysMsgToServer::OnServerStart(BOOL& ret, TcyMsgCenter* msgCenter) { if (ret) { AUTO_REGISTER_MSG_OPERATOR(msgCenter, GR_SENDMSG_TO_SERVER, OnSendSysMsgToServer); RegsiterSysMsgOpera(); } } void SysMsgToServer::RegsiterSysMsgOpera() { m_msgid2Opera.insert({ SYSMSG_GAME_CLOCK_STOP, [this](SysMsgOperaPack * pack) { return OnSysMsg_GameClockStop(pack); } }); m_msgid2Opera.insert({ YQW_SYSMSG_PLAYER_ONLINE, [this](SysMsgOperaPack * pack) { return OnSysMsg_PlayerOnline(pack); } }); m_msgid2Opera.insert({ SYSMSG_PLAYER_ONLINE, [this](SysMsgOperaPack * pack) { return OnSysMsg_PlayerOnline(pack); } }); m_msgid2Opera.insert({ SYSMSG_GAME_ON_AUTOPLAY, [this](SysMsgOperaPack * pack) { return OnSysMsg_GameOnAutoPlay(pack); } }); m_msgid2Opera.insert({ SYSMSG_GAME_CANCEL_AUTOPLAY, [this](SysMsgOperaPack * pack) { return OnSysMsg_GameCancelAutoPlay(pack); } }); m_msgid2Opera.insert({ MODULE_MSG_VOICE, [this](SysMsgOperaPack * pack) { return OnSysMsg_ModuleMsgVoice(pack); } }); } BOOL SysMsgToServer::OnSendSysMsgToServer(LPCONTEXT_HEAD lpContext, LPREQUEST lpRequest) { GAME_MSG* pMsg = RequestDataParse<GAME_MSG>(lpRequest, false); if (nullptr == pMsg) { LOG_INFO("%ld发送了不合法的消息结构,结构长度:%ld", lpContext->lTokenID, lpRequest->nDataLen); return m_pServer->NotifyResponseFaild(lpContext); } auto token = lpContext->lTokenID; BOOL bPassive = IS_BIT_SET(lpContext->dwFlags, CH_FLAG_SYSTEM_EJECT);//是否系统自己生成的消息 BYTE* pData = PBYTE(lpRequest->pDataPtr) + sizeof(GAME_MSG); int roomid = pMsg->nRoomID; int userid = pMsg->nUserID; LOG_DEBUG("OnSendSysMsgToServer###########:%ld ...", pMsg->nMsgID); if (!GameMsgCheck(pMsg)) { LOG_INFO(_T("%ld发送了不合法的消息结构,消息号为:%ld"), lpContext->lTokenID, pMsg->nMsgID); return m_pServer->NotifyResponseFaild(lpContext); } int tableno = -1; int chairno = -1; USER_DATA user_data; memset(&user_data, 0, sizeof(user_data)); if (!m_pServer->LookupUserData(userid, user_data) && bPassive == FALSE) { UwlLogFile(_T("user:%ld未在服务器注册,试图发送消息号为:%ld"), userid, pMsg->nMsgID); return m_pServer->NotifyResponseFaild(lpContext); } else { roomid = user_data.nRoomID; tableno = user_data.nTableNO; chairno = user_data.nChairNO; } CRoom* pRoom = NULL; CCommonBaseTable* pTable = NULL; if (!(pRoom = m_pServer->GetRoomPtr(roomid))) { return m_pServer->NotifyResponseFaild(lpContext, bPassive); } if (!(pTable = (CCommonBaseTable*)m_pServer->GetTablePtr(roomid, tableno))) { return m_pServer->NotifyResponseFaild(lpContext, bPassive); } if (pTable) { CAutoLock lock(&(pTable->m_csTable)); if (!pTable->ValidateChair(chairno)) { return TRUE; } if (userid && token != pTable->FindTokenByUser(userid)) { if (!lpContext->bNeedEcho) { return TRUE; } REQUEST response2; memset(&response2, 0, sizeof(response2)); response2.head.nRequest = UR_OPERATE_FAILED; return m_pServer->SendUserResponse(lpContext, &response2, bPassive, FALSE); } if (!bPassive) { pTable->m_dwLatestAction[chairno] = GetTickCount(); } if (!bPassive) { pTable->m_dwCheckBreakTime[chairno] = 0; } if (!pTable->IsPlayer(userid)) { // 不是玩家 LOG_INFO(_T("user not player. user %ld SendMsgToPlayer Failed,dwFlags:%ld"), userid, pMsg->nMsgID); return m_pServer->NotifyResponseFaild(lpContext); } if (!pTable->ValidateChair(chairno)) { LOG_INFO(_T("chairno Error. user %ld SendMsgToPlayer Failed,chairno:%ld"), userid, chairno); return m_pServer->NotifyResponseFaild(lpContext); } if (!IS_BIT_SET(pTable->m_dwStatus, TS_PLAYING_GAME) && pMsg->nMsgID != SYSMSG_PLAYER_ONLINE && pMsg->nMsgID != MODULE_MSG_VOICE) { LOG_ERROR(_T("OnSendSysMsgToServer:pTable is not in TS_PLAYING_GAME.nMsgID:%d"), pMsg->nMsgID); return m_pServer->NotifyResponseFaild(lpContext); } CPlayer* pPlayer = pTable->m_ptrPlayers[chairno]; SysMsgOperaPack pack; pack.lpContext = lpContext; pack.lpRequest = lpRequest; pack.user_data = &user_data; pack.pMsg = pMsg; pack.pData = pData; pack.roomid = roomid; pack.chairno = chairno; pack.tableno = tableno; pack.userid = userid; pack.pRoom = pRoom; pack.pTable = pTable; pack.pPlayer = pPlayer; pack.bPassive = bPassive; auto it = m_msgid2Opera.find(pMsg->nMsgID); if (it != m_msgid2Opera.end()) { it->second(&pack); } } return TRUE; } BOOL SysMsgToServer::GameMsgCheck(GAME_MSG* pMsg) { BOOL ret = FALSE; auto resquesID = pMsg->nMsgID; do { if (SYSMSG_BEGIN < resquesID && resquesID < SYSMSG_END) { ret = TRUE; break; } if (LOCAL_GAME_MSG_BEGIN < resquesID && resquesID < LOCAL_GAME_MSG_END) { ret = TRUE; break; } if (GAMEMSGEX_BEGIN < resquesID && resquesID < GAMEMSGEX_END) { ret = TRUE; break; } if (resquesID == MODULE_MSG_VOICE) { ret = TRUE; break; } } while (0); if (!ret) { return FALSE; } if (m_pServer->IsYQWRoom(pMsg->nRoomID) && (pMsg->nMsgID == SYSMSG_PLAYER_ONLINE)) { // 一起玩房间不需要这个消息 return FALSE; } return TRUE; } BOOL SysMsgToServer::NotifyTableMsg(CTable* pTable, int nDest, int nMsgID, int datalen, void* data, LONG tokenExcept) { int size = datalen + sizeof(GAME_MSG); BYTE* pGameMsg = new BYTE[size]; memset(pGameMsg, 0, size); GAME_MSG* pHead = (GAME_MSG*)pGameMsg; BYTE* pData = pGameMsg + sizeof(GAME_MSG); pHead->nMsgID = nMsgID; pHead->nUserID = -1; pHead->nVerifyKey = -1; pHead->nDatalen = datalen; if (datalen) { memcpy(pData, data, datalen); } if (pTable->ValidateChair(nDest)) { //发送给个体 CPlayer* pPlayer = pTable->m_ptrPlayers[nDest]; m_pServer->NotifyOneUser(pPlayer->m_hSocket, pPlayer->m_lTokenID, GR_SENDMSG_TO_PLAYER, pGameMsg, size); } else { if (nDest == GAME_MSG_SEND_OTHER) { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, tokenExcept); m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, tokenExcept); } else if (nDest == GAME_MSG_SEND_OTHER_PLAYER) { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, tokenExcept); } else if (nDest == GAME_MSG_SEND_EVERY_PLAYER) { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size); } else { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size); m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size); } } delete[]pGameMsg; return TRUE; } BOOL SysMsgToServer::NotifyPlayerMsgAndResponse(LPCONTEXT_HEAD lpContext, CTable* pTable, int nDest, DWORD dwFlags, DWORD datalen, void* data) { int size = datalen + sizeof(GAME_MSG); BYTE* pGameMsg = new BYTE[size]; memset(pGameMsg, 0, size); GAME_MSG* pHead = (GAME_MSG*)pGameMsg; BYTE* pData = pGameMsg + sizeof(GAME_MSG); pHead->nMsgID = dwFlags; pHead->nUserID = -1; pHead->nVerifyKey = -1; pHead->nDatalen = datalen; if (datalen) { memcpy(pData, data, datalen); } REQUEST response; memset(&response, 0, sizeof(response)); response.head.nRequest = UR_OPERATE_SUCCEEDED; response.pDataPtr = pGameMsg; response.nDataLen = size; if (pTable->ValidateChair(nDest)) { CPlayer* pPlayer = pTable->m_ptrPlayers[nDest]; if (lpContext->lTokenID == pPlayer->m_lTokenID && lpContext->bNeedEcho) { //是自己,那么回应 lpContext->bNeedEcho = FALSE; //已经回应过不再回应 m_pServer->SendUserResponse(lpContext, &response); } else { //不是发送家,那么发送 m_pServer->NotifyOneUser(pPlayer->m_hSocket, pPlayer->m_lTokenID, GR_SENDMSG_TO_PLAYER, pGameMsg, size); } } else { if (nDest == GAME_MSG_SEND_OTHER) { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); } else if (nDest == GAME_MSG_SEND_OTHER_PLAYER) { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); } else if (nDest == GAME_MSG_SEND_VISITOR) { m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size); } else if (nDest == GAME_MSG_SEND_EVERY_PLAYER) { if (lpContext->bNeedEcho) { lpContext->bNeedEcho = FALSE; //已经回应过不再回应 m_pServer->SendUserResponse(lpContext, &response); m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); } else { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, 0); } } else { if (lpContext->bNeedEcho) { lpContext->bNeedEcho = FALSE; //已经回应过不再回应 m_pServer->SendUserResponse(lpContext, &response); m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, lpContext->lTokenID); } else { m_pServer->NotifyTablePlayers(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, 0); m_pServer->NotifyTableVisitors(pTable, GR_SENDMSG_TO_PLAYER, pGameMsg, size, 0); } } } delete[]pGameMsg; return TRUE; } BOOL SysMsgToServer::OnSysMsg_GameClockStop(SysMsgOperaPack* pack) { auto* pTable = pack->pTable; int chairno = pack->chairno; auto* pRoom = pack->pRoom; if (pTable->IsOperateTimeOver() && GetTickCount() - pTable->m_dwLastClockStop > 3000) { pTable->m_dwLastClockStop = GetTickCount(); int chair = pTable->GetCurrentChair(); if (pTable->ValidateChair(chair) && pTable->CheckOffline(chair)) { pTable->m_bOffline[chairno] = TRUE; m_pServer->OnPlayerOffline(pTable, chair); //服务端自动抓牌 m_pServer->OnServerAutoPlay(pRoom, pTable, chair, !pTable->IsOffline(chair)); //end } } return TRUE; } BOOL SysMsgToServer::OnSysMsg_PlayerOnline(SysMsgOperaPack* pack) { auto* pTable = pack->pTable; auto chairno = pack->chairno; auto* pPlayer = pack->pPlayer; if (pTable->IsOffline(chairno)) { //断线续完 pTable->m_dwUserStatus[chairno] &= ~US_USER_OFFLINE; pTable->m_bOffline[chairno] = FALSE; ///////////////////////////////////////////////////////////////////////// NotifyTableMsg(pTable, GAME_MSG_SEND_OTHER, SYSMSG_RETURN_GAME, 4, &pPlayer->m_nChairNO, pPlayer->m_lTokenID); ///////////////////////////////////////////////////////////////////////// } return TRUE; } BOOL SysMsgToServer::OnSysMsg_GameOnAutoPlay(SysMsgOperaPack* pack) { auto* pTable = pack->pTable; auto chairno = pack->chairno; auto* lpContext = pack->lpContext; if (!pTable->IsAutoPlay(chairno)) { pTable->m_dwUserStatus[chairno] |= US_USER_AUTOPLAY; NotifyPlayerMsgAndResponse(lpContext, pTable, GAME_MSG_SEND_EVERYONE, SYSMSG_GAME_ON_AUTOPLAY, sizeof(int), &chairno); } else { NotifyPlayerMsgAndResponse(lpContext, pTable, chairno, SYSMSG_GAME_ON_AUTOPLAY, sizeof(int), &chairno); } return TRUE; } BOOL SysMsgToServer::OnSysMsg_GameCancelAutoPlay(SysMsgOperaPack* pack) { auto* pTable = pack->pTable; auto chairno = pack->chairno; auto* lpContext = pack->lpContext; if (pTable->IsAutoPlay(chairno)) { pTable->m_dwUserStatus[chairno] &= ~US_USER_AUTOPLAY; NotifyPlayerMsgAndResponse(lpContext, pTable, GAME_MSG_SEND_EVERYONE, SYSMSG_GAME_CANCEL_AUTOPLAY, sizeof(int), &chairno); } else { NotifyPlayerMsgAndResponse(lpContext, pTable, chairno, SYSMSG_GAME_CANCEL_AUTOPLAY, sizeof(int), &chairno); } return TRUE; } BOOL SysMsgToServer::OnSysMsg_ModuleMsgVoice(SysMsgOperaPack* pack) { auto* pTable = pack->pTable; auto chairno = pack->chairno; auto* lpContext = pack->lpContext; auto* pMsg = pack->pMsg; auto* pData = pack->pData; SOUND_INDEX stIndex; memcpy(&stIndex, pData, pMsg->nDatalen); m_pServer->NotifyTablePlayers(pTable, MODULE_MSG_VOICE, &stIndex, sizeof(stIndex)); m_pServer->NotifyTableVisitors(pTable, MODULE_MSG_VOICE, &stIndex, sizeof(stIndex)); return TRUE; }
7d418c3b633c77bdeb95d56a8f41793dfe6ff171
8f66e7057a4275882f810a570e8e208caa07395a
/COOK116Bb.cpp
ba08cbc78362f3773ad2ced8ca03e19b4e25e437
[]
no_license
amit586/cp
ab3b1d9fc12da56cde1e69c35e2b9ba627d4695b
885420a7262ee26440099ee77f430d613c55f443
refs/heads/master
2021-03-02T12:41:35.824149
2020-08-07T11:25:33
2020-08-07T11:25:33
245,869,229
0
0
null
null
null
null
UTF-8
C++
false
false
810
cpp
COOK116Bb.cpp
#include<bits/stdc++.h> #define fio ios_base::sync_with_stdio(false);cin.tie(NULL); #define f(i,j,k) for(int i=j;i<k;i++) #define fr(i,j,k) for(int i<=k-1;i>=j;i--) #define ll long long #define ld long double using namespace std; int main() { fio int TC; cin>>TC; while(TC--) { int n; cin>>n; std::vector<ll> v; ll temp; ll mx=INT_MIN; vector <ll> imax; for (int i = 0; i < n; ++i) { cin>>temp; mx = max(mx,temp); v.push_back(temp); } for(int i=0;i<n;i++) { if(v[i]==mx) imax.push_back(i); } if(imax.size()==1) { cout<<n/2<<endl; continue; } ll max_d = (n+imax[0]-imax[imax.size()-1]); for(int i=1;i<imax.size();i++) { max_d = max(max_d,imax[i]-imax[i-1]); } (max_d-n/2)>0?cout<<max_d-n/2<<endl:cout<<0<<endl; } return 0; }
62f832defef742416f34e7601b973c8e94a028fb
e582f926fa3e6c325d70424b3c76feb1b094a486
/shin_1560308/butterflyfish.cpp
1b14640fe5c44afb3671202a3027b9a2d5d78ce6
[]
no_license
tndud4429/Aquarium
dd9d9bac40294a15520c2844c5f8e5a9afd86529
c32b4611b5f892e0789befe3553da8c5ead85506
refs/heads/master
2020-08-13T03:15:53.801455
2019-10-13T21:23:47
2019-10-13T21:23:47
214,895,964
0
0
null
null
null
null
UTF-8
C++
false
false
2,447
cpp
butterflyfish.cpp
// 1560308 // Soo Young Shin // butterflyfish.cpp // Project2 #include "butterflyfish.h" #include "fish.h" #include <iostream> Butterflyfish::Butterflyfish(int capacity, std::string name): Fish(capacity,name){ //initialize its own variables b_capacity = getCapacity(); b_extendedMemory = new char[b_capacity]; b_countMemory = new int[b_capacity]; for (int i=0; i<b_capacity; i++){ b_extendedMemory[i] = '.'; } for(int i=0; i<b_capacity; i++){ b_countMemory[i]=0; } } Butterflyfish::Butterflyfish(const Butterflyfish &other): Fish(other){ b_capacity = getCapacity(); b_extendedMemory = new char[b_capacity]; b_countMemory = new int[b_capacity]; b_capacity = other.b_capacity; for(int i=0; i<b_capacity; i++){ b_extendedMemory[i]=other.b_extendedMemory[i]; } } Butterflyfish &Butterflyfish::operator=(const Butterflyfish &other){ if(this==&other){return *this;} else { Fish::operator=(other); b_capacity = other.b_capacity; for(int i=0; i<b_capacity; i++){ b_extendedMemory[i]=other.b_extendedMemory[i]; } return (*this); } } Butterflyfish::~Butterflyfish(){ delete [] b_extendedMemory; delete [] b_countMemory; } void Butterflyfish::remember(char c){ Fish::remember(c); if(getExtendedAmount()==b_capacity){ b_capacity = b_capacity*2; for (int i=(b_capacity/2); i<b_capacity; i++){ b_extendedMemory[i] = '.'; b_countMemory[i]=0; } } for(int i=0; i<b_capacity; i++){ if (b_extendedMemory[i] == c){ b_countMemory[i]++; break; } else if (b_extendedMemory[i] == '.'){ b_extendedMemory[i] = c; b_countMemory[i]++; break; } } } void Butterflyfish::printMemory() const{ Fish::printMemory(); std::cout << "I’m Obnoxious!" << std::endl; if(b_extendedMemory[0]!='.') { std::cout<< "I've seen: " << std::endl; for(int i=0; i<b_capacity; i++){ if (b_extendedMemory[i] == '.'){ break; } else std::cout << " " << b_extendedMemory[i] << " " << b_countMemory[i] << " times" << std::endl; } } } int Butterflyfish::getExtendedAmount() const { int count=0; for (int i=0; i<b_capacity; i++){ if(b_extendedMemory[i] != '.'){count++;} } return count; }
aa8ac75f39c2b5b36c8e1492b8196fa20825ec09
d6832620606848667427d2421d3f29ae2829e00b
/blackjack/src/Answer.cpp
21a37f0b41f1875c9ecf3bb3c5fd6d5a6f381e7c
[]
no_license
ManuelRolando/DEMO
499aac1615119aaa6dd226b2952f004dfaaed08a
2248de7cd21f6167c1a5ae3db2def289ec07339d
refs/heads/master
2023-05-04T10:34:19.565982
2021-05-18T01:04:30
2021-05-18T01:04:30
256,401,848
0
0
null
null
null
null
UTF-8
C++
false
false
1,347
cpp
Answer.cpp
/* * Answer.cpp * * Created on: Jul 3, 2020 * Author: solalu */ #include "../include/Answer.h" #include <string> //#include <boost/algorithm/string.hpp> #include <iostream> using namespace std; int Answer::getState() { if(accept) return 1; else if (negate) return 0; else return -1; } void Answer::setAccept() { accept = true; negate = false; ambiguous = false; } void Answer::setNegate() { accept = false; negate = true; ambiguous = false; } void Answer::setAmbiguo() { accept = false; negate = false; ambiguous = true; } void Answer::setState() { //boost::algorithm::to_lower(answer_question); if(answer_question == "yes" || answer_question == "y") this->setAccept(); else if (answer_question == "no" || answer_question == "n") this->setNegate(); else this->setAmbiguo(); } void Answer::askQuestion() { if(question == "") { string new_question=""; cout << "Set question: "; // ERROR: this not read the complete question cin >> new_question; question = new_question; this->askQuestion(); } else { cout << question << " "; cin >> answer_question; this->setState(); } } void Answer::changeQuestion(string newQuestion) { question = newQuestion; this->askQuestion(); }
7dbad9332df8d7dd20a9cd8eecf099fdca36c77a
bbc433ff1d3a0c231b8df6a673910fab2f827961
/sparse_table.cpp
21e169b5b8b0791510fdd280dd513796d0648f6a
[]
no_license
ordansantos/acm-icpc
55cbee88fbf914c33f2d802b39725a292d941313
4de30226aed36908c25756f18369ee714f3c30e1
refs/heads/master
2021-01-17T17:50:37.774583
2018-04-08T15:20:51
2018-04-08T15:20:51
70,637,259
0
0
null
null
null
null
UTF-8
C++
false
false
417
cpp
sparse_table.cpp
int v[100001], table[100001][21]; //[0,n) void build(int n){ for (int i = 0; i < n; i++) table[i][0] = v[i]; for (int j = 1; (1<<j) <= n; j++) for (int i = 0; i+(1<<j) <= n; i++) table[i][j] = min (table[i][j-1], table[i+(1<<j-1)][j-1]); } int query (int l, int r, int table[N][LOG]){ int log = __builtin_clz(1) - __builtin_clz(r-l+1); return min (table[l][log], table[r-(1<<log)+1][log]); }
859afec8d92c8b955ed57e7d3b1e4a6da0419754
3cfb828ed745518c6bead738f3da27cb3ca1d0c2
/src/radarContainer.cpp
abcaa90d464284d011ff583fa11364f2008c33bb
[ "BSD-3-Clause" ]
permissive
Zaxuhe/FlynnOS-UI
9e5ee228a5a56e5d3b519131366a4c4b0a04bf9a
2a8e5f5072468ee5e7ee634a3308e232ed6ec14f
refs/heads/master
2020-11-30T11:53:54.174834
2015-09-07T07:02:08
2015-09-07T07:02:08
42,034,448
5
2
null
2016-06-13T05:07:00
2015-09-07T06:08:32
C++
UTF-8
C++
false
false
5,379
cpp
radarContainer.cpp
#include "radarContainer.h" #include "graphics-utils.h" #include "easing-utils.h" RadarContainer::RadarContainer() { x = 0; y = 0; w = 240; h = 21*GRID_SIZE; abs_p = ofPoint(1515, 195); radar1 = Radar(); radar1.x = abs_p.x; radar1.y = abs_p.y+1*GRID_SIZE; radar1.w = w; radar1.h = 12*GRID_SIZE; radar1.cam.setDistance(375); radar1.absolute_center = ofPoint(radar1.x+w/2, radar1.y+(12*GRID_SIZE)/2); radar1.set_theta_rate(1/230.0); radar2 = Radar(); radar2.x = abs_p.x; radar2.y = abs_p.y+14*GRID_SIZE; radar2.w = w/2; radar2.h = 6*GRID_SIZE; radar2.cam.setDistance(425); radar2.absolute_center = ofPoint(radar2.x+w/2/2, radar2.y+(6*GRID_SIZE)/2); radar2.set_theta_rate(1/150.0); radar3 = Radar(); radar3.x = abs_p.x+w/2; radar3.y = abs_p.y+14*GRID_SIZE; radar3.w = w/2; radar3.h = 6*GRID_SIZE; radar3.cam.setDistance(425); radar3.absolute_center = ofPoint(radar3.x+w/2/2, radar3.y+(6*GRID_SIZE)/2); radar3.set_theta_rate(1/130.0); tline1 = newTickLine(0, 0, w, 40, 0, COLOR_LINE); tline2 = newTickLine(0, h, w, 40, 0, COLOR_LINE); // Top Left texts.push_back(newText("MEMORY", 5, 5, 7, 10, 0, COLOR_135, false)); // Top Right texts.push_back(newText("RADAR VISUALIZATION", 5, w-5, 7, 10, 0, COLOR_55, true)); // Bottom Right texts.push_back(newText("SUMMARY", 5, w-4, h-7*GRID_SIZE-11, 10, 0, COLOR_55, true)); // Bottom Left texts.push_back(newText("INSPECTION OF", 5, 5,h-7*GRID_SIZE-18, 10, 0, COLOR_55, false)); texts.push_back(newText("SYSTEM MEMORY LOAD", 5, 5,h-7*GRID_SIZE-11, 10, 0, COLOR_55, false)); // Box Text texts.push_back(newText("E1", 5, 8, h-1*GRID_SIZE-10, 10, 0, COLOR_55, false)); texts.push_back(newText("E2", 5, 8+w/2, h-1*GRID_SIZE-10, 10, 0, COLOR_55, false)); // Animation settings events.clear(); newEvent(0, 300, 0, 1); // intro newEvent(0, -1, 1, 1); // main currentEvent = events[0]; updateDependencyEvents(); updateDependencyDelays(getDelay()); } void RadarContainer::setPosSubviews(float x_, float y_) { //we use this funcion for containers that need global positioning radar1.x = x_; radar1.y = y_+30+1*GRID_SIZE; radar2.x = x_; radar2.y = y_+30+14*GRID_SIZE; radar3.x = x_+w/2; radar3.y = y_+30+14*GRID_SIZE; } void RadarContainer::setPos(float x_, float y_) { x = x_; y = y_; } void RadarContainer::draw() { updateTime(); ofPushMatrix(); { ofTranslate(x, y); // Intro tline1.draw(); tline2.draw(); for (int i = 0; i < texts.size(); i++) texts[i].draw(); int radar_delay = 75; int radar_dur = 50; if (currentEvent.id == 0) { if (getTime() > radar_delay) { if (getTime() < radar_delay+radar_dur) { float alpha = easeOut(getTime()-radar_delay, 1, 0, 20); float theta = easeOut(getTime()-radar_delay, 0, 2, radar_dur); radar1.alphaSub = alpha; radar2.alphaSub = alpha; radar3.alphaSub = alpha; radar1.maxTheta = theta; radar2.maxTheta = theta; radar3.maxTheta = theta; radar1.minTheta = 0; radar2.minTheta = 0; radar3.minTheta = 0; } radar1.draw(); radar2.draw(); radar3.draw(); } } else { radar1.draw(); radar2.draw(); radar3.draw(); } if (currentEvent.id == 0) { boxIntro(); } else { ofNoFill(); ofSetColor(COLOR_35); ofRect(0.5,0.5+h-7*GRID_SIZE,w,6*GRID_SIZE); ofRect(0.5+w/2,0.5+h-7*GRID_SIZE,w/2,6*GRID_SIZE); } } ofPopMatrix(); } void RadarContainer::updateDependencyDelays(int delay_) { tline1.setDelay(delay_); tline2.setDelay(delay_-10); int textDelay = -105; int textDelays[7] = {0,-5,-10,-15,-15,0,-5}; for (int i = 0; i < texts.size(); i++) texts[i].setDelay(delay_+textDelay+textDelays[i]); } void RadarContainer::updateDependencyEvents() { tline1.setEvents(events); tline2.setEvents(events); for (int i = 0; i < texts.size(); i++) texts[i].setEvents(events); } void RadarContainer::boxIntro() { int boxdelay = -20; int boxdurw = 40; int boxdurh = 40; // Boxes float boxh = 6*GRID_SIZE; float boxy = 0.5+h-7*GRID_SIZE; float boxw = w/2; float boxx = 0.5; float tempBoxw = easeInOut(getTime()+boxdelay, 0, boxw, boxdurw); float tempBoxh = easeInOut(getTime()+boxdelay-boxdurw/2, 0, boxh, boxdurh); ofNoFill(); ofSetColor(COLOR_35); ofRect(boxx+(w/2-tempBoxw), boxy+(boxh-tempBoxh)/2, tempBoxw, tempBoxh); ofRect(boxx+w/2, boxy+(boxh-tempBoxh)/2, tempBoxw, tempBoxh); }
5376960fb06c1399d1625c2b3836015487bd76d6
b6f8ab17bfec259eb81054eb6f9c5566ceb7f6a7
/Libraries/rsa/xlutil_hex.h
a982485995a77b74679eae4cf5c7b0764cce3ceb
[]
no_license
lhp3851/FFMpeg_iOS_Jerry
009ccb184e3af5cd2b3f3a1c5e92b74aacc43f1a
fa4eb83abbe695aa9e3c17bba2cd2d16e6062a5d
refs/heads/master
2020-03-07T09:48:43.665829
2019-05-14T08:17:02
2019-05-14T08:17:02
127,416,358
0
0
null
null
null
null
UTF-8
C++
false
false
465
h
xlutil_hex.h
// // hex_util.h // xlcommon // // Created by liujincai on 14-4-8. // Copyright (c) 2014年 xunlei. All rights reserved. // #ifndef xlcommon_hex_util_h #define xlcommon_hex_util_h #include <string> namespace xlcommon { class XlUtilHex{ public: /** 将byte转换成十六进制字符串 */ static std::string convertBytesToHex(unsigned char* data, int len); }; } #endif
5ba1fba612afe4f505e31562301fd28a5057d57b
3b36e19abaf532074d1ff57d3d8c87a037214a73
/curr/common/libs/oqstring.cpp
761232faecf147f5cf6538687072fe83e2ac52f1
[]
no_license
schdorm/openhanse-project
9823d767b5d5921dfddea019adc501c72c361057
89a3241e2d6360b53c7711a9cedce8132604581e
refs/heads/master
2021-01-22T07:03:06.034567
2012-08-13T10:15:39
2012-08-13T10:15:39
5,397,358
1
0
null
null
null
null
UTF-8
C++
false
false
3,410
cpp
oqstring.cpp
/*************************************************************************** * Copyright (C) 2009 - 2010 by Christian Doerffel * * oh.devs@googlemail.com * * * * 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 2 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, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "libs/oqstring.h" #include <QtCore/QSize> #include <QtCore/QPoint> QString removeWithespace(const QString &a_string) { QString string(a_string); string.simplified(); string.remove(" "); return string; } QString removeWithespaceRef(QString &a_string) { a_string.simplified(); a_string.remove(" "); return a_string; } #ifdef USE_SETVALID QString setValid(const QString &a_string) { if(!a_string.isEmpty()) { return a_string; } else return "0"; } QString getFromValid(const QString &a_string) { if(a_string == "0") { return QString(); } else return a_string; } #endif QString StringFromPoint1(const QPoint &a_point) { return QString("Point(" + QString::number(a_point.x()) + "|" + QString::number(a_point.y()) + ")"); } QString StringFromPoint(const QPoint &a_point) { return QString("Point(%1|%2)").arg(a_point.x()).arg(a_point.y()); } QPoint StringToPoint(const QString &a_string) { QString w_string(a_string); removeWithespaceRef(w_string); w_string.remove("Point("); w_string.remove(")"); int c_index = w_string.indexOf("|"); return QPoint(w_string.left(c_index).toInt(), w_string.right(w_string.size() - 1 - c_index).toInt()); } QString StringFromSize(const QSize &a_size) { return QString("Size(%1|%2)").arg(a_size.width()).arg(a_size.height()); } QSize StringToSize(const QString &a_string) { QString w_string(a_string); removeWithespaceRef(w_string); w_string.remove("Size("); w_string.remove(")"); int c_index = w_string.indexOf("|"); return QSize(w_string.left(c_index).toInt(), w_string.right(w_string.size() - 1 - c_index).toInt()); } QString fromBool(bool boolean) { if(boolean) return "true"; else return "false"; } bool toBool(const QString &string) { return (string == "true" || string.toInt() == 1); } bool toBool(const QStringRef stringref) { return (stringref == "true" || stringref.string()->toInt() == 1); }
9dbc3c182e1a72a6845505942e64b531bc254a38
0c2597ede91be97f8a09e6bfbadc1937570d9bc3
/src/main.cpp
cbb378bc6c89cb3aa5cd8d99772e83563be51680
[]
no_license
Cecish/pso-lib-cop
3f40bc230c76a42744c1b51b1e201b3ba9c1485d
6fa0d416ae8ac594a8c78e72b197aa5e3fd97780
refs/heads/main
2023-02-23T13:36:02.474906
2021-01-31T13:22:14
2021-01-31T13:22:14
334,632,105
0
0
null
null
null
null
UTF-8
C++
false
false
5,048
cpp
main.cpp
/*! * \file main.cpp * \author Sebastien Griolet, Cecile Riquart, Matthieu Sauboua-Beneluz * \date 31 mars 2015 * \version 0.1 * \brief Optimisation par essaims particluaires * \remarks aucune */ #include "headers/mpi-bind.h" #include "headers/Essaim.h" #include "headers/EssaimOMP.h" #include "headers/EssaimMPI.h" #include "headers/Objectif.h" #include "headers/ManipFichiers.h" #include <fstream> #include <unistd.h> /*! \namespace std * espace de nommage regroupant la bibliotheque standard C++ */ using namespace std; void affichageVecteur(vector<long double>& vecteur, long double res_obj) { unsigned taille = vecteur.size(); cout<<"---------- Coordonnees du point objectif obtenu -----------"<<endl; for (unsigned i = 1; i <= taille; ++i) { cout<<"X"+to_string(i)<<" : "<<vecteur[i-1]<<endl; } cout<<"---------- Valeur de la meilleure position ----------------"<<endl; cout<<res_obj<<endl; } /** * */ void runEssaimSequentiel() { string nom_fichier = "donneesResultats"; unsigned nb_echantillon_de_test { 1 }; //Execution de l'algoritme nb_echantillon_de_test fois pour pouvoir faire des statistiques derriere unique_ptr<Objectif<long double, 3>> obj_ptr(new Objectif<long double, 3> { }); Objectif<long double, 3>& obj = *obj_ptr; for (unsigned i =1; i <= nb_echantillon_de_test; ++i) { unique_ptr<Essaim<long double,3>> e_ptr(new Essaim<long double,3>(30,obj.getMinEspace(), obj.getMaxEspace(), obj)); Essaim<long double,3>& e = *e_ptr; cout<<"############ Itération n°"<<i<<" ############"<<endl; unique_ptr<vector<long double>> _it_et_eval_stats {e.algoEssaim(obj, 50000)}; vector<long double> &it_et_eval_stats{*_it_et_eval_stats}; affichageVecteur(e.meilleure_postion_e(), obj(e.meilleure_postion_e())); //############ Decommenter pour écrire les résultats dans des fichiers CSV // stockageDonneesDansFichier(it_et_eval_stats, nom_fichier+to_string(i)+".csv"); } } /** * */ void runEssaimParallele() { string nom_fichier = "donneesResultats"; unsigned nb_echantillon_de_test { 1 }; //Execution de l'algoritme nb_echantillon_de_test fois pour pouvoir faire des statistiques derriere unique_ptr<Objectif<long double, 4>> obj_ptr(new Objectif<long double, 4> { }); Objectif<long double, 4>& obj = *obj_ptr; for (unsigned i =1; i <= nb_echantillon_de_test; ++i) { unique_ptr<EssaimOMP<long double,4>> e_ptr(new EssaimOMP<long double,4>(100,obj.getMinEspace(), obj.getMaxEspace(), obj)); EssaimOMP<long double,4>& e = *e_ptr; cout<<"############ Itération n°"<<i<<" ############"<<endl; unique_ptr<vector<long double>> _it_et_eval_stats {e.algoEssaim(obj, 10000)}; vector<long double> &it_et_eval_stats{*_it_et_eval_stats}; affichageVecteur(e.meilleure_postion_e(), obj(e.meilleure_postion_e())); //############ Decommenter pour écrire les résultats dans des fichiers CSV // stockageDonneesDansFichier(it_et_eval_stats, nom_fichier+to_string(i)+".csv"); } } ///** // * // */ void runEssaimParalleleMPI(int argc, char** argv) { string nom_fichier = "donneesResultats"; unique_ptr<Objectif<long double, 3>> obj_ptr(new Objectif<long double, 3> { }); Objectif<long double, 3>& obj = *obj_ptr; MpiBind mpi(argc,argv); if (mpi.getSize() == 1) { unique_ptr<EssaimMPI<long double,3>> e_ptr(new EssaimMPI<long double,3>(30,obj.getMinEspace(), obj.getMaxEspace(), obj)); EssaimMPI<long double,3>& e { *e_ptr}; e.algoEssaim(obj, 50000,0); affichageVecteur(e.meilleure_postion_e(), obj(e.meilleure_postion_e())); } else { if (mpi.getRank() == 0) {//Processeur principal, envoi d'un essaim fraichement intialisé à chaque processeur unique_ptr<vector<vector<long double>>> _all_tests {new vector<vector<long double>>{}}; vector<vector<long double>>& all_vects {*_all_tests}; for (unsigned i = 1 ; i < mpi.getSize() ; ++i) { vector<long double>vect_res {}; mpi.recv(vect_res,i); all_vects.push_back(vect_res); } for (unsigned i = 0 ; i < mpi.getSize() - 1 ; ++i) { cout<<"####################### Résulat processeur n° "<<i+1<<"#######################"<<endl; affichageVecteur(all_vects[i], obj(all_vects[i])); } } else {//Reception, calcul et renvoi // usleep(1000000*((double)mpi.getRank()));//permet d'empêcher les même résultats unique_ptr<EssaimMPI<long double,3>> e_ptr(new EssaimMPI<long double,3>(30,obj.getMinEspace(), obj.getMaxEspace(), obj)); EssaimMPI<long double,3>& e { *e_ptr}; e.algoEssaim(obj, 50000, mpi.getRank());//ON envoi la seed en même temps vector<long double> vect_envoi {e.meilleure_postion_e()}; mpi.send(vect_envoi, 0); } } } /** * * @param * @param * @return */ int main(int argc, char** argv){ try { cout.precision(30);//Changer la précision d'affichage runEssaimSequentiel(); // runEssaimParallele(); // runEssaimParalleleMPI(argc, argv); } catch (std::bad_alloc& ba) { std::cerr << "bad_alloc caught: " << ba.what() << endl; } catch (const char* &e) { std::cerr << "Exception caught: " << e << endl; } return 0; }
4416f304a82a430d5d2687f5637c33649f16ef28
40739e1e1fc9bf9845c43edeef1931d564609133
/src/core/kext/RemapFunc/ForceNumLockOn.hpp
9de5d7e55d52d76eb596e131e14b40d4b637d255
[]
no_license
problame/Karabiner
2dc43413cfb87f1258850e7a78761a49052132de
21b83baf7ac5847f813cfb6f765e5329d9dd0451
refs/heads/master
2020-04-05T23:26:02.708377
2014-09-24T14:29:35
2014-09-24T14:29:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
642
hpp
ForceNumLockOn.hpp
#ifndef FORCENUMLOCKON_HPP #define FORCENUMLOCKON_HPP #include "RemapFuncBase.hpp" namespace org_pqrs_Karabiner { namespace RemapFunc { class ForceNumLockOn : public RemapFuncBase { public: ForceNumLockOn(void) : RemapFuncBase(BRIDGE_REMAPTYPE_FORCENUMLOCKON), index_(0) {} bool remapForceNumLockOn(ListHookedKeyboard::Item* item); // ---------------------------------------- // [0] => DeviceVendor // [1] => DeviceProduct void add(AddDataType datatype, AddValue newval); private: size_t index_; DeviceIdentifier deviceIdentifier_; }; } } #endif
3358bd6f946526ad784590e0cd6047437cd434af
63bb7bb2061b6101669aed07a08e11bc21a84028
/seznam.h
a2b115b19a5d9b2c78f062b3d2f98273611c8921
[]
no_license
jjunior776/seznam
b05ff0d1387306d50c7a6fa04ff1b2186ae90c4d
7686f9262d8a8f6505eae1b438a065c6b4847373
refs/heads/master
2021-01-19T06:35:08.830540
2016-06-15T17:28:27
2016-06-15T17:28:27
61,223,942
0
0
null
null
null
null
UTF-8
C++
false
false
467
h
seznam.h
#ifndef SEZNAM_H #define SEZNAM_H #include "clanek.h" #include "stdlib.h" #include "stdio.h" #include "iostream" using namespace std; class Seznam { public: Seznam(int pocet); Clanek *hlava; Clanek *ocas; int velikost; void vypisSeznam(); void nagenerujData(int maximum); Clanek *n; void clanekNaPozici(int pozice); int hodnotaNaPozici(int pozice); void nastavHodnotuNaPozici(int pozice, int hodnota); }; #endif // SEZNAM_H
314c24e9ba517725cbb04d39e7367f9382dd6881
9ba50135a412fc8edc7831b168a91a70f502f480
/CppGame/src/Vec2.h
1dafc04ef51a9d6b9bea97fcb66ccb03d29722be
[]
no_license
Danielwbolson/CppGame
5850d7f574cbef659944bb225b553b797ad9e459
7417e661b1a05041155894f27d840e38a518eda1
refs/heads/master
2020-08-09T11:29:03.037274
2019-10-13T22:09:52
2019-10-13T22:09:52
214,077,421
0
0
null
null
null
null
UTF-8
C++
false
false
736
h
Vec2.h
#ifndef VEC_2_H_ #define VEC_2_H_ #define _USE_MATH_DEFINES #include <math.h> class Vec2 { public: Vec2(); Vec2(float x, float y); ~Vec2(); float x, y; // Operators Vec2 operator+(const Vec2&) const; Vec2 operator-(const Vec2&) const; Vec2 operator+=(const Vec2&); Vec2 operator-=(const Vec2&); Vec2 operator*(const float) const; Vec2 operator*(const int) const; Vec2 operator*(const Vec2&) const; Vec2 operator/(const float) const; Vec2 operator-() const; Vec2 operator=(const Vec2&); // Vector functions float Length() const; double Distance(const Vec2&) const; }; Vec2 operator*(const int, const Vec2&); Vec2 operator*(const float, const Vec2&); #endif
54a0c47ab7f70d1709ca051098aea458c080c111
d14bcd4679f0ffa43df5267a82544f098095f1d1
/inst/include/base/base.hpp
2f4c79db848f06c085acc9bb08594900a1db0816
[]
no_license
anhnguyendepocen/SMRD
9e52aa72a5abe5274f9a8546475639d11f058c0d
c54fa017afca7f20255291c6363194673bc2435a
refs/heads/master
2022-12-15T12:29:11.165234
2020-09-10T13:23:59
2020-09-10T13:23:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
195
hpp
base.hpp
#ifndef smrd_base_H #define smrd_base_H #include <Rcpp.h> #include <base/globals.hpp> #include <base/constants.hpp> using namespace constants; using namespace Rcpp; using namespace debug; #endif
cd4b9e32113b91596753fc2ed6cea70c46d220db
dd52ec42a528dfe3f8e42cea014ef4a79c18dcab
/Codechef/MAY18/MTYFRI.cpp
61620ee2d79bccb418775ffda2d8d75113b11031
[]
no_license
sKAR04/CP-Practice
abdc16c5348ec582307580b9f43c10d94079f4ef
6655b6e9d40b970224fad982d8602e9f57e87133
refs/heads/master
2021-04-15T14:31:53.471126
2019-05-21T08:39:04
2019-05-21T08:39:04
126,747,690
0
0
null
null
null
null
UTF-8
C++
false
false
1,827
cpp
MTYFRI.cpp
//Strike me down and I shall become stronger, than you can possibly imagine #include <bits/stdc++.h> using namespace std; //save time #define endl '\n' typedef long long ll; //for sorting #define all(a) a.begin(),a.end() //Constants #define PI 3.141592653593 #define MOD 1000000007LL #define EPS 0.000000001 //loops #define REP(i,n) for(ll i=0;i<(n);++i) #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define DFOR(i,a,b) for(ll i=(a);i>=(b);--i) //vectors #define vi vector<int> #define vll vector<ll> #define vii vector<pair<int,int> > #define pb push_back #define pf push_front //pairs #define pi pair<int,int> #define pll pair<ll,ll> #define mp make_pair #define F first #define S second //general #define E empty() //Variables and Functions required inline void solve(){ int n,k; cin>>n>>k; priority_queue<int> s0; priority_queue<int,vi,greater<int> > s1; REP(i,n){ int temp; cin>>temp; if(i & 1) s1.push(temp); else s0.push(temp); } if(n==1) cout<<"NO"<<endl; else{ REP(i,k){ int foo=s0.top(),bar=s1.top(); if(foo<=bar) break; else{ s0.pop(); s1.pop(); s0.push(bar); s1.push(foo); } } int sum0=0,sum1=0; while(!s0.E){ sum0+=s0.top(); s0.pop(); } while(!s1.E){ sum1+=s1.top(); s1.pop(); } if(sum1>sum0) cout<<"YES"<<endl; else cout<<"NO"<<endl; } } //Main function int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--) solve(); return 0; }
27072cad5c6685881677a3d3fd6ef1f7cbd82ccc
5a77b5092acf817ac37a5fafd006feea434dd0d6
/Doxygen_Graphviz/DesignPatternExample/大話/cpp/interpreter/PlayContext.h
604ac794e30a664ecff15f2d08b58063770dcf02
[]
no_license
shihyu/MyTool
dfc94f507b848fb112483a635ef95e6a196c1969
3bfd1667ad86b3db63d82424cb4fa447cbe515af
refs/heads/master
2023-05-27T19:09:10.538570
2023-05-17T15:58:18
2023-05-17T15:58:18
14,722,815
33
21
null
null
null
null
UTF-8
C++
false
false
246
h
PlayContext.h
#pragma once #include <string> namespace interpreter { class PlayContext { private: std::string context; public: virtual std::string getContext(); virtual void setContext(std::string context); }; }
e9d5b390239e7af1d8b9ab655eb79bfcdc1490ca
08495614d81553d247b780ffd70a742f269e31d4
/release/data/unigine_project/unigine_project.cpp
5b1fbb1fd353df23376325a297f7c676a4feaee2
[]
no_license
lubansoft-developer-platform/MotorDesktopGraphicsEngine
b31ba7b285237b94393d9ecb9ea75ada0d3bc0d2
f4855aff461244cff7689138bd222ba91af27909
refs/heads/master
2022-05-21T08:40:38.458194
2020-04-27T07:10:46
2020-04-27T07:10:46
185,173,044
11
13
null
2019-05-30T03:27:48
2019-05-06T10:15:04
QML
UTF-8
C++
false
false
1,497
cpp
unigine_project.cpp
#include <core/unigine.h> #include <weather/scripts/weather.h> // This file is in UnigineScript language. // World script, it takes effect only when the world is loaded. int init() { // Write here code to be called on world initialization: initialize resources for your world scene during the world start. Player player = new PlayerSpectator(); player.setPosition(Vec3(0.0f,-3.401f,1.5f)); player.setDirection(Vec3(0.0f,1.0f,-0.4f)); engine.game.setPlayer(player); InitWeather(); return 1; } // start of the main loop int update() { // Write here code to be called before updating each render frame: specify all graphics-related functions you want to be called every frame while your application executes. return 1; } int render() { // The engine calls this function before rendering each render frame: correct behavior after the state of the node has been updated. return 1; } int flush() { // Write here code to be called before updating each physics frame: control physics in your application and put non-rendering calculations. // The engine calls flush() with the fixed rate (60 times per second by default) regardless of the FPS value. // WARNING: do not create, delete or change transformations of nodes here, because rendering is already in progress. return 1; } // end of the main loop int shutdown() { // Write here code to be called on world shutdown: delete resources that were created during world script execution to avoid memory leaks. return 1; }
fbf8d3e1af21b6cee301b472ae4e25429462e98f
ea34c76a8434e34615b5e145db83382754b584ae
/Project 17/include/WoodyListener.h
9b84388f8daada6d4b2a7a9ab859e50bf1953269
[]
no_license
xDusk/lostisland04
bd4f35da19b8a83dda3bae4f6d9460279964d25a
c5fe1d75d3772064fdace43d36f9ce530e715041
refs/heads/master
2020-05-29T11:10:57.376119
2012-06-23T16:26:47
2012-06-23T16:26:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
39,325
h
WoodyListener.h
/* #pragma once // General includes // ---------------------------------------------------------------- #include <windows.h> #include <Tchar.h.> #include <mmsystem.h> #include <d3d9.h> #include <d3dx9.h> #include "assert.h" #include "stdio.h" #include <Ogre.h> #include "SharedData.h" // Woody include // ---------------------------------------------------------------- #include "F:\Woody3D Evaluation (64-bit) 1.1.1\c++\woody3d_evaluate_c++\woody3d_evaluate\source\woody3d_evaluate.h" using namespace Ogre; using namespace mySharedData; #define SAFE_RELEASE(p) if( p){ (p)->Release(); (p)=0;} class WoodyListener : public FrameListener { private: // Camera and light Camera* camera; // D3DXVECTOR3 light_0_vector; Vector3 light_0_vector; // D3DXVECTOR3 light_0_color; ColourValue light_0_color; // D3DXVECTOR3 ambient_color; ColourValue ambient_color; // Woody objects wd_tree_object woody_tree; wd_directional_wind_emitter wind_emitter; wd_beaufort_scale_level_s wind_scale_array[3]; wd_real_32 tree_lod; wd_real_32 tree_y_rotation; // Textures, vertex buffers, and shaders IDirect3DTexture9* branch_texture; IDirect3DTexture9* branch_normal_texture; IDirect3DTexture9* imposter_branch_texture; IDirect3DTexture9* imposter_branch_normal_texture; IDirect3DTexture9* leaf_texture; IDirect3DTexture9* leaf_normal_texture; IDirect3DVertexBuffer9* branch_vertex_buffer; IDirect3DIndexBuffer9* branch_index_buffer; IDirect3DVertexBuffer9* imposter_branch_vertex_buffer; IDirect3DIndexBuffer9* imposter_branch_index_buffer; IDirect3DVertexBuffer9* leaf_vertex_buffer; IDirect3DIndexBuffer9* leaf_index_buffer; IDirect3DVertexDeclaration9* branch_vertex_declaration; IDirect3DVertexDeclaration9* leaf_vertex_declaration; IDirect3DVertexShader9* branch_vertex_shader; ID3DXConstantTable* branch_vertex_shader_constant_table; IDirect3DVertexShader9* leaf_vertex_shader; ID3DXConstantTable* leaf_vertex_shader_constant_table; IDirect3DPixelShader9* tree_pixel_shader; ID3DXConstantTable* tree_pixel_shader_constant_table; // Timer unsigned int elapsed_time_ms; //ogre vars MaterialPtr *treeMaterial; public: WoodyListener(Camera *cam) { camera = cam; // initialize_resources(); load_tree_mesh((wchar_t*)("E:\my project\Project\LI\Media\woodymedia\trees")); // Create tree geometry buffers create_tree_geometry_buffers(); // Seed wind emitter wind_emitter.seed(timeGetTime()); // Set wind emitter scale levels wind_scale_array[0].level = 2; wind_scale_array[0].weight = 0.8f; wind_scale_array[0].duration_min_in_ms = 2500; wind_scale_array[0].duration_max_in_ms = 4500; wind_scale_array[1].level = 3; wind_scale_array[1].weight = 0.8f; wind_scale_array[1].duration_min_in_ms = 2500; wind_scale_array[1].duration_max_in_ms = 4500; wind_scale_array[2].level = 4; wind_scale_array[2].weight = 0.4f; wind_scale_array[2].duration_min_in_ms = 1000; wind_scale_array[2].duration_max_in_ms = 2000; wind_emitter.set_wind_scale_levels(wind_scale_array, 3); // Set wind direction wind_emitter.set_wind_direction(wd_vector2(-1.0f, 0.0f), wd_degree_to_radian(1.0f)); } ~WoodyListener() { } bool frameStarted(const FrameEvent& evt) { // Local data unsigned int now_time_ms; static unsigned int s_last_time_ms = timeGetTime(); wd_real_32 wind_strength; wd_vector3 wd_camera_position, tree_position, tree_rotation, tree_scaling, wind_direction; unsigned int buffer_size; void* data_pointer; D3DXVECTOR3 sprite_center, sprite_position; // ----------------- // Get current time now_time_ms = timeGetTime(); // Store elapsed time elapsed_time_ms = now_time_ms - s_last_time_ms; // Store last time s_last_time_ms = now_time_ms; // Update the wind emitter with elapsed time wind_emitter.update(elapsed_time_ms); // Get current wind strength wind_strength = wind_emitter.get_wind_intensity(); // Get current wind direction wind_emitter.get_wind_direction(wind_direction); // Set orientation of tree to vectors tree_position = wd_vector3(0.0f, 0.0f, 0.0f); tree_rotation = wd_vector3(0.0f, tree_y_rotation, 0.0f); tree_scaling = wd_vector3(1.0f, 1.0f, 1.0f); // Set the wind data to the tree woody_tree.update_wind(elapsed_time_ms, tree_rotation, wind_direction, wind_strength); // Render tree // Shader animation and rendering // render_tree_using_gpu_animation(); return TRUE; } // Resource functions // ---------------------------------------------------------------- // Create resources and objects void initialize_resources() { / * // Local data ID3DXBuffer *shader_code; ID3DXBuffer *compile_errors; DWORD shader_flags; shader_code = 0; shader_flags = 0; compile_errors = 0; // Compile the branch vertex shader if( FAILED( D3DXCompileShaderFromFile(_T("..\\shared\\shaders\\woody3d_evaluate_branch.vs.hlsl"), 0, 0, "main", "vs_2_0", shader_flags, &shader_code, &compile_errors, &branch_vertex_shader_constant_table))) { if(compile_errors) { LPVOID error_pointer = compile_errors->GetBufferPointer(); MessageBoxA( 0, (const char*)error_pointer, "Vertex Shader Compile Error", MB_OK|MB_ICONEXCLAMATION); } else { MessageBoxA( 0, _T("Vertex Shader Compile Error"), _T("In function initialize_resources(): Failed to load woody_branch.vs.hlsl.")); } } // Create the branch vertex shader if( FAILED(d3d_device_pointer->CreateVertexShader((DWORD*)shader_code->GetBufferPointer(), &branch_vertex_shader))) { MessageBoxA( 0, _T("Failed to create branch vertex shader."), _T("Unexpected Error"), MB_OK|MB_ICONEXCLAMATION); } // Release code buffer SAFE_RELEASE( shader_code); // Compile the leaf vertex shader if( FAILED(D3DXCompileShaderFromFile(_T("..\\shared\\shaders\\woody3d_evaluate_leaf.vs.hlsl"), 0, 0, "main", "vs_2_0", shader_flags, &shader_code, &compile_errors, &leaf_vertex_shader_constant_table))) { if( compile_errors) { LPVOID error_pointer = compile_errors->GetBufferPointer(); MessageBoxA( 0, (const char*)error_pointer, "Vertex Shader Compile Error", MB_OK|MB_ICONEXCLAMATION); } else { MessageBoxA( 0,_T("Vertex Shader Compile Error"), _T("In function initialize_resources(): Failed to load woody_leaf.vs.hlsl.")); } } // Create the leaf vertex shader if( FAILED(d3d_device_pointer->CreateVertexShader((DWORD*)shader_code->GetBufferPointer(), &leaf_vertex_shader))) { MessageBoxA( 0, _T("Failed to create leaf vertex shader."), _T("Unexpected Error"), MB_OK|MB_ICONEXCLAMATION); } // Release code buffer SAFE_RELEASE(shader_code); // Compile the tree pixel shader if( FAILED( D3DXCompileShaderFromFile(_T("..\\shared\\shaders\\woody3d_evaluate.ps.hlsl"), 0, 0, "main", "ps_2_0", shader_flags, &shader_code, &compile_errors, &tree_pixel_shader_constant_table))) { if( compile_errors) { LPVOID error_pointer = compile_errors->GetBufferPointer(); MessageBoxA( 0, (const char*)error_pointer, "Pixel Shader Compile Error", MB_OK|MB_ICONEXCLAMATION); } else { MessageBoxA( 0, _T("Vertex Shader Compile Error"), _T("In function initialize_resources(): Failed to load woody.ps.hlsl.")); } return FALSE; } // Create the tree pixel shader if(FAILED(d3d_device_pointer->CreatePixelShader((DWORD*)shader_code->GetBufferPointer(), &tree_pixel_shader))) { MessageBoxA( 0, _T("Failed to create tree pixel shader."), _T("Unexpected Error"), MB_OK|MB_ICONEXCLAMATION); } // Release code buffer SAFE_RELEASE(shader_code); * / } // Free resources and objects void free_resources() { SAFE_RELEASE(branch_vertex_shader); SAFE_RELEASE(branch_vertex_shader_constant_table); SAFE_RELEASE(leaf_vertex_shader); SAFE_RELEASE(leaf_vertex_shader_constant_table); SAFE_RELEASE(tree_pixel_shader); SAFE_RELEASE(tree_pixel_shader_constant_table); } // Tree creation functions // ---------------------------------------------------------------- // Loads a Woody3D tree mesh from file void load_tree_mesh(const wchar_t* filepath) { // Local data wd_tree_material_s material; // Shader animation vertex element descriptors // The branch vertex descriptor is used on both standard branches and imposter branches wd_ved shader_branch_ved[] = { wd_ved(WD_VED_POSITION, 3), // Vertex position - 3 floats wd_ved(WD_VED_COLOR_ARGB, 1), // Vertex color - 1 float wd_ved(WD_VED_TEXCOORD, 2), // Vertex UV - 2 floats wd_ved(WD_VED_NORMAL, 3), // Vertex Normal - 3 floats wd_ved(WD_VED_TANGENT, 4), // Vertex Tangent - 4 floats wd_ved(WD_VED_FWOR, 4) // Vertex FWOR vector - 4 floats (BRANCH FLEXIBILITY, BRANCH OSCILLATION WEIGHT, BRANCH OSCILLATION PHASE OFFSET, BRANCH OSCILLATION RANGE) }; wd_ved shader_leaf_ved[] = { wd_ved(WD_VED_POSITION, 3), // Vertex position - 3 floats wd_ved(WD_VED_COLOR_ARGB, 1), // Vertex color - 1 float wd_ved(WD_VED_TEXCOORD, 2), // Vertex UV - 2 floats wd_ved(WD_VED_LLOD, 1), // Vertex LLOD - 1 float (LEAF LOD) wd_ved(WD_VED_FWOR, 4), // Vertex FWOR vector - 4 floats (BRANCH FLEXIBILITY, BRANCH OSCILLATION WEIGHT, BRANCH OSCILLATION PHASE OFFSET, BRANCH OSCILLATION RANGE) wd_ved(WD_VED_XYOR, 4), // Vertex XYOR vector - 4 floats (LEAF XY OFFSET, LEAF OSCILLATION PHASE OFFSET, LEAF ROTATION OSCILLATION RANGE) wd_ved(WD_VED_CUVA, 4) // Vertex CUVA vector - 4 floats (LEAF ANIMATION COLUMN COUNT, LEAF ANIMATION UV FRAME SIZE, LEAF ANIMATION FRAME COUNT) }; // Free old tree woody_tree.free(); // Load the mesh file for shader animation if(!woody_tree.load_mesh_from_file(0, (wd_uint_16*)filepath, TRUE, // Create tree directory shader_branch_ved, 6, // Branch ved shader_branch_ved, 6, // Imposter branch ved shader_leaf_ved, 7, // Leaf ved WD_TEXSPACE_DIRECT3D, // Texture space origin FALSE, // Is create local animation (software animation) material)) // Tree material OUT { MessageBoxA(0, _T("Load Tree Mesh Failed"), _T("In function load_tree_mesh(): Failed to load Woody3D tree mesh from file."), 0); } // Create textures from the returned material if(!create_tree_material_textures(material)) { MessageBoxA(0, _T("Load Tree Material Failed"), _T("In function create_tree_material_textures(): Failed to create Woody3D tree material."), 0); } } // Create textures from the tree material struct BOOL create_tree_material_textures(const wd_tree_material_s &material) { / * // Local data wchar_t texture_filepath[MAX_PATH], map_relative_path[MAX_PATH]; const wchar_t* filename_pointer; // Free all old textures free_tree_material_textures(); // Load branch texture if( strlen( material.branch_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.branch_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf( texture_filepath, _T("..\\trees\\%s"), filename_pointer); // Load texture if(FAILED(D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &branch_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load branch texture from file.")); return FALSE; } // Load branch normal texture if( strlen(material.branch_normal_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.branch_normal_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf(texture_filepath, _T("..\\shared\\trees\\%s"), filename_pointer); // Load texture if(FAILED(D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &branch_normal_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load branch normal texture from file.")); return FALSE; } } } // Load imposter branch texture if( strlen(material.imposter_branch_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.imposter_branch_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf( texture_filepath, _T("..\\%s"), filename_pointer); // Load texture if( FAILED( D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &imposter_branch_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load imposter branch texture from file.")); return FALSE; } // Load branch normal texture if( strlen( material.imposter_branch_normal_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.imposter_branch_normal_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf( texture_filepath, _T("..\\trees\\%s"), filename_pointer); // Load texture if( FAILED(D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &imposter_branch_normal_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load imposter branch normal texture from file.")); return FALSE; } } } // Load leaf texture if( strlen( material.leaf_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.leaf_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf( texture_filepath, _T("..\\trees\\%s"), filename_pointer); // Load texture if( FAILED(D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &leaf_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load leaf texture from file.")); return FALSE; } // Load leaf normal texture if(strlen(material.leaf_normal_map_path_utf_8) > 0) { // Convert map relative path from UTF-8 to UTF-16 MultiByteToWideChar(CP_UTF8, 0, material.leaf_normal_map_path_utf_8, -1, map_relative_path, MAX_PATH); // Extract filename from material relative path name filename_pointer = wcsrchr(map_relative_path, _T('\\')) + 1; // Create filepath based on where texture is stored relative to application wsprintf(texture_filepath, _T("..\\shared\\trees\\%s"), filename_pointer); // Load texture if(FAILED(D3DXCreateTextureFromFileEx(d3d_device_pointer, texture_filepath, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, 0, &leaf_normal_texture))) { MessageBoxA( 0, _T("Load Texture Failed"), _T("In function create_tree_material_textures(): Failed to load leaf normal texture from file.")); return FALSE; } } } * / return TRUE; } // Release tree material textures void free_tree_material_textures() { SAFE_RELEASE(branch_texture); SAFE_RELEASE(branch_normal_texture); SAFE_RELEASE(imposter_branch_texture); SAFE_RELEASE(imposter_branch_normal_texture); SAFE_RELEASE(leaf_texture); SAFE_RELEASE(leaf_normal_texture); } // Create geometry buffers for tree rendering BOOL create_tree_geometry_buffers() { / * // Local data unsigned int buffer_size; void* data_pointer; // Free old geometry buffers free_tree_geometry_buffers(); // Create vertex descriptors for D3D // Shader animation // Branch vertex D3DVERTEXELEMENT9 branch_vd[] = { // Stream Offset Type Method Usage Usage Index { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, { 0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, 24, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 }, { 0, 36, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, // TANGENT { 0, 52, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, // FWOR D3DDECL_END() }; // Leaf vertex D3DVERTEXELEMENT9 leaf_vd[] = { // Stream Offset Type Method Usage Usage Index { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, { 0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, { 0, 16, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, 24, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, // LLOD { 0, 28, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 }, // FWOR { 0, 44, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 3 }, // XYOR { 0, 60, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 4 }, // CUVA D3DDECL_END() }; // Create branch vertex declaration if( FAILED(d3d_device_pointer->CreateVertexDeclaration(branch_vd, &branch_vertex_declaration))) { MessageBoxA( 0, _T("Create Vertex Declaration Failed"), _T("In function create_tree_geometry_buffers(): Failed to create branch vertex declaration.")); return FALSE; } // Create leaf vertex declaration if(FAILED(d3d_device_pointer->CreateVertexDeclaration(leaf_vd, &leaf_vertex_declaration))) { MessageBoxA( 0, _T("Create Vertex Declaration Failed"), _T("In function create_tree_geometry_buffers(): Failed to create leaf vertex declaration.")); return FALSE; } // Set lod of tree to 1.0f to ensure buffers are large enough woody_tree.set_lod(1.0f); // Create branch geometry buffers buffer_size = woody_tree.get_branch_vertex_count() * (woody_tree.get_branch_vertex_stride() * sizeof(wd_real_32)); if( FAILED(d3d_device_pointer->CreateVertexBuffer(buffer_size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &branch_vertex_buffer, 0))) { MessageBoxA( 0, _T("Create Vertex Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create branch vertex buffer.")); return FALSE; } buffer_size = woody_tree.get_branch_index_count() * sizeof(wd_uint_16); if(FAILED(d3d_device_pointer->CreateIndexBuffer(buffer_size, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &branch_index_buffer, 0))) { MessageBoxA( 0, _T("Create Index Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create branch index buffer.")); return FALSE; } // Create imposter branch geometry buffers if( woody_tree.get_imposter_branch_vertex_count() > 0) { buffer_size = woody_tree.get_imposter_branch_vertex_count() * (woody_tree.get_imposter_branch_vertex_stride() * sizeof(wd_real_32)); if( FAILED(d3d_device_pointer->CreateVertexBuffer(buffer_size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &imposter_branch_vertex_buffer, 0))) { MessageBoxA( 0, _T("Create Vertex Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create imposter branch vertex buffer.")); return FALSE; } buffer_size = woody_tree.get_imposter_branch_index_count() * sizeof(wd_uint_16); if( FAILED(d3d_device_pointer->CreateIndexBuffer(buffer_size, D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &imposter_branch_index_buffer, 0))) { MessageBoxA( 0, _T("Create Index Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create imposter branch index buffer.")); return FALSE; } } // Create leaf geometry buffers if( woody_tree.get_leaf_vertex_count() > 0) { buffer_size = woody_tree.get_leaf_vertex_count() * (woody_tree.get_leaf_vertex_stride() * sizeof(wd_real_32)); if(FAILED(d3d_device_pointer->CreateVertexBuffer(buffer_size, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &leaf_vertex_buffer, 0))) { MessageBoxA( 0, _T("Create Vertex Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create leaf vertex buffer.")); return FALSE; } buffer_size = woody_tree.get_leaf_index_count() * sizeof(wd_uint_16); if(FAILED(d3d_device_pointer->CreateIndexBuffer(buffer_size, D3DUSAGE_WRITEONLY | D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &leaf_index_buffer, 0))) { MessageBoxA( 0, _T("Create Index Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to create leaf index buffer.")); return FALSE; } } // Copy tbe tree geometry into the buffers // Branch vertex buffer buffer_size = woody_tree.get_branch_vertex_count() * (woody_tree.get_branch_vertex_stride() * sizeof(wd_real_32)); if(FAILED(branch_vertex_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock branch vertex buffer.")); return FALSE; } memcpy(data_pointer, woody_tree.get_branch_vertex_array(), buffer_size); if(FAILED(branch_vertex_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock branch vertex buffer.")); return FALSE; } // Branch index buffer buffer_size = woody_tree.get_branch_index_count() * sizeof(wd_uint_16); if(FAILED(branch_index_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock branch index buffer.")); return FALSE; } memcpy(data_pointer, woody_tree.get_branch_index_array(), buffer_size); if(FAILED(branch_index_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock branch index buffer.")); return FALSE; } // Imposter branch vertex buffer buffer_size = woody_tree.get_imposter_branch_vertex_count() * (woody_tree.get_imposter_branch_vertex_stride() * sizeof(wd_real_32)); if( buffer_size > 0) { if( FAILED(imposter_branch_vertex_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock imposter branch vertex buffer.")); return FALSE; } memcpy( data_pointer, woody_tree.get_imposter_branch_vertex_array(), buffer_size); if( FAILED( imposter_branch_vertex_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock imposter branch vertex buffer.")); return FALSE; } // Imposter branch index buffer buffer_size = woody_tree.get_imposter_branch_index_count() * sizeof(wd_uint_16); if( FAILED( imposter_branch_index_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock imposter branch index buffer.")); return FALSE; } memcpy( data_pointer, woody_tree.get_imposter_branch_index_array(), buffer_size); if( FAILED( imposter_branch_index_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock imposter branch index buffer.")); } } // Leaf vertex buffer buffer_size = woody_tree.get_leaf_vertex_count() * (woody_tree.get_leaf_vertex_stride() * sizeof(wd_real_32)); if( buffer_size > 0) { if( FAILED(leaf_vertex_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock leaf vertex buffer.")); return FALSE; } memcpy( data_pointer, woody_tree.get_leaf_vertex_array(), buffer_size); if( FAILED( leaf_vertex_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock leaf vertex buffer.")); return FALSE; } // Leaf index buffer buffer_size = woody_tree.get_leaf_index_count() * sizeof(wd_uint_16); if(FAILED(leaf_index_buffer->Lock(0, buffer_size, (void**)&data_pointer, 0))) { MessageBoxA( 0, _T("Lock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to lock leaf index buffer.")); return FALSE; } memcpy(data_pointer, woody_tree.get_leaf_index_array(), buffer_size); if(FAILED(leaf_index_buffer->Unlock())) { MessageBoxA( 0, _T("Unlock Buffer Failed"), _T("In function create_tree_geometry_buffers(): Failed to unlock leaf index buffer.")); return FALSE; } } // Set the tree lod to global lod value woody_tree.set_lod(tree_lod); * / return TRUE; } // Release tree geometry buffers void free_tree_geometry_buffers() { SAFE_RELEASE(branch_vertex_buffer); SAFE_RELEASE(branch_index_buffer); SAFE_RELEASE(imposter_branch_vertex_buffer); SAFE_RELEASE(imposter_branch_index_buffer); SAFE_RELEASE(leaf_vertex_buffer); SAFE_RELEASE(leaf_index_buffer); SAFE_RELEASE(branch_vertex_declaration); SAFE_RELEASE(leaf_vertex_declaration); } // Render functions // ---------------------------------------------------------------- // Render tree with shader animation void render_tree_using_gpu_animation() { / * // Local data wd_vector2 ra_vector, leaf_scale_vector; wd_vector3 dul_vector, center_of_leaves; wd_vector4 xzip_vector; wd_vector3 tree_position, tree_rotation, tree_scaling; D3DXMATRIX world_matrix, translation_matrix, rotation_matrix, scale_matrix, view_matrix, projection_matrix, view_projection_matrix, world_view_projection_matrix, world_inverse_transpose_matrix; // Set orientation of tree to vectors tree_position = wd_vector3(0.0f, 0.0f, 0.0f); tree_rotation = wd_vector3(0.0f, tree_y_rotation, 0.0f); tree_scaling = wd_vector3(1.0f, 1.0f, 1.0f); // Get the woody shader constants woody_tree.get_shader_constants(xzip_vector, dul_vector, ra_vector); // -------------- // Create scale matrix D3DXMatrixScaling(&scale_matrix, tree_scaling.x, tree_scaling.y, tree_scaling.z); // Create rotation matrix using Y rotation only D3DXMatrixRotationY(&rotation_matrix, tree_y_rotation); // Create translation matrix D3DXMatrixTranslation(&translation_matrix, tree_position.x, tree_position.y, tree_position.z); // Create world matrix world_matrix = scale_matrix * rotation_matrix * translation_matrix; // Get view and projection matrices d3d_device_pointer->GetTransform( D3DTS_VIEW, &view_matrix); d3d_device_pointer->GetTransform( D3DTS_PROJECTION, &projection_matrix); // Create view projection view_projection_matrix = view_matrix * projection_matrix; // Create world view projection world_view_projection_matrix = world_matrix * view_matrix * projection_matrix; // Create world inverse transpose D3DXMatrixInverse(&world_inverse_transpose_matrix, 0, &world_matrix); D3DXMatrixTranspose(&world_inverse_transpose_matrix, &world_inverse_transpose_matrix); // -------------- // Set branch vertex shader constants branch_vertex_shader_constant_table->SetFloatArray(d3d_device_pointer, "xzip_vector", &xzip_vector.x, 4); branch_vertex_shader_constant_table->SetFloatArray(d3d_device_pointer, "light_vector", &light_0_vector.x, 3); branch_vertex_shader_constant_table->SetMatrix(d3d_device_pointer, "world_view_projection", &world_view_projection_matrix); branch_vertex_shader_constant_table->SetMatrix(d3d_device_pointer, "world_inverse_transpose", &world_inverse_transpose_matrix); branch_vertex_shader_constant_table->SetFloat(d3d_device_pointer, "normal_multiplier", 1.0f); // Set branch vertex shader d3d_device_pointer->SetVertexShader(branch_vertex_shader); // -------------- // Set pixel shader constants tree_pixel_shader_constant_table->SetFloatArray(d3d_device_pointer, "light_color", &light_0_color.x, 3); tree_pixel_shader_constant_table->SetFloatArray(d3d_device_pointer, "ambient_color", &ambient_color.x, 3); // Set the pixel shader d3d_device_pointer->SetPixelShader(tree_pixel_shader); // -------------- // If standard branches if( woody_tree.get_branch_index_count() > 0) { set_pixel_shader_texture("diffuse_sampler", tree_pixel_shader_constant_table, branch_texture); set_pixel_shader_texture("normal_sampler", tree_pixel_shader_constant_table, branch_normal_texture); tree_pixel_shader_constant_table->SetBool(d3d_device_pointer, "is_translucent", FALSE); d3d_device_pointer->SetStreamSource(0, branch_vertex_buffer, 0, woody_tree.get_branch_vertex_stride() * sizeof(wd_real_32)); d3d_device_pointer->SetIndices(branch_index_buffer); d3d_device_pointer->SetVertexDeclaration(branch_vertex_declaration); d3d_device_pointer->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, woody_tree.get_branch_vertex_count(), 0, woody_tree.get_branch_index_count() / 3); } // Enable alpha test d3d_device_pointer->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x00000077); d3d_device_pointer->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER); d3d_device_pointer->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); // If imposter branches if( woody_tree.get_imposter_branch_index_count() > 0) { set_pixel_shader_texture("diffuse_sampler", tree_pixel_shader_constant_table, imposter_branch_texture); set_pixel_shader_texture("normal_sampler", tree_pixel_shader_constant_table, imposter_branch_normal_texture); tree_pixel_shader_constant_table->SetBool(d3d_device_pointer, "is_translucent", FALSE); d3d_device_pointer->SetStreamSource(0, imposter_branch_vertex_buffer, 0, woody_tree.get_imposter_branch_vertex_stride() * sizeof(wd_real_32)); d3d_device_pointer->SetIndices(imposter_branch_index_buffer); d3d_device_pointer->SetVertexDeclaration(branch_vertex_declaration); // Render front faces d3d_device_pointer->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, woody_tree.get_imposter_branch_vertex_count(), 0, woody_tree.get_imposter_branch_index_count() / 3); // Invert normals and render back faces branch_vertex_shader_constant_table->SetFloat(d3d_device_pointer, "normal_multiplier", -1.0f); d3d_device_pointer->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); d3d_device_pointer->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, woody_tree.get_imposter_branch_vertex_count(), 0, woody_tree.get_imposter_branch_index_count() / 3); // Reset culling and branch normals d3d_device_pointer->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW); } // -------------- // Get center of leaves woody_tree.get_center_of_leaves(center_of_leaves); // Create an XY scale vector for leaves leaf_scale_vector = wd_vector2(tree_scaling.x, tree_scaling.y); // Set leaf vertex shader constants leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "ra_vector", &ra_vector.x, 2); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "dul_vector", &dul_vector.x, 3); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "xzip_vector", &xzip_vector.x, 4); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "scale_vector", &leaf_scale_vector.x, 2); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "eye_position", &camera.get_position().x, 3); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "center_of_leaves", &center_of_leaves.x, 3); leaf_vertex_shader_constant_table->SetFloatArray( d3d_device_pointer, "light_vector", &light_0_vector.x, 3); leaf_vertex_shader_constant_table->SetMatrix( d3d_device_pointer, "world_matrix", &world_matrix); leaf_vertex_shader_constant_table->SetMatrix( d3d_device_pointer, "view_projection", &view_projection_matrix); // Set leaf vertex shader d3d_device_pointer->SetVertexShader( leaf_vertex_shader); // -------------- // If leaves if( woody_tree.get_leaf_index_count() > 0) { set_pixel_shader_texture("diffuse_sampler", tree_pixel_shader_constant_table, leaf_texture); set_pixel_shader_texture("normal_sampler", tree_pixel_shader_constant_table, leaf_normal_texture); tree_pixel_shader_constant_table->SetBool(d3d_device_pointer, "is_translucent", TRUE); d3d_device_pointer->SetStreamSource(0, leaf_vertex_buffer, 0, woody_tree.get_leaf_vertex_stride() * sizeof(wd_real_32)); d3d_device_pointer->SetIndices(leaf_index_buffer); d3d_device_pointer->SetVertexDeclaration(leaf_vertex_declaration); d3d_device_pointer->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, woody_tree.get_leaf_vertex_count(), 0, woody_tree.get_leaf_index_count() / 3); } // Clear textures and shaders set_pixel_shader_texture( "diffuse_sampler", tree_pixel_shader_constant_table, 0); set_pixel_shader_texture( "normal_sampler", tree_pixel_shader_constant_table, 0); d3d_device_pointer->SetVertexShader( 0); d3d_device_pointer->SetPixelShader( 0); // Disable alpha test d3d_device_pointer->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE); * / } };*/
92bba6ca7a0a2cbcee3f051c6bd14f1546bd4a4f
2cf314b8237fc6a77b7f1a096f17a679179b0057
/internal/core/src/pb/schema.pb.h
8b2338f1180f0ea07af9803cf7af29827306d37a
[ "Apache-2.0" ]
permissive
milvus-io/milvus
a02d732cf746effec1ea723f9e4d17856843f8a8
0530fd80c91dc5b200606c00214c12bf8dd17cb4
refs/heads/master
2023-09-04T06:28:57.681855
2023-09-04T02:01:04
2023-09-04T02:01:04
208,728,772
23,316
2,917
Apache-2.0
2023-09-14T15:06:12
2019-09-16T06:43:43
Go
UTF-8
C++
false
true
255,294
h
schema.pb.h
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: schema.proto #ifndef GOOGLE_PROTOBUF_INCLUDED_schema_2eproto #define GOOGLE_PROTOBUF_INCLUDED_schema_2eproto #include <limits> #include <string> #include <google/protobuf/port_def.inc> #if PROTOBUF_VERSION < 3021000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif #if 3021004 < PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/port_undef.inc> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/metadata_lite.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> // IWYU pragma: export #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/generated_enum_reflection.h> #include <google/protobuf/unknown_field_set.h> #include "common.pb.h" // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> #define PROTOBUF_INTERNAL_EXPORT_schema_2eproto PROTOBUF_NAMESPACE_OPEN namespace internal { class AnyMetadata; } // namespace internal PROTOBUF_NAMESPACE_CLOSE // Internal implementation detail -- do not use these members. struct TableStruct_schema_2eproto { static const uint32_t offsets[]; }; extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_schema_2eproto; namespace milvus { namespace proto { namespace schema { class ArrayArray; struct ArrayArrayDefaultTypeInternal; extern ArrayArrayDefaultTypeInternal _ArrayArray_default_instance_; class BoolArray; struct BoolArrayDefaultTypeInternal; extern BoolArrayDefaultTypeInternal _BoolArray_default_instance_; class BytesArray; struct BytesArrayDefaultTypeInternal; extern BytesArrayDefaultTypeInternal _BytesArray_default_instance_; class CollectionSchema; struct CollectionSchemaDefaultTypeInternal; extern CollectionSchemaDefaultTypeInternal _CollectionSchema_default_instance_; class DoubleArray; struct DoubleArrayDefaultTypeInternal; extern DoubleArrayDefaultTypeInternal _DoubleArray_default_instance_; class FieldData; struct FieldDataDefaultTypeInternal; extern FieldDataDefaultTypeInternal _FieldData_default_instance_; class FieldSchema; struct FieldSchemaDefaultTypeInternal; extern FieldSchemaDefaultTypeInternal _FieldSchema_default_instance_; class FloatArray; struct FloatArrayDefaultTypeInternal; extern FloatArrayDefaultTypeInternal _FloatArray_default_instance_; class IDs; struct IDsDefaultTypeInternal; extern IDsDefaultTypeInternal _IDs_default_instance_; class IntArray; struct IntArrayDefaultTypeInternal; extern IntArrayDefaultTypeInternal _IntArray_default_instance_; class JSONArray; struct JSONArrayDefaultTypeInternal; extern JSONArrayDefaultTypeInternal _JSONArray_default_instance_; class LongArray; struct LongArrayDefaultTypeInternal; extern LongArrayDefaultTypeInternal _LongArray_default_instance_; class ScalarField; struct ScalarFieldDefaultTypeInternal; extern ScalarFieldDefaultTypeInternal _ScalarField_default_instance_; class SearchResultData; struct SearchResultDataDefaultTypeInternal; extern SearchResultDataDefaultTypeInternal _SearchResultData_default_instance_; class StringArray; struct StringArrayDefaultTypeInternal; extern StringArrayDefaultTypeInternal _StringArray_default_instance_; class ValueField; struct ValueFieldDefaultTypeInternal; extern ValueFieldDefaultTypeInternal _ValueField_default_instance_; class VectorField; struct VectorFieldDefaultTypeInternal; extern VectorFieldDefaultTypeInternal _VectorField_default_instance_; } // namespace schema } // namespace proto } // namespace milvus PROTOBUF_NAMESPACE_OPEN template<> ::milvus::proto::schema::ArrayArray* Arena::CreateMaybeMessage<::milvus::proto::schema::ArrayArray>(Arena*); template<> ::milvus::proto::schema::BoolArray* Arena::CreateMaybeMessage<::milvus::proto::schema::BoolArray>(Arena*); template<> ::milvus::proto::schema::BytesArray* Arena::CreateMaybeMessage<::milvus::proto::schema::BytesArray>(Arena*); template<> ::milvus::proto::schema::CollectionSchema* Arena::CreateMaybeMessage<::milvus::proto::schema::CollectionSchema>(Arena*); template<> ::milvus::proto::schema::DoubleArray* Arena::CreateMaybeMessage<::milvus::proto::schema::DoubleArray>(Arena*); template<> ::milvus::proto::schema::FieldData* Arena::CreateMaybeMessage<::milvus::proto::schema::FieldData>(Arena*); template<> ::milvus::proto::schema::FieldSchema* Arena::CreateMaybeMessage<::milvus::proto::schema::FieldSchema>(Arena*); template<> ::milvus::proto::schema::FloatArray* Arena::CreateMaybeMessage<::milvus::proto::schema::FloatArray>(Arena*); template<> ::milvus::proto::schema::IDs* Arena::CreateMaybeMessage<::milvus::proto::schema::IDs>(Arena*); template<> ::milvus::proto::schema::IntArray* Arena::CreateMaybeMessage<::milvus::proto::schema::IntArray>(Arena*); template<> ::milvus::proto::schema::JSONArray* Arena::CreateMaybeMessage<::milvus::proto::schema::JSONArray>(Arena*); template<> ::milvus::proto::schema::LongArray* Arena::CreateMaybeMessage<::milvus::proto::schema::LongArray>(Arena*); template<> ::milvus::proto::schema::ScalarField* Arena::CreateMaybeMessage<::milvus::proto::schema::ScalarField>(Arena*); template<> ::milvus::proto::schema::SearchResultData* Arena::CreateMaybeMessage<::milvus::proto::schema::SearchResultData>(Arena*); template<> ::milvus::proto::schema::StringArray* Arena::CreateMaybeMessage<::milvus::proto::schema::StringArray>(Arena*); template<> ::milvus::proto::schema::ValueField* Arena::CreateMaybeMessage<::milvus::proto::schema::ValueField>(Arena*); template<> ::milvus::proto::schema::VectorField* Arena::CreateMaybeMessage<::milvus::proto::schema::VectorField>(Arena*); PROTOBUF_NAMESPACE_CLOSE namespace milvus { namespace proto { namespace schema { enum DataType : int { None = 0, Bool = 1, Int8 = 2, Int16 = 3, Int32 = 4, Int64 = 5, Float = 10, Double = 11, String = 20, VarChar = 21, Array = 22, JSON = 23, BinaryVector = 100, FloatVector = 101, Float16Vector = 102, DataType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(), DataType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max() }; bool DataType_IsValid(int value); constexpr DataType DataType_MIN = None; constexpr DataType DataType_MAX = Float16Vector; constexpr int DataType_ARRAYSIZE = DataType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* DataType_descriptor(); template<typename T> inline const std::string& DataType_Name(T enum_t_value) { static_assert(::std::is_same<T, DataType>::value || ::std::is_integral<T>::value, "Incorrect type passed to function DataType_Name."); return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( DataType_descriptor(), enum_t_value); } inline bool DataType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DataType* value) { return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum<DataType>( DataType_descriptor(), name, value); } enum FieldState : int { FieldCreated = 0, FieldCreating = 1, FieldDropping = 2, FieldDropped = 3, FieldState_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(), FieldState_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max() }; bool FieldState_IsValid(int value); constexpr FieldState FieldState_MIN = FieldCreated; constexpr FieldState FieldState_MAX = FieldDropped; constexpr int FieldState_ARRAYSIZE = FieldState_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldState_descriptor(); template<typename T> inline const std::string& FieldState_Name(T enum_t_value) { static_assert(::std::is_same<T, FieldState>::value || ::std::is_integral<T>::value, "Incorrect type passed to function FieldState_Name."); return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( FieldState_descriptor(), enum_t_value); } inline bool FieldState_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FieldState* value) { return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum<FieldState>( FieldState_descriptor(), name, value); } // =================================================================== class FieldSchema final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.FieldSchema) */ { public: inline FieldSchema() : FieldSchema(nullptr) {} ~FieldSchema() override; explicit PROTOBUF_CONSTEXPR FieldSchema(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); FieldSchema(const FieldSchema& from); FieldSchema(FieldSchema&& from) noexcept : FieldSchema() { *this = ::std::move(from); } inline FieldSchema& operator=(const FieldSchema& from) { CopyFrom(from); return *this; } inline FieldSchema& operator=(FieldSchema&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldSchema& default_instance() { return *internal_default_instance(); } static inline const FieldSchema* internal_default_instance() { return reinterpret_cast<const FieldSchema*>( &_FieldSchema_default_instance_); } static constexpr int kIndexInFileMessages = 0; friend void swap(FieldSchema& a, FieldSchema& b) { a.Swap(&b); } inline void Swap(FieldSchema* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(FieldSchema* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- FieldSchema* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FieldSchema>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const FieldSchema& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const FieldSchema& from) { FieldSchema::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FieldSchema* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.FieldSchema"; } protected: explicit FieldSchema(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kTypeParamsFieldNumber = 6, kIndexParamsFieldNumber = 7, kNameFieldNumber = 2, kDescriptionFieldNumber = 4, kDefaultValueFieldNumber = 11, kFieldIDFieldNumber = 1, kDataTypeFieldNumber = 5, kStateFieldNumber = 9, kIsPrimaryKeyFieldNumber = 3, kAutoIDFieldNumber = 8, kIsDynamicFieldNumber = 12, kIsPartitionKeyFieldNumber = 13, kElementTypeFieldNumber = 10, }; // repeated .milvus.proto.common.KeyValuePair type_params = 6; int type_params_size() const; private: int _internal_type_params_size() const; public: void clear_type_params(); ::milvus::proto::common::KeyValuePair* mutable_type_params(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >* mutable_type_params(); private: const ::milvus::proto::common::KeyValuePair& _internal_type_params(int index) const; ::milvus::proto::common::KeyValuePair* _internal_add_type_params(); public: const ::milvus::proto::common::KeyValuePair& type_params(int index) const; ::milvus::proto::common::KeyValuePair* add_type_params(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >& type_params() const; // repeated .milvus.proto.common.KeyValuePair index_params = 7; int index_params_size() const; private: int _internal_index_params_size() const; public: void clear_index_params(); ::milvus::proto::common::KeyValuePair* mutable_index_params(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >* mutable_index_params(); private: const ::milvus::proto::common::KeyValuePair& _internal_index_params(int index) const; ::milvus::proto::common::KeyValuePair* _internal_add_index_params(); public: const ::milvus::proto::common::KeyValuePair& index_params(int index) const; ::milvus::proto::common::KeyValuePair* add_index_params(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >& index_params() const; // string name = 2; void clear_name(); const std::string& name() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: // string description = 4; void clear_description(); const std::string& description() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_description(ArgT0&& arg0, ArgT... args); std::string* mutable_description(); PROTOBUF_NODISCARD std::string* release_description(); void set_allocated_description(std::string* description); private: const std::string& _internal_description() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_description(const std::string& value); std::string* _internal_mutable_description(); public: // .milvus.proto.schema.ValueField default_value = 11; bool has_default_value() const; private: bool _internal_has_default_value() const; public: void clear_default_value(); const ::milvus::proto::schema::ValueField& default_value() const; PROTOBUF_NODISCARD ::milvus::proto::schema::ValueField* release_default_value(); ::milvus::proto::schema::ValueField* mutable_default_value(); void set_allocated_default_value(::milvus::proto::schema::ValueField* default_value); private: const ::milvus::proto::schema::ValueField& _internal_default_value() const; ::milvus::proto::schema::ValueField* _internal_mutable_default_value(); public: void unsafe_arena_set_allocated_default_value( ::milvus::proto::schema::ValueField* default_value); ::milvus::proto::schema::ValueField* unsafe_arena_release_default_value(); // int64 fieldID = 1; void clear_fieldid(); int64_t fieldid() const; void set_fieldid(int64_t value); private: int64_t _internal_fieldid() const; void _internal_set_fieldid(int64_t value); public: // .milvus.proto.schema.DataType data_type = 5; void clear_data_type(); ::milvus::proto::schema::DataType data_type() const; void set_data_type(::milvus::proto::schema::DataType value); private: ::milvus::proto::schema::DataType _internal_data_type() const; void _internal_set_data_type(::milvus::proto::schema::DataType value); public: // .milvus.proto.schema.FieldState state = 9; void clear_state(); ::milvus::proto::schema::FieldState state() const; void set_state(::milvus::proto::schema::FieldState value); private: ::milvus::proto::schema::FieldState _internal_state() const; void _internal_set_state(::milvus::proto::schema::FieldState value); public: // bool is_primary_key = 3; void clear_is_primary_key(); bool is_primary_key() const; void set_is_primary_key(bool value); private: bool _internal_is_primary_key() const; void _internal_set_is_primary_key(bool value); public: // bool autoID = 8; void clear_autoid(); bool autoid() const; void set_autoid(bool value); private: bool _internal_autoid() const; void _internal_set_autoid(bool value); public: // bool is_dynamic = 12; void clear_is_dynamic(); bool is_dynamic() const; void set_is_dynamic(bool value); private: bool _internal_is_dynamic() const; void _internal_set_is_dynamic(bool value); public: // bool is_partition_key = 13; void clear_is_partition_key(); bool is_partition_key() const; void set_is_partition_key(bool value); private: bool _internal_is_partition_key() const; void _internal_set_is_partition_key(bool value); public: // .milvus.proto.schema.DataType element_type = 10; void clear_element_type(); ::milvus::proto::schema::DataType element_type() const; void set_element_type(::milvus::proto::schema::DataType value); private: ::milvus::proto::schema::DataType _internal_element_type() const; void _internal_set_element_type(::milvus::proto::schema::DataType value); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.FieldSchema) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair > type_params_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair > index_params_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr description_; ::milvus::proto::schema::ValueField* default_value_; int64_t fieldid_; int data_type_; int state_; bool is_primary_key_; bool autoid_; bool is_dynamic_; bool is_partition_key_; int element_type_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class CollectionSchema final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.CollectionSchema) */ { public: inline CollectionSchema() : CollectionSchema(nullptr) {} ~CollectionSchema() override; explicit PROTOBUF_CONSTEXPR CollectionSchema(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); CollectionSchema(const CollectionSchema& from); CollectionSchema(CollectionSchema&& from) noexcept : CollectionSchema() { *this = ::std::move(from); } inline CollectionSchema& operator=(const CollectionSchema& from) { CopyFrom(from); return *this; } inline CollectionSchema& operator=(CollectionSchema&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const CollectionSchema& default_instance() { return *internal_default_instance(); } static inline const CollectionSchema* internal_default_instance() { return reinterpret_cast<const CollectionSchema*>( &_CollectionSchema_default_instance_); } static constexpr int kIndexInFileMessages = 1; friend void swap(CollectionSchema& a, CollectionSchema& b) { a.Swap(&b); } inline void Swap(CollectionSchema* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(CollectionSchema* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- CollectionSchema* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<CollectionSchema>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const CollectionSchema& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const CollectionSchema& from) { CollectionSchema::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(CollectionSchema* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.CollectionSchema"; } protected: explicit CollectionSchema(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kFieldsFieldNumber = 4, kNameFieldNumber = 1, kDescriptionFieldNumber = 2, kAutoIDFieldNumber = 3, kEnableDynamicFieldFieldNumber = 5, }; // repeated .milvus.proto.schema.FieldSchema fields = 4; int fields_size() const; private: int _internal_fields_size() const; public: void clear_fields(); ::milvus::proto::schema::FieldSchema* mutable_fields(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldSchema >* mutable_fields(); private: const ::milvus::proto::schema::FieldSchema& _internal_fields(int index) const; ::milvus::proto::schema::FieldSchema* _internal_add_fields(); public: const ::milvus::proto::schema::FieldSchema& fields(int index) const; ::milvus::proto::schema::FieldSchema* add_fields(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldSchema >& fields() const; // string name = 1; void clear_name(); const std::string& name() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); std::string* mutable_name(); PROTOBUF_NODISCARD std::string* release_name(); void set_allocated_name(std::string* name); private: const std::string& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); std::string* _internal_mutable_name(); public: // string description = 2; void clear_description(); const std::string& description() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_description(ArgT0&& arg0, ArgT... args); std::string* mutable_description(); PROTOBUF_NODISCARD std::string* release_description(); void set_allocated_description(std::string* description); private: const std::string& _internal_description() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_description(const std::string& value); std::string* _internal_mutable_description(); public: // bool autoID = 3; void clear_autoid(); bool autoid() const; void set_autoid(bool value); private: bool _internal_autoid() const; void _internal_set_autoid(bool value); public: // bool enable_dynamic_field = 5; void clear_enable_dynamic_field(); bool enable_dynamic_field() const; void set_enable_dynamic_field(bool value); private: bool _internal_enable_dynamic_field() const; void _internal_set_enable_dynamic_field(bool value); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.CollectionSchema) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldSchema > fields_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr description_; bool autoid_; bool enable_dynamic_field_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class BoolArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.BoolArray) */ { public: inline BoolArray() : BoolArray(nullptr) {} ~BoolArray() override; explicit PROTOBUF_CONSTEXPR BoolArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); BoolArray(const BoolArray& from); BoolArray(BoolArray&& from) noexcept : BoolArray() { *this = ::std::move(from); } inline BoolArray& operator=(const BoolArray& from) { CopyFrom(from); return *this; } inline BoolArray& operator=(BoolArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const BoolArray& default_instance() { return *internal_default_instance(); } static inline const BoolArray* internal_default_instance() { return reinterpret_cast<const BoolArray*>( &_BoolArray_default_instance_); } static constexpr int kIndexInFileMessages = 2; friend void swap(BoolArray& a, BoolArray& b) { a.Swap(&b); } inline void Swap(BoolArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(BoolArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- BoolArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<BoolArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const BoolArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const BoolArray& from) { BoolArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(BoolArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.BoolArray"; } protected: explicit BoolArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated bool data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); private: bool _internal_data(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& _internal_data() const; void _internal_add_data(bool value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* _internal_mutable_data(); public: bool data(int index) const; void set_data(int index, bool value); void add_data(bool value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* mutable_data(); // @@protoc_insertion_point(class_scope:milvus.proto.schema.BoolArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool > data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class IntArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.IntArray) */ { public: inline IntArray() : IntArray(nullptr) {} ~IntArray() override; explicit PROTOBUF_CONSTEXPR IntArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); IntArray(const IntArray& from); IntArray(IntArray&& from) noexcept : IntArray() { *this = ::std::move(from); } inline IntArray& operator=(const IntArray& from) { CopyFrom(from); return *this; } inline IntArray& operator=(IntArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const IntArray& default_instance() { return *internal_default_instance(); } static inline const IntArray* internal_default_instance() { return reinterpret_cast<const IntArray*>( &_IntArray_default_instance_); } static constexpr int kIndexInFileMessages = 3; friend void swap(IntArray& a, IntArray& b) { a.Swap(&b); } inline void Swap(IntArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(IntArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- IntArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<IntArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const IntArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const IntArray& from) { IntArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(IntArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.IntArray"; } protected: explicit IntArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated int32 data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); private: int32_t _internal_data(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >& _internal_data() const; void _internal_add_data(int32_t value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >* _internal_mutable_data(); public: int32_t data(int index) const; void set_data(int index, int32_t value); void add_data(int32_t value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >* mutable_data(); // @@protoc_insertion_point(class_scope:milvus.proto.schema.IntArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > data_; mutable std::atomic<int> _data_cached_byte_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class LongArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.LongArray) */ { public: inline LongArray() : LongArray(nullptr) {} ~LongArray() override; explicit PROTOBUF_CONSTEXPR LongArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); LongArray(const LongArray& from); LongArray(LongArray&& from) noexcept : LongArray() { *this = ::std::move(from); } inline LongArray& operator=(const LongArray& from) { CopyFrom(from); return *this; } inline LongArray& operator=(LongArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const LongArray& default_instance() { return *internal_default_instance(); } static inline const LongArray* internal_default_instance() { return reinterpret_cast<const LongArray*>( &_LongArray_default_instance_); } static constexpr int kIndexInFileMessages = 4; friend void swap(LongArray& a, LongArray& b) { a.Swap(&b); } inline void Swap(LongArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(LongArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- LongArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<LongArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const LongArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const LongArray& from) { LongArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(LongArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.LongArray"; } protected: explicit LongArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated int64 data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); private: int64_t _internal_data(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& _internal_data() const; void _internal_add_data(int64_t value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* _internal_mutable_data(); public: int64_t data(int index) const; void set_data(int index, int64_t value); void add_data(int64_t value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* mutable_data(); // @@protoc_insertion_point(class_scope:milvus.proto.schema.LongArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t > data_; mutable std::atomic<int> _data_cached_byte_size_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class FloatArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.FloatArray) */ { public: inline FloatArray() : FloatArray(nullptr) {} ~FloatArray() override; explicit PROTOBUF_CONSTEXPR FloatArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); FloatArray(const FloatArray& from); FloatArray(FloatArray&& from) noexcept : FloatArray() { *this = ::std::move(from); } inline FloatArray& operator=(const FloatArray& from) { CopyFrom(from); return *this; } inline FloatArray& operator=(FloatArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const FloatArray& default_instance() { return *internal_default_instance(); } static inline const FloatArray* internal_default_instance() { return reinterpret_cast<const FloatArray*>( &_FloatArray_default_instance_); } static constexpr int kIndexInFileMessages = 5; friend void swap(FloatArray& a, FloatArray& b) { a.Swap(&b); } inline void Swap(FloatArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(FloatArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- FloatArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FloatArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const FloatArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const FloatArray& from) { FloatArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FloatArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.FloatArray"; } protected: explicit FloatArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated float data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); private: float _internal_data(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& _internal_data() const; void _internal_add_data(float value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* _internal_mutable_data(); public: float data(int index) const; void set_data(int index, float value); void add_data(float value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* mutable_data(); // @@protoc_insertion_point(class_scope:milvus.proto.schema.FloatArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class DoubleArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.DoubleArray) */ { public: inline DoubleArray() : DoubleArray(nullptr) {} ~DoubleArray() override; explicit PROTOBUF_CONSTEXPR DoubleArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); DoubleArray(const DoubleArray& from); DoubleArray(DoubleArray&& from) noexcept : DoubleArray() { *this = ::std::move(from); } inline DoubleArray& operator=(const DoubleArray& from) { CopyFrom(from); return *this; } inline DoubleArray& operator=(DoubleArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const DoubleArray& default_instance() { return *internal_default_instance(); } static inline const DoubleArray* internal_default_instance() { return reinterpret_cast<const DoubleArray*>( &_DoubleArray_default_instance_); } static constexpr int kIndexInFileMessages = 6; friend void swap(DoubleArray& a, DoubleArray& b) { a.Swap(&b); } inline void Swap(DoubleArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(DoubleArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- DoubleArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<DoubleArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const DoubleArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const DoubleArray& from) { DoubleArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(DoubleArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.DoubleArray"; } protected: explicit DoubleArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated double data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); private: double _internal_data(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& _internal_data() const; void _internal_add_data(double value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* _internal_mutable_data(); public: double data(int index) const; void set_data(int index, double value); void add_data(double value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* mutable_data(); // @@protoc_insertion_point(class_scope:milvus.proto.schema.DoubleArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedField< double > data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class BytesArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.BytesArray) */ { public: inline BytesArray() : BytesArray(nullptr) {} ~BytesArray() override; explicit PROTOBUF_CONSTEXPR BytesArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); BytesArray(const BytesArray& from); BytesArray(BytesArray&& from) noexcept : BytesArray() { *this = ::std::move(from); } inline BytesArray& operator=(const BytesArray& from) { CopyFrom(from); return *this; } inline BytesArray& operator=(BytesArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const BytesArray& default_instance() { return *internal_default_instance(); } static inline const BytesArray* internal_default_instance() { return reinterpret_cast<const BytesArray*>( &_BytesArray_default_instance_); } static constexpr int kIndexInFileMessages = 7; friend void swap(BytesArray& a, BytesArray& b) { a.Swap(&b); } inline void Swap(BytesArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(BytesArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- BytesArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<BytesArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const BytesArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const BytesArray& from) { BytesArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(BytesArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.BytesArray"; } protected: explicit BytesArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated bytes data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); const std::string& data(int index) const; std::string* mutable_data(int index); void set_data(int index, const std::string& value); void set_data(int index, std::string&& value); void set_data(int index, const char* value); void set_data(int index, const void* value, size_t size); std::string* add_data(); void add_data(const std::string& value); void add_data(std::string&& value); void add_data(const char* value); void add_data(const void* value, size_t size); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_data(); private: const std::string& _internal_data(int index) const; std::string* _internal_add_data(); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.BytesArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class StringArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.StringArray) */ { public: inline StringArray() : StringArray(nullptr) {} ~StringArray() override; explicit PROTOBUF_CONSTEXPR StringArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); StringArray(const StringArray& from); StringArray(StringArray&& from) noexcept : StringArray() { *this = ::std::move(from); } inline StringArray& operator=(const StringArray& from) { CopyFrom(from); return *this; } inline StringArray& operator=(StringArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const StringArray& default_instance() { return *internal_default_instance(); } static inline const StringArray* internal_default_instance() { return reinterpret_cast<const StringArray*>( &_StringArray_default_instance_); } static constexpr int kIndexInFileMessages = 8; friend void swap(StringArray& a, StringArray& b) { a.Swap(&b); } inline void Swap(StringArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(StringArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- StringArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<StringArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const StringArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const StringArray& from) { StringArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(StringArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.StringArray"; } protected: explicit StringArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated string data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); const std::string& data(int index) const; std::string* mutable_data(int index); void set_data(int index, const std::string& value); void set_data(int index, std::string&& value); void set_data(int index, const char* value); void set_data(int index, const char* value, size_t size); std::string* add_data(); void add_data(const std::string& value); void add_data(std::string&& value); void add_data(const char* value); void add_data(const char* value, size_t size); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_data(); private: const std::string& _internal_data(int index) const; std::string* _internal_add_data(); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.StringArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class ArrayArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.ArrayArray) */ { public: inline ArrayArray() : ArrayArray(nullptr) {} ~ArrayArray() override; explicit PROTOBUF_CONSTEXPR ArrayArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); ArrayArray(const ArrayArray& from); ArrayArray(ArrayArray&& from) noexcept : ArrayArray() { *this = ::std::move(from); } inline ArrayArray& operator=(const ArrayArray& from) { CopyFrom(from); return *this; } inline ArrayArray& operator=(ArrayArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const ArrayArray& default_instance() { return *internal_default_instance(); } static inline const ArrayArray* internal_default_instance() { return reinterpret_cast<const ArrayArray*>( &_ArrayArray_default_instance_); } static constexpr int kIndexInFileMessages = 9; friend void swap(ArrayArray& a, ArrayArray& b) { a.Swap(&b); } inline void Swap(ArrayArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(ArrayArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- ArrayArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ArrayArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const ArrayArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const ArrayArray& from) { ArrayArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ArrayArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.ArrayArray"; } protected: explicit ArrayArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, kElementTypeFieldNumber = 2, }; // repeated .milvus.proto.schema.ScalarField data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); ::milvus::proto::schema::ScalarField* mutable_data(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::ScalarField >* mutable_data(); private: const ::milvus::proto::schema::ScalarField& _internal_data(int index) const; ::milvus::proto::schema::ScalarField* _internal_add_data(); public: const ::milvus::proto::schema::ScalarField& data(int index) const; ::milvus::proto::schema::ScalarField* add_data(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::ScalarField >& data() const; // .milvus.proto.schema.DataType element_type = 2; void clear_element_type(); ::milvus::proto::schema::DataType element_type() const; void set_element_type(::milvus::proto::schema::DataType value); private: ::milvus::proto::schema::DataType _internal_element_type() const; void _internal_set_element_type(::milvus::proto::schema::DataType value); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.ArrayArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::ScalarField > data_; int element_type_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class JSONArray final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.JSONArray) */ { public: inline JSONArray() : JSONArray(nullptr) {} ~JSONArray() override; explicit PROTOBUF_CONSTEXPR JSONArray(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); JSONArray(const JSONArray& from); JSONArray(JSONArray&& from) noexcept : JSONArray() { *this = ::std::move(from); } inline JSONArray& operator=(const JSONArray& from) { CopyFrom(from); return *this; } inline JSONArray& operator=(JSONArray&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const JSONArray& default_instance() { return *internal_default_instance(); } static inline const JSONArray* internal_default_instance() { return reinterpret_cast<const JSONArray*>( &_JSONArray_default_instance_); } static constexpr int kIndexInFileMessages = 10; friend void swap(JSONArray& a, JSONArray& b) { a.Swap(&b); } inline void Swap(JSONArray* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(JSONArray* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- JSONArray* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<JSONArray>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const JSONArray& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const JSONArray& from) { JSONArray::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(JSONArray* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.JSONArray"; } protected: explicit JSONArray(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDataFieldNumber = 1, }; // repeated bytes data = 1; int data_size() const; private: int _internal_data_size() const; public: void clear_data(); const std::string& data(int index) const; std::string* mutable_data(int index); void set_data(int index, const std::string& value); void set_data(int index, std::string&& value); void set_data(int index, const char* value); void set_data(int index, const void* value, size_t size); std::string* add_data(); void add_data(const std::string& value); void add_data(std::string&& value); void add_data(const char* value); void add_data(const void* value, size_t size); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& data() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_data(); private: const std::string& _internal_data(int index) const; std::string* _internal_add_data(); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.JSONArray) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class ValueField final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.ValueField) */ { public: inline ValueField() : ValueField(nullptr) {} ~ValueField() override; explicit PROTOBUF_CONSTEXPR ValueField(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); ValueField(const ValueField& from); ValueField(ValueField&& from) noexcept : ValueField() { *this = ::std::move(from); } inline ValueField& operator=(const ValueField& from) { CopyFrom(from); return *this; } inline ValueField& operator=(ValueField&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const ValueField& default_instance() { return *internal_default_instance(); } enum DataCase { kBoolData = 1, kIntData = 2, kLongData = 3, kFloatData = 4, kDoubleData = 5, kStringData = 6, kBytesData = 7, DATA_NOT_SET = 0, }; static inline const ValueField* internal_default_instance() { return reinterpret_cast<const ValueField*>( &_ValueField_default_instance_); } static constexpr int kIndexInFileMessages = 11; friend void swap(ValueField& a, ValueField& b) { a.Swap(&b); } inline void Swap(ValueField* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(ValueField* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- ValueField* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ValueField>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const ValueField& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const ValueField& from) { ValueField::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ValueField* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.ValueField"; } protected: explicit ValueField(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kBoolDataFieldNumber = 1, kIntDataFieldNumber = 2, kLongDataFieldNumber = 3, kFloatDataFieldNumber = 4, kDoubleDataFieldNumber = 5, kStringDataFieldNumber = 6, kBytesDataFieldNumber = 7, }; // bool bool_data = 1; bool has_bool_data() const; private: bool _internal_has_bool_data() const; public: void clear_bool_data(); bool bool_data() const; void set_bool_data(bool value); private: bool _internal_bool_data() const; void _internal_set_bool_data(bool value); public: // int32 int_data = 2; bool has_int_data() const; private: bool _internal_has_int_data() const; public: void clear_int_data(); int32_t int_data() const; void set_int_data(int32_t value); private: int32_t _internal_int_data() const; void _internal_set_int_data(int32_t value); public: // int64 long_data = 3; bool has_long_data() const; private: bool _internal_has_long_data() const; public: void clear_long_data(); int64_t long_data() const; void set_long_data(int64_t value); private: int64_t _internal_long_data() const; void _internal_set_long_data(int64_t value); public: // float float_data = 4; bool has_float_data() const; private: bool _internal_has_float_data() const; public: void clear_float_data(); float float_data() const; void set_float_data(float value); private: float _internal_float_data() const; void _internal_set_float_data(float value); public: // double double_data = 5; bool has_double_data() const; private: bool _internal_has_double_data() const; public: void clear_double_data(); double double_data() const; void set_double_data(double value); private: double _internal_double_data() const; void _internal_set_double_data(double value); public: // string string_data = 6; bool has_string_data() const; private: bool _internal_has_string_data() const; public: void clear_string_data(); const std::string& string_data() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_string_data(ArgT0&& arg0, ArgT... args); std::string* mutable_string_data(); PROTOBUF_NODISCARD std::string* release_string_data(); void set_allocated_string_data(std::string* string_data); private: const std::string& _internal_string_data() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_data(const std::string& value); std::string* _internal_mutable_string_data(); public: // bytes bytes_data = 7; bool has_bytes_data() const; private: bool _internal_has_bytes_data() const; public: void clear_bytes_data(); const std::string& bytes_data() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_bytes_data(ArgT0&& arg0, ArgT... args); std::string* mutable_bytes_data(); PROTOBUF_NODISCARD std::string* release_bytes_data(); void set_allocated_bytes_data(std::string* bytes_data); private: const std::string& _internal_bytes_data() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_bytes_data(const std::string& value); std::string* _internal_mutable_bytes_data(); public: void clear_data(); DataCase data_case() const; // @@protoc_insertion_point(class_scope:milvus.proto.schema.ValueField) private: class _Internal; void set_has_bool_data(); void set_has_int_data(); void set_has_long_data(); void set_has_float_data(); void set_has_double_data(); void set_has_string_data(); void set_has_bytes_data(); inline bool has_data() const; inline void clear_has_data(); template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { union DataUnion { constexpr DataUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; bool bool_data_; int32_t int_data_; int64_t long_data_; float float_data_; double double_data_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_data_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr bytes_data_; } data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class ScalarField final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.ScalarField) */ { public: inline ScalarField() : ScalarField(nullptr) {} ~ScalarField() override; explicit PROTOBUF_CONSTEXPR ScalarField(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); ScalarField(const ScalarField& from); ScalarField(ScalarField&& from) noexcept : ScalarField() { *this = ::std::move(from); } inline ScalarField& operator=(const ScalarField& from) { CopyFrom(from); return *this; } inline ScalarField& operator=(ScalarField&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const ScalarField& default_instance() { return *internal_default_instance(); } enum DataCase { kBoolData = 1, kIntData = 2, kLongData = 3, kFloatData = 4, kDoubleData = 5, kStringData = 6, kBytesData = 7, kArrayData = 8, kJsonData = 9, DATA_NOT_SET = 0, }; static inline const ScalarField* internal_default_instance() { return reinterpret_cast<const ScalarField*>( &_ScalarField_default_instance_); } static constexpr int kIndexInFileMessages = 12; friend void swap(ScalarField& a, ScalarField& b) { a.Swap(&b); } inline void Swap(ScalarField* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(ScalarField* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- ScalarField* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<ScalarField>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const ScalarField& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const ScalarField& from) { ScalarField::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(ScalarField* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.ScalarField"; } protected: explicit ScalarField(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kBoolDataFieldNumber = 1, kIntDataFieldNumber = 2, kLongDataFieldNumber = 3, kFloatDataFieldNumber = 4, kDoubleDataFieldNumber = 5, kStringDataFieldNumber = 6, kBytesDataFieldNumber = 7, kArrayDataFieldNumber = 8, kJsonDataFieldNumber = 9, }; // .milvus.proto.schema.BoolArray bool_data = 1; bool has_bool_data() const; private: bool _internal_has_bool_data() const; public: void clear_bool_data(); const ::milvus::proto::schema::BoolArray& bool_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::BoolArray* release_bool_data(); ::milvus::proto::schema::BoolArray* mutable_bool_data(); void set_allocated_bool_data(::milvus::proto::schema::BoolArray* bool_data); private: const ::milvus::proto::schema::BoolArray& _internal_bool_data() const; ::milvus::proto::schema::BoolArray* _internal_mutable_bool_data(); public: void unsafe_arena_set_allocated_bool_data( ::milvus::proto::schema::BoolArray* bool_data); ::milvus::proto::schema::BoolArray* unsafe_arena_release_bool_data(); // .milvus.proto.schema.IntArray int_data = 2; bool has_int_data() const; private: bool _internal_has_int_data() const; public: void clear_int_data(); const ::milvus::proto::schema::IntArray& int_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::IntArray* release_int_data(); ::milvus::proto::schema::IntArray* mutable_int_data(); void set_allocated_int_data(::milvus::proto::schema::IntArray* int_data); private: const ::milvus::proto::schema::IntArray& _internal_int_data() const; ::milvus::proto::schema::IntArray* _internal_mutable_int_data(); public: void unsafe_arena_set_allocated_int_data( ::milvus::proto::schema::IntArray* int_data); ::milvus::proto::schema::IntArray* unsafe_arena_release_int_data(); // .milvus.proto.schema.LongArray long_data = 3; bool has_long_data() const; private: bool _internal_has_long_data() const; public: void clear_long_data(); const ::milvus::proto::schema::LongArray& long_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::LongArray* release_long_data(); ::milvus::proto::schema::LongArray* mutable_long_data(); void set_allocated_long_data(::milvus::proto::schema::LongArray* long_data); private: const ::milvus::proto::schema::LongArray& _internal_long_data() const; ::milvus::proto::schema::LongArray* _internal_mutable_long_data(); public: void unsafe_arena_set_allocated_long_data( ::milvus::proto::schema::LongArray* long_data); ::milvus::proto::schema::LongArray* unsafe_arena_release_long_data(); // .milvus.proto.schema.FloatArray float_data = 4; bool has_float_data() const; private: bool _internal_has_float_data() const; public: void clear_float_data(); const ::milvus::proto::schema::FloatArray& float_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::FloatArray* release_float_data(); ::milvus::proto::schema::FloatArray* mutable_float_data(); void set_allocated_float_data(::milvus::proto::schema::FloatArray* float_data); private: const ::milvus::proto::schema::FloatArray& _internal_float_data() const; ::milvus::proto::schema::FloatArray* _internal_mutable_float_data(); public: void unsafe_arena_set_allocated_float_data( ::milvus::proto::schema::FloatArray* float_data); ::milvus::proto::schema::FloatArray* unsafe_arena_release_float_data(); // .milvus.proto.schema.DoubleArray double_data = 5; bool has_double_data() const; private: bool _internal_has_double_data() const; public: void clear_double_data(); const ::milvus::proto::schema::DoubleArray& double_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::DoubleArray* release_double_data(); ::milvus::proto::schema::DoubleArray* mutable_double_data(); void set_allocated_double_data(::milvus::proto::schema::DoubleArray* double_data); private: const ::milvus::proto::schema::DoubleArray& _internal_double_data() const; ::milvus::proto::schema::DoubleArray* _internal_mutable_double_data(); public: void unsafe_arena_set_allocated_double_data( ::milvus::proto::schema::DoubleArray* double_data); ::milvus::proto::schema::DoubleArray* unsafe_arena_release_double_data(); // .milvus.proto.schema.StringArray string_data = 6; bool has_string_data() const; private: bool _internal_has_string_data() const; public: void clear_string_data(); const ::milvus::proto::schema::StringArray& string_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::StringArray* release_string_data(); ::milvus::proto::schema::StringArray* mutable_string_data(); void set_allocated_string_data(::milvus::proto::schema::StringArray* string_data); private: const ::milvus::proto::schema::StringArray& _internal_string_data() const; ::milvus::proto::schema::StringArray* _internal_mutable_string_data(); public: void unsafe_arena_set_allocated_string_data( ::milvus::proto::schema::StringArray* string_data); ::milvus::proto::schema::StringArray* unsafe_arena_release_string_data(); // .milvus.proto.schema.BytesArray bytes_data = 7; bool has_bytes_data() const; private: bool _internal_has_bytes_data() const; public: void clear_bytes_data(); const ::milvus::proto::schema::BytesArray& bytes_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::BytesArray* release_bytes_data(); ::milvus::proto::schema::BytesArray* mutable_bytes_data(); void set_allocated_bytes_data(::milvus::proto::schema::BytesArray* bytes_data); private: const ::milvus::proto::schema::BytesArray& _internal_bytes_data() const; ::milvus::proto::schema::BytesArray* _internal_mutable_bytes_data(); public: void unsafe_arena_set_allocated_bytes_data( ::milvus::proto::schema::BytesArray* bytes_data); ::milvus::proto::schema::BytesArray* unsafe_arena_release_bytes_data(); // .milvus.proto.schema.ArrayArray array_data = 8; bool has_array_data() const; private: bool _internal_has_array_data() const; public: void clear_array_data(); const ::milvus::proto::schema::ArrayArray& array_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::ArrayArray* release_array_data(); ::milvus::proto::schema::ArrayArray* mutable_array_data(); void set_allocated_array_data(::milvus::proto::schema::ArrayArray* array_data); private: const ::milvus::proto::schema::ArrayArray& _internal_array_data() const; ::milvus::proto::schema::ArrayArray* _internal_mutable_array_data(); public: void unsafe_arena_set_allocated_array_data( ::milvus::proto::schema::ArrayArray* array_data); ::milvus::proto::schema::ArrayArray* unsafe_arena_release_array_data(); // .milvus.proto.schema.JSONArray json_data = 9; bool has_json_data() const; private: bool _internal_has_json_data() const; public: void clear_json_data(); const ::milvus::proto::schema::JSONArray& json_data() const; PROTOBUF_NODISCARD ::milvus::proto::schema::JSONArray* release_json_data(); ::milvus::proto::schema::JSONArray* mutable_json_data(); void set_allocated_json_data(::milvus::proto::schema::JSONArray* json_data); private: const ::milvus::proto::schema::JSONArray& _internal_json_data() const; ::milvus::proto::schema::JSONArray* _internal_mutable_json_data(); public: void unsafe_arena_set_allocated_json_data( ::milvus::proto::schema::JSONArray* json_data); ::milvus::proto::schema::JSONArray* unsafe_arena_release_json_data(); void clear_data(); DataCase data_case() const; // @@protoc_insertion_point(class_scope:milvus.proto.schema.ScalarField) private: class _Internal; void set_has_bool_data(); void set_has_int_data(); void set_has_long_data(); void set_has_float_data(); void set_has_double_data(); void set_has_string_data(); void set_has_bytes_data(); void set_has_array_data(); void set_has_json_data(); inline bool has_data() const; inline void clear_has_data(); template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { union DataUnion { constexpr DataUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::milvus::proto::schema::BoolArray* bool_data_; ::milvus::proto::schema::IntArray* int_data_; ::milvus::proto::schema::LongArray* long_data_; ::milvus::proto::schema::FloatArray* float_data_; ::milvus::proto::schema::DoubleArray* double_data_; ::milvus::proto::schema::StringArray* string_data_; ::milvus::proto::schema::BytesArray* bytes_data_; ::milvus::proto::schema::ArrayArray* array_data_; ::milvus::proto::schema::JSONArray* json_data_; } data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class VectorField final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.VectorField) */ { public: inline VectorField() : VectorField(nullptr) {} ~VectorField() override; explicit PROTOBUF_CONSTEXPR VectorField(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); VectorField(const VectorField& from); VectorField(VectorField&& from) noexcept : VectorField() { *this = ::std::move(from); } inline VectorField& operator=(const VectorField& from) { CopyFrom(from); return *this; } inline VectorField& operator=(VectorField&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const VectorField& default_instance() { return *internal_default_instance(); } enum DataCase { kFloatVector = 2, kBinaryVector = 3, kFloat16Vector = 4, DATA_NOT_SET = 0, }; static inline const VectorField* internal_default_instance() { return reinterpret_cast<const VectorField*>( &_VectorField_default_instance_); } static constexpr int kIndexInFileMessages = 13; friend void swap(VectorField& a, VectorField& b) { a.Swap(&b); } inline void Swap(VectorField* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(VectorField* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- VectorField* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<VectorField>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const VectorField& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const VectorField& from) { VectorField::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(VectorField* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.VectorField"; } protected: explicit VectorField(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kDimFieldNumber = 1, kFloatVectorFieldNumber = 2, kBinaryVectorFieldNumber = 3, kFloat16VectorFieldNumber = 4, }; // int64 dim = 1; void clear_dim(); int64_t dim() const; void set_dim(int64_t value); private: int64_t _internal_dim() const; void _internal_set_dim(int64_t value); public: // .milvus.proto.schema.FloatArray float_vector = 2; bool has_float_vector() const; private: bool _internal_has_float_vector() const; public: void clear_float_vector(); const ::milvus::proto::schema::FloatArray& float_vector() const; PROTOBUF_NODISCARD ::milvus::proto::schema::FloatArray* release_float_vector(); ::milvus::proto::schema::FloatArray* mutable_float_vector(); void set_allocated_float_vector(::milvus::proto::schema::FloatArray* float_vector); private: const ::milvus::proto::schema::FloatArray& _internal_float_vector() const; ::milvus::proto::schema::FloatArray* _internal_mutable_float_vector(); public: void unsafe_arena_set_allocated_float_vector( ::milvus::proto::schema::FloatArray* float_vector); ::milvus::proto::schema::FloatArray* unsafe_arena_release_float_vector(); // bytes binary_vector = 3; bool has_binary_vector() const; private: bool _internal_has_binary_vector() const; public: void clear_binary_vector(); const std::string& binary_vector() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_binary_vector(ArgT0&& arg0, ArgT... args); std::string* mutable_binary_vector(); PROTOBUF_NODISCARD std::string* release_binary_vector(); void set_allocated_binary_vector(std::string* binary_vector); private: const std::string& _internal_binary_vector() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_binary_vector(const std::string& value); std::string* _internal_mutable_binary_vector(); public: // bytes float16_vector = 4; bool has_float16_vector() const; private: bool _internal_has_float16_vector() const; public: void clear_float16_vector(); const std::string& float16_vector() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_float16_vector(ArgT0&& arg0, ArgT... args); std::string* mutable_float16_vector(); PROTOBUF_NODISCARD std::string* release_float16_vector(); void set_allocated_float16_vector(std::string* float16_vector); private: const std::string& _internal_float16_vector() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_float16_vector(const std::string& value); std::string* _internal_mutable_float16_vector(); public: void clear_data(); DataCase data_case() const; // @@protoc_insertion_point(class_scope:milvus.proto.schema.VectorField) private: class _Internal; void set_has_float_vector(); void set_has_binary_vector(); void set_has_float16_vector(); inline bool has_data() const; inline void clear_has_data(); template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { int64_t dim_; union DataUnion { constexpr DataUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::milvus::proto::schema::FloatArray* float_vector_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr binary_vector_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr float16_vector_; } data_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class FieldData final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.FieldData) */ { public: inline FieldData() : FieldData(nullptr) {} ~FieldData() override; explicit PROTOBUF_CONSTEXPR FieldData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); FieldData(const FieldData& from); FieldData(FieldData&& from) noexcept : FieldData() { *this = ::std::move(from); } inline FieldData& operator=(const FieldData& from) { CopyFrom(from); return *this; } inline FieldData& operator=(FieldData&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const FieldData& default_instance() { return *internal_default_instance(); } enum FieldCase { kScalars = 3, kVectors = 4, FIELD_NOT_SET = 0, }; static inline const FieldData* internal_default_instance() { return reinterpret_cast<const FieldData*>( &_FieldData_default_instance_); } static constexpr int kIndexInFileMessages = 14; friend void swap(FieldData& a, FieldData& b) { a.Swap(&b); } inline void Swap(FieldData* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(FieldData* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- FieldData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<FieldData>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const FieldData& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const FieldData& from) { FieldData::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(FieldData* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.FieldData"; } protected: explicit FieldData(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kFieldNameFieldNumber = 2, kTypeFieldNumber = 1, kIsDynamicFieldNumber = 6, kFieldIdFieldNumber = 5, kScalarsFieldNumber = 3, kVectorsFieldNumber = 4, }; // string field_name = 2; void clear_field_name(); const std::string& field_name() const; template <typename ArgT0 = const std::string&, typename... ArgT> void set_field_name(ArgT0&& arg0, ArgT... args); std::string* mutable_field_name(); PROTOBUF_NODISCARD std::string* release_field_name(); void set_allocated_field_name(std::string* field_name); private: const std::string& _internal_field_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_field_name(const std::string& value); std::string* _internal_mutable_field_name(); public: // .milvus.proto.schema.DataType type = 1; void clear_type(); ::milvus::proto::schema::DataType type() const; void set_type(::milvus::proto::schema::DataType value); private: ::milvus::proto::schema::DataType _internal_type() const; void _internal_set_type(::milvus::proto::schema::DataType value); public: // bool is_dynamic = 6; void clear_is_dynamic(); bool is_dynamic() const; void set_is_dynamic(bool value); private: bool _internal_is_dynamic() const; void _internal_set_is_dynamic(bool value); public: // int64 field_id = 5; void clear_field_id(); int64_t field_id() const; void set_field_id(int64_t value); private: int64_t _internal_field_id() const; void _internal_set_field_id(int64_t value); public: // .milvus.proto.schema.ScalarField scalars = 3; bool has_scalars() const; private: bool _internal_has_scalars() const; public: void clear_scalars(); const ::milvus::proto::schema::ScalarField& scalars() const; PROTOBUF_NODISCARD ::milvus::proto::schema::ScalarField* release_scalars(); ::milvus::proto::schema::ScalarField* mutable_scalars(); void set_allocated_scalars(::milvus::proto::schema::ScalarField* scalars); private: const ::milvus::proto::schema::ScalarField& _internal_scalars() const; ::milvus::proto::schema::ScalarField* _internal_mutable_scalars(); public: void unsafe_arena_set_allocated_scalars( ::milvus::proto::schema::ScalarField* scalars); ::milvus::proto::schema::ScalarField* unsafe_arena_release_scalars(); // .milvus.proto.schema.VectorField vectors = 4; bool has_vectors() const; private: bool _internal_has_vectors() const; public: void clear_vectors(); const ::milvus::proto::schema::VectorField& vectors() const; PROTOBUF_NODISCARD ::milvus::proto::schema::VectorField* release_vectors(); ::milvus::proto::schema::VectorField* mutable_vectors(); void set_allocated_vectors(::milvus::proto::schema::VectorField* vectors); private: const ::milvus::proto::schema::VectorField& _internal_vectors() const; ::milvus::proto::schema::VectorField* _internal_mutable_vectors(); public: void unsafe_arena_set_allocated_vectors( ::milvus::proto::schema::VectorField* vectors); ::milvus::proto::schema::VectorField* unsafe_arena_release_vectors(); void clear_field(); FieldCase field_case() const; // @@protoc_insertion_point(class_scope:milvus.proto.schema.FieldData) private: class _Internal; void set_has_scalars(); void set_has_vectors(); inline bool has_field() const; inline void clear_has_field(); template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr field_name_; int type_; bool is_dynamic_; int64_t field_id_; union FieldUnion { constexpr FieldUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::milvus::proto::schema::ScalarField* scalars_; ::milvus::proto::schema::VectorField* vectors_; } field_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class IDs final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.IDs) */ { public: inline IDs() : IDs(nullptr) {} ~IDs() override; explicit PROTOBUF_CONSTEXPR IDs(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); IDs(const IDs& from); IDs(IDs&& from) noexcept : IDs() { *this = ::std::move(from); } inline IDs& operator=(const IDs& from) { CopyFrom(from); return *this; } inline IDs& operator=(IDs&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const IDs& default_instance() { return *internal_default_instance(); } enum IdFieldCase { kIntId = 1, kStrId = 2, ID_FIELD_NOT_SET = 0, }; static inline const IDs* internal_default_instance() { return reinterpret_cast<const IDs*>( &_IDs_default_instance_); } static constexpr int kIndexInFileMessages = 15; friend void swap(IDs& a, IDs& b) { a.Swap(&b); } inline void Swap(IDs* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(IDs* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- IDs* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<IDs>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const IDs& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const IDs& from) { IDs::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(IDs* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.IDs"; } protected: explicit IDs(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kIntIdFieldNumber = 1, kStrIdFieldNumber = 2, }; // .milvus.proto.schema.LongArray int_id = 1; bool has_int_id() const; private: bool _internal_has_int_id() const; public: void clear_int_id(); const ::milvus::proto::schema::LongArray& int_id() const; PROTOBUF_NODISCARD ::milvus::proto::schema::LongArray* release_int_id(); ::milvus::proto::schema::LongArray* mutable_int_id(); void set_allocated_int_id(::milvus::proto::schema::LongArray* int_id); private: const ::milvus::proto::schema::LongArray& _internal_int_id() const; ::milvus::proto::schema::LongArray* _internal_mutable_int_id(); public: void unsafe_arena_set_allocated_int_id( ::milvus::proto::schema::LongArray* int_id); ::milvus::proto::schema::LongArray* unsafe_arena_release_int_id(); // .milvus.proto.schema.StringArray str_id = 2; bool has_str_id() const; private: bool _internal_has_str_id() const; public: void clear_str_id(); const ::milvus::proto::schema::StringArray& str_id() const; PROTOBUF_NODISCARD ::milvus::proto::schema::StringArray* release_str_id(); ::milvus::proto::schema::StringArray* mutable_str_id(); void set_allocated_str_id(::milvus::proto::schema::StringArray* str_id); private: const ::milvus::proto::schema::StringArray& _internal_str_id() const; ::milvus::proto::schema::StringArray* _internal_mutable_str_id(); public: void unsafe_arena_set_allocated_str_id( ::milvus::proto::schema::StringArray* str_id); ::milvus::proto::schema::StringArray* unsafe_arena_release_str_id(); void clear_id_field(); IdFieldCase id_field_case() const; // @@protoc_insertion_point(class_scope:milvus.proto.schema.IDs) private: class _Internal; void set_has_int_id(); void set_has_str_id(); inline bool has_id_field() const; inline void clear_has_id_field(); template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { union IdFieldUnion { constexpr IdFieldUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; ::milvus::proto::schema::LongArray* int_id_; ::milvus::proto::schema::StringArray* str_id_; } id_field_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; uint32_t _oneof_case_[1]; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // ------------------------------------------------------------------- class SearchResultData final : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:milvus.proto.schema.SearchResultData) */ { public: inline SearchResultData() : SearchResultData(nullptr) {} ~SearchResultData() override; explicit PROTOBUF_CONSTEXPR SearchResultData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); SearchResultData(const SearchResultData& from); SearchResultData(SearchResultData&& from) noexcept : SearchResultData() { *this = ::std::move(from); } inline SearchResultData& operator=(const SearchResultData& from) { CopyFrom(from); return *this; } inline SearchResultData& operator=(SearchResultData&& from) noexcept { if (this == &from) return *this; if (GetOwningArena() == from.GetOwningArena() #ifdef PROTOBUF_FORCE_COPY_IN_MOVE && GetOwningArena() != nullptr #endif // !PROTOBUF_FORCE_COPY_IN_MOVE ) { InternalSwap(&from); } else { CopyFrom(from); } return *this; } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { return GetDescriptor(); } static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { return default_instance().GetMetadata().descriptor; } static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { return default_instance().GetMetadata().reflection; } static const SearchResultData& default_instance() { return *internal_default_instance(); } static inline const SearchResultData* internal_default_instance() { return reinterpret_cast<const SearchResultData*>( &_SearchResultData_default_instance_); } static constexpr int kIndexInFileMessages = 16; friend void swap(SearchResultData& a, SearchResultData& b) { a.Swap(&b); } inline void Swap(SearchResultData* other) { if (other == this) return; #ifdef PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() != nullptr && GetOwningArena() == other->GetOwningArena()) { #else // PROTOBUF_FORCE_COPY_IN_SWAP if (GetOwningArena() == other->GetOwningArena()) { #endif // !PROTOBUF_FORCE_COPY_IN_SWAP InternalSwap(other); } else { ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); } } void UnsafeArenaSwap(SearchResultData* other) { if (other == this) return; GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); InternalSwap(other); } // implements Message ---------------------------------------------- SearchResultData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { return CreateMaybeMessage<SearchResultData>(arena); } using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; void CopyFrom(const SearchResultData& from); using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; void MergeFrom( const SearchResultData& from) { SearchResultData::MergeImpl(*this, from); } private: static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); public: PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; bool IsInitialized() const final; size_t ByteSizeLong() const final; const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; uint8_t* _InternalSerialize( uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; int GetCachedSize() const final { return _impl_._cached_size_.Get(); } private: void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); void SharedDtor(); void SetCachedSize(int size) const final; void InternalSwap(SearchResultData* other); private: friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { return "milvus.proto.schema.SearchResultData"; } protected: explicit SearchResultData(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned = false); public: static const ClassData _class_data_; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- enum : int { kFieldsDataFieldNumber = 3, kScoresFieldNumber = 4, kTopksFieldNumber = 6, kOutputFieldsFieldNumber = 7, kIdsFieldNumber = 5, kNumQueriesFieldNumber = 1, kTopKFieldNumber = 2, }; // repeated .milvus.proto.schema.FieldData fields_data = 3; int fields_data_size() const; private: int _internal_fields_data_size() const; public: void clear_fields_data(); ::milvus::proto::schema::FieldData* mutable_fields_data(int index); ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldData >* mutable_fields_data(); private: const ::milvus::proto::schema::FieldData& _internal_fields_data(int index) const; ::milvus::proto::schema::FieldData* _internal_add_fields_data(); public: const ::milvus::proto::schema::FieldData& fields_data(int index) const; ::milvus::proto::schema::FieldData* add_fields_data(); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldData >& fields_data() const; // repeated float scores = 4; int scores_size() const; private: int _internal_scores_size() const; public: void clear_scores(); private: float _internal_scores(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& _internal_scores() const; void _internal_add_scores(float value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* _internal_mutable_scores(); public: float scores(int index) const; void set_scores(int index, float value); void add_scores(float value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& scores() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* mutable_scores(); // repeated int64 topks = 6; int topks_size() const; private: int _internal_topks_size() const; public: void clear_topks(); private: int64_t _internal_topks(int index) const; const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& _internal_topks() const; void _internal_add_topks(int64_t value); ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* _internal_mutable_topks(); public: int64_t topks(int index) const; void set_topks(int index, int64_t value); void add_topks(int64_t value); const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& topks() const; ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* mutable_topks(); // repeated string output_fields = 7; int output_fields_size() const; private: int _internal_output_fields_size() const; public: void clear_output_fields(); const std::string& output_fields(int index) const; std::string* mutable_output_fields(int index); void set_output_fields(int index, const std::string& value); void set_output_fields(int index, std::string&& value); void set_output_fields(int index, const char* value); void set_output_fields(int index, const char* value, size_t size); std::string* add_output_fields(); void add_output_fields(const std::string& value); void add_output_fields(std::string&& value); void add_output_fields(const char* value); void add_output_fields(const char* value, size_t size); const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& output_fields() const; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* mutable_output_fields(); private: const std::string& _internal_output_fields(int index) const; std::string* _internal_add_output_fields(); public: // .milvus.proto.schema.IDs ids = 5; bool has_ids() const; private: bool _internal_has_ids() const; public: void clear_ids(); const ::milvus::proto::schema::IDs& ids() const; PROTOBUF_NODISCARD ::milvus::proto::schema::IDs* release_ids(); ::milvus::proto::schema::IDs* mutable_ids(); void set_allocated_ids(::milvus::proto::schema::IDs* ids); private: const ::milvus::proto::schema::IDs& _internal_ids() const; ::milvus::proto::schema::IDs* _internal_mutable_ids(); public: void unsafe_arena_set_allocated_ids( ::milvus::proto::schema::IDs* ids); ::milvus::proto::schema::IDs* unsafe_arena_release_ids(); // int64 num_queries = 1; void clear_num_queries(); int64_t num_queries() const; void set_num_queries(int64_t value); private: int64_t _internal_num_queries() const; void _internal_set_num_queries(int64_t value); public: // int64 top_k = 2; void clear_top_k(); int64_t top_k() const; void set_top_k(int64_t value); private: int64_t _internal_top_k() const; void _internal_set_top_k(int64_t value); public: // @@protoc_insertion_point(class_scope:milvus.proto.schema.SearchResultData) private: class _Internal; template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; typedef void InternalArenaConstructable_; typedef void DestructorSkippable_; struct Impl_ { ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldData > fields_data_; ::PROTOBUF_NAMESPACE_ID::RepeatedField< float > scores_; ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t > topks_; mutable std::atomic<int> _topks_cached_byte_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> output_fields_; ::milvus::proto::schema::IDs* ids_; int64_t num_queries_; int64_t top_k_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_schema_2eproto; }; // =================================================================== // =================================================================== #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ // FieldSchema // int64 fieldID = 1; inline void FieldSchema::clear_fieldid() { _impl_.fieldid_ = int64_t{0}; } inline int64_t FieldSchema::_internal_fieldid() const { return _impl_.fieldid_; } inline int64_t FieldSchema::fieldid() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.fieldID) return _internal_fieldid(); } inline void FieldSchema::_internal_set_fieldid(int64_t value) { _impl_.fieldid_ = value; } inline void FieldSchema::set_fieldid(int64_t value) { _internal_set_fieldid(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.fieldID) } // string name = 2; inline void FieldSchema::clear_name() { _impl_.name_.ClearToEmpty(); } inline const std::string& FieldSchema::name() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.name) return _internal_name(); } template <typename ArgT0, typename... ArgT> inline PROTOBUF_ALWAYS_INLINE void FieldSchema::set_name(ArgT0&& arg0, ArgT... args) { _impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.name) } inline std::string* FieldSchema::mutable_name() { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldSchema.name) return _s; } inline const std::string& FieldSchema::_internal_name() const { return _impl_.name_.Get(); } inline void FieldSchema::_internal_set_name(const std::string& value) { _impl_.name_.Set(value, GetArenaForAllocation()); } inline std::string* FieldSchema::_internal_mutable_name() { return _impl_.name_.Mutable(GetArenaForAllocation()); } inline std::string* FieldSchema::release_name() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldSchema.name) return _impl_.name_.Release(); } inline void FieldSchema::set_allocated_name(std::string* name) { if (name != nullptr) { } else { } _impl_.name_.SetAllocated(name, GetArenaForAllocation()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (_impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArenaForAllocation()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldSchema.name) } // bool is_primary_key = 3; inline void FieldSchema::clear_is_primary_key() { _impl_.is_primary_key_ = false; } inline bool FieldSchema::_internal_is_primary_key() const { return _impl_.is_primary_key_; } inline bool FieldSchema::is_primary_key() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.is_primary_key) return _internal_is_primary_key(); } inline void FieldSchema::_internal_set_is_primary_key(bool value) { _impl_.is_primary_key_ = value; } inline void FieldSchema::set_is_primary_key(bool value) { _internal_set_is_primary_key(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.is_primary_key) } // string description = 4; inline void FieldSchema::clear_description() { _impl_.description_.ClearToEmpty(); } inline const std::string& FieldSchema::description() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.description) return _internal_description(); } template <typename ArgT0, typename... ArgT> inline PROTOBUF_ALWAYS_INLINE void FieldSchema::set_description(ArgT0&& arg0, ArgT... args) { _impl_.description_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.description) } inline std::string* FieldSchema::mutable_description() { std::string* _s = _internal_mutable_description(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldSchema.description) return _s; } inline const std::string& FieldSchema::_internal_description() const { return _impl_.description_.Get(); } inline void FieldSchema::_internal_set_description(const std::string& value) { _impl_.description_.Set(value, GetArenaForAllocation()); } inline std::string* FieldSchema::_internal_mutable_description() { return _impl_.description_.Mutable(GetArenaForAllocation()); } inline std::string* FieldSchema::release_description() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldSchema.description) return _impl_.description_.Release(); } inline void FieldSchema::set_allocated_description(std::string* description) { if (description != nullptr) { } else { } _impl_.description_.SetAllocated(description, GetArenaForAllocation()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (_impl_.description_.IsDefault()) { _impl_.description_.Set("", GetArenaForAllocation()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldSchema.description) } // .milvus.proto.schema.DataType data_type = 5; inline void FieldSchema::clear_data_type() { _impl_.data_type_ = 0; } inline ::milvus::proto::schema::DataType FieldSchema::_internal_data_type() const { return static_cast< ::milvus::proto::schema::DataType >(_impl_.data_type_); } inline ::milvus::proto::schema::DataType FieldSchema::data_type() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.data_type) return _internal_data_type(); } inline void FieldSchema::_internal_set_data_type(::milvus::proto::schema::DataType value) { _impl_.data_type_ = value; } inline void FieldSchema::set_data_type(::milvus::proto::schema::DataType value) { _internal_set_data_type(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.data_type) } // repeated .milvus.proto.common.KeyValuePair type_params = 6; inline int FieldSchema::_internal_type_params_size() const { return _impl_.type_params_.size(); } inline int FieldSchema::type_params_size() const { return _internal_type_params_size(); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::mutable_type_params(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldSchema.type_params) return _impl_.type_params_.Mutable(index); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >* FieldSchema::mutable_type_params() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.FieldSchema.type_params) return &_impl_.type_params_; } inline const ::milvus::proto::common::KeyValuePair& FieldSchema::_internal_type_params(int index) const { return _impl_.type_params_.Get(index); } inline const ::milvus::proto::common::KeyValuePair& FieldSchema::type_params(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.type_params) return _internal_type_params(index); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::_internal_add_type_params() { return _impl_.type_params_.Add(); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::add_type_params() { ::milvus::proto::common::KeyValuePair* _add = _internal_add_type_params(); // @@protoc_insertion_point(field_add:milvus.proto.schema.FieldSchema.type_params) return _add; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >& FieldSchema::type_params() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.FieldSchema.type_params) return _impl_.type_params_; } // repeated .milvus.proto.common.KeyValuePair index_params = 7; inline int FieldSchema::_internal_index_params_size() const { return _impl_.index_params_.size(); } inline int FieldSchema::index_params_size() const { return _internal_index_params_size(); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::mutable_index_params(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldSchema.index_params) return _impl_.index_params_.Mutable(index); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >* FieldSchema::mutable_index_params() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.FieldSchema.index_params) return &_impl_.index_params_; } inline const ::milvus::proto::common::KeyValuePair& FieldSchema::_internal_index_params(int index) const { return _impl_.index_params_.Get(index); } inline const ::milvus::proto::common::KeyValuePair& FieldSchema::index_params(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.index_params) return _internal_index_params(index); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::_internal_add_index_params() { return _impl_.index_params_.Add(); } inline ::milvus::proto::common::KeyValuePair* FieldSchema::add_index_params() { ::milvus::proto::common::KeyValuePair* _add = _internal_add_index_params(); // @@protoc_insertion_point(field_add:milvus.proto.schema.FieldSchema.index_params) return _add; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::common::KeyValuePair >& FieldSchema::index_params() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.FieldSchema.index_params) return _impl_.index_params_; } // bool autoID = 8; inline void FieldSchema::clear_autoid() { _impl_.autoid_ = false; } inline bool FieldSchema::_internal_autoid() const { return _impl_.autoid_; } inline bool FieldSchema::autoid() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.autoID) return _internal_autoid(); } inline void FieldSchema::_internal_set_autoid(bool value) { _impl_.autoid_ = value; } inline void FieldSchema::set_autoid(bool value) { _internal_set_autoid(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.autoID) } // .milvus.proto.schema.FieldState state = 9; inline void FieldSchema::clear_state() { _impl_.state_ = 0; } inline ::milvus::proto::schema::FieldState FieldSchema::_internal_state() const { return static_cast< ::milvus::proto::schema::FieldState >(_impl_.state_); } inline ::milvus::proto::schema::FieldState FieldSchema::state() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.state) return _internal_state(); } inline void FieldSchema::_internal_set_state(::milvus::proto::schema::FieldState value) { _impl_.state_ = value; } inline void FieldSchema::set_state(::milvus::proto::schema::FieldState value) { _internal_set_state(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.state) } // .milvus.proto.schema.DataType element_type = 10; inline void FieldSchema::clear_element_type() { _impl_.element_type_ = 0; } inline ::milvus::proto::schema::DataType FieldSchema::_internal_element_type() const { return static_cast< ::milvus::proto::schema::DataType >(_impl_.element_type_); } inline ::milvus::proto::schema::DataType FieldSchema::element_type() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.element_type) return _internal_element_type(); } inline void FieldSchema::_internal_set_element_type(::milvus::proto::schema::DataType value) { _impl_.element_type_ = value; } inline void FieldSchema::set_element_type(::milvus::proto::schema::DataType value) { _internal_set_element_type(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.element_type) } // .milvus.proto.schema.ValueField default_value = 11; inline bool FieldSchema::_internal_has_default_value() const { return this != internal_default_instance() && _impl_.default_value_ != nullptr; } inline bool FieldSchema::has_default_value() const { return _internal_has_default_value(); } inline void FieldSchema::clear_default_value() { if (GetArenaForAllocation() == nullptr && _impl_.default_value_ != nullptr) { delete _impl_.default_value_; } _impl_.default_value_ = nullptr; } inline const ::milvus::proto::schema::ValueField& FieldSchema::_internal_default_value() const { const ::milvus::proto::schema::ValueField* p = _impl_.default_value_; return p != nullptr ? *p : reinterpret_cast<const ::milvus::proto::schema::ValueField&>( ::milvus::proto::schema::_ValueField_default_instance_); } inline const ::milvus::proto::schema::ValueField& FieldSchema::default_value() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.default_value) return _internal_default_value(); } inline void FieldSchema::unsafe_arena_set_allocated_default_value( ::milvus::proto::schema::ValueField* default_value) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.default_value_); } _impl_.default_value_ = default_value; if (default_value) { } else { } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.FieldSchema.default_value) } inline ::milvus::proto::schema::ValueField* FieldSchema::release_default_value() { ::milvus::proto::schema::ValueField* temp = _impl_.default_value_; _impl_.default_value_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); if (GetArenaForAllocation() == nullptr) { delete old; } #else // PROTOBUF_FORCE_COPY_IN_RELEASE if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } inline ::milvus::proto::schema::ValueField* FieldSchema::unsafe_arena_release_default_value() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldSchema.default_value) ::milvus::proto::schema::ValueField* temp = _impl_.default_value_; _impl_.default_value_ = nullptr; return temp; } inline ::milvus::proto::schema::ValueField* FieldSchema::_internal_mutable_default_value() { if (_impl_.default_value_ == nullptr) { auto* p = CreateMaybeMessage<::milvus::proto::schema::ValueField>(GetArenaForAllocation()); _impl_.default_value_ = p; } return _impl_.default_value_; } inline ::milvus::proto::schema::ValueField* FieldSchema::mutable_default_value() { ::milvus::proto::schema::ValueField* _msg = _internal_mutable_default_value(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldSchema.default_value) return _msg; } inline void FieldSchema::set_allocated_default_value(::milvus::proto::schema::ValueField* default_value) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete _impl_.default_value_; } if (default_value) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(default_value); if (message_arena != submessage_arena) { default_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, default_value, submessage_arena); } } else { } _impl_.default_value_ = default_value; // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldSchema.default_value) } // bool is_dynamic = 12; inline void FieldSchema::clear_is_dynamic() { _impl_.is_dynamic_ = false; } inline bool FieldSchema::_internal_is_dynamic() const { return _impl_.is_dynamic_; } inline bool FieldSchema::is_dynamic() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.is_dynamic) return _internal_is_dynamic(); } inline void FieldSchema::_internal_set_is_dynamic(bool value) { _impl_.is_dynamic_ = value; } inline void FieldSchema::set_is_dynamic(bool value) { _internal_set_is_dynamic(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.is_dynamic) } // bool is_partition_key = 13; inline void FieldSchema::clear_is_partition_key() { _impl_.is_partition_key_ = false; } inline bool FieldSchema::_internal_is_partition_key() const { return _impl_.is_partition_key_; } inline bool FieldSchema::is_partition_key() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldSchema.is_partition_key) return _internal_is_partition_key(); } inline void FieldSchema::_internal_set_is_partition_key(bool value) { _impl_.is_partition_key_ = value; } inline void FieldSchema::set_is_partition_key(bool value) { _internal_set_is_partition_key(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldSchema.is_partition_key) } // ------------------------------------------------------------------- // CollectionSchema // string name = 1; inline void CollectionSchema::clear_name() { _impl_.name_.ClearToEmpty(); } inline const std::string& CollectionSchema::name() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.CollectionSchema.name) return _internal_name(); } template <typename ArgT0, typename... ArgT> inline PROTOBUF_ALWAYS_INLINE void CollectionSchema::set_name(ArgT0&& arg0, ArgT... args) { _impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.CollectionSchema.name) } inline std::string* CollectionSchema::mutable_name() { std::string* _s = _internal_mutable_name(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.CollectionSchema.name) return _s; } inline const std::string& CollectionSchema::_internal_name() const { return _impl_.name_.Get(); } inline void CollectionSchema::_internal_set_name(const std::string& value) { _impl_.name_.Set(value, GetArenaForAllocation()); } inline std::string* CollectionSchema::_internal_mutable_name() { return _impl_.name_.Mutable(GetArenaForAllocation()); } inline std::string* CollectionSchema::release_name() { // @@protoc_insertion_point(field_release:milvus.proto.schema.CollectionSchema.name) return _impl_.name_.Release(); } inline void CollectionSchema::set_allocated_name(std::string* name) { if (name != nullptr) { } else { } _impl_.name_.SetAllocated(name, GetArenaForAllocation()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (_impl_.name_.IsDefault()) { _impl_.name_.Set("", GetArenaForAllocation()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.CollectionSchema.name) } // string description = 2; inline void CollectionSchema::clear_description() { _impl_.description_.ClearToEmpty(); } inline const std::string& CollectionSchema::description() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.CollectionSchema.description) return _internal_description(); } template <typename ArgT0, typename... ArgT> inline PROTOBUF_ALWAYS_INLINE void CollectionSchema::set_description(ArgT0&& arg0, ArgT... args) { _impl_.description_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.CollectionSchema.description) } inline std::string* CollectionSchema::mutable_description() { std::string* _s = _internal_mutable_description(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.CollectionSchema.description) return _s; } inline const std::string& CollectionSchema::_internal_description() const { return _impl_.description_.Get(); } inline void CollectionSchema::_internal_set_description(const std::string& value) { _impl_.description_.Set(value, GetArenaForAllocation()); } inline std::string* CollectionSchema::_internal_mutable_description() { return _impl_.description_.Mutable(GetArenaForAllocation()); } inline std::string* CollectionSchema::release_description() { // @@protoc_insertion_point(field_release:milvus.proto.schema.CollectionSchema.description) return _impl_.description_.Release(); } inline void CollectionSchema::set_allocated_description(std::string* description) { if (description != nullptr) { } else { } _impl_.description_.SetAllocated(description, GetArenaForAllocation()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (_impl_.description_.IsDefault()) { _impl_.description_.Set("", GetArenaForAllocation()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.CollectionSchema.description) } // bool autoID = 3; inline void CollectionSchema::clear_autoid() { _impl_.autoid_ = false; } inline bool CollectionSchema::_internal_autoid() const { return _impl_.autoid_; } inline bool CollectionSchema::autoid() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.CollectionSchema.autoID) return _internal_autoid(); } inline void CollectionSchema::_internal_set_autoid(bool value) { _impl_.autoid_ = value; } inline void CollectionSchema::set_autoid(bool value) { _internal_set_autoid(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.CollectionSchema.autoID) } // repeated .milvus.proto.schema.FieldSchema fields = 4; inline int CollectionSchema::_internal_fields_size() const { return _impl_.fields_.size(); } inline int CollectionSchema::fields_size() const { return _internal_fields_size(); } inline void CollectionSchema::clear_fields() { _impl_.fields_.Clear(); } inline ::milvus::proto::schema::FieldSchema* CollectionSchema::mutable_fields(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.CollectionSchema.fields) return _impl_.fields_.Mutable(index); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldSchema >* CollectionSchema::mutable_fields() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.CollectionSchema.fields) return &_impl_.fields_; } inline const ::milvus::proto::schema::FieldSchema& CollectionSchema::_internal_fields(int index) const { return _impl_.fields_.Get(index); } inline const ::milvus::proto::schema::FieldSchema& CollectionSchema::fields(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.CollectionSchema.fields) return _internal_fields(index); } inline ::milvus::proto::schema::FieldSchema* CollectionSchema::_internal_add_fields() { return _impl_.fields_.Add(); } inline ::milvus::proto::schema::FieldSchema* CollectionSchema::add_fields() { ::milvus::proto::schema::FieldSchema* _add = _internal_add_fields(); // @@protoc_insertion_point(field_add:milvus.proto.schema.CollectionSchema.fields) return _add; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldSchema >& CollectionSchema::fields() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.CollectionSchema.fields) return _impl_.fields_; } // bool enable_dynamic_field = 5; inline void CollectionSchema::clear_enable_dynamic_field() { _impl_.enable_dynamic_field_ = false; } inline bool CollectionSchema::_internal_enable_dynamic_field() const { return _impl_.enable_dynamic_field_; } inline bool CollectionSchema::enable_dynamic_field() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.CollectionSchema.enable_dynamic_field) return _internal_enable_dynamic_field(); } inline void CollectionSchema::_internal_set_enable_dynamic_field(bool value) { _impl_.enable_dynamic_field_ = value; } inline void CollectionSchema::set_enable_dynamic_field(bool value) { _internal_set_enable_dynamic_field(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.CollectionSchema.enable_dynamic_field) } // ------------------------------------------------------------------- // BoolArray // repeated bool data = 1; inline int BoolArray::_internal_data_size() const { return _impl_.data_.size(); } inline int BoolArray::data_size() const { return _internal_data_size(); } inline void BoolArray::clear_data() { _impl_.data_.Clear(); } inline bool BoolArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline bool BoolArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.BoolArray.data) return _internal_data(index); } inline void BoolArray::set_data(int index, bool value) { _impl_.data_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.BoolArray.data) } inline void BoolArray::_internal_add_data(bool value) { _impl_.data_.Add(value); } inline void BoolArray::add_data(bool value) { _internal_add_data(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.BoolArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& BoolArray::_internal_data() const { return _impl_.data_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >& BoolArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.BoolArray.data) return _internal_data(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* BoolArray::_internal_mutable_data() { return &_impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< bool >* BoolArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.BoolArray.data) return _internal_mutable_data(); } // ------------------------------------------------------------------- // IntArray // repeated int32 data = 1; inline int IntArray::_internal_data_size() const { return _impl_.data_.size(); } inline int IntArray::data_size() const { return _internal_data_size(); } inline void IntArray::clear_data() { _impl_.data_.Clear(); } inline int32_t IntArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline int32_t IntArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.IntArray.data) return _internal_data(index); } inline void IntArray::set_data(int index, int32_t value) { _impl_.data_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.IntArray.data) } inline void IntArray::_internal_add_data(int32_t value) { _impl_.data_.Add(value); } inline void IntArray::add_data(int32_t value) { _internal_add_data(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.IntArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >& IntArray::_internal_data() const { return _impl_.data_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >& IntArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.IntArray.data) return _internal_data(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >* IntArray::_internal_mutable_data() { return &_impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >* IntArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.IntArray.data) return _internal_mutable_data(); } // ------------------------------------------------------------------- // LongArray // repeated int64 data = 1; inline int LongArray::_internal_data_size() const { return _impl_.data_.size(); } inline int LongArray::data_size() const { return _internal_data_size(); } inline void LongArray::clear_data() { _impl_.data_.Clear(); } inline int64_t LongArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline int64_t LongArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.LongArray.data) return _internal_data(index); } inline void LongArray::set_data(int index, int64_t value) { _impl_.data_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.LongArray.data) } inline void LongArray::_internal_add_data(int64_t value) { _impl_.data_.Add(value); } inline void LongArray::add_data(int64_t value) { _internal_add_data(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.LongArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& LongArray::_internal_data() const { return _impl_.data_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& LongArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.LongArray.data) return _internal_data(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* LongArray::_internal_mutable_data() { return &_impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* LongArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.LongArray.data) return _internal_mutable_data(); } // ------------------------------------------------------------------- // FloatArray // repeated float data = 1; inline int FloatArray::_internal_data_size() const { return _impl_.data_.size(); } inline int FloatArray::data_size() const { return _internal_data_size(); } inline void FloatArray::clear_data() { _impl_.data_.Clear(); } inline float FloatArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline float FloatArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FloatArray.data) return _internal_data(index); } inline void FloatArray::set_data(int index, float value) { _impl_.data_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FloatArray.data) } inline void FloatArray::_internal_add_data(float value) { _impl_.data_.Add(value); } inline void FloatArray::add_data(float value) { _internal_add_data(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.FloatArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& FloatArray::_internal_data() const { return _impl_.data_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& FloatArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.FloatArray.data) return _internal_data(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* FloatArray::_internal_mutable_data() { return &_impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* FloatArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.FloatArray.data) return _internal_mutable_data(); } // ------------------------------------------------------------------- // DoubleArray // repeated double data = 1; inline int DoubleArray::_internal_data_size() const { return _impl_.data_.size(); } inline int DoubleArray::data_size() const { return _internal_data_size(); } inline void DoubleArray::clear_data() { _impl_.data_.Clear(); } inline double DoubleArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline double DoubleArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.DoubleArray.data) return _internal_data(index); } inline void DoubleArray::set_data(int index, double value) { _impl_.data_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.DoubleArray.data) } inline void DoubleArray::_internal_add_data(double value) { _impl_.data_.Add(value); } inline void DoubleArray::add_data(double value) { _internal_add_data(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.DoubleArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& DoubleArray::_internal_data() const { return _impl_.data_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >& DoubleArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.DoubleArray.data) return _internal_data(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* DoubleArray::_internal_mutable_data() { return &_impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< double >* DoubleArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.DoubleArray.data) return _internal_mutable_data(); } // ------------------------------------------------------------------- // BytesArray // repeated bytes data = 1; inline int BytesArray::_internal_data_size() const { return _impl_.data_.size(); } inline int BytesArray::data_size() const { return _internal_data_size(); } inline void BytesArray::clear_data() { _impl_.data_.Clear(); } inline std::string* BytesArray::add_data() { std::string* _s = _internal_add_data(); // @@protoc_insertion_point(field_add_mutable:milvus.proto.schema.BytesArray.data) return _s; } inline const std::string& BytesArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline const std::string& BytesArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.BytesArray.data) return _internal_data(index); } inline std::string* BytesArray::mutable_data(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.BytesArray.data) return _impl_.data_.Mutable(index); } inline void BytesArray::set_data(int index, const std::string& value) { _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.BytesArray.data) } inline void BytesArray::set_data(int index, std::string&& value) { _impl_.data_.Mutable(index)->assign(std::move(value)); // @@protoc_insertion_point(field_set:milvus.proto.schema.BytesArray.data) } inline void BytesArray::set_data(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:milvus.proto.schema.BytesArray.data) } inline void BytesArray::set_data(int index, const void* value, size_t size) { _impl_.data_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:milvus.proto.schema.BytesArray.data) } inline std::string* BytesArray::_internal_add_data() { return _impl_.data_.Add(); } inline void BytesArray::add_data(const std::string& value) { _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.BytesArray.data) } inline void BytesArray::add_data(std::string&& value) { _impl_.data_.Add(std::move(value)); // @@protoc_insertion_point(field_add:milvus.proto.schema.BytesArray.data) } inline void BytesArray::add_data(const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:milvus.proto.schema.BytesArray.data) } inline void BytesArray::add_data(const void* value, size_t size) { _impl_.data_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:milvus.proto.schema.BytesArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& BytesArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.BytesArray.data) return _impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* BytesArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.BytesArray.data) return &_impl_.data_; } // ------------------------------------------------------------------- // StringArray // repeated string data = 1; inline int StringArray::_internal_data_size() const { return _impl_.data_.size(); } inline int StringArray::data_size() const { return _internal_data_size(); } inline void StringArray::clear_data() { _impl_.data_.Clear(); } inline std::string* StringArray::add_data() { std::string* _s = _internal_add_data(); // @@protoc_insertion_point(field_add_mutable:milvus.proto.schema.StringArray.data) return _s; } inline const std::string& StringArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline const std::string& StringArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.StringArray.data) return _internal_data(index); } inline std::string* StringArray::mutable_data(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.StringArray.data) return _impl_.data_.Mutable(index); } inline void StringArray::set_data(int index, const std::string& value) { _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.StringArray.data) } inline void StringArray::set_data(int index, std::string&& value) { _impl_.data_.Mutable(index)->assign(std::move(value)); // @@protoc_insertion_point(field_set:milvus.proto.schema.StringArray.data) } inline void StringArray::set_data(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:milvus.proto.schema.StringArray.data) } inline void StringArray::set_data(int index, const char* value, size_t size) { _impl_.data_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:milvus.proto.schema.StringArray.data) } inline std::string* StringArray::_internal_add_data() { return _impl_.data_.Add(); } inline void StringArray::add_data(const std::string& value) { _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.StringArray.data) } inline void StringArray::add_data(std::string&& value) { _impl_.data_.Add(std::move(value)); // @@protoc_insertion_point(field_add:milvus.proto.schema.StringArray.data) } inline void StringArray::add_data(const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:milvus.proto.schema.StringArray.data) } inline void StringArray::add_data(const char* value, size_t size) { _impl_.data_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:milvus.proto.schema.StringArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& StringArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.StringArray.data) return _impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* StringArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.StringArray.data) return &_impl_.data_; } // ------------------------------------------------------------------- // ArrayArray // repeated .milvus.proto.schema.ScalarField data = 1; inline int ArrayArray::_internal_data_size() const { return _impl_.data_.size(); } inline int ArrayArray::data_size() const { return _internal_data_size(); } inline void ArrayArray::clear_data() { _impl_.data_.Clear(); } inline ::milvus::proto::schema::ScalarField* ArrayArray::mutable_data(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ArrayArray.data) return _impl_.data_.Mutable(index); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::ScalarField >* ArrayArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.ArrayArray.data) return &_impl_.data_; } inline const ::milvus::proto::schema::ScalarField& ArrayArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline const ::milvus::proto::schema::ScalarField& ArrayArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ArrayArray.data) return _internal_data(index); } inline ::milvus::proto::schema::ScalarField* ArrayArray::_internal_add_data() { return _impl_.data_.Add(); } inline ::milvus::proto::schema::ScalarField* ArrayArray::add_data() { ::milvus::proto::schema::ScalarField* _add = _internal_add_data(); // @@protoc_insertion_point(field_add:milvus.proto.schema.ArrayArray.data) return _add; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::ScalarField >& ArrayArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.ArrayArray.data) return _impl_.data_; } // .milvus.proto.schema.DataType element_type = 2; inline void ArrayArray::clear_element_type() { _impl_.element_type_ = 0; } inline ::milvus::proto::schema::DataType ArrayArray::_internal_element_type() const { return static_cast< ::milvus::proto::schema::DataType >(_impl_.element_type_); } inline ::milvus::proto::schema::DataType ArrayArray::element_type() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ArrayArray.element_type) return _internal_element_type(); } inline void ArrayArray::_internal_set_element_type(::milvus::proto::schema::DataType value) { _impl_.element_type_ = value; } inline void ArrayArray::set_element_type(::milvus::proto::schema::DataType value) { _internal_set_element_type(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ArrayArray.element_type) } // ------------------------------------------------------------------- // JSONArray // repeated bytes data = 1; inline int JSONArray::_internal_data_size() const { return _impl_.data_.size(); } inline int JSONArray::data_size() const { return _internal_data_size(); } inline void JSONArray::clear_data() { _impl_.data_.Clear(); } inline std::string* JSONArray::add_data() { std::string* _s = _internal_add_data(); // @@protoc_insertion_point(field_add_mutable:milvus.proto.schema.JSONArray.data) return _s; } inline const std::string& JSONArray::_internal_data(int index) const { return _impl_.data_.Get(index); } inline const std::string& JSONArray::data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.JSONArray.data) return _internal_data(index); } inline std::string* JSONArray::mutable_data(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.JSONArray.data) return _impl_.data_.Mutable(index); } inline void JSONArray::set_data(int index, const std::string& value) { _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.JSONArray.data) } inline void JSONArray::set_data(int index, std::string&& value) { _impl_.data_.Mutable(index)->assign(std::move(value)); // @@protoc_insertion_point(field_set:milvus.proto.schema.JSONArray.data) } inline void JSONArray::set_data(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:milvus.proto.schema.JSONArray.data) } inline void JSONArray::set_data(int index, const void* value, size_t size) { _impl_.data_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:milvus.proto.schema.JSONArray.data) } inline std::string* JSONArray::_internal_add_data() { return _impl_.data_.Add(); } inline void JSONArray::add_data(const std::string& value) { _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.JSONArray.data) } inline void JSONArray::add_data(std::string&& value) { _impl_.data_.Add(std::move(value)); // @@protoc_insertion_point(field_add:milvus.proto.schema.JSONArray.data) } inline void JSONArray::add_data(const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.data_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:milvus.proto.schema.JSONArray.data) } inline void JSONArray::add_data(const void* value, size_t size) { _impl_.data_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:milvus.proto.schema.JSONArray.data) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& JSONArray::data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.JSONArray.data) return _impl_.data_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* JSONArray::mutable_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.JSONArray.data) return &_impl_.data_; } // ------------------------------------------------------------------- // ValueField // bool bool_data = 1; inline bool ValueField::_internal_has_bool_data() const { return data_case() == kBoolData; } inline bool ValueField::has_bool_data() const { return _internal_has_bool_data(); } inline void ValueField::set_has_bool_data() { _impl_._oneof_case_[0] = kBoolData; } inline void ValueField::clear_bool_data() { if (_internal_has_bool_data()) { _impl_.data_.bool_data_ = false; clear_has_data(); } } inline bool ValueField::_internal_bool_data() const { if (_internal_has_bool_data()) { return _impl_.data_.bool_data_; } return false; } inline void ValueField::_internal_set_bool_data(bool value) { if (!_internal_has_bool_data()) { clear_data(); set_has_bool_data(); } _impl_.data_.bool_data_ = value; } inline bool ValueField::bool_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.bool_data) return _internal_bool_data(); } inline void ValueField::set_bool_data(bool value) { _internal_set_bool_data(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.bool_data) } // int32 int_data = 2; inline bool ValueField::_internal_has_int_data() const { return data_case() == kIntData; } inline bool ValueField::has_int_data() const { return _internal_has_int_data(); } inline void ValueField::set_has_int_data() { _impl_._oneof_case_[0] = kIntData; } inline void ValueField::clear_int_data() { if (_internal_has_int_data()) { _impl_.data_.int_data_ = 0; clear_has_data(); } } inline int32_t ValueField::_internal_int_data() const { if (_internal_has_int_data()) { return _impl_.data_.int_data_; } return 0; } inline void ValueField::_internal_set_int_data(int32_t value) { if (!_internal_has_int_data()) { clear_data(); set_has_int_data(); } _impl_.data_.int_data_ = value; } inline int32_t ValueField::int_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.int_data) return _internal_int_data(); } inline void ValueField::set_int_data(int32_t value) { _internal_set_int_data(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.int_data) } // int64 long_data = 3; inline bool ValueField::_internal_has_long_data() const { return data_case() == kLongData; } inline bool ValueField::has_long_data() const { return _internal_has_long_data(); } inline void ValueField::set_has_long_data() { _impl_._oneof_case_[0] = kLongData; } inline void ValueField::clear_long_data() { if (_internal_has_long_data()) { _impl_.data_.long_data_ = int64_t{0}; clear_has_data(); } } inline int64_t ValueField::_internal_long_data() const { if (_internal_has_long_data()) { return _impl_.data_.long_data_; } return int64_t{0}; } inline void ValueField::_internal_set_long_data(int64_t value) { if (!_internal_has_long_data()) { clear_data(); set_has_long_data(); } _impl_.data_.long_data_ = value; } inline int64_t ValueField::long_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.long_data) return _internal_long_data(); } inline void ValueField::set_long_data(int64_t value) { _internal_set_long_data(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.long_data) } // float float_data = 4; inline bool ValueField::_internal_has_float_data() const { return data_case() == kFloatData; } inline bool ValueField::has_float_data() const { return _internal_has_float_data(); } inline void ValueField::set_has_float_data() { _impl_._oneof_case_[0] = kFloatData; } inline void ValueField::clear_float_data() { if (_internal_has_float_data()) { _impl_.data_.float_data_ = 0; clear_has_data(); } } inline float ValueField::_internal_float_data() const { if (_internal_has_float_data()) { return _impl_.data_.float_data_; } return 0; } inline void ValueField::_internal_set_float_data(float value) { if (!_internal_has_float_data()) { clear_data(); set_has_float_data(); } _impl_.data_.float_data_ = value; } inline float ValueField::float_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.float_data) return _internal_float_data(); } inline void ValueField::set_float_data(float value) { _internal_set_float_data(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.float_data) } // double double_data = 5; inline bool ValueField::_internal_has_double_data() const { return data_case() == kDoubleData; } inline bool ValueField::has_double_data() const { return _internal_has_double_data(); } inline void ValueField::set_has_double_data() { _impl_._oneof_case_[0] = kDoubleData; } inline void ValueField::clear_double_data() { if (_internal_has_double_data()) { _impl_.data_.double_data_ = 0; clear_has_data(); } } inline double ValueField::_internal_double_data() const { if (_internal_has_double_data()) { return _impl_.data_.double_data_; } return 0; } inline void ValueField::_internal_set_double_data(double value) { if (!_internal_has_double_data()) { clear_data(); set_has_double_data(); } _impl_.data_.double_data_ = value; } inline double ValueField::double_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.double_data) return _internal_double_data(); } inline void ValueField::set_double_data(double value) { _internal_set_double_data(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.double_data) } // string string_data = 6; inline bool ValueField::_internal_has_string_data() const { return data_case() == kStringData; } inline bool ValueField::has_string_data() const { return _internal_has_string_data(); } inline void ValueField::set_has_string_data() { _impl_._oneof_case_[0] = kStringData; } inline void ValueField::clear_string_data() { if (_internal_has_string_data()) { _impl_.data_.string_data_.Destroy(); clear_has_data(); } } inline const std::string& ValueField::string_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.string_data) return _internal_string_data(); } template <typename ArgT0, typename... ArgT> inline void ValueField::set_string_data(ArgT0&& arg0, ArgT... args) { if (!_internal_has_string_data()) { clear_data(); set_has_string_data(); _impl_.data_.string_data_.InitDefault(); } _impl_.data_.string_data_.Set( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.string_data) } inline std::string* ValueField::mutable_string_data() { std::string* _s = _internal_mutable_string_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ValueField.string_data) return _s; } inline const std::string& ValueField::_internal_string_data() const { if (_internal_has_string_data()) { return _impl_.data_.string_data_.Get(); } return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); } inline void ValueField::_internal_set_string_data(const std::string& value) { if (!_internal_has_string_data()) { clear_data(); set_has_string_data(); _impl_.data_.string_data_.InitDefault(); } _impl_.data_.string_data_.Set(value, GetArenaForAllocation()); } inline std::string* ValueField::_internal_mutable_string_data() { if (!_internal_has_string_data()) { clear_data(); set_has_string_data(); _impl_.data_.string_data_.InitDefault(); } return _impl_.data_.string_data_.Mutable( GetArenaForAllocation()); } inline std::string* ValueField::release_string_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ValueField.string_data) if (_internal_has_string_data()) { clear_has_data(); return _impl_.data_.string_data_.Release(); } else { return nullptr; } } inline void ValueField::set_allocated_string_data(std::string* string_data) { if (has_data()) { clear_data(); } if (string_data != nullptr) { set_has_string_data(); _impl_.data_.string_data_.InitAllocated(string_data, GetArenaForAllocation()); } // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.ValueField.string_data) } // bytes bytes_data = 7; inline bool ValueField::_internal_has_bytes_data() const { return data_case() == kBytesData; } inline bool ValueField::has_bytes_data() const { return _internal_has_bytes_data(); } inline void ValueField::set_has_bytes_data() { _impl_._oneof_case_[0] = kBytesData; } inline void ValueField::clear_bytes_data() { if (_internal_has_bytes_data()) { _impl_.data_.bytes_data_.Destroy(); clear_has_data(); } } inline const std::string& ValueField::bytes_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ValueField.bytes_data) return _internal_bytes_data(); } template <typename ArgT0, typename... ArgT> inline void ValueField::set_bytes_data(ArgT0&& arg0, ArgT... args) { if (!_internal_has_bytes_data()) { clear_data(); set_has_bytes_data(); _impl_.data_.bytes_data_.InitDefault(); } _impl_.data_.bytes_data_.SetBytes( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.ValueField.bytes_data) } inline std::string* ValueField::mutable_bytes_data() { std::string* _s = _internal_mutable_bytes_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ValueField.bytes_data) return _s; } inline const std::string& ValueField::_internal_bytes_data() const { if (_internal_has_bytes_data()) { return _impl_.data_.bytes_data_.Get(); } return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); } inline void ValueField::_internal_set_bytes_data(const std::string& value) { if (!_internal_has_bytes_data()) { clear_data(); set_has_bytes_data(); _impl_.data_.bytes_data_.InitDefault(); } _impl_.data_.bytes_data_.Set(value, GetArenaForAllocation()); } inline std::string* ValueField::_internal_mutable_bytes_data() { if (!_internal_has_bytes_data()) { clear_data(); set_has_bytes_data(); _impl_.data_.bytes_data_.InitDefault(); } return _impl_.data_.bytes_data_.Mutable( GetArenaForAllocation()); } inline std::string* ValueField::release_bytes_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ValueField.bytes_data) if (_internal_has_bytes_data()) { clear_has_data(); return _impl_.data_.bytes_data_.Release(); } else { return nullptr; } } inline void ValueField::set_allocated_bytes_data(std::string* bytes_data) { if (has_data()) { clear_data(); } if (bytes_data != nullptr) { set_has_bytes_data(); _impl_.data_.bytes_data_.InitAllocated(bytes_data, GetArenaForAllocation()); } // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.ValueField.bytes_data) } inline bool ValueField::has_data() const { return data_case() != DATA_NOT_SET; } inline void ValueField::clear_has_data() { _impl_._oneof_case_[0] = DATA_NOT_SET; } inline ValueField::DataCase ValueField::data_case() const { return ValueField::DataCase(_impl_._oneof_case_[0]); } // ------------------------------------------------------------------- // ScalarField // .milvus.proto.schema.BoolArray bool_data = 1; inline bool ScalarField::_internal_has_bool_data() const { return data_case() == kBoolData; } inline bool ScalarField::has_bool_data() const { return _internal_has_bool_data(); } inline void ScalarField::set_has_bool_data() { _impl_._oneof_case_[0] = kBoolData; } inline void ScalarField::clear_bool_data() { if (_internal_has_bool_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.bool_data_; } clear_has_data(); } } inline ::milvus::proto::schema::BoolArray* ScalarField::release_bool_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.bool_data) if (_internal_has_bool_data()) { clear_has_data(); ::milvus::proto::schema::BoolArray* temp = _impl_.data_.bool_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.bool_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::BoolArray& ScalarField::_internal_bool_data() const { return _internal_has_bool_data() ? *_impl_.data_.bool_data_ : reinterpret_cast< ::milvus::proto::schema::BoolArray&>(::milvus::proto::schema::_BoolArray_default_instance_); } inline const ::milvus::proto::schema::BoolArray& ScalarField::bool_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.bool_data) return _internal_bool_data(); } inline ::milvus::proto::schema::BoolArray* ScalarField::unsafe_arena_release_bool_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.bool_data) if (_internal_has_bool_data()) { clear_has_data(); ::milvus::proto::schema::BoolArray* temp = _impl_.data_.bool_data_; _impl_.data_.bool_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_bool_data(::milvus::proto::schema::BoolArray* bool_data) { clear_data(); if (bool_data) { set_has_bool_data(); _impl_.data_.bool_data_ = bool_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.bool_data) } inline ::milvus::proto::schema::BoolArray* ScalarField::_internal_mutable_bool_data() { if (!_internal_has_bool_data()) { clear_data(); set_has_bool_data(); _impl_.data_.bool_data_ = CreateMaybeMessage< ::milvus::proto::schema::BoolArray >(GetArenaForAllocation()); } return _impl_.data_.bool_data_; } inline ::milvus::proto::schema::BoolArray* ScalarField::mutable_bool_data() { ::milvus::proto::schema::BoolArray* _msg = _internal_mutable_bool_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.bool_data) return _msg; } // .milvus.proto.schema.IntArray int_data = 2; inline bool ScalarField::_internal_has_int_data() const { return data_case() == kIntData; } inline bool ScalarField::has_int_data() const { return _internal_has_int_data(); } inline void ScalarField::set_has_int_data() { _impl_._oneof_case_[0] = kIntData; } inline void ScalarField::clear_int_data() { if (_internal_has_int_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.int_data_; } clear_has_data(); } } inline ::milvus::proto::schema::IntArray* ScalarField::release_int_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.int_data) if (_internal_has_int_data()) { clear_has_data(); ::milvus::proto::schema::IntArray* temp = _impl_.data_.int_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.int_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::IntArray& ScalarField::_internal_int_data() const { return _internal_has_int_data() ? *_impl_.data_.int_data_ : reinterpret_cast< ::milvus::proto::schema::IntArray&>(::milvus::proto::schema::_IntArray_default_instance_); } inline const ::milvus::proto::schema::IntArray& ScalarField::int_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.int_data) return _internal_int_data(); } inline ::milvus::proto::schema::IntArray* ScalarField::unsafe_arena_release_int_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.int_data) if (_internal_has_int_data()) { clear_has_data(); ::milvus::proto::schema::IntArray* temp = _impl_.data_.int_data_; _impl_.data_.int_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_int_data(::milvus::proto::schema::IntArray* int_data) { clear_data(); if (int_data) { set_has_int_data(); _impl_.data_.int_data_ = int_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.int_data) } inline ::milvus::proto::schema::IntArray* ScalarField::_internal_mutable_int_data() { if (!_internal_has_int_data()) { clear_data(); set_has_int_data(); _impl_.data_.int_data_ = CreateMaybeMessage< ::milvus::proto::schema::IntArray >(GetArenaForAllocation()); } return _impl_.data_.int_data_; } inline ::milvus::proto::schema::IntArray* ScalarField::mutable_int_data() { ::milvus::proto::schema::IntArray* _msg = _internal_mutable_int_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.int_data) return _msg; } // .milvus.proto.schema.LongArray long_data = 3; inline bool ScalarField::_internal_has_long_data() const { return data_case() == kLongData; } inline bool ScalarField::has_long_data() const { return _internal_has_long_data(); } inline void ScalarField::set_has_long_data() { _impl_._oneof_case_[0] = kLongData; } inline void ScalarField::clear_long_data() { if (_internal_has_long_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.long_data_; } clear_has_data(); } } inline ::milvus::proto::schema::LongArray* ScalarField::release_long_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.long_data) if (_internal_has_long_data()) { clear_has_data(); ::milvus::proto::schema::LongArray* temp = _impl_.data_.long_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.long_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::LongArray& ScalarField::_internal_long_data() const { return _internal_has_long_data() ? *_impl_.data_.long_data_ : reinterpret_cast< ::milvus::proto::schema::LongArray&>(::milvus::proto::schema::_LongArray_default_instance_); } inline const ::milvus::proto::schema::LongArray& ScalarField::long_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.long_data) return _internal_long_data(); } inline ::milvus::proto::schema::LongArray* ScalarField::unsafe_arena_release_long_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.long_data) if (_internal_has_long_data()) { clear_has_data(); ::milvus::proto::schema::LongArray* temp = _impl_.data_.long_data_; _impl_.data_.long_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_long_data(::milvus::proto::schema::LongArray* long_data) { clear_data(); if (long_data) { set_has_long_data(); _impl_.data_.long_data_ = long_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.long_data) } inline ::milvus::proto::schema::LongArray* ScalarField::_internal_mutable_long_data() { if (!_internal_has_long_data()) { clear_data(); set_has_long_data(); _impl_.data_.long_data_ = CreateMaybeMessage< ::milvus::proto::schema::LongArray >(GetArenaForAllocation()); } return _impl_.data_.long_data_; } inline ::milvus::proto::schema::LongArray* ScalarField::mutable_long_data() { ::milvus::proto::schema::LongArray* _msg = _internal_mutable_long_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.long_data) return _msg; } // .milvus.proto.schema.FloatArray float_data = 4; inline bool ScalarField::_internal_has_float_data() const { return data_case() == kFloatData; } inline bool ScalarField::has_float_data() const { return _internal_has_float_data(); } inline void ScalarField::set_has_float_data() { _impl_._oneof_case_[0] = kFloatData; } inline void ScalarField::clear_float_data() { if (_internal_has_float_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.float_data_; } clear_has_data(); } } inline ::milvus::proto::schema::FloatArray* ScalarField::release_float_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.float_data) if (_internal_has_float_data()) { clear_has_data(); ::milvus::proto::schema::FloatArray* temp = _impl_.data_.float_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.float_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::FloatArray& ScalarField::_internal_float_data() const { return _internal_has_float_data() ? *_impl_.data_.float_data_ : reinterpret_cast< ::milvus::proto::schema::FloatArray&>(::milvus::proto::schema::_FloatArray_default_instance_); } inline const ::milvus::proto::schema::FloatArray& ScalarField::float_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.float_data) return _internal_float_data(); } inline ::milvus::proto::schema::FloatArray* ScalarField::unsafe_arena_release_float_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.float_data) if (_internal_has_float_data()) { clear_has_data(); ::milvus::proto::schema::FloatArray* temp = _impl_.data_.float_data_; _impl_.data_.float_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_float_data(::milvus::proto::schema::FloatArray* float_data) { clear_data(); if (float_data) { set_has_float_data(); _impl_.data_.float_data_ = float_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.float_data) } inline ::milvus::proto::schema::FloatArray* ScalarField::_internal_mutable_float_data() { if (!_internal_has_float_data()) { clear_data(); set_has_float_data(); _impl_.data_.float_data_ = CreateMaybeMessage< ::milvus::proto::schema::FloatArray >(GetArenaForAllocation()); } return _impl_.data_.float_data_; } inline ::milvus::proto::schema::FloatArray* ScalarField::mutable_float_data() { ::milvus::proto::schema::FloatArray* _msg = _internal_mutable_float_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.float_data) return _msg; } // .milvus.proto.schema.DoubleArray double_data = 5; inline bool ScalarField::_internal_has_double_data() const { return data_case() == kDoubleData; } inline bool ScalarField::has_double_data() const { return _internal_has_double_data(); } inline void ScalarField::set_has_double_data() { _impl_._oneof_case_[0] = kDoubleData; } inline void ScalarField::clear_double_data() { if (_internal_has_double_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.double_data_; } clear_has_data(); } } inline ::milvus::proto::schema::DoubleArray* ScalarField::release_double_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.double_data) if (_internal_has_double_data()) { clear_has_data(); ::milvus::proto::schema::DoubleArray* temp = _impl_.data_.double_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.double_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::DoubleArray& ScalarField::_internal_double_data() const { return _internal_has_double_data() ? *_impl_.data_.double_data_ : reinterpret_cast< ::milvus::proto::schema::DoubleArray&>(::milvus::proto::schema::_DoubleArray_default_instance_); } inline const ::milvus::proto::schema::DoubleArray& ScalarField::double_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.double_data) return _internal_double_data(); } inline ::milvus::proto::schema::DoubleArray* ScalarField::unsafe_arena_release_double_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.double_data) if (_internal_has_double_data()) { clear_has_data(); ::milvus::proto::schema::DoubleArray* temp = _impl_.data_.double_data_; _impl_.data_.double_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_double_data(::milvus::proto::schema::DoubleArray* double_data) { clear_data(); if (double_data) { set_has_double_data(); _impl_.data_.double_data_ = double_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.double_data) } inline ::milvus::proto::schema::DoubleArray* ScalarField::_internal_mutable_double_data() { if (!_internal_has_double_data()) { clear_data(); set_has_double_data(); _impl_.data_.double_data_ = CreateMaybeMessage< ::milvus::proto::schema::DoubleArray >(GetArenaForAllocation()); } return _impl_.data_.double_data_; } inline ::milvus::proto::schema::DoubleArray* ScalarField::mutable_double_data() { ::milvus::proto::schema::DoubleArray* _msg = _internal_mutable_double_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.double_data) return _msg; } // .milvus.proto.schema.StringArray string_data = 6; inline bool ScalarField::_internal_has_string_data() const { return data_case() == kStringData; } inline bool ScalarField::has_string_data() const { return _internal_has_string_data(); } inline void ScalarField::set_has_string_data() { _impl_._oneof_case_[0] = kStringData; } inline void ScalarField::clear_string_data() { if (_internal_has_string_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.string_data_; } clear_has_data(); } } inline ::milvus::proto::schema::StringArray* ScalarField::release_string_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.string_data) if (_internal_has_string_data()) { clear_has_data(); ::milvus::proto::schema::StringArray* temp = _impl_.data_.string_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.string_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::StringArray& ScalarField::_internal_string_data() const { return _internal_has_string_data() ? *_impl_.data_.string_data_ : reinterpret_cast< ::milvus::proto::schema::StringArray&>(::milvus::proto::schema::_StringArray_default_instance_); } inline const ::milvus::proto::schema::StringArray& ScalarField::string_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.string_data) return _internal_string_data(); } inline ::milvus::proto::schema::StringArray* ScalarField::unsafe_arena_release_string_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.string_data) if (_internal_has_string_data()) { clear_has_data(); ::milvus::proto::schema::StringArray* temp = _impl_.data_.string_data_; _impl_.data_.string_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_string_data(::milvus::proto::schema::StringArray* string_data) { clear_data(); if (string_data) { set_has_string_data(); _impl_.data_.string_data_ = string_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.string_data) } inline ::milvus::proto::schema::StringArray* ScalarField::_internal_mutable_string_data() { if (!_internal_has_string_data()) { clear_data(); set_has_string_data(); _impl_.data_.string_data_ = CreateMaybeMessage< ::milvus::proto::schema::StringArray >(GetArenaForAllocation()); } return _impl_.data_.string_data_; } inline ::milvus::proto::schema::StringArray* ScalarField::mutable_string_data() { ::milvus::proto::schema::StringArray* _msg = _internal_mutable_string_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.string_data) return _msg; } // .milvus.proto.schema.BytesArray bytes_data = 7; inline bool ScalarField::_internal_has_bytes_data() const { return data_case() == kBytesData; } inline bool ScalarField::has_bytes_data() const { return _internal_has_bytes_data(); } inline void ScalarField::set_has_bytes_data() { _impl_._oneof_case_[0] = kBytesData; } inline void ScalarField::clear_bytes_data() { if (_internal_has_bytes_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.bytes_data_; } clear_has_data(); } } inline ::milvus::proto::schema::BytesArray* ScalarField::release_bytes_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.bytes_data) if (_internal_has_bytes_data()) { clear_has_data(); ::milvus::proto::schema::BytesArray* temp = _impl_.data_.bytes_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.bytes_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::BytesArray& ScalarField::_internal_bytes_data() const { return _internal_has_bytes_data() ? *_impl_.data_.bytes_data_ : reinterpret_cast< ::milvus::proto::schema::BytesArray&>(::milvus::proto::schema::_BytesArray_default_instance_); } inline const ::milvus::proto::schema::BytesArray& ScalarField::bytes_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.bytes_data) return _internal_bytes_data(); } inline ::milvus::proto::schema::BytesArray* ScalarField::unsafe_arena_release_bytes_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.bytes_data) if (_internal_has_bytes_data()) { clear_has_data(); ::milvus::proto::schema::BytesArray* temp = _impl_.data_.bytes_data_; _impl_.data_.bytes_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_bytes_data(::milvus::proto::schema::BytesArray* bytes_data) { clear_data(); if (bytes_data) { set_has_bytes_data(); _impl_.data_.bytes_data_ = bytes_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.bytes_data) } inline ::milvus::proto::schema::BytesArray* ScalarField::_internal_mutable_bytes_data() { if (!_internal_has_bytes_data()) { clear_data(); set_has_bytes_data(); _impl_.data_.bytes_data_ = CreateMaybeMessage< ::milvus::proto::schema::BytesArray >(GetArenaForAllocation()); } return _impl_.data_.bytes_data_; } inline ::milvus::proto::schema::BytesArray* ScalarField::mutable_bytes_data() { ::milvus::proto::schema::BytesArray* _msg = _internal_mutable_bytes_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.bytes_data) return _msg; } // .milvus.proto.schema.ArrayArray array_data = 8; inline bool ScalarField::_internal_has_array_data() const { return data_case() == kArrayData; } inline bool ScalarField::has_array_data() const { return _internal_has_array_data(); } inline void ScalarField::set_has_array_data() { _impl_._oneof_case_[0] = kArrayData; } inline void ScalarField::clear_array_data() { if (_internal_has_array_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.array_data_; } clear_has_data(); } } inline ::milvus::proto::schema::ArrayArray* ScalarField::release_array_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.array_data) if (_internal_has_array_data()) { clear_has_data(); ::milvus::proto::schema::ArrayArray* temp = _impl_.data_.array_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.array_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::ArrayArray& ScalarField::_internal_array_data() const { return _internal_has_array_data() ? *_impl_.data_.array_data_ : reinterpret_cast< ::milvus::proto::schema::ArrayArray&>(::milvus::proto::schema::_ArrayArray_default_instance_); } inline const ::milvus::proto::schema::ArrayArray& ScalarField::array_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.array_data) return _internal_array_data(); } inline ::milvus::proto::schema::ArrayArray* ScalarField::unsafe_arena_release_array_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.array_data) if (_internal_has_array_data()) { clear_has_data(); ::milvus::proto::schema::ArrayArray* temp = _impl_.data_.array_data_; _impl_.data_.array_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_array_data(::milvus::proto::schema::ArrayArray* array_data) { clear_data(); if (array_data) { set_has_array_data(); _impl_.data_.array_data_ = array_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.array_data) } inline ::milvus::proto::schema::ArrayArray* ScalarField::_internal_mutable_array_data() { if (!_internal_has_array_data()) { clear_data(); set_has_array_data(); _impl_.data_.array_data_ = CreateMaybeMessage< ::milvus::proto::schema::ArrayArray >(GetArenaForAllocation()); } return _impl_.data_.array_data_; } inline ::milvus::proto::schema::ArrayArray* ScalarField::mutable_array_data() { ::milvus::proto::schema::ArrayArray* _msg = _internal_mutable_array_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.array_data) return _msg; } // .milvus.proto.schema.JSONArray json_data = 9; inline bool ScalarField::_internal_has_json_data() const { return data_case() == kJsonData; } inline bool ScalarField::has_json_data() const { return _internal_has_json_data(); } inline void ScalarField::set_has_json_data() { _impl_._oneof_case_[0] = kJsonData; } inline void ScalarField::clear_json_data() { if (_internal_has_json_data()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.json_data_; } clear_has_data(); } } inline ::milvus::proto::schema::JSONArray* ScalarField::release_json_data() { // @@protoc_insertion_point(field_release:milvus.proto.schema.ScalarField.json_data) if (_internal_has_json_data()) { clear_has_data(); ::milvus::proto::schema::JSONArray* temp = _impl_.data_.json_data_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.json_data_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::JSONArray& ScalarField::_internal_json_data() const { return _internal_has_json_data() ? *_impl_.data_.json_data_ : reinterpret_cast< ::milvus::proto::schema::JSONArray&>(::milvus::proto::schema::_JSONArray_default_instance_); } inline const ::milvus::proto::schema::JSONArray& ScalarField::json_data() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.ScalarField.json_data) return _internal_json_data(); } inline ::milvus::proto::schema::JSONArray* ScalarField::unsafe_arena_release_json_data() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.ScalarField.json_data) if (_internal_has_json_data()) { clear_has_data(); ::milvus::proto::schema::JSONArray* temp = _impl_.data_.json_data_; _impl_.data_.json_data_ = nullptr; return temp; } else { return nullptr; } } inline void ScalarField::unsafe_arena_set_allocated_json_data(::milvus::proto::schema::JSONArray* json_data) { clear_data(); if (json_data) { set_has_json_data(); _impl_.data_.json_data_ = json_data; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.ScalarField.json_data) } inline ::milvus::proto::schema::JSONArray* ScalarField::_internal_mutable_json_data() { if (!_internal_has_json_data()) { clear_data(); set_has_json_data(); _impl_.data_.json_data_ = CreateMaybeMessage< ::milvus::proto::schema::JSONArray >(GetArenaForAllocation()); } return _impl_.data_.json_data_; } inline ::milvus::proto::schema::JSONArray* ScalarField::mutable_json_data() { ::milvus::proto::schema::JSONArray* _msg = _internal_mutable_json_data(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.ScalarField.json_data) return _msg; } inline bool ScalarField::has_data() const { return data_case() != DATA_NOT_SET; } inline void ScalarField::clear_has_data() { _impl_._oneof_case_[0] = DATA_NOT_SET; } inline ScalarField::DataCase ScalarField::data_case() const { return ScalarField::DataCase(_impl_._oneof_case_[0]); } // ------------------------------------------------------------------- // VectorField // int64 dim = 1; inline void VectorField::clear_dim() { _impl_.dim_ = int64_t{0}; } inline int64_t VectorField::_internal_dim() const { return _impl_.dim_; } inline int64_t VectorField::dim() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.VectorField.dim) return _internal_dim(); } inline void VectorField::_internal_set_dim(int64_t value) { _impl_.dim_ = value; } inline void VectorField::set_dim(int64_t value) { _internal_set_dim(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.VectorField.dim) } // .milvus.proto.schema.FloatArray float_vector = 2; inline bool VectorField::_internal_has_float_vector() const { return data_case() == kFloatVector; } inline bool VectorField::has_float_vector() const { return _internal_has_float_vector(); } inline void VectorField::set_has_float_vector() { _impl_._oneof_case_[0] = kFloatVector; } inline void VectorField::clear_float_vector() { if (_internal_has_float_vector()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.data_.float_vector_; } clear_has_data(); } } inline ::milvus::proto::schema::FloatArray* VectorField::release_float_vector() { // @@protoc_insertion_point(field_release:milvus.proto.schema.VectorField.float_vector) if (_internal_has_float_vector()) { clear_has_data(); ::milvus::proto::schema::FloatArray* temp = _impl_.data_.float_vector_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.data_.float_vector_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::FloatArray& VectorField::_internal_float_vector() const { return _internal_has_float_vector() ? *_impl_.data_.float_vector_ : reinterpret_cast< ::milvus::proto::schema::FloatArray&>(::milvus::proto::schema::_FloatArray_default_instance_); } inline const ::milvus::proto::schema::FloatArray& VectorField::float_vector() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.VectorField.float_vector) return _internal_float_vector(); } inline ::milvus::proto::schema::FloatArray* VectorField::unsafe_arena_release_float_vector() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.VectorField.float_vector) if (_internal_has_float_vector()) { clear_has_data(); ::milvus::proto::schema::FloatArray* temp = _impl_.data_.float_vector_; _impl_.data_.float_vector_ = nullptr; return temp; } else { return nullptr; } } inline void VectorField::unsafe_arena_set_allocated_float_vector(::milvus::proto::schema::FloatArray* float_vector) { clear_data(); if (float_vector) { set_has_float_vector(); _impl_.data_.float_vector_ = float_vector; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.VectorField.float_vector) } inline ::milvus::proto::schema::FloatArray* VectorField::_internal_mutable_float_vector() { if (!_internal_has_float_vector()) { clear_data(); set_has_float_vector(); _impl_.data_.float_vector_ = CreateMaybeMessage< ::milvus::proto::schema::FloatArray >(GetArenaForAllocation()); } return _impl_.data_.float_vector_; } inline ::milvus::proto::schema::FloatArray* VectorField::mutable_float_vector() { ::milvus::proto::schema::FloatArray* _msg = _internal_mutable_float_vector(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.VectorField.float_vector) return _msg; } // bytes binary_vector = 3; inline bool VectorField::_internal_has_binary_vector() const { return data_case() == kBinaryVector; } inline bool VectorField::has_binary_vector() const { return _internal_has_binary_vector(); } inline void VectorField::set_has_binary_vector() { _impl_._oneof_case_[0] = kBinaryVector; } inline void VectorField::clear_binary_vector() { if (_internal_has_binary_vector()) { _impl_.data_.binary_vector_.Destroy(); clear_has_data(); } } inline const std::string& VectorField::binary_vector() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.VectorField.binary_vector) return _internal_binary_vector(); } template <typename ArgT0, typename... ArgT> inline void VectorField::set_binary_vector(ArgT0&& arg0, ArgT... args) { if (!_internal_has_binary_vector()) { clear_data(); set_has_binary_vector(); _impl_.data_.binary_vector_.InitDefault(); } _impl_.data_.binary_vector_.SetBytes( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.VectorField.binary_vector) } inline std::string* VectorField::mutable_binary_vector() { std::string* _s = _internal_mutable_binary_vector(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.VectorField.binary_vector) return _s; } inline const std::string& VectorField::_internal_binary_vector() const { if (_internal_has_binary_vector()) { return _impl_.data_.binary_vector_.Get(); } return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); } inline void VectorField::_internal_set_binary_vector(const std::string& value) { if (!_internal_has_binary_vector()) { clear_data(); set_has_binary_vector(); _impl_.data_.binary_vector_.InitDefault(); } _impl_.data_.binary_vector_.Set(value, GetArenaForAllocation()); } inline std::string* VectorField::_internal_mutable_binary_vector() { if (!_internal_has_binary_vector()) { clear_data(); set_has_binary_vector(); _impl_.data_.binary_vector_.InitDefault(); } return _impl_.data_.binary_vector_.Mutable( GetArenaForAllocation()); } inline std::string* VectorField::release_binary_vector() { // @@protoc_insertion_point(field_release:milvus.proto.schema.VectorField.binary_vector) if (_internal_has_binary_vector()) { clear_has_data(); return _impl_.data_.binary_vector_.Release(); } else { return nullptr; } } inline void VectorField::set_allocated_binary_vector(std::string* binary_vector) { if (has_data()) { clear_data(); } if (binary_vector != nullptr) { set_has_binary_vector(); _impl_.data_.binary_vector_.InitAllocated(binary_vector, GetArenaForAllocation()); } // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.VectorField.binary_vector) } // bytes float16_vector = 4; inline bool VectorField::_internal_has_float16_vector() const { return data_case() == kFloat16Vector; } inline bool VectorField::has_float16_vector() const { return _internal_has_float16_vector(); } inline void VectorField::set_has_float16_vector() { _impl_._oneof_case_[0] = kFloat16Vector; } inline void VectorField::clear_float16_vector() { if (_internal_has_float16_vector()) { _impl_.data_.float16_vector_.Destroy(); clear_has_data(); } } inline const std::string& VectorField::float16_vector() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.VectorField.float16_vector) return _internal_float16_vector(); } template <typename ArgT0, typename... ArgT> inline void VectorField::set_float16_vector(ArgT0&& arg0, ArgT... args) { if (!_internal_has_float16_vector()) { clear_data(); set_has_float16_vector(); _impl_.data_.float16_vector_.InitDefault(); } _impl_.data_.float16_vector_.SetBytes( static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.VectorField.float16_vector) } inline std::string* VectorField::mutable_float16_vector() { std::string* _s = _internal_mutable_float16_vector(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.VectorField.float16_vector) return _s; } inline const std::string& VectorField::_internal_float16_vector() const { if (_internal_has_float16_vector()) { return _impl_.data_.float16_vector_.Get(); } return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); } inline void VectorField::_internal_set_float16_vector(const std::string& value) { if (!_internal_has_float16_vector()) { clear_data(); set_has_float16_vector(); _impl_.data_.float16_vector_.InitDefault(); } _impl_.data_.float16_vector_.Set(value, GetArenaForAllocation()); } inline std::string* VectorField::_internal_mutable_float16_vector() { if (!_internal_has_float16_vector()) { clear_data(); set_has_float16_vector(); _impl_.data_.float16_vector_.InitDefault(); } return _impl_.data_.float16_vector_.Mutable( GetArenaForAllocation()); } inline std::string* VectorField::release_float16_vector() { // @@protoc_insertion_point(field_release:milvus.proto.schema.VectorField.float16_vector) if (_internal_has_float16_vector()) { clear_has_data(); return _impl_.data_.float16_vector_.Release(); } else { return nullptr; } } inline void VectorField::set_allocated_float16_vector(std::string* float16_vector) { if (has_data()) { clear_data(); } if (float16_vector != nullptr) { set_has_float16_vector(); _impl_.data_.float16_vector_.InitAllocated(float16_vector, GetArenaForAllocation()); } // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.VectorField.float16_vector) } inline bool VectorField::has_data() const { return data_case() != DATA_NOT_SET; } inline void VectorField::clear_has_data() { _impl_._oneof_case_[0] = DATA_NOT_SET; } inline VectorField::DataCase VectorField::data_case() const { return VectorField::DataCase(_impl_._oneof_case_[0]); } // ------------------------------------------------------------------- // FieldData // .milvus.proto.schema.DataType type = 1; inline void FieldData::clear_type() { _impl_.type_ = 0; } inline ::milvus::proto::schema::DataType FieldData::_internal_type() const { return static_cast< ::milvus::proto::schema::DataType >(_impl_.type_); } inline ::milvus::proto::schema::DataType FieldData::type() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.type) return _internal_type(); } inline void FieldData::_internal_set_type(::milvus::proto::schema::DataType value) { _impl_.type_ = value; } inline void FieldData::set_type(::milvus::proto::schema::DataType value) { _internal_set_type(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldData.type) } // string field_name = 2; inline void FieldData::clear_field_name() { _impl_.field_name_.ClearToEmpty(); } inline const std::string& FieldData::field_name() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.field_name) return _internal_field_name(); } template <typename ArgT0, typename... ArgT> inline PROTOBUF_ALWAYS_INLINE void FieldData::set_field_name(ArgT0&& arg0, ArgT... args) { _impl_.field_name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation()); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldData.field_name) } inline std::string* FieldData::mutable_field_name() { std::string* _s = _internal_mutable_field_name(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldData.field_name) return _s; } inline const std::string& FieldData::_internal_field_name() const { return _impl_.field_name_.Get(); } inline void FieldData::_internal_set_field_name(const std::string& value) { _impl_.field_name_.Set(value, GetArenaForAllocation()); } inline std::string* FieldData::_internal_mutable_field_name() { return _impl_.field_name_.Mutable(GetArenaForAllocation()); } inline std::string* FieldData::release_field_name() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldData.field_name) return _impl_.field_name_.Release(); } inline void FieldData::set_allocated_field_name(std::string* field_name) { if (field_name != nullptr) { } else { } _impl_.field_name_.SetAllocated(field_name, GetArenaForAllocation()); #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING if (_impl_.field_name_.IsDefault()) { _impl_.field_name_.Set("", GetArenaForAllocation()); } #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.FieldData.field_name) } // .milvus.proto.schema.ScalarField scalars = 3; inline bool FieldData::_internal_has_scalars() const { return field_case() == kScalars; } inline bool FieldData::has_scalars() const { return _internal_has_scalars(); } inline void FieldData::set_has_scalars() { _impl_._oneof_case_[0] = kScalars; } inline void FieldData::clear_scalars() { if (_internal_has_scalars()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.field_.scalars_; } clear_has_field(); } } inline ::milvus::proto::schema::ScalarField* FieldData::release_scalars() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldData.scalars) if (_internal_has_scalars()) { clear_has_field(); ::milvus::proto::schema::ScalarField* temp = _impl_.field_.scalars_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.field_.scalars_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::ScalarField& FieldData::_internal_scalars() const { return _internal_has_scalars() ? *_impl_.field_.scalars_ : reinterpret_cast< ::milvus::proto::schema::ScalarField&>(::milvus::proto::schema::_ScalarField_default_instance_); } inline const ::milvus::proto::schema::ScalarField& FieldData::scalars() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.scalars) return _internal_scalars(); } inline ::milvus::proto::schema::ScalarField* FieldData::unsafe_arena_release_scalars() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.FieldData.scalars) if (_internal_has_scalars()) { clear_has_field(); ::milvus::proto::schema::ScalarField* temp = _impl_.field_.scalars_; _impl_.field_.scalars_ = nullptr; return temp; } else { return nullptr; } } inline void FieldData::unsafe_arena_set_allocated_scalars(::milvus::proto::schema::ScalarField* scalars) { clear_field(); if (scalars) { set_has_scalars(); _impl_.field_.scalars_ = scalars; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.FieldData.scalars) } inline ::milvus::proto::schema::ScalarField* FieldData::_internal_mutable_scalars() { if (!_internal_has_scalars()) { clear_field(); set_has_scalars(); _impl_.field_.scalars_ = CreateMaybeMessage< ::milvus::proto::schema::ScalarField >(GetArenaForAllocation()); } return _impl_.field_.scalars_; } inline ::milvus::proto::schema::ScalarField* FieldData::mutable_scalars() { ::milvus::proto::schema::ScalarField* _msg = _internal_mutable_scalars(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldData.scalars) return _msg; } // .milvus.proto.schema.VectorField vectors = 4; inline bool FieldData::_internal_has_vectors() const { return field_case() == kVectors; } inline bool FieldData::has_vectors() const { return _internal_has_vectors(); } inline void FieldData::set_has_vectors() { _impl_._oneof_case_[0] = kVectors; } inline void FieldData::clear_vectors() { if (_internal_has_vectors()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.field_.vectors_; } clear_has_field(); } } inline ::milvus::proto::schema::VectorField* FieldData::release_vectors() { // @@protoc_insertion_point(field_release:milvus.proto.schema.FieldData.vectors) if (_internal_has_vectors()) { clear_has_field(); ::milvus::proto::schema::VectorField* temp = _impl_.field_.vectors_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.field_.vectors_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::VectorField& FieldData::_internal_vectors() const { return _internal_has_vectors() ? *_impl_.field_.vectors_ : reinterpret_cast< ::milvus::proto::schema::VectorField&>(::milvus::proto::schema::_VectorField_default_instance_); } inline const ::milvus::proto::schema::VectorField& FieldData::vectors() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.vectors) return _internal_vectors(); } inline ::milvus::proto::schema::VectorField* FieldData::unsafe_arena_release_vectors() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.FieldData.vectors) if (_internal_has_vectors()) { clear_has_field(); ::milvus::proto::schema::VectorField* temp = _impl_.field_.vectors_; _impl_.field_.vectors_ = nullptr; return temp; } else { return nullptr; } } inline void FieldData::unsafe_arena_set_allocated_vectors(::milvus::proto::schema::VectorField* vectors) { clear_field(); if (vectors) { set_has_vectors(); _impl_.field_.vectors_ = vectors; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.FieldData.vectors) } inline ::milvus::proto::schema::VectorField* FieldData::_internal_mutable_vectors() { if (!_internal_has_vectors()) { clear_field(); set_has_vectors(); _impl_.field_.vectors_ = CreateMaybeMessage< ::milvus::proto::schema::VectorField >(GetArenaForAllocation()); } return _impl_.field_.vectors_; } inline ::milvus::proto::schema::VectorField* FieldData::mutable_vectors() { ::milvus::proto::schema::VectorField* _msg = _internal_mutable_vectors(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.FieldData.vectors) return _msg; } // int64 field_id = 5; inline void FieldData::clear_field_id() { _impl_.field_id_ = int64_t{0}; } inline int64_t FieldData::_internal_field_id() const { return _impl_.field_id_; } inline int64_t FieldData::field_id() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.field_id) return _internal_field_id(); } inline void FieldData::_internal_set_field_id(int64_t value) { _impl_.field_id_ = value; } inline void FieldData::set_field_id(int64_t value) { _internal_set_field_id(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldData.field_id) } // bool is_dynamic = 6; inline void FieldData::clear_is_dynamic() { _impl_.is_dynamic_ = false; } inline bool FieldData::_internal_is_dynamic() const { return _impl_.is_dynamic_; } inline bool FieldData::is_dynamic() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.FieldData.is_dynamic) return _internal_is_dynamic(); } inline void FieldData::_internal_set_is_dynamic(bool value) { _impl_.is_dynamic_ = value; } inline void FieldData::set_is_dynamic(bool value) { _internal_set_is_dynamic(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.FieldData.is_dynamic) } inline bool FieldData::has_field() const { return field_case() != FIELD_NOT_SET; } inline void FieldData::clear_has_field() { _impl_._oneof_case_[0] = FIELD_NOT_SET; } inline FieldData::FieldCase FieldData::field_case() const { return FieldData::FieldCase(_impl_._oneof_case_[0]); } // ------------------------------------------------------------------- // IDs // .milvus.proto.schema.LongArray int_id = 1; inline bool IDs::_internal_has_int_id() const { return id_field_case() == kIntId; } inline bool IDs::has_int_id() const { return _internal_has_int_id(); } inline void IDs::set_has_int_id() { _impl_._oneof_case_[0] = kIntId; } inline void IDs::clear_int_id() { if (_internal_has_int_id()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.id_field_.int_id_; } clear_has_id_field(); } } inline ::milvus::proto::schema::LongArray* IDs::release_int_id() { // @@protoc_insertion_point(field_release:milvus.proto.schema.IDs.int_id) if (_internal_has_int_id()) { clear_has_id_field(); ::milvus::proto::schema::LongArray* temp = _impl_.id_field_.int_id_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.id_field_.int_id_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::LongArray& IDs::_internal_int_id() const { return _internal_has_int_id() ? *_impl_.id_field_.int_id_ : reinterpret_cast< ::milvus::proto::schema::LongArray&>(::milvus::proto::schema::_LongArray_default_instance_); } inline const ::milvus::proto::schema::LongArray& IDs::int_id() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.IDs.int_id) return _internal_int_id(); } inline ::milvus::proto::schema::LongArray* IDs::unsafe_arena_release_int_id() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.IDs.int_id) if (_internal_has_int_id()) { clear_has_id_field(); ::milvus::proto::schema::LongArray* temp = _impl_.id_field_.int_id_; _impl_.id_field_.int_id_ = nullptr; return temp; } else { return nullptr; } } inline void IDs::unsafe_arena_set_allocated_int_id(::milvus::proto::schema::LongArray* int_id) { clear_id_field(); if (int_id) { set_has_int_id(); _impl_.id_field_.int_id_ = int_id; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.IDs.int_id) } inline ::milvus::proto::schema::LongArray* IDs::_internal_mutable_int_id() { if (!_internal_has_int_id()) { clear_id_field(); set_has_int_id(); _impl_.id_field_.int_id_ = CreateMaybeMessage< ::milvus::proto::schema::LongArray >(GetArenaForAllocation()); } return _impl_.id_field_.int_id_; } inline ::milvus::proto::schema::LongArray* IDs::mutable_int_id() { ::milvus::proto::schema::LongArray* _msg = _internal_mutable_int_id(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.IDs.int_id) return _msg; } // .milvus.proto.schema.StringArray str_id = 2; inline bool IDs::_internal_has_str_id() const { return id_field_case() == kStrId; } inline bool IDs::has_str_id() const { return _internal_has_str_id(); } inline void IDs::set_has_str_id() { _impl_._oneof_case_[0] = kStrId; } inline void IDs::clear_str_id() { if (_internal_has_str_id()) { if (GetArenaForAllocation() == nullptr) { delete _impl_.id_field_.str_id_; } clear_has_id_field(); } } inline ::milvus::proto::schema::StringArray* IDs::release_str_id() { // @@protoc_insertion_point(field_release:milvus.proto.schema.IDs.str_id) if (_internal_has_str_id()) { clear_has_id_field(); ::milvus::proto::schema::StringArray* temp = _impl_.id_field_.str_id_; if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } _impl_.id_field_.str_id_ = nullptr; return temp; } else { return nullptr; } } inline const ::milvus::proto::schema::StringArray& IDs::_internal_str_id() const { return _internal_has_str_id() ? *_impl_.id_field_.str_id_ : reinterpret_cast< ::milvus::proto::schema::StringArray&>(::milvus::proto::schema::_StringArray_default_instance_); } inline const ::milvus::proto::schema::StringArray& IDs::str_id() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.IDs.str_id) return _internal_str_id(); } inline ::milvus::proto::schema::StringArray* IDs::unsafe_arena_release_str_id() { // @@protoc_insertion_point(field_unsafe_arena_release:milvus.proto.schema.IDs.str_id) if (_internal_has_str_id()) { clear_has_id_field(); ::milvus::proto::schema::StringArray* temp = _impl_.id_field_.str_id_; _impl_.id_field_.str_id_ = nullptr; return temp; } else { return nullptr; } } inline void IDs::unsafe_arena_set_allocated_str_id(::milvus::proto::schema::StringArray* str_id) { clear_id_field(); if (str_id) { set_has_str_id(); _impl_.id_field_.str_id_ = str_id; } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.IDs.str_id) } inline ::milvus::proto::schema::StringArray* IDs::_internal_mutable_str_id() { if (!_internal_has_str_id()) { clear_id_field(); set_has_str_id(); _impl_.id_field_.str_id_ = CreateMaybeMessage< ::milvus::proto::schema::StringArray >(GetArenaForAllocation()); } return _impl_.id_field_.str_id_; } inline ::milvus::proto::schema::StringArray* IDs::mutable_str_id() { ::milvus::proto::schema::StringArray* _msg = _internal_mutable_str_id(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.IDs.str_id) return _msg; } inline bool IDs::has_id_field() const { return id_field_case() != ID_FIELD_NOT_SET; } inline void IDs::clear_has_id_field() { _impl_._oneof_case_[0] = ID_FIELD_NOT_SET; } inline IDs::IdFieldCase IDs::id_field_case() const { return IDs::IdFieldCase(_impl_._oneof_case_[0]); } // ------------------------------------------------------------------- // SearchResultData // int64 num_queries = 1; inline void SearchResultData::clear_num_queries() { _impl_.num_queries_ = int64_t{0}; } inline int64_t SearchResultData::_internal_num_queries() const { return _impl_.num_queries_; } inline int64_t SearchResultData::num_queries() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.num_queries) return _internal_num_queries(); } inline void SearchResultData::_internal_set_num_queries(int64_t value) { _impl_.num_queries_ = value; } inline void SearchResultData::set_num_queries(int64_t value) { _internal_set_num_queries(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.num_queries) } // int64 top_k = 2; inline void SearchResultData::clear_top_k() { _impl_.top_k_ = int64_t{0}; } inline int64_t SearchResultData::_internal_top_k() const { return _impl_.top_k_; } inline int64_t SearchResultData::top_k() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.top_k) return _internal_top_k(); } inline void SearchResultData::_internal_set_top_k(int64_t value) { _impl_.top_k_ = value; } inline void SearchResultData::set_top_k(int64_t value) { _internal_set_top_k(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.top_k) } // repeated .milvus.proto.schema.FieldData fields_data = 3; inline int SearchResultData::_internal_fields_data_size() const { return _impl_.fields_data_.size(); } inline int SearchResultData::fields_data_size() const { return _internal_fields_data_size(); } inline void SearchResultData::clear_fields_data() { _impl_.fields_data_.Clear(); } inline ::milvus::proto::schema::FieldData* SearchResultData::mutable_fields_data(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.SearchResultData.fields_data) return _impl_.fields_data_.Mutable(index); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldData >* SearchResultData::mutable_fields_data() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.SearchResultData.fields_data) return &_impl_.fields_data_; } inline const ::milvus::proto::schema::FieldData& SearchResultData::_internal_fields_data(int index) const { return _impl_.fields_data_.Get(index); } inline const ::milvus::proto::schema::FieldData& SearchResultData::fields_data(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.fields_data) return _internal_fields_data(index); } inline ::milvus::proto::schema::FieldData* SearchResultData::_internal_add_fields_data() { return _impl_.fields_data_.Add(); } inline ::milvus::proto::schema::FieldData* SearchResultData::add_fields_data() { ::milvus::proto::schema::FieldData* _add = _internal_add_fields_data(); // @@protoc_insertion_point(field_add:milvus.proto.schema.SearchResultData.fields_data) return _add; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::milvus::proto::schema::FieldData >& SearchResultData::fields_data() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.SearchResultData.fields_data) return _impl_.fields_data_; } // repeated float scores = 4; inline int SearchResultData::_internal_scores_size() const { return _impl_.scores_.size(); } inline int SearchResultData::scores_size() const { return _internal_scores_size(); } inline void SearchResultData::clear_scores() { _impl_.scores_.Clear(); } inline float SearchResultData::_internal_scores(int index) const { return _impl_.scores_.Get(index); } inline float SearchResultData::scores(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.scores) return _internal_scores(index); } inline void SearchResultData::set_scores(int index, float value) { _impl_.scores_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.scores) } inline void SearchResultData::_internal_add_scores(float value) { _impl_.scores_.Add(value); } inline void SearchResultData::add_scores(float value) { _internal_add_scores(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.SearchResultData.scores) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& SearchResultData::_internal_scores() const { return _impl_.scores_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >& SearchResultData::scores() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.SearchResultData.scores) return _internal_scores(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* SearchResultData::_internal_mutable_scores() { return &_impl_.scores_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< float >* SearchResultData::mutable_scores() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.SearchResultData.scores) return _internal_mutable_scores(); } // .milvus.proto.schema.IDs ids = 5; inline bool SearchResultData::_internal_has_ids() const { return this != internal_default_instance() && _impl_.ids_ != nullptr; } inline bool SearchResultData::has_ids() const { return _internal_has_ids(); } inline void SearchResultData::clear_ids() { if (GetArenaForAllocation() == nullptr && _impl_.ids_ != nullptr) { delete _impl_.ids_; } _impl_.ids_ = nullptr; } inline const ::milvus::proto::schema::IDs& SearchResultData::_internal_ids() const { const ::milvus::proto::schema::IDs* p = _impl_.ids_; return p != nullptr ? *p : reinterpret_cast<const ::milvus::proto::schema::IDs&>( ::milvus::proto::schema::_IDs_default_instance_); } inline const ::milvus::proto::schema::IDs& SearchResultData::ids() const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.ids) return _internal_ids(); } inline void SearchResultData::unsafe_arena_set_allocated_ids( ::milvus::proto::schema::IDs* ids) { if (GetArenaForAllocation() == nullptr) { delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.ids_); } _impl_.ids_ = ids; if (ids) { } else { } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:milvus.proto.schema.SearchResultData.ids) } inline ::milvus::proto::schema::IDs* SearchResultData::release_ids() { ::milvus::proto::schema::IDs* temp = _impl_.ids_; _impl_.ids_ = nullptr; #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); if (GetArenaForAllocation() == nullptr) { delete old; } #else // PROTOBUF_FORCE_COPY_IN_RELEASE if (GetArenaForAllocation() != nullptr) { temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); } #endif // !PROTOBUF_FORCE_COPY_IN_RELEASE return temp; } inline ::milvus::proto::schema::IDs* SearchResultData::unsafe_arena_release_ids() { // @@protoc_insertion_point(field_release:milvus.proto.schema.SearchResultData.ids) ::milvus::proto::schema::IDs* temp = _impl_.ids_; _impl_.ids_ = nullptr; return temp; } inline ::milvus::proto::schema::IDs* SearchResultData::_internal_mutable_ids() { if (_impl_.ids_ == nullptr) { auto* p = CreateMaybeMessage<::milvus::proto::schema::IDs>(GetArenaForAllocation()); _impl_.ids_ = p; } return _impl_.ids_; } inline ::milvus::proto::schema::IDs* SearchResultData::mutable_ids() { ::milvus::proto::schema::IDs* _msg = _internal_mutable_ids(); // @@protoc_insertion_point(field_mutable:milvus.proto.schema.SearchResultData.ids) return _msg; } inline void SearchResultData::set_allocated_ids(::milvus::proto::schema::IDs* ids) { ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); if (message_arena == nullptr) { delete _impl_.ids_; } if (ids) { ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(ids); if (message_arena != submessage_arena) { ids = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( message_arena, ids, submessage_arena); } } else { } _impl_.ids_ = ids; // @@protoc_insertion_point(field_set_allocated:milvus.proto.schema.SearchResultData.ids) } // repeated int64 topks = 6; inline int SearchResultData::_internal_topks_size() const { return _impl_.topks_.size(); } inline int SearchResultData::topks_size() const { return _internal_topks_size(); } inline void SearchResultData::clear_topks() { _impl_.topks_.Clear(); } inline int64_t SearchResultData::_internal_topks(int index) const { return _impl_.topks_.Get(index); } inline int64_t SearchResultData::topks(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.topks) return _internal_topks(index); } inline void SearchResultData::set_topks(int index, int64_t value) { _impl_.topks_.Set(index, value); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.topks) } inline void SearchResultData::_internal_add_topks(int64_t value) { _impl_.topks_.Add(value); } inline void SearchResultData::add_topks(int64_t value) { _internal_add_topks(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.SearchResultData.topks) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& SearchResultData::_internal_topks() const { return _impl_.topks_; } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >& SearchResultData::topks() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.SearchResultData.topks) return _internal_topks(); } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* SearchResultData::_internal_mutable_topks() { return &_impl_.topks_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int64_t >* SearchResultData::mutable_topks() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.SearchResultData.topks) return _internal_mutable_topks(); } // repeated string output_fields = 7; inline int SearchResultData::_internal_output_fields_size() const { return _impl_.output_fields_.size(); } inline int SearchResultData::output_fields_size() const { return _internal_output_fields_size(); } inline void SearchResultData::clear_output_fields() { _impl_.output_fields_.Clear(); } inline std::string* SearchResultData::add_output_fields() { std::string* _s = _internal_add_output_fields(); // @@protoc_insertion_point(field_add_mutable:milvus.proto.schema.SearchResultData.output_fields) return _s; } inline const std::string& SearchResultData::_internal_output_fields(int index) const { return _impl_.output_fields_.Get(index); } inline const std::string& SearchResultData::output_fields(int index) const { // @@protoc_insertion_point(field_get:milvus.proto.schema.SearchResultData.output_fields) return _internal_output_fields(index); } inline std::string* SearchResultData::mutable_output_fields(int index) { // @@protoc_insertion_point(field_mutable:milvus.proto.schema.SearchResultData.output_fields) return _impl_.output_fields_.Mutable(index); } inline void SearchResultData::set_output_fields(int index, const std::string& value) { _impl_.output_fields_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::set_output_fields(int index, std::string&& value) { _impl_.output_fields_.Mutable(index)->assign(std::move(value)); // @@protoc_insertion_point(field_set:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::set_output_fields(int index, const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.output_fields_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set_char:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::set_output_fields(int index, const char* value, size_t size) { _impl_.output_fields_.Mutable(index)->assign( reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_set_pointer:milvus.proto.schema.SearchResultData.output_fields) } inline std::string* SearchResultData::_internal_add_output_fields() { return _impl_.output_fields_.Add(); } inline void SearchResultData::add_output_fields(const std::string& value) { _impl_.output_fields_.Add()->assign(value); // @@protoc_insertion_point(field_add:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::add_output_fields(std::string&& value) { _impl_.output_fields_.Add(std::move(value)); // @@protoc_insertion_point(field_add:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::add_output_fields(const char* value) { GOOGLE_DCHECK(value != nullptr); _impl_.output_fields_.Add()->assign(value); // @@protoc_insertion_point(field_add_char:milvus.proto.schema.SearchResultData.output_fields) } inline void SearchResultData::add_output_fields(const char* value, size_t size) { _impl_.output_fields_.Add()->assign(reinterpret_cast<const char*>(value), size); // @@protoc_insertion_point(field_add_pointer:milvus.proto.schema.SearchResultData.output_fields) } inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>& SearchResultData::output_fields() const { // @@protoc_insertion_point(field_list:milvus.proto.schema.SearchResultData.output_fields) return _impl_.output_fields_; } inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string>* SearchResultData::mutable_output_fields() { // @@protoc_insertion_point(field_mutable_list:milvus.proto.schema.SearchResultData.output_fields) return &_impl_.output_fields_; } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) } // namespace schema } // namespace proto } // namespace milvus PROTOBUF_NAMESPACE_OPEN template <> struct is_proto_enum< ::milvus::proto::schema::DataType> : ::std::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::milvus::proto::schema::DataType>() { return ::milvus::proto::schema::DataType_descriptor(); } template <> struct is_proto_enum< ::milvus::proto::schema::FieldState> : ::std::true_type {}; template <> inline const EnumDescriptor* GetEnumDescriptor< ::milvus::proto::schema::FieldState>() { return ::milvus::proto::schema::FieldState_descriptor(); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc> #endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_schema_2eproto
f7bfc87c514a9d27ebb4f23250ad355f818bcccc
325770e648204b9715ade4c446940f46501ec3ea
/2021/RF/Receiver/RF_receiver_RCSwitch_wOLED/RF_receiver_RCSwitch_wOLED.ino
9524445be65a840b142e1f24f281857245201477
[]
no_license
JackBauer76/IOTanks
17e3714a199dda5b91f9f93809e6c499f69c46db
424a4d1ca14a20bccf4e1f131980296b72edd11c
refs/heads/master
2021-12-29T22:40:45.819752
2021-12-28T19:58:41
2021-12-28T19:58:41
161,743,249
1
0
null
2019-01-31T19:06:46
2018-12-14T06:44:35
C++
UTF-8
C++
false
false
1,313
ino
RF_receiver_RCSwitch_wOLED.ino
#include <RCSwitch.h> #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_RESET 4 #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 Adafruit_SSD1306 display(OLED_RESET); RCSwitch mySwitch = RCSwitch(); long value_received; const int LED = 6; void setup() { Serial.begin(9600); mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2 pinMode(LED, OUTPUT); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) } void loop() { if (mySwitch.available()) { value_received = mySwitch.getReceivedValue(); Serial.print("Received "); Serial.print( mySwitch.getReceivedValue() ); Serial.print(" / "); Serial.print( mySwitch.getReceivedBitlength() ); Serial.print("bit "); Serial.print("Protocol: "); Serial.println( mySwitch.getReceivedProtocol() ); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(10,0); display.clearDisplay(); display.println(value_received); display.display(); mySwitch.resetAvailable(); } if (value_received > 5000) { digitalWrite(LED, HIGH); } else { digitalWrite(LED, LOW); } }
76727d4b01a0942b02df19e40958f2b71828974d
26df6604faf41197c9ced34c3df13839be6e74d4
/ext/src/java/awt/geom/IllegalPathStateException.hpp
8e1b6fa141a76232849b968402b61697637cc19e
[ "Apache-2.0" ]
permissive
pebble2015/cpoi
58b4b1e38a7769b13ccfb2973270d15d490de07f
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
refs/heads/master
2021-07-09T09:02:41.986901
2017-10-08T12:12:56
2017-10-08T12:12:56
105,988,119
0
0
null
null
null
null
UTF-8
C++
false
false
771
hpp
IllegalPathStateException.hpp
// Generated from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar #pragma once #include <java/awt/geom/fwd-POI.hpp> #include <java/lang/fwd-POI.hpp> #include <java/lang/RuntimeException.hpp> struct default_init_tag; class java::awt::geom::IllegalPathStateException : public ::java::lang::RuntimeException { public: typedef ::java::lang::RuntimeException super; protected: void ctor(); void ctor(::java::lang::String* s); // Generated public: IllegalPathStateException(); IllegalPathStateException(::java::lang::String* s); protected: IllegalPathStateException(const ::default_init_tag&); public: static ::java::lang::Class *class_(); private: virtual ::java::lang::Class* getClass0(); };
8ee4aad2820d1a9d1dc838e70731611c943272d1
2586504dd635fd0dc8f39514009210b0cd9a72fb
/Code Jam LG/2018 Final/Rectangles.cpp
1dfbd5860d4817f144c64cba73d7c463f996bf9a
[]
no_license
clarkhungson/Algorithm
e746ad7b2377aee55c343691ca686e045ca8ebe3
33e96e9af1f9ec8690ceeafd1c5425365823ed9d
refs/heads/master
2023-06-25T05:07:15.016952
2021-07-21T16:48:53
2021-07-21T16:48:53
368,232,533
0
0
null
null
null
null
UTF-8
C++
false
false
1,227
cpp
Rectangles.cpp
// https://codejam.lge.com/problem/16207 // build: g++ -o Rectangles Rectangles.cpp -std=c++11 && Rectangles #include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include <vector> #include <bits/stdc++.h> #include <algorithm> #include <unordered_map> using namespace std; /* 9 10 3 4 4 4 5 6 6 6 */ void solve() { int N; scanf("%d", &N); vector<int64_t> x; int e; for (int64_t i = 0; i < N; i++) { scanf("%d", &e); x.push_back(e); } sort(x.begin(), x.end()); int64_t sum = 0; bool flag = false; for (int64_t i = N - 1; i > 0; i--) { if (flag == true) { flag = false; continue; } if (x[i - 1] == x[i]) { flag = true; continue; } if (x[i - 1] == x[i] - 1) { x[i] = x[i] - 1; flag = true; continue; } x[i] = 0; } vector<int64_t> y; for (int64_t i = 0; i < N; i++) { if (x[i] != 0) { y.push_back(x[i]); } } for (int64_t i = y.size() - 1; i >= 3; i -= 4) { sum += y[i] * y[i - 2]; } cout << sum << endl; } int main() { solve(); }
d41b8b2da5e7001c6ec88b6a62a1435506956446
2b6366070b9408137f5cfc593b0f6c260b76d022
/NhEast.ino
f5f58312ffcaa3eef1ef69a18752232b199508db
[]
no_license
gciurpita/NhEast
2dd13f9918c0067b61deddef093cf4543617c7bb
1f43e6ca6593ddea57daf6dc2bf5bc708d6ffb70
refs/heads/master
2023-08-23T18:58:05.966010
2021-10-08T11:48:27
2021-10-08T11:48:27
402,087,450
0
0
null
null
null
null
UTF-8
C++
false
false
42,116
ino
NhEast.ino
// New Haven East 3 // Bill's panel program by Geoff Smith w/ correctio // enhanced with serial monitor debugging by gregc const char version [] = "New Haven East 3 211005a"; #include "Wire.h" //For I2R operations with MRC cards byte Input[4]; byte Output = 0; //Chip addresses int chip20 = 0x020; int chip21 = 0x021; int chip22 = 0x022; int chip23 = 0x023; int chip24 = 0x024; int chip25 = 0x025; int portA = 0x012; int portB = 0x013; //Inputs from buttons bool bA1, bA2, bA3, bA4, bA5, bA6; bool bB1, bB2, bB3, bB4, bB5, bB6, bB7, bB8, bB9, bB10, bB11, bB12, bB13; bool bC1, bC2, bC3, bC4, bC5, bC6; bool bD1, bD2, bD3, bD4, bD5, bD6, bX1, bX2; //Output addresses for switch relays int s1N = 0; int s1R = 1; int s2N = 2; int s2R = 3; int s3N = 4; int s3R = 5; int s4N = 6; int s4R = 7; int s5N = 8; int s5R = 9; int s6N = 10; int s6R = 11; int s7N = 12; int s7R = 13; int s8N = 14; int s8R = 15; int s9N = 16; int s9R = 17; int s10N = 18; int s10R = 19; int s11N = 20; int s11R = 21; int s12N = 22; int s12R = 23; int s13N = 24; int s13R = 25; int s14N = 26; int s14R = 27; int s15N = 28; int s15R = 29; int s16N = 30; int s16R = 31; int s17N = 32; int s17R = 33; int s18N = 34; int s18R = 35; int s19N = 36; int s19R = 37; int s20N = 38; int s20R = 39; int s21N = 40; int s21R = 41; int s22N = 42; int s22R = 43; int s23N = 44; int s23R = 45; int s24N = 46; int s24R = 47; int s25N = 48; int s25R = 49; int s26N = 50; int s26R = 51; int s27N = 52; int s27R = 53; int s28N = 54; int s28R = 55; int s29N = 56; int s29R = 57; int LED = 13; bool routeSet = false; // ----------------------------------------------------------------------------- void setup() { Serial.begin(9600); Wire.begin(); //start I2C bus //set output ports Wire.beginTransmission(chip22); Wire.write(0x00); //IODIRA register Wire.write(0x00); //set port A to outputs Wire.endTransmission(); Wire.beginTransmission(chip22); Wire.write(0x01); //IODIRB register Wire.write(0x00); //set port B to outputs Wire.endTransmission(); Wire.beginTransmission(chip23); Wire.write(0x00); Wire.write(0x00); Wire.endTransmission(); Wire.beginTransmission(chip23); Wire.write(0x01); Wire.write(0x00); Wire.endTransmission(); Wire.beginTransmission(chip24); Wire.write(0x00); Wire.write(0x00); Wire.endTransmission(); Wire.beginTransmission(chip24); Wire.write(0x01); Wire.write(0x00); Wire.endTransmission(); Wire.beginTransmission(chip25); Wire.write(0x00); Wire.write(0x00); Wire.endTransmission(); Wire.beginTransmission(chip25); Wire.write(0x01); Wire.write(0x00); Wire.endTransmission(); //Set pullup resistors on inputs Wire.beginTransmission(chip20); Wire.write(0x0C); // GPPUA register Wire.write(0xFF); // turn on pullups Wire.endTransmission(); Wire.beginTransmission(chip20); Wire.write(0x0D); // GPPUB register Wire.write(0xFF); // turn on pullups Wire.endTransmission(); Wire.beginTransmission(chip21); Wire.write(0x0C); // GPPUA register Wire.write(0xFF); // turn on pullups Wire.endTransmission(); Wire.beginTransmission(chip21); Wire.write(0x0D); // GPPUB register Wire.write(0xFF); // turn on pullups Wire.endTransmission(); pinMode(A0, INPUT_PULLUP); //Arduino pins A0 and A1 are additional digital inputs pinMode(A1, INPUT_PULLUP); pinMode(LED, OUTPUT); //LED pin Serial.println (version); } // ----------------------------------------------------------------------------- byte ReadPort(int chip, int port) { Wire.beginTransmission(chip); Wire.write(port); Wire.endTransmission(); Wire.requestFrom(chip, 1); //get 1 byte return Wire.read(); } // ----------------------------------------------------------------------------- void readButtons() { Input[0] = ReadPort(chip20, portB); //Inputs from MRC boards Input[1] = ReadPort(chip20, portA); Input[2] = ReadPort(chip21, portB); Input[3] = ReadPort(chip21, portA); bA1 = !bitRead(Input[0], 7); //break out individual buttons from port bytes bA2 = !bitRead(Input[0], 6); bA3 = !bitRead(Input[0], 5); bA4 = !bitRead(Input[0], 4); bA5 = !bitRead(Input[0], 3); bA6 = !bitRead(Input[0], 2); bB2 = !bitRead(Input[0], 1); bB3 = !bitRead(Input[0], 0); bB4 = !bitRead(Input[1], 7); bB5 = !bitRead(Input[1], 6); bB6 = !bitRead(Input[1], 5); bB7 = !bitRead(Input[1], 4); bB8 = !bitRead(Input[1], 3); bB9 = !bitRead(Input[1], 2); bB10 = !bitRead(Input[1], 1); bB11 = !bitRead(Input[1], 0); bB12 = !bitRead(Input[2], 7); bB13 = !bitRead(Input[2], 6); bB1 = !bitRead(Input[2], 5); bC1 = !bitRead(Input[2], 4); bC2 = !bitRead(Input[2], 3); bC3 = !bitRead(Input[2], 2); bC4 = !bitRead(Input[2], 1); bC5 = !bitRead(Input[2], 0); bC6 = !bitRead(Input[3], 7); bX1 = !bitRead(Input[3], 6); bD6 = !bitRead(Input[3], 5); bD5 = !bitRead(Input[3], 4); bD1 = !bitRead(Input[3], 3); bD2 = !bitRead(Input[3], 2); bD3 = !bitRead(Input[3], 1); bD4 = !bitRead(Input[3], 0); bX2 = !digitalRead(A0); //Input from Arduino pin } // ----------------------------------------------------------------------------- void debounce() //second read of buttons { delay(100); readButtons(); } // ----------------------------------------------------------------------------- //relay pulse functions void sendPulse( int chip, int port, byte output ) { Serial.print ("sendPulse: "); Serial.print (chip, HEX); Serial.print (" "); Serial.print (port, HEX); Serial.print (" "); Serial.println (output, HEX); Wire.beginTransmission(chip); Wire.write(port); Wire.write(output); //set pulse bit Wire.endTransmission(); delay(20); //pulse length Wire.beginTransmission(chip); Wire.write(port); Wire.write(0); //clear pulse bit Wire.endTransmission(); delay(20); //interpulse delay } // ----------------------------------------------------------------------------- void pulse( int relay ) { Serial.print ("pulse: "); Serial.println (relay, DEC); Output = 0; bitWrite(Output, relay%8, 1); //set the relevant bit in the byte to be sent if(relay < 8) //then find the right port to send it to sendPulse(chip22, portB, Output); else if(relay > 7 && relay < 16) sendPulse(chip22, portA, Output); else if(relay > 15 && relay < 24) sendPulse(chip23, portB, Output); else if(relay > 23 && relay < 32) sendPulse(chip23, portA, Output); else if(relay > 31 && relay < 40) sendPulse(chip24, portB, Output); else if(relay > 39 && relay < 48) sendPulse(chip24, portA, Output); else if(relay > 47 && relay < 56) sendPulse(chip25, portB, Output); else sendPulse(chip25, portA, Output); } // ----------------------------------------------------------------------------- // process commands from serial monitor void pcRead (void) { static int val = 0; if (Serial.available()) { int c = Serial.read (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': val = c - '0' + (10 * val); Serial.println (val); break; case ' ': val = 0; break; case 'p': pulse (val); val = 0; break; case 'v': Serial.print ("\nversion: "); Serial.println (version); break; default: Serial.print ("unknown: "); Serial.println (c); break; } } } // ----------------------------------------------------------------------------- void loop() { pcRead (); readButtons(); //Routes from A to B-------------------------------- if(bA1 && bB2) //A1 to B2 { if(!routeSet) { debounce(); if(bA1 && bB2) //confirm that buttons still pushed { pulse(s1N); //set selected route routeSet = true; } } } else if(bA1 && bB3) //A1 to B3 { if(!routeSet) { debounce(); if(bA1 && bB3) { pulse(s1R); pulse(s2N); routeSet = true; } } } else if(bA2 && bB3) //A2 to B3 { if(!routeSet) { debounce(); if(bA2 && bB3) { pulse(s2R); pulse(s1N); routeSet = true; } } } else if(bA2 && bB4) //A2 to B4 { if(!routeSet) { debounce(); if(bA2 && bB4) { pulse(s2N); pulse(s3N); routeSet = true; } } } else if(bA3 && bB4) //A3 to B4 { if(!routeSet) { debounce(); if(bA3 && bB4) { pulse(s4N); pulse(s3R); routeSet = true; } } } else if(bA3 && bB5) //A3 to B5 { if(!routeSet) { debounce(); if(bA3 && bB5) { pulse(s4N); pulse(s3N); routeSet = true; } } } else if(bA3 && bB6) //A3 to B6 { if(!routeSet) { debounce(); if(bA3 && bB6) { pulse(s4R); pulse(s5N); routeSet = true; } } } else if(bA4 && bB6) //A4 to B6 { if(!routeSet) { debounce(); if(bA4 && bB6) { pulse(s5R); pulse(s4N); routeSet = true; } } } else if(bA4 && bB7) //A4 to B7 { if(!routeSet) { debounce(); if(bA4 && bB7) { pulse(s5N); routeSet = true; } } } else if(bA5 && bB10) //A5 to B10 { if(!routeSet) { debounce(); if(bA5 && bB10) { pulse(s6N); routeSet = true; } } } else if(bA5 && bB11) //A5 to B11 { if(!routeSet) { debounce(); if(bA5 && bB11) { pulse(s6R); pulse(s7N); routeSet = true; } } } else if(bA6 && bB11) //A6 to B11 { if(!routeSet) { debounce(); if(bA6 && bB11) { pulse(s7R); pulse(s6N); routeSet = true; } } } else if(bA6 && bB12) //A6 to B12 { if(!routeSet) { debounce(); if(bA6 && bB12) { pulse(s7N); routeSet = true; } } } //Routes from B to C----------------------------------------- else if(bB1 && bC1) //B1 to C1 { if(!routeSet) { debounce(); if(bB1 && bC1) { pulse(s15R); routeSet = true; } } } else if(bB2 && bC1) //B2 to C1 { if(!routeSet) { debounce(); if(bB2 && bC1) { pulse(s10N); pulse(s15N); routeSet = true; } } } else if(bB3 && bC1) //B3 to C1 { if(!routeSet) { debounce(); if(bB3 && bC1) { pulse(s10R); pulse(s15N); routeSet = true; } } } else if(bB3 && bC2) //B3 to C2 { if(!routeSet) { debounce(); if(bB3 && bC2) { pulse(s10N); pulse(s11R); pulse(s16N); routeSet = true; } } } else if(bB4 && bC2) //B4 to C2 { if(!routeSet) { debounce(); if(bB4 && bC2) { pulse(s11N); pulse(s16N); routeSet = true; } } } else if(bB5 && bC2) //B5 to C2 { if(!routeSet) { debounce(); if(bB5 && bC2) { pulse(s12N); pulse(s16R); routeSet = true; } } } else if(bB5 && bC3) //B5 to C3 { if(!routeSet) { debounce(); if(bB5 && bC3) { pulse(s12N); pulse(s16N); pulse(s17N); routeSet = true; } } } else if(bB6 && bC2) //B6 to C2 { if(!routeSet) { debounce(); if(bB6 && bC2) { pulse(s8R); pulse(s12R); pulse(s16R); routeSet = true; } } } else if(bB6 && bC3) //B6 to C3 { if(!routeSet) { debounce(); if(bB6 && bC3) { pulse(s8R); pulse(s12R); pulse(s16N); routeSet = true; } } } else if(bB7 && bC2) //B7 to C2 { if(!routeSet) { debounce(); if(bB7 && bC2) //B7 to C2 { pulse(s8N); pulse(s12R); pulse(s16R); routeSet = true; } } } else if(bB7 && bC3) //B7 to C3 { if(!routeSet) { debounce(); if(bB7 && bC3) { pulse(s8N); pulse(s12R); pulse(s16N); pulse(s17N); routeSet = true; } } } else if(bB8 && bC3) //B8 to C3 { if(!routeSet) { debounce(); if(bB8 && bC3) { pulse(s17R); routeSet = true; } } } else if(bB8 && bC4) //B8 to C4 { if(!routeSet) { debounce(); if(bB8 && bC4) { pulse(s17N); pulse(s18N); pulse(s20N); routeSet = true; } } } else if(bB9 && bC4) //B9 to C4 { if(!routeSet) { debounce(); if(bB9 && bC4) { pulse(s14N); pulse(s18R); pulse(s20N); routeSet = true; } } } else if(bB10 && bC4) //B10 to C4 { if(!routeSet) { debounce(); if(bB10 && bC4) { pulse(s14R); pulse(s18R); pulse(s20N); routeSet = true; } } } else if(bB11 && bC4) //B11 to C4 { if(!routeSet) { debounce(); if(bB11 && bC4) { pulse(s9R); pulse(s13N); pulse(s20R); routeSet = true; } } } else if(bB11 && bC5) //B11 to C5 { if(!routeSet) { debounce(); if(bB11 && bC5) { pulse(s9R); pulse(s13N); pulse(s20N); routeSet = true; } } } else if(bB12 && bC4) //B12 to C4 { if(!routeSet) { debounce(); if(bB12 && bC4) { pulse(s9N); pulse(s13N); pulse(s20R); routeSet = true; } } } else if(bB12 && bC5) //B12 to C5 { if(!routeSet) { debounce(); if(bB12 && bC5) { pulse(s9N); pulse(s13N); pulse(s20N); routeSet = true; } } } else if(bB13 && bC4) //B13 to C4 { if(!routeSet) { debounce(); if(bB13 && bC4) { pulse(s13R); pulse(s20R); routeSet = true; } } } else if(bB13 && bC5) //B13 to C5 { if(!routeSet) { debounce(); if(bB13 && bC5) { pulse(s13R); pulse(s20N); routeSet = true; } } } // Routes from C to D---------------------------------------------------------- else if(bC1 && bD1) //C1 to D1 { if(!routeSet) { debounce(); if(bC1 && bD1) { pulse(s19N); pulse(s26N); pulse(s27R); routeSet = true; } } } else if(bC1 && bD2) //C1 to D2 { if(!routeSet) { debounce(); if(bC1 && bD2) { pulse(s19N); pulse(s26N); pulse(s27N); routeSet = true; } } } else if(bC1 && bD3) //C1 to D3 { if(!routeSet) { debounce(); if(bC1 && bD3) { pulse(s19R); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bC1 && bD4) //C1 to D4 { if(!routeSet) { debounce(); if(bC1 && bD4) { pulse(s19R); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bC2 && bD1) //C2 to D1 { if(!routeSet) { debounce(); if(bC2 && bD1) { pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27R); routeSet = true; } } } else if(bC2 && bD2) //C2 to D2 { if(!routeSet) { debounce(); if(bC2 && bD2) { pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bC2 && bD3) //C2 to D3 { if(!routeSet) { debounce(); if(bC2 && bD3) { pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bC2 && bD4) //C2 to D4 { if(!routeSet) { debounce(); if(bC2 && bD4) { pulse(s19N); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bC3 && bD1) //C3 to D1 { if(!routeSet) { debounce(); if(bC3 && bD1) { pulse(s23N); pulse(s24N); pulse(s25R); pulse(s26R); pulse(s27R); routeSet = true; } } } else if(bC3 && bD2) //C3 to D2 { if(!routeSet) { debounce(); if(bC3 && bD2) { pulse(s23N); pulse(s24N); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bC3 && bD3) //C3 to D3 { if(!routeSet) { debounce(); if(bC3 && bD3) { pulse(s23N); pulse(s24N); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bC3 && bD4) //C3 to D4 { if(!routeSet) { debounce(); if(bC3 && bD4) { pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bC4 && bD1) //C4 to D1 { if(!routeSet) { debounce(); if(bC4 && bD1) { pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27R); routeSet = true; } } } else if(bC4 && bD2) //C4 to D2 { if(!routeSet) { debounce(); if(bC4 && bD2) { pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bC4 && bD3) //C4 to D3 { if(!routeSet) { debounce(); if(bC4 && bD3) { pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bC4 && bD4) //C4 to D4 { if(!routeSet) { debounce(); if(bC4 && bD4) { pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bC4 && bD5) //C4 to D5 { if(!routeSet) { debounce(); if(bC4 && bD5) { pulse(s22N); pulse(s24N); // pulse(s28N); // pulse(s29N); routeSet = true; } } } else if(bC5 && bD1) //C5 to D1 { if(!routeSet) { debounce(); if(bC5 && bD1) { pulse(s21N); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27R); routeSet = true; } } } else if(bC5 && bD2) //C5 to D2 { if(!routeSet) { debounce(); if(bC5 && bD2) { pulse(s21N); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bC5 && bD3) //C5 to D3 { if(!routeSet) { debounce(); if(bC5 && bD3) { pulse(s21N); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bC5 && bD4) //C5 to D4 { if(!routeSet) { debounce(); if(bC5 && bD4) { pulse(s21N); pulse(s22R); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bC5 && bD5) //C5 to D5 { if(!routeSet) { debounce(); if(bC5 && bD5) { pulse(s21N); pulse(s22R); pulse(s24N); // pulse(s28N); // pulse(s29N); routeSet =true; } } } else if(bC5 && bD6) //C5 to D6 { if(!routeSet) { debounce(); if(bC5 && bD6) { pulse(s21N); pulse(s22N); // pulse(s28R); // pulse(s29N); routeSet = true; } } } else if(bC6 && bD1) //C6 to D1 { if(!routeSet) { debounce(); if(bC6 && bD1) { pulse(s21R); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27R); routeSet = true; } } } else if(bC6 && bD2) //C6 to D2 { if(!routeSet) { debounce(); if(bC6 && bD2) { pulse(s21R); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bC6 && bD3) //C6 to D3 { if(!routeSet) { debounce(); if(bC6 && bD3) { pulse(s21R); pulse(s22R); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bC6 && bD4) //C6 to D4 { if(!routeSet) { debounce(); if(bC6 && bD4) { pulse(s21R); pulse(s22R); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bC6 && bD5) //C6 to D5 { if(!routeSet) { debounce(); if(bC6 && bD5) { pulse(s21R); pulse(s22R); pulse(s24N); // pulse(s28N); // pulse(s29N); routeSet = true; } } } #if 0 else if(bD5) //D5 { if(!routeSet) { debounce(); if(bD5) { pulse(s28N); pulse(s29N); routeSet = true; } } } #endif else if(bC6 && bD6) //C6 to D6 { if(!routeSet) { debounce(); if(bC6 && bD6) { pulse(s21R); pulse(s22N); // pulse(s28R); // pulse(s29N); routeSet = true; } } } else if(bC6 && bX1) //C6 to X1 { if(!routeSet) { debounce(); if(bC6 && bX1) { pulse(s21N); routeSet = true; } } } //Super routes---------------------------------------------------------- else if(bA1 && bD2) //A1 to D2 { if(!routeSet) { debounce(); if(bA1 && bD2) { pulse(s1N); pulse(s10N); pulse(s15N); pulse(s19N); pulse(s26N); pulse(s27N); routeSet = true; } } } else if(bA1 && bD3) //A1 to D3 { if(!routeSet) { debounce(); if(bA1 && bD3) { pulse(s1N); pulse(s10N); pulse(s15N); pulse(s19R); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bA1 && bD4) //A1 to D4 { if(!routeSet) { debounce(); if(bA1 && bD4) { pulse(s1N); pulse(s10N); pulse(s15N); pulse(s19R); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA2 && bD2) //A2 to D2 { if(!routeSet) { debounce(); if(bA2 && bD2) { pulse(s2N); pulse(s3N); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB3 && bD2) //B3 to D2 { if(!routeSet) { debounce(); if(bB3 && bD2) { pulse(s10R); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB4 && bD2) //B4 to D2 { if(!routeSet) { debounce(); if(bB4 && bD2) { pulse(s10N); pulse(s11R); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bA2 && bD3) //A2 to D3 { { debounce(); if(bA2 && bD3) { pulse(s2N); pulse(s3N); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bB3 && bD3) //B3 to D3 { { debounce(); if(bB3 && bD3) { pulse(s10N); pulse(s11R); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bB4 && bD3) //B4 to D3 { { debounce(); if(bB4 && bD3) { pulse(s10N); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bA2 && bD4) //A2 to D4 { if(!routeSet) { debounce(); if(bA2 && bD4) { pulse(s2N); pulse(s3N); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB3 && bD4) //B3 to D4 { if(!routeSet) { debounce(); if(bB3 && bD4) { pulse(s11R); pulse(s16N); pulse(s19N); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB4 && bD4) //B4 to D4 { if(!routeSet) { debounce(); if(bB4 && bD4) { pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA3 && bD2) //A3 to D2 { if(!routeSet) { debounce(); if(bA3 && bD2) { pulse(s4N); pulse(s3R); pulse(s11N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bA3 && bD3) //A3 to D3 { if(!routeSet) { debounce(); if(bA3 && bD3) { pulse(s4N); pulse(s3R); pulse(s11N); pulse(s12N); pulse(s16N); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bA3 && bD4) //A3 to D4 { if(!routeSet) { debounce(); if(bA3 && bD4) { pulse(s4N); pulse(s3N); pulse(s12N); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB6 && bD2) //B6 to D2 { if(!routeSet) { debounce(); if(bB6 && bD2) { pulse(s8R); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB7 && bD2) //B7 to D2 { if(!routeSet) { debounce(); if(bB7 && bD2) { pulse(s8N); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB6 && bD3) //B6 to D3 { if(!routeSet) { debounce(); if(bB6 && bD3) { pulse(s8R); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bB7 && bD3) //B7 to D3 { if(!routeSet) { debounce(); if(bB7 && bD3) { pulse(s8N); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bB6 && bD4) //B6 to D4 { if(!routeSet) { debounce(); if(bB6 && bD4) { pulse(s8R); pulse(s12R); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB7 && bD4) //B7 to D4 { if(!routeSet) { debounce(); if(bB7 && bD4) { pulse(s8N); pulse(s12R); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA4 && bD4) //A4 to D4 { if(!routeSet) { debounce(); if(bA4 && bD4) { pulse(s5N); pulse(s8N); pulse(s12R); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA4 && bD4) //A4 to D4 { if(!routeSet) { debounce(); if(bA4 && bD4) { pulse(s5N); pulse(s8N); pulse(s12R); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA4 && bD2) //A4 to D2 { if(!routeSet) { debounce(); if(bA4 && bD2) { pulse(s5N); pulse(s8N); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bA4 && bD3) //A4 to D3 { if(!routeSet) { debounce(); if(bA4 && bD3) { pulse(s5N); pulse(s8N); pulse(s12R); pulse(s16R); pulse(s19N); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bA4 && bD4) //A4 to D4 { if(!routeSet) { debounce(); if(bA4 && bD4) { pulse(s5N); pulse(s8N); pulse(s12R); pulse(s16N); pulse(s17N); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bA5 && bB10) //A5 to B10 { if(!routeSet) { debounce(); if(bA5 && bB10) { pulse(s6N); routeSet = true; } } } else if(bA5 && bD2) //A5 to D2 { if(!routeSet) { debounce(); if(bA5 && bD2) { pulse(s6N); pulse(s14R); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bA5 && bD3) //A5 to D3 { if(!routeSet) { debounce(); if(bA5 && bD3) { pulse(s6N); pulse(s14R); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bA5 && bD4) //A5 to D4 { if(!routeSet) { debounce(); if(bA5 && bD4) { pulse(s6N); pulse(s14R); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bA5 && bD5) //A5 to D5 { if(!routeSet) { debounce(); if(bA5 && bD5) { pulse(s6N); pulse(s14R); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bA6 && bD2) //A6 to D2 { if(!routeSet) { debounce(); if(bA6 && bD2) { pulse(s7N); pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB11 && bD2) //B11 to D2 { if(!routeSet) { debounce(); if(bB11 && bD2) { pulse(s9R); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB12 && bD2) //B12 to D2 { if(!routeSet) { debounce(); if(bB12 && bD2) { pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bA6 && bD3) //A6 to D3 { if(!routeSet) { debounce(); if(bA6 && bD3) { pulse(s7N); pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bB11 && bD3) //A6 to D3 { if(!routeSet) { debounce(); if(bB11 && bD3) { pulse(s9R); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bB12 && bD3) //B12 to D3 { if(!routeSet) { debounce(); if(bB12 && bD3) { pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bA6 && bD4) //A6 to D4 { if(!routeSet) { debounce(); if(bA6 && bD4) { pulse(s7N); pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bB11 && bD4) //A6 to D4 { if(!routeSet) { debounce(); if(bB11 && bD4) { pulse(s9R); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bB12 && bD4) //A6 to D4 { if(!routeSet) { debounce(); if(bB12 && bD4) { pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bA6 && bD5) //A6 to D5 { if(!routeSet) { debounce(); if(bA6 && bD5) { pulse(s7N); pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bB11 && bD5) //B11 to D5 { if(!routeSet) { debounce(); if(bB11 && bD5) { pulse(s9R); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bB12 && bD5) //B12 to D5 { if(!routeSet) { debounce(); if(bB12 && bD5) { pulse(s9N); pulse(s13N); pulse(s20R); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bA6 && bD6) //A6 to D6 { if(!routeSet) { debounce(); if(bA6 && bD6) { pulse(s7N); pulse(s9N); pulse(s13N); pulse(s20N); pulse(s22N); pulse(s28R); pulse(s29N); routeSet = true; } } } else if(bB1 && bD2) //B1 to D2 { if(!routeSet) { debounce(); if(bB1 && bD2) { pulse(s15R); pulse(s19N); pulse(s26N); pulse(s27N); routeSet = true; } } } else if(bB1 && bD3) //B1 to D3 { if(!routeSet) { debounce(); if(bB1 && bD3) { pulse(s15R); pulse(s19R); pulse(s23N); pulse(s25N); pulse(s26N); routeSet = true; } } } else if(bB1 && bD4) //B1 to D4 { if(!routeSet) { debounce(); if(bB1 && bD4) { pulse(s15R); pulse(s19R); pulse(s23R); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB8 && bD2) { if(!routeSet) { debounce(); if(bB8 && bD2) { pulse(s17R); pulse(s23N); pulse(s24N); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB8 && bD3) //B8 to D3 { if(!routeSet) { debounce(); if(bB8 && bD3) { pulse(s17R); pulse(s23N); pulse(s24N); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bB8 && bD4) //B8 to D4 { if(!routeSet) { debounce(); if(bB8 && bD4) { pulse(s17R); pulse(s23N); pulse(s24N); pulse(s25N); routeSet = true; } } } else if(bB8 && bD5) //B8 to D5 { if(!routeSet) { debounce(); if(bB8 && bD5) { pulse(s17N); pulse(s18N); pulse(s20N); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bB9 && bD2) //B9 to D2 { if(!routeSet) { debounce(); if(bB9 && bD2) { pulse(s14N); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26R); pulse(s27N); routeSet = true; } } } else if(bB9 && bD3) //B9 to D3 { if(!routeSet) { debounce(); if(bB9 && bD3) { pulse(s14N); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25R); pulse(s26N); routeSet = true; } } } else if(bB9 && bD4) //B9 to D4 { if(!routeSet) { debounce(); if(bB9 && bD4) { pulse(s14N); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24R); pulse(s25N); routeSet = true; } } } else if(bB9 && bD5) //B9 to D5 { if(!routeSet) { debounce(); if(bB9 && bD5) { pulse(s14N); pulse(s18R); pulse(s20N); pulse(s22N); pulse(s24N); pulse(s28N); pulse(s29N); routeSet = true; } } } else if(bB11 && bD6) //B11 to D6 { if(!routeSet) { debounce(); if(bB11 && bD6) { pulse(s9R); pulse(s13N); pulse(s20N); pulse(s20N); pulse(s22N); pulse(s28R); pulse(s29N); routeSet = true; } } } else if(bB12 && bD6) //B12 to D6 { if(!routeSet) { debounce(); if(bB12 && bD6) { pulse(s9N); pulse(s13N); pulse(s20N); pulse(s20N); pulse(s22N); pulse(s28R); pulse(s29N); routeSet = true; } } } else if(bB13 && bD6) //B13 to D6 { if(!routeSet) { debounce(); if(bB13 && bD6) { pulse(s13R); pulse(s20N); pulse(s21N); pulse(s22N); // pulse(s28R); // pulse(s29N); routeSet = true; } } } else if(bD6) //D6 { if(!routeSet) { debounce(); if(bD6) { pulse(s28R); pulse(s29N); routeSet = true; } } } else if(bC6 && bX2) //C6 to X2 { if(!routeSet) { debounce(); if(bC6 && bX2) { pulse(s21N); pulse(s29R); routeSet = true; } } } // single buttons #if 0 else if(bX1 && bX2) //X1 to X2 { if(!routeSet) { debounce(); if(bX1 && bX2) { pulse(s29R); routeSet = true; } } } #else // test case else if(bX2) // X2 { if(!routeSet) { debounce(); if(bX2) { pulse(s29R); routeSet = true; } } } #endif else if (bA1 && bA3 && bA5) //all switches normal { if(!routeSet) { debounce(); if(bA1 && bA3 && bA5) { pulse(s1N); pulse(s2N); pulse(s3N); pulse(s4N); pulse(s5N); pulse(s6N); pulse(s7N); pulse(s8N); pulse(s9N); pulse(s10N); pulse(s11N); pulse(s12N); pulse(s13N); pulse(s14N); pulse(s15N); pulse(s16N); pulse(s17N); pulse(s18N); pulse(s19N); pulse(s20N); pulse(s21N); pulse(s22N); pulse(s23N); pulse(s24N); pulse(s25N); pulse(s26N); pulse(s27N); pulse(s28N); pulse(s29N); routeSet = true; } } } else //all possible routes checked { routeSet = false; //all button combinations released } if(routeSet) { digitalWrite(LED, HIGH); //keep LED on while buttons pressed } else { digitalWrite(LED, HIGH); //flash LED otherwise to confirm program running delay(100); digitalWrite(LED, LOW); delay(100); } }
aeb7223a49f855ee24a751235ea80a51204508d4
b596414720ecf38b0c9b79faddd1068d1436e0a9
/flowvr/flowvr-interface/gltrace/src/stats.cpp
76ad41cfc6ed8ba7447dddbd0f0a94f67bf6a9a3
[]
no_license
TNick/FlowVR
f66302c23ddaf19bbbc23fe9e7efb32cb45b76bf
80a6e504294fbd99b14bfb2c32b022dddf40448c
refs/heads/master
2021-01-15T16:47:07.670183
2015-02-10T14:12:14
2015-02-10T14:12:14
30,590,575
0
0
null
2015-02-10T12:14:19
2015-02-10T12:14:18
null
UTF-8
C++
false
false
13,237
cpp
stats.cpp
/******* COPYRIGHT ************************************************ * * * FlowVR * * Utils * * * *-----------------------------------------------------------------* * COPYRIGHT (C) 2003-2011 by * * INRIA and * * Laboratoire d'Informatique Fondamentale d'Orleans * * (FRE 2490) ALL RIGHTS RESERVED. * * * * This source is covered by the GNU LGPL, please refer to the * * COPYING file for further information. * * * *-----------------------------------------------------------------* * * * Original Contributors: * * Jeremie Allard, * * Ronan Gaugne, * * Valerie Gouranton, * * Loick Lecointre, * * Sebastien Limet, * * Clement Menier, * * Bruno Raffin, * * Sophie Robert, * * Emmanuel Melin. * * * ******************************************************************* * * * File: src/log/stats.cpp * * * * Contacts: * * 28/05/2004 Jeremie Allard <Jeremie.Allard@imag.fr> * * * ******************************************************************/ #include <flowvr/trace.h> #include <iostream> #include <fstream> #include <vector> #include <map> #include <string> #include <math.h> #include <sys/time.h> using namespace flowvr; typedef flowvr::Trace::cycle_t cycle_t; class LogHost { public: std::vector<double> timeTable; std::vector<cycle_t> cycleTable; double freq; }; typedef std::map<std::string,LogHost> HostMap; HostMap hosts; double lasttime; class LogEntry { public: double t; int val; LogEntry(double _t=0, int _val=0) : t(_t), val(_val) {} }; class LogTrace { public: //int id; std::string obj; std::string name; std::vector<LogEntry> evt; }; std::vector<LogTrace> traces; void addHostTime(const std::string& hostname, int num, double t, cycle_t c) { std::cout << "Adding time "<<num<<" from "<<hostname<<": t="<<t<<std::endl;//" c="<<c<<std::endl; LogHost& host = hosts[hostname]; if (host.timeTable.size()<=(unsigned)num) host.timeTable.resize(num+1); host.timeTable[num] = t; if (host.cycleTable.size()<=(unsigned)num) host.cycleTable.resize(num+1); host.cycleTable[num] = c; } void addTrace(int num, const std::string& name, const std::string& from) { std::cout << "Adding trace "<<num<<" from "<<from<<" name "<<name<<std::endl; if(traces.size()<=(unsigned)num) traces.resize(num+1); traces[num].name = name; traces[num].obj = from; } bool init(const char* resultsfile, const char* masterhost = NULL) { lasttime=0; std::ifstream results(resultsfile); if (!results.is_open()) { std::cerr << "ERROR opening file "<<resultsfile<<std::endl; return false; } std::string line; while (getline(results,line)) { xml::DOMParser parser; if (parser.parseString(line.c_str())) { std::cerr << "ERROR parsing line "<<line<<std::endl; return false; } xml::DOMElement* result = parser.getDocument()->RootElement()->FirstChildElement(); if (result == NULL) { } else if (!strcmp(result->getNodeName(),"time")) { const char* tname = result->Attribute("name"); if (tname != NULL && tname[0]) { ++tname; int num = atoi(tname); while (*tname>='0' && *tname<='9') ++tname; if (*tname=='-') { ++tname; std::string hostname = tname; unsigned int sec = atoi(result->Attribute("sec")); unsigned int usec = atoi(result->Attribute("usec")); double t = sec+usec/1000000.0; cycle_t c;// atoll(result->Attribute("cycle")); addHostTime(hostname,num,t,c); } } } else if (!strcmp(result->getNodeName(),"trace")) { const char* name = result->Attribute("name"); const char* id = result->Attribute("id"); const char* from = result->Attribute("from"); if (name && name[0] && id && id[0] && from && from[0]) { addTrace(atoi(id),name,from); } } } // sync all times to the given master if (masterhost && *masterhost) { LogHost& master = hosts[masterhost]; for (HostMap::iterator it = hosts.begin(); it != hosts.end(); ++it) { LogHost& host = it->second; if (host.timeTable.size()>master.timeTable.size()) { host.timeTable.resize(master.timeTable.size()); host.cycleTable.resize(master.timeTable.size()); } for (unsigned int i=0;i<host.timeTable.size();i++) host.timeTable[i] = master.timeTable[i]; } } for (HostMap::iterator it = hosts.begin(); it != hosts.end(); ++it) { LogHost& host = it->second; // substract the first time to all times for (unsigned int i=1;i<host.timeTable.size();i++) { host.timeTable[i] -= host.timeTable[0]; } host.timeTable[0] = 0; // then compute the frequency /* if (host.timeTable.size()>1) host.freq = (host.cycleTable[host.cycleTable.size()-1]-host.cycleTable[0])/host.timeTable[host.timeTable.size()-1]; else host.freq = 1000000000.0; // default: 1 GHz*/ std::cout << "CPU Frequency "<<it->first<<": "<<(int)(host.freq/1000000)<<" Mhz"<<std::endl; } return true; } int operator<(const LogEntry& a, const LogEntry &b) { return a.t < b.t; } bool readLogs(const char* logprefix) { for (HostMap::iterator it = hosts.begin(); it != hosts.end(); ++it) { std::string hostname = it->first; std::cout << "Processing log from "<<hostname<<std::endl; LogHost& host = it->second; std::string fname = logprefix; fname += hostname; std::ifstream log(fname.c_str(),std::ifstream::in|std::ifstream::binary); if (!log.is_open()) { std::cerr << "ERROR opening file "<<fname<<std::endl; return false; } cycle_t c0 = host.cycleTable[0]; double freq = host.freq; int nrec = 0; while (log.good()) { unsigned int size = ((unsigned)log.get())*4; if (size>1024) break; if (size!=16) { std::cerr << "Unsupported size 0x"<<std::hex<<size<<std::dec<<std::endl; log.seekg(size-1,std::ifstream::cur); } else { cycle_t c;//=0; log.read((char*)&c,sizeof(cycle_t)-1); int id = 0; log.read((char*)&id,sizeof(int)); int val = 0; log.read((char*)&val,sizeof(int)); double t =0;// (double)(c-c0)/freq; if ((unsigned)id<(unsigned)traces.size()) { traces[id].evt.push_back(LogEntry(t,val)); ++nrec; if (t>lasttime) lasttime=t; } else std::cerr << "Invalid log ID "<<id<<std::endl; } } std::cout << nrec << " entries read."<<std::endl; } std::cout << "Sorting entries..."<<std::endl; for (unsigned int i=0;i<traces.size();i++) { std::sort(traces[i].evt.begin(),traces[i].evt.end()); unsigned int nval = traces[i].evt.size(); if (nval>0) { int base = traces[i].evt[0].val; bool linear = true; bool valid = true; for (unsigned int j=1;j<nval;j++) { if (traces[i].evt[j].val!=base+(int)j) linear = false; if (traces[i].evt[j].val<traces[i].evt[j-1].val) { std::cerr << "ERROR(Trace "<<traces[i].obj<<":"<<traces[i].name<<"): invalid value at event "<<j<<std::endl; valid = false; break; } if (traces[i].evt[j].t<traces[i].evt[j-1].t) { std::cerr << "ERROR(Trace "<<traces[i].obj<<":"<<traces[i].name<<"): invalid time at event "<<j<<std::endl; valid = false; break; } } if (valid) { if (linear) std::cout << "Trace "<<traces[i].obj<<":"<<traces[i].name<<" val(it)=it+ "<<base<<std::endl; else std::cout << "Trace "<<traces[i].obj<<":"<<traces[i].name<<" val(it)=val(it-1)+D"<<std::endl; } } } return true; } int findTrace(std::string name) { for (unsigned int i=0;i<traces.size();i++) { std::string s = traces[i].obj+":"+traces[i].name; if (s == name) return i; } return -1; } double calcSpeed(std::string name, double tmin=0, double tmax=0) { int id = findTrace(name); if (id<0) return 0; int it0,it1; it0 = 0; if (tmin>0) { while (it0<(int)traces[id].evt.size()-1 && traces[id].evt[it0].t<tmin) ++it0; } it1 = traces[id].evt.size()-1; if (tmin>0) { while (it1>0 && traces[id].evt[it1].t>tmax) --it1; } if (it0>=it1) return 0; double t = traces[id].evt[it1].t-traces[id].evt[it0].t; double r = (it1-it0)/t; std::cout << name<<" "<<it1-it0+1<<" events in "<<t<<" sec: "<<r<<" iter/s"<<std::endl; return r; } int split(const std::string& input, const std::string& delimiter, std::vector<std::string>& results) { int iPos = 0; int newPos = -1; int sizeS2 = delimiter.size(); int isize = input.size(); std::vector<int> positions; newPos = input.find (delimiter, 0); if( newPos < 0 ) { return 0; } int numFound = 0; while( newPos > iPos ) { numFound++; positions.push_back(newPos); iPos = newPos; newPos = input.find (delimiter, iPos+sizeS2+1); } for( int i=0; i <= (int)positions.size(); i++ ) { std::string s; if( i == 0 ) { s = input.substr( i, positions[i] ); } else { int offset = positions[i-1] + sizeS2; if( offset < isize ) { if( i == (int)positions.size() ) s = input.substr(offset); else if( i > 0 ) s = input.substr( positions[i-1] + sizeS2, positions[i] - positions[i-1] - sizeS2 ); } } if( s.size() > 0 ) results.push_back(s); } return numFound; } double calcLatency(std::string path,double tmin=0,double tmax=0) { std::vector<std::string> tracenames; split(path,"=",tracenames); if (tracenames.size()<=1) return calcSpeed(path,tmin,tmax); std::vector<int> traceids; traceids.resize(tracenames.size()); std::cout << "Latency of "; bool valid = true; double val = 0; for (unsigned int i=0;i<tracenames.size();i++) { int id; if (tracenames[i][0] == '-') { id = atoi(tracenames[i].c_str()); if (id >= 0) valid = false; } else { id = findTrace(tracenames[i]); if (id<0) valid = false; } traceids[i] = id; if (i) std::cout << "<-"; std::cout << tracenames[i]<<"("<<id<<")"; } if (valid) { int id = traceids[0]; int it0,it1; it0 = 0; if (tmin>0) { while (it0<(int)traces[id].evt.size()-1 && traces[id].evt[it0].t<tmin) ++it0; } it1 = traces[id].evt.size()-1; if (tmin>0) { while (it1>0 && traces[id].evt[it1].t>tmax) --it1; } if (it0>=it1) return 0; int idiff = 0; double tdiff = 0; int nb = 0; for (int num=it0;num<=it1;num++) { int n = num; int i; double t1 = 0; //std::cout<<n<<" "; for (i=0;i<(int)traceids.size()-1;i++) { if (traceids[i]<0) n += traceids[i]; else { if (!((unsigned)n<traces[traceids[i]].evt.size())) break; double t2 = traces[traceids[i]].evt[n].t; if (t1 && t2>t1) { std::cerr << "Temporal causality destroyed at "<<tracenames[i]<<"["<<n<<"]: "<<t2<<">"<<t1<<std::endl; } n = traces[traceids[i]].evt[n].val; t1=t2; } //std::cout << n<<" "; } //std::cout << std::endl; if (i==(int)traceids.size()-1) { idiff += (num-n); tdiff += (traces[id].evt[num].t-traces[traceids[i]].evt[n].t); ++nb; } } if (nb>0) { val = 1000*tdiff / nb; double ival = (double)idiff/(double)nb; std::cout <<" "<<nb<<" events: "<<val<<" ms ("<<ival<<" iter)"; } } std::cout << std::endl; return val; } int main ( int argc, char ** argv ) { if (argc < 3) { std::cout << "Usage: "<<argv[0]<<" resultsfiles logfileprefix [timemasterhost [tmin tmax traces...]]]"<<std::endl; return -1; } if (!init(argv[1],(argc>=4?argv[3]:NULL))) { return 10; } if (!readLogs(argv[2])) { return 20; } if (argc>=7) { // stat computation mode double tmin = atof(argv[4]); double tmax = atof(argv[5]); for (int a=6;a<argc;a++) { std::cerr << '\t' << calcLatency(argv[a],tmin,tmax); // << std::endl; } } return 0; }
95474a88eddd68b533382be20d1fe972cf81c08e
01969323491cdd8db5876e819a283325ddcd6ec1
/RYU_prototype/Private/Character/States/RyuCharacterSprintState.cpp
0998007d992e6b56a81ea1dcc869de70505d22f6
[]
no_license
Hengle/Ryu
8f3de7e3883dbb633a2e3d7c048734d429771b16
4c8e4c0c225195dc6949b3ac8b3997fe70816789
refs/heads/master
2023-04-19T18:34:05.889585
2021-05-03T16:15:01
2021-05-03T16:15:01
null
0
0
null
null
null
null
ISO-8859-10
C++
false
false
2,197
cpp
RyuCharacterSprintState.cpp
// Copyright 2019 80k Games, All Rights Reserved. #include "RyuCharacterSprintState.h" #include "Enums/ERyuInputState.h" #include "Enums/ERyuMovementState.h" #include "RYU_prototype.h" #include "RyuBaseCharacter.h" #include "RyuCharacterIdleState.h" #include "RyuCharacterJumpForwardState.h" #include "RyuCharacterOnGroundState.h" #include "RyuCharacterRollState.h" #include "RyuCharacterRunState.h" URyuCharacterSprintState::URyuCharacterSprintState() { } URyuCharacterState* URyuCharacterSprintState::HandleInput(ARyuBaseCharacter* Character, const ERyuInputState Input) { switch (Input) { case ERyuInputState::PressJump: { //TODO how to create NewObject of class with OverloadConstructor ? -> own StaticClass / "FactoryPattern" //return NewObject<URyuCharacterJumpForwardState>(ERyuMovementState::Sprinting); return NewObject<URyuCharacterJumpForwardState>(); break; } case ERyuInputState::ReleaseLeft: case ERyuInputState::ReleaseRight: { return NewObject<URyuCharacterIdleState>(); break; } case ERyuInputState::ReleaseSprintRight: case ERyuInputState::ReleaseSprintLeft: { return NewObject<URyuCharacterRunState>(); break; } case ERyuInputState::PressDown: { return NewObject<URyuCharacterRollState>(); break; } default: { // only make special call when Input occurs which is not handled in the Baseclass, otherwise we donīt need to handle Input, just walk up in the hierarchy return Super::HandleInput(Character, Input); break; } } } void URyuCharacterSprintState::Update(ARyuBaseCharacter* Character) { } void URyuCharacterSprintState::Enter(ARyuBaseCharacter* Character) { CharacterState = ERyuCharacterState::Sprint; Character->SetCharacterMovementState(ERyuMovementState::Sprinting); // Set IdleGraphics or other Asset related stuff } void URyuCharacterSprintState::Exit(ARyuBaseCharacter* Character) { }
7c8182f9fae8280cec325fc61ef7eedeed0de0d5
7f7d7be77ff8d1a8c16440eff45a8a3fef872b1e
/vec.cpp
ff697a04ce076dd695cb060c365ab8052d133d35
[]
no_license
sujoy98/cppOLD
80bd10029abbbe1cf10d325d68fe599e27b2e6c9
0da80506c9598b115a5f806b0565663b49b7ed17
refs/heads/master
2022-11-24T05:39:20.120053
2020-07-27T17:12:03
2020-07-27T17:12:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
165
cpp
vec.cpp
#include<iostream> #include<vector> using namespace std; int main(){ vector<int> data ={1,2,3}; data.push_back(12); cout<<data[3]<<endl; return 0; }
72d123e6cee1d5a5e686e374ce79c923753993a3
21262e403efd2b8eef212894bbc6b3794ceeaea5
/Arduino/MotorOdometry/MotorOdometry.ino
886473d957043317e4f18831d2b2079de7566d3b
[]
no_license
ChenBao294/tas
7cc4358bb8aea90823f7ae87f4c855e4b349069e
c7fde936847bb08c90b6bfa43f2e2eb034fea2cb
refs/heads/master
2021-01-20T11:10:53.442205
2016-01-28T09:48:12
2016-01-28T09:48:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,420
ino
MotorOdometry.ino
/* Motor Odometry * * This sketch reads in three hall encoder sensor lines from a sensored * brushless motor. It decodes the tri-phase quadrature signal and publishes it * via rosserial to the ROS network, where it can be used as odometry signal. * * Laurenz 2015-01 * ga68gug / TUM LSR TAS */ // This define is required when an native-USB Arduino like the Micro is used! #define USE_USBCON #include <ros.h> #include <tas_odometry/Encoder.h> // IO pin numbers static const uint8_t pinA = 2; static const uint8_t pinB = 3; static const uint8_t pinC = 7; // When this time (ms) has passed, publish a message even though nothing changed static const uint16_t pub_0vel_after = 100; bool published_0vel = false; // ROS objects ros::NodeHandle nh; tas_odometry::Encoder msg; ros::Publisher pub("motor_encoder", &msg); // The three hall encoder data lines volatile bool A, B, C; // The encoder counter. It's 32b, because with 16b, at 17000rpm (max motor speed) it would overflow 3 times a second volatile int32_t counter = 0; // Timestamp of last encoder tick (in 1us, 4us resolution) volatile unsigned long last_tick = 0; // Time between ticks that actually get published volatile unsigned long accumulated_duration = 1; // Flag telling if new data is available volatile bool dirty = false; // Time of last message having been published unsigned long last_sent = 0; // counter for toggling the LED with its LSB uint8_t ledcounter = 0; const char hello_str [] PROGMEM = "TAS Encoder Odometry\nLaurenz Altenmueller (ga68gug) 2015-01"; // There was an error, handle this gracefully void error_reset() { // temporarily disable interrupts uint8_t oldSREG = SREG; cli(); // Re-read channel values bool A_old = A; bool B_old = B; bool C_old = C; A = digitalRead(pinA); B = digitalRead(pinB); C = digitalRead(pinC); dirty = false; // Efficiently build a string like "E: 100/110" char err_str[] = "E: 000/000"; err_str[3] += A_old; err_str[4] += B_old; err_str[5] += C_old; err_str[7] += A; err_str[8] += B; err_str[9] += C; // re-enable interrupts SREG = oldSREG; // Write the string to the roslog nh.logwarn(err_str); } // This ISR (Interrupt Service Routine) will be called whenever there is a change on pinA. Normal code execution is halted until the ISR returns. void isr_a() { // Measure inter-tick duration right at ISR entry and add it to time since last publishing accumulated_duration += micros() - last_tick; last_tick = micros(); if (!A) { // Rising edge (b/c A was low before) if (B && !C) // if channel B is high, channel C is low counter++; // this indicates forward motion else if (!B && C) // the other way round? counter--; // then backwards else // any other state indicates either input overflow or wrong logic (interchanged wires...) error_reset(); } else { // Falling edge if (!B && C) counter++; else if (B && !C) counter--; else error_reset(); } // Set dirty flag dirty = true; // Update channel value A = digitalRead(pinA); } void isr_b() { // analogous to isr_a accumulated_duration += micros() - last_tick; last_tick = micros(); if (!B) { if (!A && C) counter++; else if (A && !C) counter--; else error_reset(); } else { if (A && !C) counter++; else if (!A && C) counter--; else error_reset(); } dirty = true; B = digitalRead(pinB); } void isr_c() { // analogous to isr_a accumulated_duration += micros() - last_tick; last_tick = micros(); if (!C) { if (A && !B) counter++; else if (!A && B) counter--; else error_reset(); } else { if (!A && B) counter++; else if (A && !B) counter--; else error_reset(); } dirty = true; C = digitalRead(pinC); } // The setup function is called once at startup of the sketch void setup() { // Set up IOs pinMode(pinA, INPUT); pinMode(pinB, INPUT); pinMode(pinC, INPUT); TX_RX_LED_INIT; digitalWrite(pinA, HIGH); // activate int pull-up digitalWrite(pinB, HIGH); digitalWrite(pinC, HIGH); // Read initial logic states A = digitalRead(pinA); B = digitalRead(pinB); C = digitalRead(pinC); // Set up ISR vectors attachInterrupt(digitalPinToInterrupt(pinA), isr_a, CHANGE); attachInterrupt(digitalPinToInterrupt(pinB), isr_b, CHANGE); attachInterrupt(digitalPinToInterrupt(pinC), isr_c, CHANGE); // Setup ROS nh.initNode(); nh.advertise(pub); nh.loginfo(hello_str); } // The loop function is called in an endless loop void loop() { // save time unsigned long now = millis(); // If new data is available, publish it if (dirty) { uint8_t oldSREG = SREG; cli(); // Temporarily disable interrupts to prevent race conditions msg.duration = accumulated_duration; msg.encoder_ticks = counter; counter = 0; accumulated_duration = 0; SREG = oldSREG; // reactivate ISRs ledcounter += msg.encoder_ticks; dirty = false; published_0vel = false; last_sent = now; pub.publish(&msg); } else // If no update happens, after 100ms publish 0 - once! if (!published_0vel && now - last_sent > pub_0vel_after) { published_0vel = true; msg.duration = 1; // avoid accidental divisions by zero... msg.encoder_ticks = 0; pub.publish(&msg); } // Handle ROS nh.spinOnce(); // TXLED blinks when data is published if(now - last_sent < 20) TXLED0; //on else TXLED1; //off // RXLED blinks with changing counter if(ledcounter & 0x01) RXLED0; else RXLED1; }
5a566b5071405dff598fd91d1b185f50b5832380
f51e190b5212f39075d9ba169bbd2daa583be538
/ItemShop/ItemShop/ItemShop.cpp
da05d8b397d1a001648e2b5679fe5566353a43a1
[]
no_license
Epikkat/TextBasedRPG
6aad3205731e86e0337346176ed48c8a9807fda2
ab0d1b8cba03206ced5eec67c23399100375749b
refs/heads/master
2020-07-11T16:00:23.847777
2019-09-06T19:14:18
2019-09-06T19:14:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,746
cpp
ItemShop.cpp
// ItemShop #include <iostream> using namespace std; int shopSelection; int coin = 200; int potion = 50; int sword = 100; int shield = 80; int main() { cout << "(Enter the Item shop. The shopkeeper greets you)\n\n"; cout << "Hello, Adventurer! Please, have a gander at our items.\n"; do { int itemAmount; int confirmPurchase; cout << "(To buy an item, type the number of the item you wish to purchase)\n\n"; cout << "(1) Sword ---- 100 Coin\n"; cout << "(2) Shield ----- 80 Coin\n"; cout << "(3) Potion ----- 20 Coin\n"; cout << "(Press 4 to exit the shop)\n"; cout << "You have " << coin << " coins.\n\n"; cin >> shopSelection; if ((shopSelection == 1) && (sword == true)) { cout << "You already own this item\n\n"; } else if (shopSelection == 1) { if (coin >= 100) { cout << "This will cost 100 coins. Are you sure?\n"; cout << "(Press 1 to confirm, 2 to go back)\n"; cin >> confirmPurchase; cout << "\n\n\n"; if (confirmPurchase == 1) { cout << "You have bought a Sword for 100 coins.\n"; coin = coin - 100; sword = true; cout << "You have " << coin << " coins remaining.\n"; } } else { cout << "You do not have enough coin.\n\n"; } } if ((shield == true) && (shopSelection == 2)) { cout << "You already own this item\n\n"; } else if (shopSelection == 2) { if (coin >= 80) { cout << "This will cost 80 coins. Are you sure?\n"; cout << "(Press 1 to confirm, 2 to go back)\n"; cin >> confirmPurchase; cout << "\n\n\n"; if (confirmPurchase == 1) { cout << "You have bought a Shield for 80 coins.\n"; shield = true; coin = coin - 80; cout << "You have " << coin << " coins remaining.\n"; } } else { cout << "You do not have enough coin.\n\n"; } } if (shopSelection == 3) { cout << "How many would you like to buy? (Press 0 to go back)\n\n"; cin >> itemAmount; cout << "\n\n"; while ((itemAmount * 20 > coin) && (itemAmount != 0)) { cout << "You do not have enough coin.Please press 0 to go back\n\n"; cin >> itemAmount; } if (itemAmount != 0) { cout << "This will cost " << itemAmount * 20 << " coins. Are you sure?\n"; cout << "(Press 1 to confirm, 2 to go back)\n"; cin >> confirmPurchase; cout << "\n\n\n"; if (confirmPurchase == 3) { cout << "You have bought " << itemAmount << " Potion(s) for " << itemAmount * 20 << " coins.\n"; coin = coin - (itemAmount * 20); cout << "You have " << coin << " coins remaining.\n\n"; } } } } while (shopSelection != 4); cout << "Thanks for coming! Please stop by again!\n\n"; cout << "(Press enter to continue)\n"; cin.ignore(); cin.get(); return 0; }
5a56ffe692f0da7899709fffe22e033276ebeeeb
56d297b034a34b48a11cc30d8a8c5f327bcce925
/zbluenet/zbluenet/src/zbluenet/logger_base.h
90e7c1a817967b5db266929ce83acb2c0fccda10
[ "Apache-2.0" ]
permissive
zhengjinwei123/zbluenet
accbde850a801f3876c5ada8447efd927d7e262d
2d3c26f587de34ca7924176487b92e0700756792
refs/heads/main
2023-07-19T14:41:32.075978
2021-09-08T09:19:26
2021-09-08T09:19:26
392,528,193
4
0
null
null
null
null
UTF-8
C++
false
false
1,145
h
logger_base.h
#ifndef ZBLUENET_LOGGER_BASE_H #define ZBLUENET_LOGGER_BASE_H #include <cstdarg> #include <functional> #include <zbluenet/class_util.h> namespace zbluenet { class LoggerBase { public: struct LogLevel { enum type { MIN = 0, DEBUG = 0, INFO, WARNING, ERR, MAX }; }; using LogFunc = std::function<void(int level, const char *fmt, va_list args)>; void setLogFunc(LogFunc log_func); void log(int level, const char *fmt, ...); private: ZBLEUNET_PRECREATED_SINGLETON(LoggerBase); LogFunc log_func_; }; } // namespace zbluenet #define BASE_DEBUG(fmt, ...) \ zbluenet::LoggerBase::getInstance()->log(zbluenet::LoggerBase::LogLevel::DEBUG, fmt, ##__VA_ARGS__) #define BASE_INFO(fmt, ...) \ zbluenet::LoggerBase::getInstance()->log(zbluenet::LoggerBase::LogLevel::INFO, fmt, ##__VA_ARGS__) #define BASE_WARNING(fmt, ...) \ zbluenet::LoggerBase::getInstance()->log(zbluenet::LoggerBase::LogLevel::WARNING, fmt, ##__VA_ARGS__) #define BASE_ERROR(fmt, ...) \ zbluenet::LoggerBase::getInstance()->log(zbluenet::LoggerBase::LogLevel::ERR, fmt, ##__VA_ARGS__) #endif // ZBLUENET_LOGGER_BASE_H
392ee1341f3d2aa6dbf474668ab742b9bebc0b48
4d3a9a026674958d4d077da2f3d0fd4adb94e7ac
/LAB4/LAB4/Source.cpp
0722a395ee53f8bb11ce2e8bbbfee512af5fab01
[]
no_license
Hirikava/KGG
e219b4caea3c4a69b9513fcbf432e3fa0367d4dd
dae46c377f1251346e9ac6c1f4b54213583a8093
refs/heads/master
2021-01-16T01:14:56.994870
2020-04-08T13:50:28
2020-04-08T13:50:28
242,921,947
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
5,827
cpp
Source.cpp
#include <glad/gl.h> #include <glfw3.h> #include <iostream> #include <cmath> #include "camera/camera.h" #include "tools/shaders.h" #include <glm/glm.hpp> #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/matrix_transform.hpp> float func(float x, float y) { return std::cos(x * y); } bool mouseFirst = true; Camera* camera = new Camera(glm::vec3(-3, 0, 0)); bool keys[1024]; GLfloat lastX = 400; GLfloat lastY = 300; void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) { if (action == GLFW_PRESS) keys[key] = true; else if (action == GLFW_RELEASE) keys[key] = false; if (key == GLFW_KEY_ESCAPE) glfwSetWindowShouldClose(window, GL_TRUE); } void mouse_callback(GLFWwindow* window, double xpos, double ypos) { if (mouseFirst) { mouseFirst = false; lastX = xpos; lastY = ypos; return; } GLfloat xoffset = xpos - lastX; GLfloat yoffset = lastY - ypos; // ќбратный пор¤док вычитани¤ потому что оконные Y-координаты возрастают с верху вниз lastX = xpos; lastY = ypos; GLfloat sensitivity = 0.05f; xoffset *= sensitivity; yoffset *= sensitivity; camera->Turn(yoffset, xoffset); } void do_movement() { // Camera controls GLfloat cameraSpeed = 0.04f; if (keys[GLFW_KEY_W]) camera->MoveForward(cameraSpeed); if (keys[GLFW_KEY_S]) camera->MoveBack(cameraSpeed); } int main() { // Блок создания и настройки окна оторбражения if (!glfwInit()) { std::cout << "Unable to initialize graphics module" << std::endl; exit(1); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); const auto window = glfwCreateWindow(900, 900, "Da'As LAB4", nullptr, nullptr); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); //делаем курсор невидимым и привязанным к окну glfwSetKeyCallback(window, key_callback); glfwSetCursorPosCallback(window, mouse_callback); if (!window) { std::cout << "Unable to create a window" << std::endl; } glfwMakeContextCurrent(window); gladLoadGL(glfwGetProcAddress); glfwSwapInterval(1); // Блок подготовки графического конвейра //генерация данных float X = -1, Y = -1; unsigned int XStepNumber = 200; unsigned int YStepNumber = 200; float step = 0.02; GLfloat* data = new GLfloat[XStepNumber * YStepNumber * 3]; for(int i = 0; i < YStepNumber; i++) { for(int j = 0; j < XStepNumber; j++) { float x = X + step * j; float y = Y + step * i; data[i * 3 * YStepNumber + j * 3] =x; data[i * 3* YStepNumber + j * 3 + 1] = y; data[i *3 * YStepNumber + j *3 + 2] = func(x, y); } } GLuint VAO, VBO; glGenVertexArrays(1, &VAO); glBindVertexArray(VAO); glGenBuffers(1, &VBO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * XStepNumber * YStepNumber * 3, data, GL_STATIC_DRAW); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, 0); glEnableVertexAttribArray(0); glBindVertexArray(0); GLfloat lines[] = { -10,0,0, 10,0,0, 0,-10,0, 0,10,0, 0,0,-10, 0,0,10 }; GLuint MeshVAO, MeshVBO; glGenVertexArrays(1, &MeshVAO); glBindVertexArray(MeshVAO); glGenBuffers(1, &MeshVBO); glBindBuffer(GL_ARRAY_BUFFER, MeshVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(lines),lines, GL_STATIC_DRAW); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, 0); glEnableVertexAttribArray(0); glBindVertexArray(0); GLint status; GLuint program, vertex, fragment; program = glCreateProgram(); vertex = glCreateShader(GL_VERTEX_SHADER); fragment = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(vertex, 1, &vertex_shader, 0); glShaderSource(fragment, 1, &fragment_shader, 0); glCompileShader(vertex); glGetShaderiv(vertex, GL_COMPILE_STATUS, &status); glCompileShader(fragment); glGetShaderiv(fragment, GL_COMPILE_STATUS, &status); glAttachShader(program, vertex); glAttachShader(program, fragment); glLinkProgram(program); glGetProgramiv(program, GL_LINK_STATUS, &status); std::cout << glGetError() << std::endl; glUseProgram(program); GLuint viewLoc = glGetUniformLocation(program, "View"); GLuint projectionLoc = glGetUniformLocation(program, "Projection"); GLuint colorLoc = glGetUniformLocation(program, "Color"); glm::mat4 projection = glm::perspective(45.0f, (GLfloat)(400) / (GLfloat)(400), 0.1f,1000.0f); glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection)); glm::vec3 redColor = glm::vec3(1.0f, 0.0f, 0.0f); glm::vec3 greenColor = glm::vec3(0.0f, 1.0f, 0.0f); glm::vec3 blueColor = glm::vec3(0.0f, .0f, 1.0f); glm::vec3 color = glm::vec3(0.8f, 0.4f, 0.4f); glEnable(GL_DEPTH_TEST); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // чистим буфер auto view = camera->GetViewMatrix(); glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view)); glBindVertexArray(MeshVAO); glUniform3fv(colorLoc, 1, glm::value_ptr(redColor)); //цвет x glDrawArrays(GL_LINES, 0, 2); glUniform3fv(colorLoc, 1, glm::value_ptr(blueColor)); //цвет y glDrawArrays(GL_LINES, 2, 2); glUniform3fv(colorLoc, 1, glm::value_ptr(greenColor)); //цвет z glDrawArrays(GL_LINES, 4, 2); glBindVertexArray(VAO); glUniform3fv(colorLoc, 1, glm::value_ptr(color)); // цвет графика glDrawArrays(GL_POINTS,0, XStepNumber * YStepNumber); glfwSwapBuffers(window); //отображаем текущий буфер glfwPollEvents(); //функция вызывающая обработку сообщений окна (нужна для управления камерой) do_movement(); } return 0; }
349b582e1f09bc0233f8407f9fd6b875c0216c86
10bdf7284ced1bbebe606298d9893fc3006cd3e0
/lib/cocos2d-x/core/platform/android/jni/JniHelper.cpp
7ed45ceeb1234a8501a431adc78a845f0f3d19d3
[ "MIT" ]
permissive
qcdong2016/quick-x
bcd54f9cb744ea4d07ec3c4b869b0331aceff5fd
6eba67489971ac673b17f8af1355880a6b0caf94
refs/heads/master
2021-06-24T00:25:21.467206
2017-07-14T02:20:59
2017-07-14T02:20:59
67,413,006
5
0
null
2017-07-14T02:21:00
2016-09-05T10:52:41
C
UTF-8
C++
false
false
3,901
cpp
JniHelper.cpp
/**************************************************************************** Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "JniHelper.h" #include "CCDevice.h" #include "android/asset_manager_jni.h" extern "C" { JNIEnv *Android_JNI_GetEnv(void); jclass Android_JNI_GetActivityClass(void); } namespace cocos2d { static jmethodID loadclassMethod_methodID = NULL; static jobject classloader = NULL; JNIEnv* JniHelper::getEnv() { return Android_JNI_GetEnv(); } void* JniHelper::getAssetManager() { JNIEnv* env = getEnv(); jclass activity = Android_JNI_GetActivityClass(); /* context = SDLActivity.getContext(); */ jmethodID mid = env->GetStaticMethodID(activity, "getContext","()Landroid/content/Context;"); jobject context = env->CallStaticObjectMethod(activity, mid); /* assetManager = context.getAssets(); */ mid = env->GetMethodID(env->GetObjectClass(context), "getAssets", "()Landroid/content/res/AssetManager;"); jobject assetManager = env->CallObjectMethod(context, mid); return AAssetManager_fromJava(env, assetManager); } bool JniHelper::getStaticMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode) { if ((NULL == className) || (NULL == methodName) || (NULL == paramCode)) { return false; } JNIEnv *env = JniHelper::getEnv(); if (!env) { CCLog("Failed to get JNIEnv"); return false; } jclass classID = env->FindClass(className); if (! classID) { CCLog("Failed to find class %s", className); env->ExceptionClear(); return false; } jmethodID methodID = env->GetStaticMethodID(classID, methodName, paramCode); if (! methodID) { CCLog("Failed to find static method id of %s", methodName); env->ExceptionClear(); return false; } methodinfo.classID = classID; methodinfo.env = env; methodinfo.methodID = methodID; return true; } std::string JniHelper::jstring2string(jstring jstr) { if (jstr == NULL) { return ""; } JNIEnv *env = JniHelper::getEnv(); if (!env) { return NULL; } const char* chars = env->GetStringUTFChars(jstr, NULL); std::string ret(chars); env->ReleaseStringUTFChars(jstr, chars); return ret; } NS_CC_END
d634f4f7e1c355a9d6f3bcba7c66ca5b4f1ab325
b6afdd7ea068479901d1e33592c81e55b7a0189e
/hazard.cpp
f7943efbaa89bf66f5de25b00ed1835c4b3758c9
[]
no_license
adityaiiitv/Computer-Architecture
f77e1dc7321344897da561c63f4dc37d72d3508b
b003e662ae52020585bf9ba948211b942b3dafa2
refs/heads/master
2021-01-19T08:27:56.662002
2017-04-08T12:54:12
2017-04-08T12:54:12
87,633,624
0
0
null
null
null
null
UTF-8
C++
false
false
1,539
cpp
hazard.cpp
#include<iostream> #include<string.h> using namespace std; int main() { string i[4]; cout<<"\n Four instructions using _ in place of spaces.\n"; i[0]="ADD_R1,R1,R1"; i[1]="SUB_R1,R1,R1"; i[2]="ADD_R1,R1,R1"; i[3]="MUL_R1,R1,R1"; cout<<"\n "<<i[0]<<"\n "<<i[1]<<"\n "<<i[2]<<"\n "<<i[3]<<"\n"; int order[4], start=0; cout<<"\n Enter the order by shuffling 0,1,2,3. Enter only one change in the configuration.\n"; cin>>order[0]>>order[1]>>order[2]>>order[3]; if(order[0]==0 && order[1]==1 && order[2]==2 && order[3]==3) { cout<<"\n No hazards"; start++; } int raw=0,war=0,waw=0,num; if(start==0) { // order 0 if(order[0]!=0) { int loc=1; for(int i=1;i<=4;i++) { if(order[i-1]==order[0]) { loc=i; } } num=loc; raw+=(num*2); war+=(num*2); waw+=num; } // order 1 if(order[1]!=1) { int loc=1; for(int i=1;i<=4;i++) { if(order[i-1]==order[1]) { loc=i; } } num=loc; raw+=(num*2); war+=(num*2); waw+=num; } // order 2 if(order[2]!=2) { int loc=1; for(int i=1;i<=4;i++) { if(order[i-1]==order[2]) { loc=i; } } num=loc; raw+=(num*2); war+=(num*2); waw+=num; } // order 3 if(order[3]!=3) { int loc=1; for(int i=1;i<=4;i++) { if(order[i-1]==order[3]) { loc=i; } } num=loc; raw+=(num*2); war+=(num*2); waw+=num; } } cout<<"\n Total number of hazards in the configuration(raw,war,waw):"<<raw<<" "<<war<<" "<<waw<<"\n"; return 0; }
6ab6eff0daa53af5f3e80964ac2fd73d629bf6a0
08fdd8c5857acd45aa9556e1bdb7fef208e39699
/Print/Print.cpp
75945ddc3fe68e2bab09f9fd8cc0c7b1cfa2f836
[]
no_license
AhmadBan/Visual-studio-Mock-for-Arduino
d5e4d6b324be5e74ea3c79b66717d118bdf8568b
f42337edbc14693fba89c1894dd214ebca4ec00e
refs/heads/master
2023-07-07T12:54:57.009458
2020-12-03T16:40:33
2020-12-03T16:40:33
318,246,646
1
0
null
null
null
null
UTF-8
C++
false
false
4,009
cpp
Print.cpp
#include "Print.h" #include <iostream> using namespace std; #define String std::string // Public Methods ////////////////////////////////////////////////////////////// /* default implementation: may be overridden */ size_t Print::write(const uint8_t* buffer, size_t size) { cout << buffer; return size; } size_t Print::write(String buffer) { return write(buffer.c_str(), buffer.size()); } size_t Print::printf(const char* format, ...) { va_list arg; va_start(arg, format); char temp[64]; char* buffer = temp; size_t len = vsnprintf(temp, sizeof(temp), format, arg); va_end(arg); if (len > sizeof(temp) - 1) { buffer = new char[len + 1]; if (!buffer) { return 0; } va_start(arg, format); vsnprintf(buffer, len + 1, format, arg); va_end(arg); } len = write((const uint8_t*)buffer, len); if (buffer != temp) { delete[] buffer; } return len; } size_t Print::print(const String& s) { return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { return write(str); } size_t Print::print(char c) { return write(c); } size_t Print::print(unsigned char b, int base) { return print((unsigned long)b, base); } size_t Print::print(int n, int base) { return print((long)n, base); } size_t Print::print(unsigned int n, int base) { return print((unsigned long)n, base); } size_t Print::print(long n, int base) { if (base == 0) { return write(n); } else if (base == 10) { if (n < 0) { int t = print('-'); n = -n; return printNumber(n, 10) + t; } return printNumber(n, 10); } else { return printNumber(n, base); } } size_t Print::print(unsigned long n, int base) { if (base == 0) return write(n); else return printNumber(n, base); } size_t Print::print(double n, int digits) { return printFloat(n, digits); } size_t Print::print(const Printable& x) { return x.printTo(*this); } size_t Print::println(void) { return print("\r\n"); } size_t Print::println(const String& s) { size_t n = print(s); n += println(); return n; } size_t Print::println(const char c[]) { size_t n = print(c); n += println(); return n; } size_t Print::println(char c) { size_t n = print(c); n += println(); return n; } size_t Print::println(unsigned char b, int base) { size_t n = print(b, base); n += println(); return n; } size_t Print::println(int num, int base) { size_t n = print(num, base); n += println(); return n; } size_t Print::println(unsigned int num, int base) { size_t n = print(num, base); n += println(); return n; } size_t Print::println(long num, int base) { size_t n = print(num, base); n += println(); return n; } size_t Print::println(unsigned long num, int base) { size_t n = print(num, base); n += println(); return n; } size_t Print::println(double num, int digits) { size_t n = print(num, digits); n += println(); return n; } size_t Print::println(const Printable& x) { size_t n = print(x); n += println(); return n; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. char* str = &buf[sizeof(buf) - 1]; *str = '\0'; // prevent crash if called with base == 1 if (base < 2) base = 10; do { unsigned long m = n; n /= base; char c = m - base * n; *--str = c < 10 ? c + '0' : c + 'A' - 10; } while (n); return write(str); } size_t Print::printFloat(double number, uint8_t digits) { char buf[40]; std::string format = "%0." + std::to_string(digits) + "f"; sprintf(buf, format.c_str(), number); return write(buf); }
99563ad745fd30f3a4bee16116b9f09914eb17ef
9a712f98b3b7efe4933a2a4bcdd3586ed73b3334
/Classic Tower Defence/Game/cursor systems.hpp
fa98e28d4d32c8ce8ad95ea96ec3015af0d41142
[]
no_license
indianakernick/Classic-Tower-Defence
a3244ff347ac59db991220719b5db495bd050c38
b71711becd01c7774ee39f8fef3fe4f93893379b
refs/heads/master
2022-05-14T07:35:31.075179
2018-10-07T04:05:49
2018-10-07T04:05:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
538
hpp
cursor systems.hpp
// // cursor systems.hpp // Classic Tower Defence // // Created by Indi Kernick on 19/5/18. // Copyright © 2018 Indi Kernick. All rights reserved. // #ifndef cursor_systems_hpp #define cursor_systems_hpp #include <glm/vec2.hpp> #include "input consumed.hpp" #include <Simpleton/ECS/registry.hpp> #include <Simpleton/SDL/system cursors.hpp> ECS::EntityID getObjAtPos(ECS::Registry &, glm::vec2); void updateCursor(ECS::Registry &, SDL::SystemCursors &, ECS::EntityID); Consumed handleClick(ECS::Registry &, ECS::EntityID); #endif
6844f1997c73f77870530c19f51c53dd90b44068
29b81bdc013d76b057a2ba12e912d6d4c5b033ef
/boost/include/boost/geometry/io/wkt/read.hpp
d60bc29d5db00190414bf53bc72e4c9cd78ee87a
[]
no_license
GSIL-Monitor/third_dependences
864d2ad73955ffe0ce4912966a4f0d1c60ebd960
888ebf538db072a92d444a9e5aaa5e18b0f11083
refs/heads/master
2020-04-17T07:32:49.546337
2019-01-18T08:47:28
2019-01-18T08:47:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
130
hpp
read.hpp
version https://git-lfs.github.com/spec/v1 oid sha256:4ad16593ae7d9f08bbb9831a3b701d097354e38f39eb2bc05b3a9f22c8aad16c size 26500
48af446154657faf3bcbd0ca36167497cb2d59a6
ef57a7d942cb26b0f4ac91277cd9f094703bc2f9
/main.cpp
f87230854633bd92729593b036b693bbe75423ab
[]
no_license
jm125/Undergrad-Research
78b42e53b02f5cc463bf803872d603bd7ddcb44a
0d044e76720d924b16bdae33063774fb9dff5506
refs/heads/master
2021-01-19T20:16:25.775392
2014-08-10T23:50:58
2014-08-10T23:50:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,709
cpp
main.cpp
#include <nvector/nvector_serial.h> #include <sundials/sundials_types.h> #include <cvode/cvode.h> #include <sundials/sundials_math.h> #include "force.h" #include <fstream> #include <vector> void printPoints(realtype[], int); void PopulateLists(std::vector<double>&, std::vector<int>&, std::vector<int>&,int&,bool&); int main() { void *cvode_mem = CVodeCreate(CV_ADAMS, CV_FUNCTIONAL); int flag; //initialize int numPoints; std::vector<int> extensibleSpringList; std::vector<int> torsionalSpringList; std::vector<double> init; bool returnFlag; PopulateLists(init, extensibleSpringList, torsionalSpringList, numPoints, returnFlag); if (returnFlag) { return(-1); } N_Vector u = N_VNew_Serial(numPoints*3); for (int i = 0; i < init.size(); ++i) { NV_Ith_S(u,i) = init.at(i); } realtype reltol = RCONST(1e-9); realtype abstol = RCONST(1e-9); flag = CVodeInit(cvode_mem, force, RCONST(0), u); flag = CVodeSStolerances(cvode_mem, reltol, abstol); hexconfig testhex(u, numPoints, extensibleSpringList, torsionalSpringList); flag = CVodeSetUserData(cvode_mem, &testhex); realtype tout = 100; realtype t; realtype radius = testhex.r; generate_nhbd(u, testhex.nhbd, testhex.nhbd_partner, radius, numPoints); std::ofstream outFile; outFile.open("output.xyz"); while (t < tout) { flag = CVode(cvode_mem, tout, u, &t, CV_ONE_STEP); int curtime; curtime = static_cast<int> (t); //TBD: change to verlet list if (curtime % 10 == 0) { outFile << numPoints << "\n" << "Frame: t = " << t << "\n"; for (int i = 0; i<numPoints; i++) { outFile << "C\t" << NV_Ith_S(u,i) << "\t" << NV_Ith_S(u,i+numPoints) << "\t" << NV_Ith_S(u,i+2*numPoints) << "\t\n"; } generate_nhbd(u, testhex.nhbd, testhex.nhbd_partner, radius, numPoints); realtype check[numPoints*3]; for (int i = 0; i < numPoints*3; ++i) { check[i] = NV_Ith_S(u, i); } std::cout << "\nChecking at point " << t << ":"; printPoints(check,numPoints); } } outFile.close(); realtype final[36]; for (int i = 0; i < 36; ++i) { final[i] = NV_Ith_S(u, i); } std::cout << "\nFinal list:"; printPoints(final,12); N_VDestroy(u); CVodeFree(&cvode_mem); } void printPoints(realtype list[], int numPoints) { std::cout << "\n"; for (int i = 0; i < (numPoints*3); ++i) { std::cout << (i < numPoints ? "x" : (i < (2*numPoints) ? "y" : "z")) << (i < numPoints ? i : (i < (2*numPoints) ? i - numPoints : i - (2*numPoints))) << ":\t " << list[i] << "\n"; } } void PopulateLists(std::vector<double>& init, std::vector<int>& extensibleSprings, std::vector<int>& torsionalSprings, int& numPoints, bool& returnFlag) { std::ifstream inFile; inFile.open("init.txt"); double line; numPoints = 0; returnFlag = false; const double ESPRING_INDEX = 1011; const double TSPRING_INDEX = 1012; if(!inFile) { std::cout << "Failed to open input file\n"; returnFlag = true; } else { int listID = 0; int initIndex = 0; int curPointInt; double curPoint; while(inFile >> line && !returnFlag) { if (line == ESPRING_INDEX) { listID = 1; } else if (line == TSPRING_INDEX) { listID = 2; } else { switch(listID) { case 0: curPoint = line; init.push_back(curPoint); initIndex++; numPoints++; break; case 1: curPointInt = int(line); extensibleSprings.push_back(curPointInt); break; case 2: curPointInt = int(line); torsionalSprings.push_back(curPointInt); break; default: std::cout << "Error in input text"; returnFlag = true; break; } } } } inFile.close(); numPoints = numPoints / 3; }
6c824ace6725e26d609c0f6b0932d5d1752df47f
f6529b63d418f7d0563d33e817c4c3f6ec6c618d
/source/menu/menu_main.cpp
96d6f2c55f673cf9eee50def054584fdfb333107
[]
no_license
Captnoord/Wodeflow
b087659303bc4e6d7360714357167701a2f1e8da
5c8d6cf837aee74dc4265e3ea971a335ba41a47c
refs/heads/master
2020-12-24T14:45:43.854896
2011-07-25T14:15:53
2011-07-25T14:15:53
2,096,630
1
3
null
null
null
null
UTF-8
C++
false
false
12,637
cpp
menu_main.cpp
#include "menu.hpp" #include <wiiuse/wpad.h> #include <unistd.h> #include <fstream> #include "wbfs.h" #include "gecko.h" using namespace std; extern const u8 btnconfig_png[]; extern const u8 btnconfigs_png[]; extern const u8 btninfo_png[]; extern const u8 btninfos_png[]; extern const u8 btnquit_png[]; extern const u8 btnquits_png[]; extern const u8 btnnext_png[]; extern const u8 btnnexts_png[]; extern const u8 btnprev_png[]; extern const u8 btnprevs_png[]; extern const u8 gradient_png[]; extern const u8 favoriteson_png[]; extern const u8 favoritesons_png[]; extern const u8 favoritesoff_png[]; extern const u8 favoritesoffs_png[]; static inline int loopNum(int i, int s) { return i < 0 ? (s - (-i % s)) % s : i % s; } void CMenu::_hideMain(bool instant) { m_btnMgr.hide(m_mainBtnNext, instant); m_btnMgr.hide(m_mainBtnPrev, instant); m_btnMgr.hide(m_mainBtnConfig, instant); m_btnMgr.hide(m_mainBtnInfo, instant); m_btnMgr.hide(m_mainBtnQuit, instant); m_btnMgr.hide(m_mainBtnInit, instant); m_btnMgr.hide(m_mainLblInit, instant); m_btnMgr.hide(m_mainBtnFavoritesOn, instant); m_btnMgr.hide(m_mainBtnFavoritesOff, instant); m_btnMgr.hide(m_mainLblLetter, instant); for (u32 i = 0; i < ARRAY_SIZE(m_mainLblUser); ++i) if (m_mainLblUser[i] != -1u) m_btnMgr.hide(m_mainLblUser[i], instant); } void CMenu::_showMain(void) { _setBg(m_mainBg, m_mainBgLQ); m_btnMgr.show(m_mainBtnConfig); m_btnMgr.show(m_mainBtnInfo); m_btnMgr.show(m_mainBtnQuit); for (u32 i = 1; i < ARRAY_SIZE(m_mainLblUser); ++i) if (m_mainLblUser[i] != -1u) m_btnMgr.show(m_mainLblUser[i]); if (m_gameList.empty()) { m_btnMgr.show(m_mainBtnInit); m_btnMgr.show(m_mainLblInit); } } int CMenu::main(void) { s32 padsState; WPADData *wd; u32 btn; wstringEx curLetter; int repeatButton = 0; u32 buttonHeld = (u32)-1; string prevTheme = m_cfg.getString(" GENERAL", "theme", "default"); bool reload = false; float angle = 0; float mag = 0; // static u32 disc_check = 0, olddisc_check = 0; WPAD_Rumble(WPAD_CHAN_0, 0); m_padLeftDelay = 0; m_padRightDelay = 0; _loadGameList(); _showMain(); m_curGameId.clear(); _initCF(); _searchMusic(); _startMusic(); // WDVD_GetCoverStatus(&disc_check); while (true) { // olddisc_check = disc_check; // WDVD_GetCoverStatus(&disc_check); WPAD_ScanPads(); padsState = WPAD_ButtonsDown(0); wd = WPAD_Data(0); btn = _btnRepeat(wd->btns_h); //Get Nunchuk values angle = wd->exp.nunchuk.js.ang; mag = wd->exp.nunchuk.js.mag; //check if Disc was inserted /* if ((disc_check & 0x2) && (disc_check!=olddisc_check) && !m_locked) { _hideMain(); _wbfsOp(CMenu::WO_ADD_GAME); _showMain(); } */ if ((padsState & WPAD_BUTTON_HOME) != 0) { reload = (wd->btns_h & WPAD_BUTTON_B) != 0; break; } if (wd->ir.valid) m_btnMgr.mouse(wd->ir.x - m_cur.width() / 2, wd->ir.y - m_cur.height() / 2); ++repeatButton; if ((wd->btns_h & WPAD_BUTTON_A) == 0) buttonHeld = (u32)-1; else if (buttonHeld != (u32)-1 && buttonHeld == m_btnMgr.selected() && repeatButton >= 16) padsState |= WPAD_BUTTON_A; if ((padsState & WPAD_BUTTON_1) != 0) { int cfVersion = 1 + loopNum(m_cfg.getInt(" GENERAL", "last_cf_mode", 1), m_numCFVersions); _loadCFLayout(cfVersion); m_cf.applySettings(); m_cfg.setInt(" GENERAL", "last_cf_mode", cfVersion); } else if ((padsState & WPAD_BUTTON_2) != 0) { int cfVersion = 1 + loopNum(m_cfg.getInt(" GENERAL", "last_cf_mode", 1) - 2, m_numCFVersions); _loadCFLayout(cfVersion); m_cf.applySettings(); m_cfg.setInt(" GENERAL", "last_cf_mode", cfVersion); } if (((padsState & (WPAD_BUTTON_DOWN | WPAD_BUTTON_RIGHT)) != 0 && (wd->btns_h & WPAD_BUTTON_B) != 0) || ((padsState & WPAD_BUTTON_PLUS) != 0 && m_alphaSearch == ((wd->btns_h & WPAD_BUTTON_B) == 0))) { curLetter.resize(1); curLetter[0] = m_cf.nextLetter(); m_letter = 60; m_btnMgr.setText(m_mainLblLetter, curLetter); m_btnMgr.show(m_mainLblLetter); } else if (((padsState & (WPAD_BUTTON_UP | WPAD_BUTTON_LEFT)) != 0 && (wd->btns_h & WPAD_BUTTON_B) != 0) || ((padsState & WPAD_BUTTON_MINUS) != 0 && m_alphaSearch == ((wd->btns_h & WPAD_BUTTON_B) == 0))) { curLetter.resize(1); curLetter[0] = m_cf.prevLetter(); m_letter = 60; m_btnMgr.setText(m_mainLblLetter, curLetter); m_btnMgr.show(m_mainLblLetter); } else if ((padsState & WPAD_BUTTON_UP) != 0) m_cf.up(); else if ((padsState & WPAD_BUTTON_DOWN) != 0) m_cf.down(); else if ((padsState & WPAD_BUTTON_MINUS) != 0) m_cf.pageUp(); else if ((padsState & WPAD_BUTTON_PLUS) != 0) m_cf.pageDown(); else if ((btn & WPAD_BUTTON_LEFT) != 0 || ((angle > 255 && angle < 285) && mag > 0.75)) m_cf.left(); else if ((btn & WPAD_BUTTON_RIGHT) != 0 || ((angle > 75 && angle < 105) && mag > 0.75)) m_cf.right(); if ((padsState & WPAD_BUTTON_A) != 0) { if (buttonHeld != m_btnMgr.selected()) m_btnMgr.click(); if (m_btnMgr.selected() == m_mainBtnQuit) break; else if (m_btnMgr.selected() == m_mainBtnInit) { _hideMain(); _config(2); if (prevTheme != m_cfg.getString(" GENERAL", "theme")) { reload = true; break; } _showMain(); } else if (m_btnMgr.selected() == m_mainBtnConfig) { _hideMain(); _config(1); if (prevTheme != m_cfg.getString(" GENERAL", "theme")) { reload = true; break; } _showMain(); } else if (m_btnMgr.selected() == m_mainBtnInfo) { _hideMain(); _about(); _showMain(); } else if (m_btnMgr.selected() == m_mainBtnNext) { m_cf.right(); if (buttonHeld != m_btnMgr.selected()) { repeatButton = 0; buttonHeld = m_btnMgr.selected(); } } else if (m_btnMgr.selected() == m_mainBtnPrev) { m_cf.left(); if (buttonHeld != m_btnMgr.selected()) { repeatButton = 0; buttonHeld = m_btnMgr.selected(); } } else if (m_btnMgr.selected() == m_mainBtnFavoritesOn || m_btnMgr.selected() == m_mainBtnFavoritesOff) { m_favorites = !m_favorites; m_cfg.setInt(" GENERAL", "favorites", m_favorites); m_curGameId = m_cf.getId(); _initCF(); } else if (!m_cf.empty()) { if (m_cf.select()) { _hideMain(); _game((wd->btns_h & WPAD_BUTTON_B) != 0); m_cf.cancel(); _showMain(); } } } if (m_letter > 0) if (--m_letter == 0) m_btnMgr.hide(m_mainLblLetter); // if (!m_gameList.empty() && wd->ir.valid && m_cur.x() >= m_mainPrevZone.x && m_cur.y() >= m_mainPrevZone.y && m_cur.x() < m_mainPrevZone.x + m_mainPrevZone.w && m_cur.y() < m_mainPrevZone.y + m_mainPrevZone.h) m_btnMgr.show(m_mainBtnPrev); else m_btnMgr.hide(m_mainBtnPrev); if (!m_gameList.empty() && wd->ir.valid && m_cur.x() >= m_mainNextZone.x && m_cur.y() >= m_mainNextZone.y && m_cur.x() < m_mainNextZone.x + m_mainNextZone.w && m_cur.y() < m_mainNextZone.y + m_mainNextZone.h) m_btnMgr.show(m_mainBtnNext); else m_btnMgr.hide(m_mainBtnNext); if (!m_gameList.empty() && wd->ir.valid && m_cur.x() >= m_mainButtonsZone.x && m_cur.y() >= m_mainButtonsZone.y && m_cur.x() < m_mainButtonsZone.x + m_mainButtonsZone.w && m_cur.y() < m_mainButtonsZone.y + m_mainButtonsZone.h) { m_btnMgr.show(m_mainLblUser[0]); m_btnMgr.show(m_mainBtnConfig); m_btnMgr.show(m_mainBtnInfo); m_btnMgr.show(m_mainBtnQuit); m_btnMgr.show(m_favorites ? m_mainBtnFavoritesOn : m_mainBtnFavoritesOff); m_btnMgr.hide(m_favorites ? m_mainBtnFavoritesOff : m_mainBtnFavoritesOn); } else { m_btnMgr.hide(m_mainLblUser[0]); m_btnMgr.hide(m_mainBtnConfig); m_btnMgr.hide(m_mainBtnInfo); m_btnMgr.hide(m_mainBtnQuit); m_btnMgr.hide(m_mainBtnFavoritesOn); m_btnMgr.hide(m_mainBtnFavoritesOff); } // if (!wd->ir.valid || m_btnMgr.selected() != (u32)-1) m_cf.mouse(m_vid, -1, -1); else m_cf.mouse(m_vid, m_cur.x(), m_cur.y()); _mainLoopCommon(wd, true); } WPAD_Rumble(WPAD_CHAN_0, 0); // GX_InvVtxCache(); GX_InvalidateTexAll(); m_cf.clear(); m_cfg.save(); // m_loc.save(); _stopSounds(); if (reload) { m_vid.waitMessage(m_waitMessage); return 1; } return 0; } void CMenu::_initMainMenu(CMenu::SThemeData &theme) { STexture texQuit; STexture texQuitS; STexture texInfo; STexture texInfoS; STexture texConfig; STexture texConfigS; STexture texPrev; STexture texPrevS; STexture texNext; STexture texNextS; STexture texFavOn; STexture texFavOnS; STexture texFavOff; STexture texFavOffS; STexture bgLQ; STexture emptyTex; m_mainBg = _texture(theme.texSet, "MAIN/BG", "texture", theme.bg); if (m_theme.loaded() && STexture::TE_OK == bgLQ.fromPNGFile(sfmt("%s/%s", m_themeDataDir.c_str(), m_theme.getString("MAIN/BG", "texture").c_str()).c_str(), GX_TF_CMPR, ALLOC_MEM2, 64, 64)) m_mainBgLQ = bgLQ; texQuit.fromPNG(btnquit_png); texQuitS.fromPNG(btnquits_png); texInfo.fromPNG(btninfo_png); texInfoS.fromPNG(btninfos_png); texConfig.fromPNG(btnconfig_png); texConfigS.fromPNG(btnconfigs_png); texPrev.fromPNG(btnprev_png); texPrevS.fromPNG(btnprevs_png); texNext.fromPNG(btnnext_png); texNextS.fromPNG(btnnexts_png); texFavOn.fromPNG(favoriteson_png); texFavOnS.fromPNG(favoritesons_png); texFavOff.fromPNG(favoritesoff_png); texFavOffS.fromPNG(favoritesoffs_png); _addUserLabels(theme, m_mainLblUser, ARRAY_SIZE(m_mainLblUser), "MAIN"); m_mainBtnInfo = _addPicButton(theme, "MAIN/INFO_BTN", texInfo, texInfoS, 20, 412, 48, 48); m_mainBtnConfig = _addPicButton(theme, "MAIN/CONFIG_BTN", texConfig, texConfigS, 70, 412, 48, 48); m_mainBtnQuit = _addPicButton(theme, "MAIN/QUIT_BTN", texQuit, texQuitS, 570, 412, 48, 48); m_mainBtnNext = _addPicButton(theme, "MAIN/NEXT_BTN", texNext, texNextS, 540, 146, 80, 80); m_mainBtnPrev = _addPicButton(theme, "MAIN/PREV_BTN", texPrev, texPrevS, 20, 146, 80, 80); m_mainBtnInit = _addButton(theme, "MAIN/BIG_SETTINGS_BTN", theme.titleFont, L"", 60, 180, 520, 120, CColor(0xFFFFFFFF)); m_mainLblInit = _addLabel(theme, "MAIN/MESSAGE", theme.lblFont, L"", 40, 40, 560, 140, CColor(0xFFFFFFFF), FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_mainBtnFavoritesOn = _addPicButton(theme, "MAIN/FAVORITES_ON", texFavOn, texFavOnS, 300, 412, 56, 56); m_mainBtnFavoritesOff = _addPicButton(theme, "MAIN/FAVORITES_OFF", texFavOff, texFavOffS, 300, 412, 56, 56); m_mainLblLetter = _addLabel(theme, "MAIN/LETTER", theme.titleFont, L"", 540, 40, 80, 80, CColor(0xFFFFFFFF), FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, emptyTex); // m_mainPrevZone.x = m_theme.getInt("MAIN/ZONES", "prev_x", -32); m_mainPrevZone.y = m_theme.getInt("MAIN/ZONES", "prev_y", -32); m_mainPrevZone.w = m_theme.getInt("MAIN/ZONES", "prev_w", 182); m_mainPrevZone.h = m_theme.getInt("MAIN/ZONES", "prev_h", 382); m_mainNextZone.x = m_theme.getInt("MAIN/ZONES", "next_x", 490); m_mainNextZone.y = m_theme.getInt("MAIN/ZONES", "next_y", -32); m_mainNextZone.w = m_theme.getInt("MAIN/ZONES", "next_w", 182); m_mainNextZone.h = m_theme.getInt("MAIN/ZONES", "next_h", 382); m_mainButtonsZone.x = m_theme.getInt("MAIN/ZONES", "buttons_x", -32); m_mainButtonsZone.y = m_theme.getInt("MAIN/ZONES", "buttons_y", 350); m_mainButtonsZone.w = m_theme.getInt("MAIN/ZONES", "buttons_w", 704); m_mainButtonsZone.h = m_theme.getInt("MAIN/ZONES", "buttons_h", 162); // _setHideAnim(m_mainBtnNext, "MAIN/NEXT_BTN", 0, 0, 0.f, 0.f); _setHideAnim(m_mainBtnPrev, "MAIN/PREV_BTN", 0, 0, 0.f, 0.f); _setHideAnim(m_mainBtnConfig, "MAIN/CONFIG_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnInfo, "MAIN/INFO_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnQuit, "MAIN/QUIT_BTN", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnFavoritesOn, "MAIN/FAVORITES_ON", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnFavoritesOff, "MAIN/FAVORITES_OFF", 0, 40, 0.f, 0.f); _setHideAnim(m_mainBtnInit, "MAIN/BIG_SETTINGS_BTN", 0, 0, -2.f, 0.f); _setHideAnim(m_mainLblInit, "MAIN/MESSAGE", 0, 0, 0.f, 0.f); _setHideAnim(m_mainLblLetter, "MAIN/LETTER", 0, 0, 0.f, 0.f); _hideMain(true); _textMain(); } void CMenu::_textMain(void) { m_btnMgr.setText(m_mainBtnInit, _t("main1", L"Settings")); m_btnMgr.setText(m_mainLblInit, _t("main2", L"Welcome to WodeFlow. I have not found any game. Click on Settings to install games."), true); }