blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c08b4de9cfcdbe436ff6ad41fdae2e9644b764dd | 9b23195793276f2fc17f459f2813fe9f1d5e97b6 | /snbody.cpp | 7d12c0d68a28d348400ae4d436f4d0df8b299a94 | [] | no_license | abbenteprizer/n-body | 7875488ff188348ce78a2e0cfc417cb2e2f92d45 | 149ba0b8a7f287126e2714681cb178a9012536b1 | refs/heads/master | 2020-04-27T17:06:18.413579 | 2019-03-17T14:22:03 | 2019-03-17T14:22:03 | 174,505,096 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,367 | cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <omp.h>
#include <limits>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <stdbool.h>
// #define G 6.67e-11
#define DIMENSION 100
#define TIMESTEP 0.1
double G = 6.67e-11;
int num_planets;
using namespace std;
struct point {
double x; //position
double y;
double vx; // velocity
double vy;
double fx; // force
double fy;
double m; // mass
};
/* benchmark code */
double read_timer() {
static bool initialized = false;
static struct timeval start;
struct timeval end;
if( !initialized )
{
gettimeofday( &start, NULL );
initialized = true;
}
gettimeofday( &end, NULL );
return (end.tv_sec - start.tv_sec) + 1.0e-6 * (end.tv_usec - start.tv_usec);
}
void calcForces(std::vector<point> &p){ // p contains all points
double distance, magnitude, direction;
double xd, yd; // partial directions
double e = 0.001; // margin to avoid zero division
for(unsigned i = 0; i < p.size() - 1; i++) {
for(unsigned j = i + 1; j < p.size(); j++) {
distance = std::sqrt( std::pow((p[i].x - p[j].x), 2 ) +
std::pow((p[i].y - p[j].y),2) );
if(distance < e){ // avoids dividing by zero
distance = e;
// printf("too close the distance was %lf\n", distance);
}
magnitude = (G * p[i].m * p[j].m) / std::pow(distance, 2);
xd = p[j].x - p[i].x; // direction with respect to x
yd = p[j].y - p[i].y; // direction with respect to y
// printf("did we get here?\n");
/* update forces */
p[i].fx = p[i].fx + magnitude * xd / distance; // make not inf
p[j].fx = p[j].fx - magnitude * xd / distance;
p[i].fy = p[i].fy + magnitude * yd / distance;
p[j].fy = p[j].fy - magnitude * yd / distance;
}
}
}
void moveBodies(std::vector<point> &p) {
double dvx, dvy, dpx, dpy; // partial velocities and positions
for(unsigned i = 0; i < p.size(); i++) {
dvx = p[i].fx / p[i].m * TIMESTEP;
dvy = p[i].fy / p[i].m * TIMESTEP;
dpx = (p[i].vx + dvx/2) * TIMESTEP;
dpy = (p[i].vy + dvy/2) * TIMESTEP;
p[i].vx = p[i].vx + dvx; // change velocity
p[i].vy = p[i].vy + dvy;
p[i].x = p[i].x + dpx; // change position
p[i].y = p[i].y + dpy;
// cout << "node "<< i << " has position [" << p[i].x << "][" << p[i].y << "]" << endl;
double color = i / (double)num_planets;
// printf("%lf %lf %lf\n", p[i].x, p[i].y, color);
p[i].fx = p[i].fy = 0.0; //reset force vector
}
}
void createBody(double xp, double yp, double vx, double vy, double fx, double fy, double m, std::vector<point> &bodies) {
point* newPoint = new point;
newPoint->x = xp;
newPoint->y = yp;
newPoint->vx = vx;
newPoint->vy = vy;
newPoint->fx = fx;
newPoint->fy = fy;
newPoint->m = m;
bodies.push_back(*newPoint);
}
// used for random numbers
double r(int range) {
int imax = std::numeric_limits<int>::max();
double whole = rand() % range;
// printf("rand = %d\n", rand());
double fraction = (double) (rand() % 10000) / 10000;
// printf("fraction %lf\n", fraction);
double retval = whole + fraction;
if((int)retval % 2) // allow for negative
retval = -retval;
// printf("retval is %lf\n", retval);
return retval;// random double
}
int main(int argc, char* argv[]){
num_planets = (argc > 1) ? atoi(argv[1]): 120;
int num_iterations = (argc > 2) ? atoi(argv[2]): 1000;
/* create bodies */
vector<point> bodies;
// just for fun
G = 1.0; // This greatly increase the gravity
// args are in form: (xp, yp, vx, vy, fx, fy, m, &bodies)
srand( 1234567 );//time(NULL) ); // set seed for random
// create the central and heavier body
createBody(0, 0, 0, 0, r(10), r(10), abs(r(20)) + 10, bodies);
for(int i = 1; i < num_planets; i++) {
createBody(r(100), r(100), r(4), r(4), r(10), r(10), abs(r(4)) + 1, bodies);
}
double start_time, end_time; /* start and end times */
start_time = read_timer();
srand( time(NULL) ); // set seed for random
/* uses TIMESTEP for making time discrete */
for(int i = 0; i < num_iterations; i++){
/* calculateForces */
calcForces(bodies);
/* move bodies */
moveBodies(bodies);
}
end_time = read_timer();
printf("%g\n", end_time - start_time);
return 0;
}
| [
"abbenteprizer@gmail.com"
] | abbenteprizer@gmail.com |
2ef59753ac8dfd047569bb5d357b14a415b4f945 | d4b17a1dde0309ea8a1b2f6d6ae640e44a811052 | /lang_service/java/com/intel/daal/algorithms/univariate_outlier_detection/input.cpp | 3fe1bd68f3ec46e678716a3b0a5f915bfc36bd28 | [
"Apache-2.0",
"Intel"
] | permissive | h2oai/daal | c50f2b14dc4a9ffc0b7f7bcb40b599cadac6d333 | d49815df3040f3872a1fdb9dc99ee86148e4494e | refs/heads/daal_2018_beta_update1 | 2023-05-25T17:48:44.312245 | 2017-09-29T13:30:10 | 2017-09-29T13:30:10 | 96,125,165 | 2 | 3 | null | 2017-09-29T13:30:11 | 2017-07-03T15:26:26 | C++ | UTF-8 | C++ | false | false | 1,976 | cpp | /* file: input.cpp */
/*******************************************************************************
* Copyright 2014-2017 Intel Corporation
*
* 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 <jni.h>/* Header for class com_intel_daal_algorithms_univariate_outlier_detection_Input */
#include "daal.h"
#include "univariate_outlier_detection/JInput.h"
#include "univariate_outlier_detection/JMethod.h"
#include "common_helpers.h"
USING_COMMON_NAMESPACES()
using namespace daal::algorithms::univariate_outlier_detection;
/*
* Class: com_intel_daal_algorithms_univariate_outlier_detection_Input
* Method: cSetInput
* Signature: (JIJ)V
*/
JNIEXPORT void JNICALL Java_com_intel_daal_algorithms_univariate_1outlier_1detection_Input_cSetInput
(JNIEnv *env, jobject thisObj, jlong inputAddr, jint id, jlong ntAddr)
{
jniInput<univariate_outlier_detection::Input>::set<univariate_outlier_detection::InputId, NumericTable>(inputAddr, id, ntAddr);
}
/*
* Class: com_intel_daal_algorithms_univariate_outlier_detection_Input
* Method: cGetInputTable
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_univariate_1outlier_1detection_Input_cGetInputTable
(JNIEnv *env, jobject thisObj, jlong inputAddr, jint id)
{
return jniInput<univariate_outlier_detection::Input>::get<univariate_outlier_detection::InputId, NumericTable>(inputAddr, id);
}
| [
"vasily.rubtsov@intel.com"
] | vasily.rubtsov@intel.com |
b9582b9d5ff56229dbcc0492f43314f9c354b154 | 451d07b78493d503add9b54ee9ba23d3777f43e1 | /src/QuickLZ/level-4.cpp | 9361c15c23bac557c2e06d7fa5453e34252e516a | [
"MIT"
] | permissive | Vladimir-Lin/QtQuickLZ | 3c16e964bd3bc73c1954324a6fbea263715c50f6 | 2f60319997fb254388f7007f3f0226eee91dc129 | refs/heads/main | 2023-06-15T11:30:28.761370 | 2021-07-11T14:26:25 | 2021-07-11T14:26:25 | 377,382,791 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,280 | cpp | /****************************************************************************
*
* Copyright (C) 2016 Neutrino International Inc.
*
* Author : Brian Lin ( Vladimir Lin , Vladimir Forest )
* E-mail : lin.foxman@gmail.com
* : lin.vladimir@gmail.com
* : wolfram_lin@yahoo.com
* : wolfram_lin@sina.com
* : wolfram_lin@163.com
* Skype : wolfram_lin
* WeChat : 153-0271-7160
* WhatsApp : 153-0271-7160
* QQ : lin.vladimir@gmail.com
* URL : http://qtlz4.sourceforge.net/
*
* QtLZ4 acts as an interface between Qt and QuickLZ library.
* Please keep QtLZ4 as simple as possible.
*
* Copyright 2001 ~ 2016
*
****************************************************************************/
#include "qlz.hpp"
QT_BEGIN_NAMESPACE
//////////////////////////////////////////////////////////////////////////////
inline void reset_table_compress(qlz_state_compress_level_4 * state)
{
for (int i = 0 ; i < QLZ_HASH_VALUES_L4 ; i++ ) {
state -> hash_counter [ i ] = 0 ;
} ;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
QT_END_NAMESPACE
| [
"lin.vladimir@gmail.com"
] | lin.vladimir@gmail.com |
5cf55322a5c88303104a8c14079528a168146ee7 | 52de6170dbd69f70d83c640ba2b118657bd876e3 | /console/queue/queue/queue.h | 50b2a3391d399f904c1df353765daea0cfc6b4a9 | [] | no_license | Nukem74/QTSolutions | 96fdc25f3b8c0b1b3c932c677c6076eb61452920 | 6e8ff67ca3f684b7c30bd1b7b2b581ffba665a82 | refs/heads/master | 2020-05-16T16:53:46.921259 | 2019-12-10T05:38:25 | 2019-12-10T05:38:25 | 182,659,727 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,298 | h | #ifndef QUEUE_H
#define QUEUE_H
#include <iostream>
#include <cassert>
using namespace std;
template<typename T>
class Queue
{
private:
T *queuePtr; // указатель на очередь
const int size; // максимальное количество элементов в очереди
int begin, // начало очереди
end; // конец очереди
int elemCT; // счетчик элементов
public:
Queue(int =10); // конструктор по умолчанию
Queue(const Queue<T> &); // конструктор копирования
~Queue(); // деструктор
void enqueue(const T &); // добавить элемент в очередь
T dequeue(); // удалить элемент из очереди
void printQueue();
};
// реализация методов шаблона класса Queue
// конструктор по умолчанию
template<typename T>
Queue<T>::Queue(int sizeQueue) :
size(sizeQueue), // инициализация константы
begin(0), end(0), elemCT(0)
{
// дополнительная позици поможет нам различать конец и начало очереди
queuePtr = new T[size + 1];
}
// конструктор копии
template<typename T>
Queue<T>::Queue(const Queue &otherQueue) :
size(otherQueue.size) , begin(otherQueue.begin),
end(otherQueue.end), elemCT(otherQueue.elemCT),
queuePtr(new T[size + 1])
{
for (int ix = 0; ix < size; ix++)
queuePtr[ix] = otherQueue.queuePtr[ix]; // копируем очередь
}
// деструктор класса Queue
template<typename T>
Queue<T>::~Queue()
{
delete [] queuePtr;
}
// функция добавления элемента в очередь
template<typename T>
void Queue<T>::enqueue(const T &newElem)
{
// проверяем, ести ли свободное место в очереди
assert( elemCT < size );
// обратите внимание на то, что очередь начинает заполняться с 0 индекса
queuePtr[end++] = newElem;
elemCT++;
// проверка кругового заполнения очереди
if (end > size)
end -= size + 1; // возвращаем end на начало очереди
}
// функция удаления элемента из очереди
template<typename T>
T Queue<T>::dequeue()
{
// проверяем, есть ли в очереди элементы
assert( elemCT > 0 );
T returnValue = queuePtr[begin++];
elemCT--;
// проверка кругового заполнения очереди
if (begin > size)
begin -= size + 1; // возвращаем begin на начало очереди
return returnValue;
}
template<typename T>
void Queue<T>::printQueue()
{
cout << "Queue: ";
if (end == 0 && begin == 0)
cout << " empty\n";
else
{
for (int ix = end; ix >= begin; ix--)
cout << queuePtr[ix] << " ";
cout << endl;
}
}
#endif // QUEUE_H
| [
"Nukem74@gmail.com"
] | Nukem74@gmail.com |
0c79661938a75134cd97ae2e936df3a1ed8c6294 | bdd86480abf7ce41ee0f80e0a541c880d7835e0a | /Profilers.cpp | 7ca7ca6b362b651de44e9d5f2ebb302000b27630 | [
"BSD-2-Clause"
] | permissive | Adam23713/CPP-Profiler | 24813a2655d9482f8b0fc7d862de70b909c2f9d4 | f80861a72a37ae0d40792550856bc54b8b764296 | refs/heads/master | 2020-03-24T04:15:47.517187 | 2018-07-26T14:11:57 | 2018-07-26T14:11:57 | 142,449,623 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,173 | cpp | #include "Profilers.h"
TimeMeasurer::TimeMeasurer(const std::string& name) : _subjectName(name), _curretTimer(true)
{
}
TimeMeasurer::~TimeMeasurer()
{
auto duration = _curretTimer.ElapsedTime<TimeType>();
TimerMeasurerCollector::Instance().AddNewElement(_subjectName, duration);
}
std::string TimerMeasurerCollector::ChronoTimeToStdString(TimeType time) const
{
auto nanoTime = std::chrono::duration_cast<std::chrono::nanoseconds>(time).count();
if (nanoTime >= 1000000000)
{
auto sec = nanoTime / (double)1000000000;
if (sec >= 3600)
return std::to_string(sec / (double)3600) + " hour";
else if (sec >= 60)
return std::to_string(sec / (double)60) + " min";
return std::to_string(sec) + " sec";
}
else if (nanoTime >= 1000000)
return std::to_string(nanoTime / (double)1000000) + " ms";
else if (nanoTime >= 1000)
return std::to_string(nanoTime / (double)1000) + " us";
return std::to_string(nanoTime) + " ns";
}
TimerMeasurerCollector& TimerMeasurerCollector::Instance()
{
static TimerMeasurerCollector _instance;
return _instance;
}
void TimerMeasurerCollector::WriteResults(std::ostream *stream, bool desc) const
{
std::lock_guard<std::mutex> lock(_guardMutex); //Lock function
ConsoleTable table(6);
table.AddNewRow({ "Name", "Runs", "Minimum", "Maximum", "Total Time","Average Time"});
for(const std::pair<std::string, PerformanceResult<TimeType>>& result : _results)
{
std::forward_list<std::string> row;
TimeType max = result.second.GetMaximum();
TimeType min = result.second.GetMinimum();
row.push_front(ChronoTimeToStdString(result.second.GetSummary() / result.second.GetCounter()));
row.push_front(ChronoTimeToStdString(result.second.GetSummary()));
row.push_front(ChronoTimeToStdString(max));
row.push_front(ChronoTimeToStdString(min));
row.push_front(std::to_string(result.second.GetCounter()));
row.push_front(result.first);
table.AddNewRow(row);
}
table.WriteTable(Align::Center, stream);
}
void TimerMeasurerCollector::AddNewElement(const std::string& name, TimeType duration)
{
std::lock_guard<std::mutex> lock(_guardMutex); //Lock Function
_results[name].AddTimeResult(duration);
}
| [
"kerteszadam23@gmail.com"
] | kerteszadam23@gmail.com |
fcbabb5a8252f47e9308f42038f522b607ae0e64 | 1bfefe31f2bca91052272326f5f5f07a19eb8344 | /MaxCam/DmtpcStringToolsCint.h | fb7a56785b9d1f2847eae78c9ba53b9b3c6ff57f | [] | no_license | tjjjjjjj/OLIVIA-DCTPC | d1e4279519d25014a29793888ac1b92b3b02672d | d25c4896c8fb44e838593bcc5c7da42838713259 | refs/heads/master | 2020-12-25T10:35:53.368417 | 2016-08-22T17:24:52 | 2016-08-22T17:24:52 | 60,537,945 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,030 | h | /********************************************************************
* DmtpcStringToolsCint.h
* CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED
* FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX().
* CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE.
********************************************************************/
#ifdef __CINT__
#error DmtpcStringToolsCint.h/C is only for compilation. Abort cint.
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define G__ANSIHEADER
#define G__DICTIONARY
#define G__PRIVATE_GVALUE
#include "G__ci.h"
#include "FastAllocString.h"
extern "C" {
extern void G__cpp_setup_tagtableDmtpcStringToolsCint();
extern void G__cpp_setup_inheritanceDmtpcStringToolsCint();
extern void G__cpp_setup_typetableDmtpcStringToolsCint();
extern void G__cpp_setup_memvarDmtpcStringToolsCint();
extern void G__cpp_setup_globalDmtpcStringToolsCint();
extern void G__cpp_setup_memfuncDmtpcStringToolsCint();
extern void G__cpp_setup_funcDmtpcStringToolsCint();
extern void G__set_cpp_environmentDmtpcStringToolsCint();
}
#include "TObject.h"
#include "TMemberInspector.h"
#include "DmtpcStringTools.hh"
#include <algorithm>
namespace std { }
using namespace std;
#ifndef G__MEMFUNCBODY
#endif
extern G__linked_taginfo G__DmtpcStringToolsCintLN_string;
extern G__linked_taginfo G__DmtpcStringToolsCintLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR;
extern G__linked_taginfo G__DmtpcStringToolsCintLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__DmtpcStringToolsCintLN_vectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgR;
extern G__linked_taginfo G__DmtpcStringToolsCintLN_reverse_iteratorlEvectorlETVirtualArraymUcOallocatorlETVirtualArraymUgRsPgRcLcLiteratorgR;
extern G__linked_taginfo G__DmtpcStringToolsCintLN_DmtpcStringTools;
/* STUB derived class for protected member access */
| [
"spitzj@mit.edu"
] | spitzj@mit.edu |
366a33789987b71093c15d5cd74b37d965641cbe | ea3719ca6418482df5d1bbe38851114684794e9f | /Algorithms/094. Binary Tree Inorder Traversal/94. Binary Tree Inorder Traversal(Iteration).cpp | 1fe4dc4b5ddb957fc8a72a32ce4837737998766a | [] | no_license | JokerLbz/Leetcode | 131335a48b1607df31c1e1b23b81b3acb1eaad38 | 26f0e97c5168c45929dac5d7d41c78eef8321a56 | refs/heads/master | 2020-04-25T08:59:41.535235 | 2019-04-20T12:58:07 | 2019-04-20T12:58:07 | 172,664,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,084 | cpp | //Question : 94. Binary Tree Inorder Traversal
//URL : https://leetcode.com/problems/binary-tree-inorder-traversal/
//Approach : Iteration (迭代)
//Runtime : 4 ms (100%)
//Memory Usage : 8.9 MB (97.23%)
//Time complexity : O(n)
//Space complexity : O(n)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> inorderTraversal(TreeNode* root) {
if(!root) return vector<int>{};
vector<int> res;
stack<TreeNode*> s;
s.push(root);
while(!s.empty())
{
TreeNode* temp = s.top();
if(temp -> left)
{
s.push(temp -> left);
temp -> left = nullptr;
}
else
{
res.push_back(temp -> val);
s.pop();
if(temp -> right)
s.push(temp -> right);
}
}
return res;
}
}; | [
"lbz1996@hotmail.com"
] | lbz1996@hotmail.com |
9e4ae45293a82dc6d84ec440115461fc19ea6fea | 10ecd7454a082e341eb60817341efa91d0c7fd0b | /SDK/HooksClothingCategory_classes.h | cfd6e277ef0ea2ab2ba26e6e4d68877211ca48b5 | [] | no_license | Blackstate/Sot-SDK | 1dba56354524572894f09ed27d653ae5f367d95b | cd73724ce9b46e3eb5b075c468427aa5040daf45 | refs/heads/main | 2023-04-10T07:26:10.255489 | 2021-04-23T01:39:08 | 2021-04-23T01:39:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 750 | h | #pragma once
// Name: SoT, Version: 2.1.0.1
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass HooksClothingCategory.HooksClothingCategory_C
// 0x0000 (FullSize[0x00A0] - InheritedSize[0x00A0])
class UHooksClothingCategory_C : public UClothingCategory
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass HooksClothingCategory.HooksClothingCategory_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"ploszjanos9844@gmail.com"
] | ploszjanos9844@gmail.com |
a51dad7f111740e19e8ba316d34bf8cfee6b1e8f | a2be0dcdddf8d3004623340d470b3aa85a639947 | /DataBaseConnection/DataBaseConnection/sha256.cpp | 560b81f0cf3ac0c783eb7a68b6653c00b4dc34c3 | [] | no_license | AlteracValleyHumber2019/NetworkTest | b9ae0cc54fa0ac72c726d12776310b6ff522e4e8 | b1c7ff5aa8435bee1f7ce9cf33258e31c17f4feb | refs/heads/master | 2020-04-25T11:40:35.505752 | 2019-04-20T17:50:08 | 2019-04-20T17:50:08 | 172,752,629 | 0 | 0 | null | 2019-04-09T21:05:31 | 2019-02-26T16:55:24 | C | UTF-8 | C++ | false | false | 3,650 | cpp | #include <cstring>
#include <fstream>
#include "pch.h"
#include "sha256.h"
const unsigned int SHA256::sha256_k[64] = //UL = uint32
{ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 };
void SHA256::transform(const unsigned char *message, unsigned int block_nb)
{
uint32 w[64];
uint32 wv[8];
uint32 t1, t2;
const unsigned char *sub_block;
int i;
int j;
for (i = 0; i < (int)block_nb; i++) {
sub_block = message + (i << 6);
for (j = 0; j < 16; j++) {
SHA2_PACK32(&sub_block[j << 2], &w[j]);
}
for (j = 16; j < 64; j++) {
w[j] = SHA256_F4(w[j - 2]) + w[j - 7] + SHA256_F3(w[j - 15]) + w[j - 16];
}
for (j = 0; j < 8; j++) {
wv[j] = m_h[j];
}
for (j = 0; j < 64; j++) {
t1 = wv[7] + SHA256_F2(wv[4]) + SHA2_CH(wv[4], wv[5], wv[6])
+ sha256_k[j] + w[j];
t2 = SHA256_F1(wv[0]) + SHA2_MAJ(wv[0], wv[1], wv[2]);
wv[7] = wv[6];
wv[6] = wv[5];
wv[5] = wv[4];
wv[4] = wv[3] + t1;
wv[3] = wv[2];
wv[2] = wv[1];
wv[1] = wv[0];
wv[0] = t1 + t2;
}
for (j = 0; j < 8; j++) {
m_h[j] += wv[j];
}
}
}
void SHA256::init()
{
m_h[0] = 0x6a09e667;
m_h[1] = 0xbb67ae85;
m_h[2] = 0x3c6ef372;
m_h[3] = 0xa54ff53a;
m_h[4] = 0x510e527f;
m_h[5] = 0x9b05688c;
m_h[6] = 0x1f83d9ab;
m_h[7] = 0x5be0cd19;
m_len = 0;
m_tot_len = 0;
}
void SHA256::update(const unsigned char *message, unsigned int len)
{
unsigned int block_nb;
unsigned int new_len, rem_len, tmp_len;
const unsigned char *shifted_message;
tmp_len = SHA224_256_BLOCK_SIZE - m_len;
rem_len = len < tmp_len ? len : tmp_len;
memcpy(&m_block[m_len], message, rem_len);
if (m_len + len < SHA224_256_BLOCK_SIZE) {
m_len += len;
return;
}
new_len = len - rem_len;
block_nb = new_len / SHA224_256_BLOCK_SIZE;
shifted_message = message + rem_len;
transform(m_block, 1);
transform(shifted_message, block_nb);
rem_len = new_len % SHA224_256_BLOCK_SIZE;
memcpy(m_block, &shifted_message[block_nb << 6], rem_len);
m_len = rem_len;
m_tot_len += (block_nb + 1) << 6;
}
void SHA256::final(unsigned char *digest)
{
unsigned int block_nb;
unsigned int pm_len;
unsigned int len_b;
int i;
block_nb = (1 + ((SHA224_256_BLOCK_SIZE - 9)
< (m_len % SHA224_256_BLOCK_SIZE)));
len_b = (m_tot_len + m_len) << 3;
pm_len = block_nb << 6;
memset(m_block + m_len, 0, pm_len - m_len);
m_block[m_len] = 0x80;
SHA2_UNPACK32(len_b, m_block + pm_len - 4);
transform(m_block, block_nb);
for (i = 0; i < 8; i++) {
SHA2_UNPACK32(m_h[i], &digest[i << 2]);
}
}
std::string sha256(std::string input)
{
unsigned char digest[SHA256::DIGEST_SIZE];
memset(digest, 0, SHA256::DIGEST_SIZE);
SHA256 ctx = SHA256();
ctx.init();
ctx.update((unsigned char*)input.c_str(), input.length());
ctx.final(digest);
char buf[2 * SHA256::DIGEST_SIZE + 1];
buf[2 * SHA256::DIGEST_SIZE] = 0;
for (int i = 0; i < SHA256::DIGEST_SIZE; i++)
sprintf(buf + i * 2, "%02x", digest[i]);
return std::string(buf);
} | [
"44447611+MrKupos@users.noreply.github.com"
] | 44447611+MrKupos@users.noreply.github.com |
21ecf11ea0c042743d740d1444af0836f5c09872 | cc5c71c9c4a7f1bdd3d1a6af4356cddf4020c7a5 | /ConsoleApocalypseTests/intro_game_state_tests.cc | 73cf39af9ba7bbcbe676e6c61245ae8c9a051844 | [
"MIT"
] | permissive | rob-lane/ConsoleApocolypse | 82456913bab67a2db66d3b8fb16a7f7a8f4b6bae | 68710b5ec56666b62d1ac9f82ce590242cd19db6 | refs/heads/master | 2021-01-01T15:35:47.594897 | 2014-02-18T08:09:14 | 2014-02-18T08:09:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 938 | cc | #include "gtest/gtest.h"
#include "intro_game_state.h"
namespace console_apoc{
class IntroGameStateTest : public ::testing::Test {
protected:
void SetUp() {
state_with_message_ = new IntroGameState(default_message_);
state_with_null_message_ = new IntroGameState();
}
void TearDown() {
if (state_with_message_ == NULL) {
state_with_message_->stop();
delete state_with_message_;
state_with_message_ = NULL;
}
}
IntroGameState *state_with_message_;
IntroGameState *state_with_null_message_;
const string default_message_ = "Welcome to the super awesome test \
game";
};
TEST_F(IntroGameStateTest, PersistsIntroText) {
EXPECT_EQ(default_message_, state_with_message_->intro_text());
}
TEST_F(IntroGameStateTest, HandlesBlankIntroText) {
EXPECT_NE(default_message_, state_with_null_message_->intro_text());
EXPECT_TRUE(state_with_null_message_->intro_text().size() > 0);
}
} | [
"roblane09@gmail.com"
] | roblane09@gmail.com |
2dbf298b34ad6b0d313306dfa1f7a6d2536e07d6 | fae4f1916006fe9d2e3c28bfa1eb18e5075fdf1a | /06_abstract_data_types/c/01_nonlinear/es12_nonlinear/00_binary_tree/albBin4.c | 947ff62e6a0bfcfccb22ca857fd0d90a518988c3 | [] | no_license | RRejuan/utilities | ccae2e9ec70612488a06552b21fe0cd3d08b041d | 890299913ab98b920ef10bf8585212c869dd3e9f | refs/heads/master | 2023-03-06T16:08:25.803297 | 2021-02-20T02:57:07 | 2021-02-20T02:57:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,724 | c | /*
Name: albBin4.cpp
Copyright:
Author: Roberto Ricci
Date: 12/03/04
Description: STRUTTURE NON LINEARI DINAMICHE: Alberi Binari
Legge una espressione algebrica in forma prefissa,
la trasforma in un albero binario e la riscrive in
forma infissa e postfissa.
*/
#include <stdio.h>
#include <stdlib.h>
typedef char tipoValore;
typedef struct nodo *albBin;
struct nodo {
albBin sin;
tipoValore value;
albBin des;
};
typedef char stringa[100];
stringa str;
int i=0;
albBin leggePre();
void visGraf(int, albBin);
void visInOrd(albBin);
void visPostOrd(albBin);
main(){
printf("Scrivi una espressione algebrica in forma PREFISSA: ");
scanf("%s",str);
albBin p=leggePre();
printf("\nUna visualizzazione come grafo:\n");
visGraf(0,p);
printf("\nIn forma INFISSA: ");
visInOrd(p);
printf("\nIn forma POSTFISSA: ");
visPostOrd(p);
}
albBin leggePre(){
albBin p;
if (str[i]=='+' || str[i]=='*' || str[i]=='-' || str[i]=='/'){
p=(albBin) malloc(sizeof(nodo));
p->value=str[i];
i++;
p->sin=leggePre();
i++;
p->des=leggePre();
}else{
p=(albBin) malloc(sizeof(nodo));
p->sin =NULL;
p->value=str[i];
p->des=NULL;
}
return p;
}
void visGraf(int n, albBin p){
if (p!=NULL){
int i;
visGraf(n+1,p->sin);
for (i=0;i<n;i++)
printf(" ");
printf("%c\n",p->value);
visGraf(n+1,p->des);
}
}
void visInOrd(albBin p){
if (p!=NULL){
visInOrd(p->sin);
printf("%c",p->value);
visInOrd(p->des);
}
}
void visPostOrd(albBin p){
if (p!=NULL){
visPostOrd(p->sin);
visPostOrd(p->des);
printf("%c",p->value);
}
}
| [
"giorgio.bornia@ttu.edu"
] | giorgio.bornia@ttu.edu |
fae2530640881b7807fc5b966924ecf265044f2d | b7ec245465d8b544dac01454e419ceabb4c69e04 | /test_meta_system/main.cpp | 1b578d983806213c93b15730cbd046c8b41c2500 | [] | no_license | chenyucode/QmlTest | 00d0907bbbbc0cf8b741e4caf30bba82ead08494 | d240b9122eb0e3d197a475b5810ead2a27ce90d4 | refs/heads/master | 2021-09-25T04:11:33.609640 | 2018-10-17T23:47:01 | 2018-10-17T23:47:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,517 | cpp | #include <QtCore>
#include <QtGui>
#include <QtWidgets/qapplication.h>
#include "TestWidet.hpp"
int main(int argc ,char ** argv){
QApplication varApp{argc,argv};
TestWidget varWidget;
varWidget.show();
/********************************/
auto varMetaObject = varWidget.metaObject();
qDebug()<< varMetaObject->className();
{/**QMetaObject::normalizedSignature()**/
auto varCloseFunctionIndex = varMetaObject->indexOfMethod("testAdd(int,int)");
auto varFunction = varMetaObject->method( varCloseFunctionIndex );
int a = 1; int b = 2; int c=0;
varFunction.invoke(&varWidget, Qt::DirectConnection, Q_RETURN_ARG(int, c), Q_ARG(int, a), Q_ARG(int, b));
qDebug() << c;
}
{//Q_DECLARE_FLAGS
//Q_FLAG
auto varPriorityIndex = varMetaObject->indexOfEnumerator("Prioritys");
auto varEnumerator = varMetaObject->enumerator(varPriorityIndex);
qDebug() << varEnumerator.key(2);
varWidget.testEnum(TestWidget::High | TestWidget::Low);
qDebug() << varEnumerator.valueToKeys(TestWidget::High | TestWidget::Low);
}
{/*The Property System*/
auto varTestValueIndex = varMetaObject->indexOfProperty("testValue");
auto varProperty = varMetaObject->property(varTestValueIndex);
varProperty.write(&varWidget,13);
qDebug()<< varProperty.read(&varWidget).toInt();
}
/********************************/
return varApp.exec();
//Q_NAMESPACE
//Q_GADGET
}
| [
"nanguazhude@vip.qq.com"
] | nanguazhude@vip.qq.com |
a5977073c0431bf157afd03cb4f951ffb31ba90a | eec110ae830de729f095bd8e95f7cef46b7cb3f5 | /utility/parsers/simple_regex_parser.hpp | 403477df3533f4ed5d6594d463c4d182b8f3b0fe | [] | no_license | SeijiEmery/comp235 | e4994cd177d89c457b6c86b97890cb6f36ff0a02 | 9c6c449643ffdba741e44491b13c306d1d26d963 | refs/heads/master | 2021-05-09T15:41:37.876072 | 2018-05-20T02:25:36 | 2018-05-20T02:25:36 | 119,097,136 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,367 | hpp | // utility/parsers/simple_regex_parser.hpp
// Copyright (C) 2017 Seiji Emery
//
// This forms part of the implicit utility library I originally wrote for part
// of a data structures class; since additional source files were prohibited I
// copied + pasted code and it grew more or less organically.
//
// This file in particular implements a "simple regex parser", aka a
// fuzzily-matched stack-like language that ignores bad syntax and matches
// only user-defined structures defined using a regex-like syntax.
//
// Such a parser is remarkably useful as a tool to implement minimalistic
// interactive programs to test the behavior of other code. Initially, I
// wrote this to test a hashtable, with code that looked something like
// the following:
//
// #include "utility/util/lineio.hpp"
// #include "utility/simple_regex_parser.hpp"
// #include "some_hashtable.hpp"
//
// int main () {
// Hashtable hashtable;
//
// SimpleRegexParser()
// .caseOf("quit", [&](Match match) {
// warn() << "exiting";
// exit(0);
// })
// .caseOf("capacity", [&](Match match) {
// report() << hashtable.capacity();
// })
// .caseOf("length|size", [&](Match match) {
// report() << hashtable.size();
// })
// .caseOf("display|show", [&](Match match) {
// report() << hashtable;
// })
// .caseOf("resize {}", [&](Match match) {
// auto size = atoi(match[1].str().c_str());
// report() << "Resizing to " << size << " (current size " << hashtable.size() << ")";
// hashtable.resize(size);
// })
// .caseOf("clear", [&](Match match) {
// hashtable.clear();
// })
// .caseOf("del {}", [&](Match match) {
// auto key = match[1].str();
// if (hashtable.containsKey(key)) {
// report() << "deleted " << key;
// hashtable.deleteKey(key);
// } else {
// warn() << "missing key " << key;
// }
// })
// .caseOf("{} = {}", [&](Match match) {
// auto key = match[1].str(), value = match[2].str();
// hashtable[key] = value;
// report() << key << " = " << value;
// })
// .caseOf("{}", [&](Match match) {
// auto key = match[1].str();
// if (hashtable.containsKey(key)) {
// report() << hashtable[key];
// } else {
// warn() << "undefined";
// }
// })
// .parse(std::cin);
// return 0;
// }
//
// SYNTAX:
// " " spaces converted to 'match 1+ whitespace: `\s*`'
// "{}" curly brackets converted to 'match 1 word: `(\w+)`'
// anything else is properly escaped and handled as a normal regex
// (ie. treated as a literal for most cases; may use further regex syntax)
//
// USAGE:
// SimpleRegexParser()
// .caseOf(<syntax 1>, [](const std::smatch& match) { /* ... */ })
// .caseOf(<syntax 2>, [](const std::smatch& match) { /* ... */ })
// ...
// .parse(std::cin);
//
// Note: std::cin may be replaced by any std::istream, including files, strings, etc.
// .parse(<input>) will exit when its input is exhausted; for std::cin, it will never
// exit so you should implement eg. "quit" in your DSL grammar (ie. call exit(0)).
//
#pragma once
#include <functional> // std::function
#include <utility> // std::pair
#include <vector> // std::vector
#include <regex> // std::regex, regex_replace, smatch
struct SimpleRegexParser {
typedef std::function<void(const std::smatch&)> callback_t;
typedef std::pair<std::regex, callback_t> case_t;
std::vector<case_t> cases;
public:
SimpleRegexParser () {}
SimpleRegexParser (std::initializer_list<case_t> cases)
: cases(cases) {}
private:
static std::string replace_whitespace (std::string input) {
static std::regex r { "([ ]+)"};
return std::regex_replace(input, r, "\\s*");
}
static std::string replace_group (std::string input) {
static std::regex r { "\\{[^\\}]*\\}" };
return std::regex_replace(input, r, "([^\\s]+)");
}
static std::string escape_chars (std::string input) {
static std::regex r { "([\\.\\+\\=\\[\\]\\(\\)\\-\\?\\:])" };
return std::regex_replace(input, r, ("\\$1"));
}
static std::string to_regex (std::string input) {
return "^\\s*" + replace_group(replace_whitespace(escape_chars(input)));
}
public:
SimpleRegexParser& caseOf (const char* pattern, callback_t callback) {
auto regex = to_regex(pattern);
// info() << "Creating case from " << pattern;
// info() << "Generated regex: " << regex;
cases.emplace_back(std::regex(regex), callback);
return *this;
}
bool parse (std::string& line, std::smatch &match) const {
for (auto& case_ : cases) {
if (std::regex_search(line, match, case_.first)) {
case_.second(match);
line = match.suffix().str();
return true;
}
}
return false;
}
void parse (std::istream& is) const {
std::string line;
std::smatch match;
while (is) {
while (!getline(is, line));
while (parse(line, match));
}
}
};
| [
"seijiemery@gmail.com"
] | seijiemery@gmail.com |
c19a62a15b0d011499498009bf9d0182c42cecff | 8d24b2baa605e5e2a9c1068d10d24ca92e1efa9d | /301CR Renderer and UI Sample/Framework/Framework/potionEvent.h | ab7c0ae601f5ea7951e0aa106ffdce3a75a73671 | [] | no_license | collett9/GameEngineFinal | e685648b971f6512b199605d9647961d91068b97 | 78da811e1d6b2d5b71c4b3da4c169784fce3db0b | refs/heads/master | 2020-04-15T06:15:11.113074 | 2019-01-07T16:20:10 | 2019-01-07T16:20:10 | 164,453,861 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 155 | h | #pragma once
#include "gameEvent.h"
class potionEvent :
public gameEvent
{
public:
potionEvent(gameObject * characterTakingPotion);
~potionEvent();
};
| [
"collett9@uni.coventry.ac.uk"
] | collett9@uni.coventry.ac.uk |
3ae5e0b6ce2111787ee1e85fd49622140333aa07 | e5d928c1439ad22bfa42707d3ca51862353c0502 | /datastructures/singly_linked_list.cpp | e63c00fddd6c7b676b7ff1cc347f2c16a7abe1d8 | [] | no_license | judesantos/algo-cpp | c858b03af0ddf86352eaf814df5454868ea46591 | 47e5f9a523c58e0daa93f03621274bbebb43a24f | refs/heads/master | 2021-06-29T22:03:27.187936 | 2017-09-14T16:25:44 | 2017-09-14T16:25:44 | 103,554,567 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,788 | cpp | #include <iostream>
#include <stdexcept>
using namespace std;
template <typename T>
struct node {
node():next(0) {}
~node(){}
node* next;
T data;
};
template <typename T>
class singly_linked_list
{
public:
singly_linked_list();
virtual ~singly_linked_list();
int push(T data, unsigned int idx = 0); // default inserts to head of list
T pop(unsigned int idx = 0); // default delete head of list
void empty(); // delete all
unsigned int size() { return this->last_index + 1; }
private:
struct node<T>* head;
int last_index;
};
template <typename T>
singly_linked_list<T>::singly_linked_list():
last_index(0),
head(0)
{
}
template <typename T>
singly_linked_list<T>::~singly_linked_list()
{
this->empty();
}
template <typename T>
int singly_linked_list<T>::push(T data, unsigned int idx)
{
if (idx > last_index) {
return -1;
}
if (!this->head)
{
this->head = new node<T>();
this->head->data = data;
return 0;
}
else
{
struct node<T>* prev = this->head;
struct node<T>* next = this->head;
int x = 0;
while (idx != x++) {
prev = next;
next = prev->next;
}
struct node<T>* _new = new node<T>();
_new->data = data;
_new->next = next;
if (idx == 0) {
this->head = _new;
} else {
prev->next = _new;
}
++this->last_index;
}
return idx;
}
template <typename T>
T singly_linked_list<T>::pop(unsigned int idx)
{
if (idx > last_index) {
return 0;
}
struct node<T>* prev = this->head;
struct node<T>* next = this->head;
int x = 0;
do {
prev = next;
next = prev->next;
}
while (idx != x++);
if (idx == 0)
{
this->head = next;
} else {
prev->next = next;
}
--this->last_index;
T t = prev->data;
delete prev;
return t;
}
template <typename T>
void singly_linked_list<T>::empty()
{
while(0 <= this->last_index) {
this->pop(this->last_index--);
}
}
int main() {
singly_linked_list<string> ll;
ll.push("String");
ll.push("a");
ll.push("is");
ll.push("this");
ll.push("fucking", 3);
cout << ll.size() << endl;
cout << ll.pop(4) << endl;
cout << ll.size() << endl;
cout << ll.pop(3) << endl;
cout << ll.size() << endl;
cout << ll.pop(2) << endl;
cout << ll.size() << endl;
cout << ll.pop(1) << endl;
cout << ll.size() << endl;
cout << ll.pop(0) << endl;
cout << ll.size() << endl;
}
| [
"jude@yourtechy.com"
] | jude@yourtechy.com |
79150ce488243637fe09bfee337b61623c7c3e03 | 5a77b5092acf817ac37a5fafd006feea434dd0d6 | /Doxygen_Graphviz/DesignPatternExample/品味Java的21種設計模式/dp_cpp/observer/example3/Observer.cpp | d7f81c01e6f111c8f08fd192c2d0087c796efd50 | [] | 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 | 171 | cpp | #include "Observer.h"
namespace cn
{
namespace javass
{
namespace dp
{
namespace observer
{
namespace example3
{
}
}
}
}
}
| [
"jason_yao@htc.com"
] | jason_yao@htc.com |
7c6377062694bbb42c35bf0ca50ad6ade0853a17 | 8f590f348d4ee65db9d9d8401b8bdc6f123d489c | /simulator/FakeArduino/FakeArduino.cpp | 9ed9253a9911f1c474b806c4044e4574dba3b1e6 | [] | no_license | arthursw/tipibot-firmware | e0511e146b7409e1cdb8f98f52dff79bd72658f2 | 986c8c1333ae694ef6affb67ab75b1c9abc71a01 | refs/heads/master | 2021-08-11T05:16:12.642669 | 2018-10-28T16:33:45 | 2018-10-28T16:33:45 | 140,685,528 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,329 | cpp | #include "FakeArduino.h"
#include <iostream>
using namespace std;
void randomSeed(unsigned long seed)
{
if (seed != 0) {
srandom(seed);
}
}
long random(long howbig)
{
if (howbig == 0) {
return 0;
}
return random() % howbig;
}
long random(long howsmall, long howbig)
{
if (howsmall >= howbig) {
return howsmall;
}
long diff = howbig - howsmall;
return random(diff) + howsmall;
}
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
auto start = std::chrono::high_resolution_clock::now();
void delay(unsigned long ms) {
}
void delayMicroseconds(unsigned int us) {
}
unsigned long millis() {
return micros()/1000;
}
unsigned long micros() {
auto elapsed = std::chrono::high_resolution_clock::now() - start;
return std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
}
void initialize_mock_arduino() {
}
void pinMode(unsigned char pin, unsigned char mode) {
}
#ifndef OVERRIDE_DIGITAL_WRITE
void digitalWrite(unsigned char pin, unsigned char value) {
}
#endif
// use byte == ' ' instead of isSpace (I don't know exactly which space isSpace considers, but not only ' ' ; '\n' is also considered as space...)
// bool isSpace(int byte) {
// return byte == ' ';
// }
| [
"arthur.sw@gmail.com"
] | arthur.sw@gmail.com |
d13e74ecff2185b6e004f556c97339db2449384a | 5499e8b91353ef910d2514c8a57a80565ba6f05b | /src/lib/inspect_deprecated/deprecated/expose.h | 8bc33194086814c9a47890b6844d3852243d55b9 | [
"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 | 16,151 | h | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// !!! DEPRECATED !!!
// New usages should reference garnet/public/lib/inspect...
#ifndef SRC_LIB_INSPECT_DEPRECATED_DEPRECATED_EXPOSE_H_
#define SRC_LIB_INSPECT_DEPRECATED_DEPRECATED_EXPOSE_H_
#include <fuchsia/inspect/deprecated/cpp/fidl.h>
#include <lib/fidl/cpp/binding_set.h>
#include <lib/fit/defer.h>
#include <lib/fit/function.h>
#include <mutex>
#include <set>
#include <unordered_map>
#include <variant>
#include <vector>
#include <fs/lazy_dir.h>
#include <fs/pseudo_file.h>
namespace component {
// Property is a string value associated with an |Object| belonging to a
// |Component|. The string value may be updated lazily at read time through the
// use of a callback.
//
// This class is not thread safe; concurrent accesses require external
// coordination.
class Property {
public:
using ByteVector = std::vector<uint8_t>;
using StringValueCallback = fit::function<std::string()>;
using VectorValueCallback = fit::function<ByteVector()>;
// Constructs an empty property with string value "".
Property() { Set(""); }
// Constructs a property from a string.
explicit Property(std::string value) { Set(std::move(value)); }
explicit Property(ByteVector value) { Set(std::move(value)); }
// Constructs a property with value set on each read by the given callback.
explicit Property(StringValueCallback callback) { Set(std::move(callback)); }
explicit Property(VectorValueCallback callback) { Set(std::move(callback)); }
// Sets the property from a string.
void Set(std::string value);
void Set(ByteVector value);
// Sets the property with value set on each read by the given callback.
void Set(StringValueCallback callback);
void Set(VectorValueCallback callback);
fuchsia::inspect::deprecated::Property ToFidl(const std::string& name) const;
private:
// Variants of possible values for this property.
std::variant<std::string, ByteVector, StringValueCallback, VectorValueCallback> value_;
};
// Metric is a numeric value associated with an |Object| belonging to
// a |Component|.
// A Metric has a type, which is one of:
// INT: int64_t
// UINT: uint64_t
// DOUBLE: double
// CALLBACK: Set by a callback function.
//
// Calling Set*() on a metric changes its type, but Add and Sub
// simply perform += or -= respectively, not changing the type of the
// Metric. This means the result of an operation will be cast back to the
// original type.
//
// This class is not thread safe; concurrent accesses require external
// coordination.
class Metric {
public:
using ValueCallback = fit::function<void(Metric*)>;
enum Type { INT, UINT, DOUBLE, CALLBACK };
// Constructs an INT metric with value 0.
Metric() { SetInt(0); }
// Constructs a metric set on read by the given callback.
explicit Metric(ValueCallback callback) { SetCallback(std::move(callback)); }
// Sets the type of this metric to INT with the given value.
void SetInt(int64_t value);
// Sets the type of this metric to UINT with the given value.
void SetUInt(uint64_t value);
// Sets the type of this metric to DOUBLE with the given value.
void SetDouble(double value);
// Sets the type of this metric to CALLBACK, where the given callback
// is responsible for the value of this metric.
void SetCallback(ValueCallback callback);
// Gets the value of this metric as a string.
std::string ToString() const;
// Converts the value of this metric into its FIDL representation,
// using the given name for the |name| field.
fuchsia::inspect::deprecated::Metric ToFidl(const std::string& name) const;
// Adds a numeric type to the value of this metric. The type of
// the metric will not be affected by this operation regardless of the
// type passed in. Adding to a CALLBACK metric does nothing.
template <typename T>
void Add(T amount) {
switch (type_) {
case INT:
int_value_ += static_cast<int64_t>(amount);
break;
case UINT:
uint_value_ += static_cast<uint64_t>(amount);
break;
case DOUBLE:
double_value_ += static_cast<double>(amount);
break;
case CALLBACK:
break;
}
}
// Subtracts a numeric type to the value of this metric. The type of
// the metric will not be affected by this operation regardless of the
// type passed in. Subtracting from a CALLBACK metric does nothing.
template <typename T>
void Sub(T amount) {
switch (type_) {
case INT:
int_value_ -= static_cast<int64_t>(amount);
break;
case UINT:
uint_value_ -= static_cast<uint64_t>(amount);
break;
case DOUBLE:
double_value_ -= static_cast<double>(amount);
break;
case CALLBACK:
break;
}
}
private:
// The current type of this metric.
Type type_;
// Union of 64-bit value types for the value of this metric.
union {
int64_t int_value_;
uint64_t uint_value_;
double double_value_;
};
// Callback to be used if type_ == CALLBACK.
ValueCallback callback_;
};
Metric IntMetric(int64_t value);
Metric UIntMetric(uint64_t value);
Metric DoubleMetric(double value);
Metric CallbackMetric(Metric::ValueCallback callback);
// An interface for dynamic management of an Inspect hierarchy. Implementations
// of this interface are provided by components integrating with Inspect and are
// called by Inspect during inspections to modify the Inspect hierarchy,
// typically by adding or "pinning" nodes of the hierarchy in place for the
// duration of the inspection.
class ChildrenManager {
public:
ChildrenManager() = default;
virtual ~ChildrenManager() = default;
// Specifies to Inspect the names of children available under
// the node with which this ChildrenExpansionFunctions object
// is registered. The names passed by the inspected system to
// the callback need not include or exclude the names of
// child structures already resident in memory and
// maintaining a static Inspect node under the node with
// which this ChildrenExpansionFunctions object is
// registered. The inspected system’s including a name among
// those passed to the callback is not a guarantee that a
// child with that name will be found resultant from a later
// call to Attach.
//
// NOTE(crjohns, jeffbrown, nathaniel): This method is likely
// to be fit::promise-ified in the future.
virtual void GetNames(fit::function<void(std::set<std::string>)> callback) = 0;
// Directs the system under inspection to
// (1) if the structure for the given child is not already
// resident in memory and maintaining a static Inspect
// node in the Inspect hierarchy, bring that structure
// into memory such that it attaches its static node to
// the hierarchy,
// (2) provide to Inspect a closure that Inspect will call
// at a later time to indicate that it is no longer
// examining the portion of the hierarchy with which the
// structure is associated (the system under inspection
// is responsible for ensuring that the closure remains
// safe to call until (a) it is called or (b) the
// ChildrenManager in response to a call on which the
// closure was created is removed from Inspect (at which
// time the closure will be called)), and
// (3) Make a best-effort attempt to retain in memory the
// structure associated with the given child name.
// This method is also best-effort in its overall function;
// systems under inspection may do nothing and pass a no-op
// closure to the callback and doing so will simply
// indicate “no such child” to Inspect.
virtual void Attach(std::string name, fit::function<void(fit::closure)> callback) = 0;
};
// A component |Object| is any named entity that a component wishes to expose
// for inspection. An |Object| consists of any number of string |Property| and
// numeric |Metric| values. They may also have any number of uniquely named
// children. The set of children may be set dynamically at read time.
//
// |Object| implements the |Inspect| interface to expose its values and
// children over FIDL, and it implements |LazyDir| to expose the same over a
// file system.
//
// In the directory implementation, the special file `.channel` exposes a
// |Service| file to bind to the FIDL interface. The special file `.data`
// exposes the current values of the |Object| in a TAB-separated format for
// debugging. `.data` should be used strictly for debugging, and all user-facing
// utilities must communicate over the FIDL interface.
//
// This class is thread safe.
class Object : public fuchsia::inspect::deprecated::Inspect {
public:
using ObjectVector = std::vector<std::shared_ptr<Object>>;
using ChildrenCallback = fit::function<void(ObjectVector*)>;
using StringOutputVector = fidl::VectorPtr<std::string>;
~Object();
// Makes a new shared pointer to an Object.
static std::shared_ptr<Object> Make(std::string name) {
auto ret = std::shared_ptr<Object>(new Object(std::move(name)));
std::lock_guard<std::mutex> lock(ret->mutex_);
ret->self_weak_ptr_ = ret;
return ret;
}
// Gets the name of this |Object|.
std::string name() { return name_; }
// Gets a new reference to a child by name. The return value may be empty if
// the child does not exist.
std::shared_ptr<Object> GetChild(std::string name);
// Sets a child to a new reference. If the child already exists, the contained
// reference will be dropped and replaced with the given one.
void SetChild(std::shared_ptr<Object> child);
// Takes a child from this |Object|. This |Object| will no longer contain a
// reference to the returned child. The return value may be empty if the child
// does not exist.
std::shared_ptr<Object> TakeChild(std::string name);
// Sets a callback to dynamically populate children. The children returned by
// this callback are in addition to the children already contained by this
// |Object|.
void SetChildrenCallback(ChildrenCallback callback);
// Clears the callback for dynamic children. After calling this function, the
// returned children will consist only of children contained by this object.
void ClearChildrenCallback();
// Sets (if |children_manager| is not null) or clears (if |children_manager|
// is null) the ChildrenManager to be used to dynamically expand the inspect
// hierarchy below this Object. The pointed-to ChildrenManager must live until
// another call to this method assigns a different ChildrenManager (or no
// ChildrenManager) or until this Object is deleted.
void SetChildrenManager(ChildrenManager* children_manager);
// Called by this Object's parent Object when its ChildrenManager is being
// reset and the detachers consequent from the being-reset ChildrenManager
// need to be destroyed earlier than they otherwise would be.
std::vector<fit::deferred_callback> TakeDetachers();
// Remove a property from the object, returning true if it was found and
// removed.
bool RemoveProperty(const std::string& name);
// Remove a metric from the object, returning true if it was found and
// removed.
bool RemoveMetric(const std::string& name);
// Sets a |Property| on this |Object| to the given value.
// The name of the property cannot include null bytes.
bool SetProperty(const std::string& name, Property value);
// Sets a |Metric| on this |Object| to the given value.
// The name of the metric cannot include null bytes.
bool SetMetric(const std::string& name, Metric metric);
// Adds to a numeric |Metric| on this |Object|.
template <typename T>
bool AddMetric(const std::string& name, T amount) {
std::lock_guard<std::mutex> lock(mutex_);
auto it = metrics_.find(name);
if (it == metrics_.end()) {
return false;
}
it->second.Add(amount);
return true;
}
// Subtracts from a numeric |Metric| on this |Object|.
template <typename T>
bool SubMetric(const std::string& name, T amount) {
std::lock_guard<std::mutex> lock(mutex_);
auto it = metrics_.find(name);
if (it == metrics_.end()) {
return false;
}
it->second.Sub(amount);
return true;
}
// |Inspect| implementation
// Reads local properties and metrics.
void ReadData(ReadDataCallback callback) override;
// Lists the children of this Object, including dynamic ones if they exist.
void ListChildren(ListChildrenCallback callback) override;
// Opens a channel with the requested child
void OpenChild(std::string name, ::fidl::InterfaceRequest<Inspect> child_channel,
OpenChildCallback callback) override;
// Turn this |Object| into its FIDL representation.
fuchsia::inspect::deprecated::Object ToFidl();
// Returns the names of this Object's children in a vector.
StringOutputVector GetChildren();
private:
// Constructs a new |Object| with the given name.
// Every object requires a name, and names for children must be unique.
explicit Object(std::string name);
// The common implementation of the two AddBinding overloads.
void InnerAddBinding(fidl::InterfaceRequest<Inspect> chan) __TA_REQUIRES(mutex_);
// Adds a new binding.
void AddBinding(fidl::InterfaceRequest<Inspect> chan);
// Adds a new binding and a behavior to be called when this Object's binding
// set becomes empty. The behavior may be related to the life cycle of this
// Object and calling it may have the effect of deleting this object. Because
// this method is the only means of adding these behaviors to this Object, it
// is invariant that detachers_ is only ever non-empty when bindings_ is
// non-empty.
void AddBinding(fidl::InterfaceRequest<Inspect> chan, fit::deferred_callback detacher);
std::shared_ptr<Object> GetUnmanagedChild(std::string name);
std::vector<std::string> ListUnmanagedChildNames();
// The name of this object.
std::string name_;
// Because the function of ChildrenManager is to potentially mutate children_
// when asked, the lock protecting ChildrenManager is not the same as the lock
// protecting the things they change.
mutable std::mutex children_manager_mutex_;
ChildrenManager* children_manager_ __TA_GUARDED(children_manager_mutex_);
// Mutex protecting fields below.
mutable std::mutex mutex_;
// |Property| for this object, keyed by name.
std::unordered_map<std::string, Property> properties_ __TA_GUARDED(mutex_);
// |Property| for this object, keyed by name.
std::unordered_map<std::string, Metric> metrics_ __TA_GUARDED(mutex_);
// |Children| for this object, keyed by name. Ordered structure for consistent
// iteration.
std::map<std::string, std::shared_ptr<Object>> children_ __TA_GUARDED(mutex_);
// TODO(crjohns): Convert all remaining uses of ChildrenCallback (who are
// indirectly users of lazy_object_callback_) to use ChildrenManager and
// remove ChildrenCallback.
//
// Callback for retrieving lazily generated children. May be empty.
ChildrenCallback lazy_object_callback_ __TA_GUARDED(mutex_);
// The bindings for channels connected to this |Inspect|. The object itself is
// owned by |self_if_bindings_| below.
fidl::BindingSet<fuchsia::inspect::deprecated::Inspect, Object*> bindings_ __TA_GUARDED(mutex_);
std::vector<fit::deferred_callback> detachers_ __TA_GUARDED(mutex_);
// A self shared_ptr, held only if |bindings_| is non-empty. Allows avoiding
// circular ownership. Recursive destruction is impossible because the object
// will not be destructed while pointing to itself.
// TODO(FIDL-452): change when FIDL supports storing self shared ptrs.
std::shared_ptr<Object> self_if_bindings_ __TA_GUARDED(mutex_);
// A self weak_ptr, used to promote to a self shared_ptr when |bindings_| is
// non-empty.
std::weak_ptr<Object> self_weak_ptr_ __TA_GUARDED(mutex_);
};
} // namespace component
#endif // SRC_LIB_INSPECT_DEPRECATED_DEPRECATED_EXPOSE_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
14c73b31665ac5085391ed79c2ffee86d474c374 | a7101e123e4f115f2fba0ecfe2e60439dab78dee | /include/omniunit/units/dimensionless_angle.hh | e492721c98182a10b335c18482092a4899625dc8 | [
"BSD-3-Clause"
] | permissive | Baxlan/OmniUnit | 1982be878eef4f26871a138e32c8abe0091ee79e | 5487b3da0dd5d3f6c969ed05d6a8d8bf29254a9b | refs/heads/master | 2023-03-14T00:41:55.156173 | 2021-03-06T23:02:51 | 2021-03-06T23:02:51 | 282,056,319 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,330 | hh | //dimensionless_angle.hh
/*
BSD 3-Clause License
Copyright (c) 2021, Denis Tosetto alias Baxlan
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OMNIUNIT_DIMENSIONLESS_ANGLE_HH_
#define OMNIUNIT_DIMENSIONLESS_ANGLE_HH_
#include "../omniunit.hh"
#include "constants_for_units.hh"
namespace omni
{
template <typename Rep = OMNI_DEFAULT_TYPE>
using value = Unit<Dimensionless, Rep, base, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using percent = Unit<Dimensionless, Rep, Ratio<E0, E2>, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using permille = Unit<Dimensionless, Rep, Ratio<E0, E3>, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using perhundredthousand = Unit<Dimensionless, Rep, Ratio<E0, E5>, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using permillion = Unit<Dimensionless, Rep, Ratio<E0, E6>, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using radian = Unit<Dimensionless, Rep, base, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using milliradian = Unit<Dimensionless, Rep, milli, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using revolution = Unit<Dimensionless, Rep, tau, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using degree = Unit<Dimensionless, Rep, typename Ratio_over_value<pi, degDef>::type, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using grad = Unit<Dimensionless, Rep, typename Ratio_over_value<pi, gradDef>::type, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using arcminute = Unit<Dimensionless, Rep, typename Ratio_over_value<typename degree<Rep>::period, sixty>::type, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using arcsecond = Unit<Dimensionless, Rep, typename Ratio_over_value<typename degree<Rep>::period, secondsPerHour>::type, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using steradian = Unit<Dimensionless, Rep, base, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using hemisphere = Unit<Dimensionless, Rep, tau, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using sphere = Unit<Dimensionless, Rep, typename value_times_Ratio<four, pi>::type, zero>;
template <typename Rep = OMNI_DEFAULT_TYPE>
using degree2 = Unit<Dimensionless, Rep, typename Ratio_power<typename degree<Rep>::period, 2>::type, zero>;
typedef value<> Value;
typedef percent<> Percent;
typedef permille<> Permille;
typedef perhundredthousand<> Perhundredthousand;
typedef permillion<> Permillion;
typedef radian<> Radian;
typedef milliradian<> Milliradian;
typedef revolution<> Revolution;
typedef degree<> Degree;
typedef grad<> Grad;
typedef arcminute<> Arcminute;
typedef arcsecond<>Arcsecond;
typedef steradian<> Steradian;
typedef hemisphere<> Hemisphere;
typedef sphere<> Sphere;
typedef degree2<> Degree2;
namespace suffixes
{
constexpr value<OMNI_LITTERAL_FLOATING> operator"" _v(long double val){return val;}
constexpr percent<OMNI_LITTERAL_FLOATING> operator"" _ppc(long double val){return val;}
constexpr permille<OMNI_LITTERAL_FLOATING> operator"" _ppmi(long double val){return val;}
constexpr perhundredthousand<OMNI_LITTERAL_FLOATING> operator"" _ppht(long double val){return val;}
constexpr permillion<OMNI_LITTERAL_FLOATING> operator"" _ppm(long double val){return val;}
constexpr radian<OMNI_LITTERAL_FLOATING> operator"" _rad(long double val){return val;}
constexpr milliradian<OMNI_LITTERAL_FLOATING> operator"" _mrad(long double val){return val;}
constexpr revolution<OMNI_LITTERAL_FLOATING> operator"" _rev(long double val){return val;}
constexpr degree<OMNI_LITTERAL_FLOATING> operator"" _deg(long double val){return val;}
constexpr grad<OMNI_LITTERAL_FLOATING> operator"" _grad(long double val){return val;}
constexpr arcminute<OMNI_LITTERAL_FLOATING> operator"" _arcmin(long double val){return val;}
constexpr arcsecond<OMNI_LITTERAL_FLOATING> operator"" _arcs(long double val){return val;}
constexpr steradian<OMNI_LITTERAL_FLOATING> operator"" _sr(long double val){return val;}
constexpr hemisphere<OMNI_LITTERAL_FLOATING> operator"" _hsphe(long double val){return val;}
constexpr sphere<OMNI_LITTERAL_FLOATING> operator"" _sphe(long double val){return val;}
constexpr degree2<OMNI_LITTERAL_FLOATING> operator"" _deg2(long double val){return val;}
constexpr value<OMNI_LITTERAL_INTEGER> operator"" _v(unsigned long long int val){return val;}
constexpr percent<OMNI_LITTERAL_INTEGER> operator"" _ppc(unsigned long long int val){return val;}
constexpr permille<OMNI_LITTERAL_INTEGER> operator"" _ppmi(unsigned long long int val){return val;}
constexpr perhundredthousand<OMNI_LITTERAL_INTEGER> operator"" _ppht(unsigned long long int val){return val;}
constexpr permillion<OMNI_LITTERAL_INTEGER> operator"" _ppm(unsigned long long int val){return val;}
constexpr radian<OMNI_LITTERAL_INTEGER> operator"" _rad(unsigned long long int val){return val;}
constexpr milliradian<OMNI_LITTERAL_INTEGER> operator"" _mrad(unsigned long long int val){return val;}
constexpr revolution<OMNI_LITTERAL_INTEGER> operator"" _rev(unsigned long long int val){return val;}
constexpr degree<OMNI_LITTERAL_INTEGER> operator"" _deg(unsigned long long int val){return val;}
constexpr grad<OMNI_LITTERAL_INTEGER> operator"" _grad(unsigned long long int val){return val;}
constexpr arcminute<OMNI_LITTERAL_INTEGER> operator"" _arcmin(unsigned long long int val){return val;}
constexpr arcsecond<OMNI_LITTERAL_INTEGER> operator"" _arcs(unsigned long long int val){return val;}
constexpr steradian<OMNI_LITTERAL_INTEGER> operator"" _sr(unsigned long long int val){return val;}
constexpr hemisphere<OMNI_LITTERAL_INTEGER> operator"" _hsphe(unsigned long long int val){return val;}
constexpr sphere<OMNI_LITTERAL_INTEGER> operator"" _sphe(unsigned long long int val){return val;}
constexpr degree2<OMNI_LITTERAL_INTEGER> operator"" _deg2(unsigned long long int val){return val;}
} // namespace suffixes
} //namespace omni
#endif //OMNIUNIT_DIMENSIONLESS_ANGLE_HH_ | [
"cavalioz@hotmail.fr"
] | cavalioz@hotmail.fr |
8c27fdba2067c813f126be415c94e5f9da887482 | f8d82cd7544d183eb8303fbf518a61ac6e82d6a4 | /src/backend/src/generated/action/action.pb.cc | 3fa9a3d2612267e7f3aedaf75a9c0ad71cee50cc | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | hieudovan/MAVSDK | f42e5fe1fb68dea5a1598a02223584cb280432bd | 38ec5f6ee52190f2e1f6e14e8d371caec5341009 | refs/heads/master | 2020-12-27T10:32:45.171158 | 2020-01-28T20:51:53 | 2020-01-28T20:51:53 | 237,871,216 | 0 | 0 | BSD-3-Clause | 2020-02-03T02:36:28 | 2020-02-03T02:36:27 | null | UTF-8 | C++ | false | true | 273,457 | cc | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: action/action.proto
#include "action/action.pb.h"
#include <algorithm>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
extern PROTOBUF_INTERNAL_EXPORT_action_2faction_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ActionResult_action_2faction_2eproto;
namespace mavsdk {
namespace rpc {
namespace action {
class ArmRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ArmRequest> _instance;
} _ArmRequest_default_instance_;
class ArmResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ArmResponse> _instance;
} _ArmResponse_default_instance_;
class DisarmRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<DisarmRequest> _instance;
} _DisarmRequest_default_instance_;
class DisarmResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<DisarmResponse> _instance;
} _DisarmResponse_default_instance_;
class TakeoffRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TakeoffRequest> _instance;
} _TakeoffRequest_default_instance_;
class TakeoffResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TakeoffResponse> _instance;
} _TakeoffResponse_default_instance_;
class LandRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LandRequest> _instance;
} _LandRequest_default_instance_;
class LandResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LandResponse> _instance;
} _LandResponse_default_instance_;
class RebootRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<RebootRequest> _instance;
} _RebootRequest_default_instance_;
class RebootResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<RebootResponse> _instance;
} _RebootResponse_default_instance_;
class KillRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<KillRequest> _instance;
} _KillRequest_default_instance_;
class KillResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<KillResponse> _instance;
} _KillResponse_default_instance_;
class ReturnToLaunchRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ReturnToLaunchRequest> _instance;
} _ReturnToLaunchRequest_default_instance_;
class ReturnToLaunchResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ReturnToLaunchResponse> _instance;
} _ReturnToLaunchResponse_default_instance_;
class TransitionToFixedWingRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TransitionToFixedWingRequest> _instance;
} _TransitionToFixedWingRequest_default_instance_;
class TransitionToFixedWingResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TransitionToFixedWingResponse> _instance;
} _TransitionToFixedWingResponse_default_instance_;
class TransitionToMulticopterRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TransitionToMulticopterRequest> _instance;
} _TransitionToMulticopterRequest_default_instance_;
class TransitionToMulticopterResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TransitionToMulticopterResponse> _instance;
} _TransitionToMulticopterResponse_default_instance_;
class GetTakeoffAltitudeRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetTakeoffAltitudeRequest> _instance;
} _GetTakeoffAltitudeRequest_default_instance_;
class GetTakeoffAltitudeResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetTakeoffAltitudeResponse> _instance;
} _GetTakeoffAltitudeResponse_default_instance_;
class SetTakeoffAltitudeRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetTakeoffAltitudeRequest> _instance;
} _SetTakeoffAltitudeRequest_default_instance_;
class SetTakeoffAltitudeResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetTakeoffAltitudeResponse> _instance;
} _SetTakeoffAltitudeResponse_default_instance_;
class GetMaximumSpeedRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetMaximumSpeedRequest> _instance;
} _GetMaximumSpeedRequest_default_instance_;
class GetMaximumSpeedResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetMaximumSpeedResponse> _instance;
} _GetMaximumSpeedResponse_default_instance_;
class SetMaximumSpeedRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetMaximumSpeedRequest> _instance;
} _SetMaximumSpeedRequest_default_instance_;
class SetMaximumSpeedResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetMaximumSpeedResponse> _instance;
} _SetMaximumSpeedResponse_default_instance_;
class GetReturnToLaunchAltitudeRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetReturnToLaunchAltitudeRequest> _instance;
} _GetReturnToLaunchAltitudeRequest_default_instance_;
class GetReturnToLaunchAltitudeResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<GetReturnToLaunchAltitudeResponse> _instance;
} _GetReturnToLaunchAltitudeResponse_default_instance_;
class SetReturnToLaunchAltitudeRequestDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetReturnToLaunchAltitudeRequest> _instance;
} _SetReturnToLaunchAltitudeRequest_default_instance_;
class SetReturnToLaunchAltitudeResponseDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<SetReturnToLaunchAltitudeResponse> _instance;
} _SetReturnToLaunchAltitudeResponse_default_instance_;
class ActionResultDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ActionResult> _instance;
} _ActionResult_default_instance_;
} // namespace action
} // namespace rpc
} // namespace mavsdk
static void InitDefaultsscc_info_ActionResult_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_ActionResult_default_instance_;
new (ptr) ::mavsdk::rpc::action::ActionResult();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::ActionResult::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ActionResult_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ActionResult_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_ArmRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_ArmRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::ArmRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::ArmRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ArmRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ArmRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_ArmResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_ArmResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::ArmResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::ArmResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ArmResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_ArmResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_DisarmRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_DisarmRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::DisarmRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::DisarmRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DisarmRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_DisarmRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_DisarmResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_DisarmResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::DisarmResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::DisarmResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_DisarmResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_DisarmResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_GetMaximumSpeedRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetMaximumSpeedRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetMaximumSpeedRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetMaximumSpeedRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_GetMaximumSpeedRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_GetMaximumSpeedRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_GetMaximumSpeedResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetMaximumSpeedResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetMaximumSpeedResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetMaximumSpeedResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_GetMaximumSpeedResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_GetMaximumSpeedResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_GetReturnToLaunchAltitudeRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetReturnToLaunchAltitudeRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_GetReturnToLaunchAltitudeRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_GetReturnToLaunchAltitudeRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetReturnToLaunchAltitudeResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_GetTakeoffAltitudeRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetTakeoffAltitudeRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetTakeoffAltitudeRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetTakeoffAltitudeRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_GetTakeoffAltitudeRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_GetTakeoffAltitudeRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_GetTakeoffAltitudeResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::GetTakeoffAltitudeResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::GetTakeoffAltitudeResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_KillRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_KillRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::KillRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::KillRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_KillRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_KillRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_KillResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_KillResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::KillResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::KillResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_KillResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_KillResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_LandRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_LandRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::LandRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::LandRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_LandRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_LandRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_LandResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_LandResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::LandResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::LandResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_LandResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_LandResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_RebootRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_RebootRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::RebootRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::RebootRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_RebootRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_RebootRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_RebootResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_RebootResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::RebootResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::RebootResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_RebootResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_RebootResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_ReturnToLaunchRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_ReturnToLaunchRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::ReturnToLaunchRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::ReturnToLaunchRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ReturnToLaunchRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ReturnToLaunchRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_ReturnToLaunchResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_ReturnToLaunchResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::ReturnToLaunchResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::ReturnToLaunchResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_ReturnToLaunchResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_ReturnToLaunchResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_SetMaximumSpeedRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetMaximumSpeedRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetMaximumSpeedRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetMaximumSpeedRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SetMaximumSpeedRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SetMaximumSpeedRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_SetMaximumSpeedResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetMaximumSpeedResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetMaximumSpeedResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetMaximumSpeedResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SetMaximumSpeedResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_SetMaximumSpeedResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_SetReturnToLaunchAltitudeRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetReturnToLaunchAltitudeRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SetReturnToLaunchAltitudeRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SetReturnToLaunchAltitudeRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetReturnToLaunchAltitudeResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_SetTakeoffAltitudeRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetTakeoffAltitudeRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetTakeoffAltitudeRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetTakeoffAltitudeRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_SetTakeoffAltitudeRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_SetTakeoffAltitudeRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_SetTakeoffAltitudeResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::SetTakeoffAltitudeResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::SetTakeoffAltitudeResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_TakeoffRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TakeoffRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::TakeoffRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TakeoffRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_TakeoffRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_TakeoffRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_TakeoffResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TakeoffResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::TakeoffResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TakeoffResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TakeoffResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_TakeoffResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_TransitionToFixedWingRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TransitionToFixedWingRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::TransitionToFixedWingRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TransitionToFixedWingRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_TransitionToFixedWingRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_TransitionToFixedWingRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_TransitionToFixedWingResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TransitionToFixedWingResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::TransitionToFixedWingResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TransitionToFixedWingResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TransitionToFixedWingResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_TransitionToFixedWingResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static void InitDefaultsscc_info_TransitionToMulticopterRequest_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TransitionToMulticopterRequest_default_instance_;
new (ptr) ::mavsdk::rpc::action::TransitionToMulticopterRequest();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TransitionToMulticopterRequest::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_TransitionToMulticopterRequest_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_TransitionToMulticopterRequest_action_2faction_2eproto}, {}};
static void InitDefaultsscc_info_TransitionToMulticopterResponse_action_2faction_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::mavsdk::rpc::action::_TransitionToMulticopterResponse_default_instance_;
new (ptr) ::mavsdk::rpc::action::TransitionToMulticopterResponse();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
::mavsdk::rpc::action::TransitionToMulticopterResponse::InitAsDefaultInstance();
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TransitionToMulticopterResponse_action_2faction_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_TransitionToMulticopterResponse_action_2faction_2eproto}, {
&scc_info_ActionResult_action_2faction_2eproto.base,}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_action_2faction_2eproto[31];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_action_2faction_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_action_2faction_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_action_2faction_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ArmRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ArmResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ArmResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::DisarmRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::DisarmResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::DisarmResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TakeoffRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TakeoffResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TakeoffResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::LandRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::LandResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::LandResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::RebootRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::RebootResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::RebootResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::KillRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::KillResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::KillResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ReturnToLaunchRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ReturnToLaunchResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ReturnToLaunchResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToFixedWingRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToFixedWingResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToFixedWingResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToMulticopterRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToMulticopterResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::TransitionToMulticopterResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetTakeoffAltitudeRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetTakeoffAltitudeResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetTakeoffAltitudeResponse, action_result_),
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetTakeoffAltitudeResponse, altitude_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetTakeoffAltitudeRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetTakeoffAltitudeRequest, altitude_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetTakeoffAltitudeResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetTakeoffAltitudeResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetMaximumSpeedRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetMaximumSpeedResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetMaximumSpeedResponse, action_result_),
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetMaximumSpeedResponse, speed_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetMaximumSpeedRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetMaximumSpeedRequest, speed_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetMaximumSpeedResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetMaximumSpeedResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse, action_result_),
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse, relative_altitude_m_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest, relative_altitude_m_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse, action_result_),
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ActionResult, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ActionResult, result_),
PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::action::ActionResult, result_str_),
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, sizeof(::mavsdk::rpc::action::ArmRequest)},
{ 5, -1, sizeof(::mavsdk::rpc::action::ArmResponse)},
{ 11, -1, sizeof(::mavsdk::rpc::action::DisarmRequest)},
{ 16, -1, sizeof(::mavsdk::rpc::action::DisarmResponse)},
{ 22, -1, sizeof(::mavsdk::rpc::action::TakeoffRequest)},
{ 27, -1, sizeof(::mavsdk::rpc::action::TakeoffResponse)},
{ 33, -1, sizeof(::mavsdk::rpc::action::LandRequest)},
{ 38, -1, sizeof(::mavsdk::rpc::action::LandResponse)},
{ 44, -1, sizeof(::mavsdk::rpc::action::RebootRequest)},
{ 49, -1, sizeof(::mavsdk::rpc::action::RebootResponse)},
{ 55, -1, sizeof(::mavsdk::rpc::action::KillRequest)},
{ 60, -1, sizeof(::mavsdk::rpc::action::KillResponse)},
{ 66, -1, sizeof(::mavsdk::rpc::action::ReturnToLaunchRequest)},
{ 71, -1, sizeof(::mavsdk::rpc::action::ReturnToLaunchResponse)},
{ 77, -1, sizeof(::mavsdk::rpc::action::TransitionToFixedWingRequest)},
{ 82, -1, sizeof(::mavsdk::rpc::action::TransitionToFixedWingResponse)},
{ 88, -1, sizeof(::mavsdk::rpc::action::TransitionToMulticopterRequest)},
{ 93, -1, sizeof(::mavsdk::rpc::action::TransitionToMulticopterResponse)},
{ 99, -1, sizeof(::mavsdk::rpc::action::GetTakeoffAltitudeRequest)},
{ 104, -1, sizeof(::mavsdk::rpc::action::GetTakeoffAltitudeResponse)},
{ 111, -1, sizeof(::mavsdk::rpc::action::SetTakeoffAltitudeRequest)},
{ 117, -1, sizeof(::mavsdk::rpc::action::SetTakeoffAltitudeResponse)},
{ 123, -1, sizeof(::mavsdk::rpc::action::GetMaximumSpeedRequest)},
{ 128, -1, sizeof(::mavsdk::rpc::action::GetMaximumSpeedResponse)},
{ 135, -1, sizeof(::mavsdk::rpc::action::SetMaximumSpeedRequest)},
{ 141, -1, sizeof(::mavsdk::rpc::action::SetMaximumSpeedResponse)},
{ 147, -1, sizeof(::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest)},
{ 152, -1, sizeof(::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse)},
{ 159, -1, sizeof(::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest)},
{ 165, -1, sizeof(::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse)},
{ 171, -1, sizeof(::mavsdk::rpc::action::ActionResult)},
};
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_ArmRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_ArmResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_DisarmRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_DisarmResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TakeoffRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TakeoffResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_LandRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_LandResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_RebootRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_RebootResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_KillRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_KillResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_ReturnToLaunchRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_ReturnToLaunchResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TransitionToFixedWingRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TransitionToFixedWingResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TransitionToMulticopterRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_TransitionToMulticopterResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetTakeoffAltitudeRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetTakeoffAltitudeResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetTakeoffAltitudeRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetTakeoffAltitudeResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetMaximumSpeedRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetMaximumSpeedResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetMaximumSpeedRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetMaximumSpeedResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetReturnToLaunchAltitudeRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_GetReturnToLaunchAltitudeResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetReturnToLaunchAltitudeRequest_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_SetReturnToLaunchAltitudeResponse_default_instance_),
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::action::_ActionResult_default_instance_),
};
const char descriptor_table_protodef_action_2faction_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\023action/action.proto\022\021mavsdk.rpc.action"
"\"\014\n\nArmRequest\"E\n\013ArmResponse\0226\n\raction_"
"result\030\001 \001(\0132\037.mavsdk.rpc.action.ActionR"
"esult\"\017\n\rDisarmRequest\"H\n\016DisarmResponse"
"\0226\n\raction_result\030\001 \001(\0132\037.mavsdk.rpc.act"
"ion.ActionResult\"\020\n\016TakeoffRequest\"I\n\017Ta"
"keoffResponse\0226\n\raction_result\030\001 \001(\0132\037.m"
"avsdk.rpc.action.ActionResult\"\r\n\013LandReq"
"uest\"F\n\014LandResponse\0226\n\raction_result\030\001 "
"\001(\0132\037.mavsdk.rpc.action.ActionResult\"\017\n\r"
"RebootRequest\"H\n\016RebootResponse\0226\n\ractio"
"n_result\030\001 \001(\0132\037.mavsdk.rpc.action.Actio"
"nResult\"\r\n\013KillRequest\"F\n\014KillResponse\0226"
"\n\raction_result\030\001 \001(\0132\037.mavsdk.rpc.actio"
"n.ActionResult\"\027\n\025ReturnToLaunchRequest\""
"P\n\026ReturnToLaunchResponse\0226\n\raction_resu"
"lt\030\001 \001(\0132\037.mavsdk.rpc.action.ActionResul"
"t\"\036\n\034TransitionToFixedWingRequest\"W\n\035Tra"
"nsitionToFixedWingResponse\0226\n\raction_res"
"ult\030\001 \001(\0132\037.mavsdk.rpc.action.ActionResu"
"lt\" \n\036TransitionToMulticopterRequest\"Y\n\037"
"TransitionToMulticopterResponse\0226\n\ractio"
"n_result\030\001 \001(\0132\037.mavsdk.rpc.action.Actio"
"nResult\"\033\n\031GetTakeoffAltitudeRequest\"f\n\032"
"GetTakeoffAltitudeResponse\0226\n\raction_res"
"ult\030\001 \001(\0132\037.mavsdk.rpc.action.ActionResu"
"lt\022\020\n\010altitude\030\002 \001(\002\"-\n\031SetTakeoffAltitu"
"deRequest\022\020\n\010altitude\030\001 \001(\002\"T\n\032SetTakeof"
"fAltitudeResponse\0226\n\raction_result\030\001 \001(\013"
"2\037.mavsdk.rpc.action.ActionResult\"\030\n\026Get"
"MaximumSpeedRequest\"`\n\027GetMaximumSpeedRe"
"sponse\0226\n\raction_result\030\001 \001(\0132\037.mavsdk.r"
"pc.action.ActionResult\022\r\n\005speed\030\002 \001(\002\"\'\n"
"\026SetMaximumSpeedRequest\022\r\n\005speed\030\001 \001(\002\"Q"
"\n\027SetMaximumSpeedResponse\0226\n\raction_resu"
"lt\030\001 \001(\0132\037.mavsdk.rpc.action.ActionResul"
"t\"\"\n GetReturnToLaunchAltitudeRequest\"x\n"
"!GetReturnToLaunchAltitudeResponse\0226\n\rac"
"tion_result\030\001 \001(\0132\037.mavsdk.rpc.action.Ac"
"tionResult\022\033\n\023relative_altitude_m\030\002 \001(\002\""
"\?\n SetReturnToLaunchAltitudeRequest\022\033\n\023r"
"elative_altitude_m\030\001 \001(\002\"[\n!SetReturnToL"
"aunchAltitudeResponse\0226\n\raction_result\030\001"
" \001(\0132\037.mavsdk.rpc.action.ActionResult\"\361\002"
"\n\014ActionResult\0226\n\006result\030\001 \001(\0162&.mavsdk."
"rpc.action.ActionResult.Result\022\022\n\nresult"
"_str\030\002 \001(\t\"\224\002\n\006Result\022\013\n\007UNKNOWN\020\000\022\013\n\007SU"
"CCESS\020\001\022\r\n\tNO_SYSTEM\020\002\022\024\n\020CONNECTION_ERR"
"OR\020\003\022\010\n\004BUSY\020\004\022\022\n\016COMMAND_DENIED\020\005\022\'\n#CO"
"MMAND_DENIED_LANDED_STATE_UNKNOWN\020\006\022\035\n\031C"
"OMMAND_DENIED_NOT_LANDED\020\007\022\013\n\007TIMEOUT\020\010\022"
"#\n\037VTOL_TRANSITION_SUPPORT_UNKNOWN\020\t\022\036\n\032"
"NO_VTOL_TRANSITION_SUPPORT\020\n\022\023\n\017PARAMETE"
"R_ERROR\020\0132\247\014\n\rActionService\022F\n\003Arm\022\035.mav"
"sdk.rpc.action.ArmRequest\032\036.mavsdk.rpc.a"
"ction.ArmResponse\"\000\022O\n\006Disarm\022 .mavsdk.r"
"pc.action.DisarmRequest\032!.mavsdk.rpc.act"
"ion.DisarmResponse\"\000\022R\n\007Takeoff\022!.mavsdk"
".rpc.action.TakeoffRequest\032\".mavsdk.rpc."
"action.TakeoffResponse\"\000\022I\n\004Land\022\036.mavsd"
"k.rpc.action.LandRequest\032\037.mavsdk.rpc.ac"
"tion.LandResponse\"\000\022O\n\006Reboot\022 .mavsdk.r"
"pc.action.RebootRequest\032!.mavsdk.rpc.act"
"ion.RebootResponse\"\000\022I\n\004Kill\022\036.mavsdk.rp"
"c.action.KillRequest\032\037.mavsdk.rpc.action"
".KillResponse\"\000\022g\n\016ReturnToLaunch\022(.mavs"
"dk.rpc.action.ReturnToLaunchRequest\032).ma"
"vsdk.rpc.action.ReturnToLaunchResponse\"\000"
"\022|\n\025TransitionToFixedWing\022/.mavsdk.rpc.a"
"ction.TransitionToFixedWingRequest\0320.mav"
"sdk.rpc.action.TransitionToFixedWingResp"
"onse\"\000\022\202\001\n\027TransitionToMulticopter\0221.mav"
"sdk.rpc.action.TransitionToMulticopterRe"
"quest\0322.mavsdk.rpc.action.TransitionToMu"
"lticopterResponse\"\000\022s\n\022GetTakeoffAltitud"
"e\022,.mavsdk.rpc.action.GetTakeoffAltitude"
"Request\032-.mavsdk.rpc.action.GetTakeoffAl"
"titudeResponse\"\000\022s\n\022SetTakeoffAltitude\022,"
".mavsdk.rpc.action.SetTakeoffAltitudeReq"
"uest\032-.mavsdk.rpc.action.SetTakeoffAltit"
"udeResponse\"\000\022j\n\017GetMaximumSpeed\022).mavsd"
"k.rpc.action.GetMaximumSpeedRequest\032*.ma"
"vsdk.rpc.action.GetMaximumSpeedResponse\""
"\000\022j\n\017SetMaximumSpeed\022).mavsdk.rpc.action"
".SetMaximumSpeedRequest\032*.mavsdk.rpc.act"
"ion.SetMaximumSpeedResponse\"\000\022\210\001\n\031GetRet"
"urnToLaunchAltitude\0223.mavsdk.rpc.action."
"GetReturnToLaunchAltitudeRequest\0324.mavsd"
"k.rpc.action.GetReturnToLaunchAltitudeRe"
"sponse\"\000\022\210\001\n\031SetReturnToLaunchAltitude\0223"
".mavsdk.rpc.action.SetReturnToLaunchAlti"
"tudeRequest\0324.mavsdk.rpc.action.SetRetur"
"nToLaunchAltitudeResponse\"\000B\037\n\020io.mavsdk"
".actionB\013ActionProtob\006proto3"
;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_action_2faction_2eproto_deps[1] = {
};
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_action_2faction_2eproto_sccs[31] = {
&scc_info_ActionResult_action_2faction_2eproto.base,
&scc_info_ArmRequest_action_2faction_2eproto.base,
&scc_info_ArmResponse_action_2faction_2eproto.base,
&scc_info_DisarmRequest_action_2faction_2eproto.base,
&scc_info_DisarmResponse_action_2faction_2eproto.base,
&scc_info_GetMaximumSpeedRequest_action_2faction_2eproto.base,
&scc_info_GetMaximumSpeedResponse_action_2faction_2eproto.base,
&scc_info_GetReturnToLaunchAltitudeRequest_action_2faction_2eproto.base,
&scc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base,
&scc_info_GetTakeoffAltitudeRequest_action_2faction_2eproto.base,
&scc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto.base,
&scc_info_KillRequest_action_2faction_2eproto.base,
&scc_info_KillResponse_action_2faction_2eproto.base,
&scc_info_LandRequest_action_2faction_2eproto.base,
&scc_info_LandResponse_action_2faction_2eproto.base,
&scc_info_RebootRequest_action_2faction_2eproto.base,
&scc_info_RebootResponse_action_2faction_2eproto.base,
&scc_info_ReturnToLaunchRequest_action_2faction_2eproto.base,
&scc_info_ReturnToLaunchResponse_action_2faction_2eproto.base,
&scc_info_SetMaximumSpeedRequest_action_2faction_2eproto.base,
&scc_info_SetMaximumSpeedResponse_action_2faction_2eproto.base,
&scc_info_SetReturnToLaunchAltitudeRequest_action_2faction_2eproto.base,
&scc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base,
&scc_info_SetTakeoffAltitudeRequest_action_2faction_2eproto.base,
&scc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto.base,
&scc_info_TakeoffRequest_action_2faction_2eproto.base,
&scc_info_TakeoffResponse_action_2faction_2eproto.base,
&scc_info_TransitionToFixedWingRequest_action_2faction_2eproto.base,
&scc_info_TransitionToFixedWingResponse_action_2faction_2eproto.base,
&scc_info_TransitionToMulticopterRequest_action_2faction_2eproto.base,
&scc_info_TransitionToMulticopterResponse_action_2faction_2eproto.base,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_action_2faction_2eproto_once;
static bool descriptor_table_action_2faction_2eproto_initialized = false;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_action_2faction_2eproto = {
&descriptor_table_action_2faction_2eproto_initialized, descriptor_table_protodef_action_2faction_2eproto, "action/action.proto", 3748,
&descriptor_table_action_2faction_2eproto_once, descriptor_table_action_2faction_2eproto_sccs, descriptor_table_action_2faction_2eproto_deps, 31, 0,
schemas, file_default_instances, TableStruct_action_2faction_2eproto::offsets,
file_level_metadata_action_2faction_2eproto, 31, file_level_enum_descriptors_action_2faction_2eproto, file_level_service_descriptors_action_2faction_2eproto,
};
// Force running AddDescriptors() at dynamic initialization time.
static bool dynamic_init_dummy_action_2faction_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_action_2faction_2eproto), true);
namespace mavsdk {
namespace rpc {
namespace action {
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ActionResult_Result_descriptor() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_action_2faction_2eproto);
return file_level_enum_descriptors_action_2faction_2eproto[0];
}
bool ActionResult_Result_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
return true;
default:
return false;
}
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
constexpr ActionResult_Result ActionResult::UNKNOWN;
constexpr ActionResult_Result ActionResult::SUCCESS;
constexpr ActionResult_Result ActionResult::NO_SYSTEM;
constexpr ActionResult_Result ActionResult::CONNECTION_ERROR;
constexpr ActionResult_Result ActionResult::BUSY;
constexpr ActionResult_Result ActionResult::COMMAND_DENIED;
constexpr ActionResult_Result ActionResult::COMMAND_DENIED_LANDED_STATE_UNKNOWN;
constexpr ActionResult_Result ActionResult::COMMAND_DENIED_NOT_LANDED;
constexpr ActionResult_Result ActionResult::TIMEOUT;
constexpr ActionResult_Result ActionResult::VTOL_TRANSITION_SUPPORT_UNKNOWN;
constexpr ActionResult_Result ActionResult::NO_VTOL_TRANSITION_SUPPORT;
constexpr ActionResult_Result ActionResult::PARAMETER_ERROR;
constexpr ActionResult_Result ActionResult::Result_MIN;
constexpr ActionResult_Result ActionResult::Result_MAX;
constexpr int ActionResult::Result_ARRAYSIZE;
#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
// ===================================================================
void ArmRequest::InitAsDefaultInstance() {
}
class ArmRequest::_Internal {
public:
};
ArmRequest::ArmRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.ArmRequest)
}
ArmRequest::ArmRequest(const ArmRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.ArmRequest)
}
void ArmRequest::SharedCtor() {
}
ArmRequest::~ArmRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.ArmRequest)
SharedDtor();
}
void ArmRequest::SharedDtor() {
}
void ArmRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const ArmRequest& ArmRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ArmRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void ArmRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.ArmRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* ArmRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ArmRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.ArmRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.ArmRequest)
return target;
}
size_t ArmRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.ArmRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void ArmRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.ArmRequest)
GOOGLE_DCHECK_NE(&from, this);
const ArmRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ArmRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.ArmRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.ArmRequest)
MergeFrom(*source);
}
}
void ArmRequest::MergeFrom(const ArmRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.ArmRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void ArmRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.ArmRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ArmRequest::CopyFrom(const ArmRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.ArmRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ArmRequest::IsInitialized() const {
return true;
}
void ArmRequest::InternalSwap(ArmRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ArmRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void ArmResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_ArmResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class ArmResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const ArmResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
ArmResponse::_Internal::action_result(const ArmResponse* msg) {
return *msg->action_result_;
}
ArmResponse::ArmResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.ArmResponse)
}
ArmResponse::ArmResponse(const ArmResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.ArmResponse)
}
void ArmResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ArmResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
ArmResponse::~ArmResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.ArmResponse)
SharedDtor();
}
void ArmResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void ArmResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const ArmResponse& ArmResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ArmResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void ArmResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.ArmResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* ArmResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ArmResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.ArmResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.ArmResponse)
return target;
}
size_t ArmResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.ArmResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void ArmResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.ArmResponse)
GOOGLE_DCHECK_NE(&from, this);
const ArmResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ArmResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.ArmResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.ArmResponse)
MergeFrom(*source);
}
}
void ArmResponse::MergeFrom(const ArmResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.ArmResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void ArmResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.ArmResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ArmResponse::CopyFrom(const ArmResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.ArmResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ArmResponse::IsInitialized() const {
return true;
}
void ArmResponse::InternalSwap(ArmResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ArmResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void DisarmRequest::InitAsDefaultInstance() {
}
class DisarmRequest::_Internal {
public:
};
DisarmRequest::DisarmRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.DisarmRequest)
}
DisarmRequest::DisarmRequest(const DisarmRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.DisarmRequest)
}
void DisarmRequest::SharedCtor() {
}
DisarmRequest::~DisarmRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.DisarmRequest)
SharedDtor();
}
void DisarmRequest::SharedDtor() {
}
void DisarmRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const DisarmRequest& DisarmRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DisarmRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void DisarmRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.DisarmRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* DisarmRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* DisarmRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.DisarmRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.DisarmRequest)
return target;
}
size_t DisarmRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.DisarmRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void DisarmRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.DisarmRequest)
GOOGLE_DCHECK_NE(&from, this);
const DisarmRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<DisarmRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.DisarmRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.DisarmRequest)
MergeFrom(*source);
}
}
void DisarmRequest::MergeFrom(const DisarmRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.DisarmRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void DisarmRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.DisarmRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DisarmRequest::CopyFrom(const DisarmRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.DisarmRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DisarmRequest::IsInitialized() const {
return true;
}
void DisarmRequest::InternalSwap(DisarmRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata DisarmRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void DisarmResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_DisarmResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class DisarmResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const DisarmResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
DisarmResponse::_Internal::action_result(const DisarmResponse* msg) {
return *msg->action_result_;
}
DisarmResponse::DisarmResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.DisarmResponse)
}
DisarmResponse::DisarmResponse(const DisarmResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.DisarmResponse)
}
void DisarmResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_DisarmResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
DisarmResponse::~DisarmResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.DisarmResponse)
SharedDtor();
}
void DisarmResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void DisarmResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const DisarmResponse& DisarmResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DisarmResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void DisarmResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.DisarmResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* DisarmResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* DisarmResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.DisarmResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.DisarmResponse)
return target;
}
size_t DisarmResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.DisarmResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void DisarmResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.DisarmResponse)
GOOGLE_DCHECK_NE(&from, this);
const DisarmResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<DisarmResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.DisarmResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.DisarmResponse)
MergeFrom(*source);
}
}
void DisarmResponse::MergeFrom(const DisarmResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.DisarmResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void DisarmResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.DisarmResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DisarmResponse::CopyFrom(const DisarmResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.DisarmResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DisarmResponse::IsInitialized() const {
return true;
}
void DisarmResponse::InternalSwap(DisarmResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata DisarmResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TakeoffRequest::InitAsDefaultInstance() {
}
class TakeoffRequest::_Internal {
public:
};
TakeoffRequest::TakeoffRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TakeoffRequest)
}
TakeoffRequest::TakeoffRequest(const TakeoffRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TakeoffRequest)
}
void TakeoffRequest::SharedCtor() {
}
TakeoffRequest::~TakeoffRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TakeoffRequest)
SharedDtor();
}
void TakeoffRequest::SharedDtor() {
}
void TakeoffRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TakeoffRequest& TakeoffRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TakeoffRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TakeoffRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TakeoffRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* TakeoffRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TakeoffRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TakeoffRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TakeoffRequest)
return target;
}
size_t TakeoffRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TakeoffRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TakeoffRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TakeoffRequest)
GOOGLE_DCHECK_NE(&from, this);
const TakeoffRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TakeoffRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TakeoffRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TakeoffRequest)
MergeFrom(*source);
}
}
void TakeoffRequest::MergeFrom(const TakeoffRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TakeoffRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void TakeoffRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TakeoffRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TakeoffRequest::CopyFrom(const TakeoffRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TakeoffRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TakeoffRequest::IsInitialized() const {
return true;
}
void TakeoffRequest::InternalSwap(TakeoffRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TakeoffRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TakeoffResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_TakeoffResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class TakeoffResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const TakeoffResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
TakeoffResponse::_Internal::action_result(const TakeoffResponse* msg) {
return *msg->action_result_;
}
TakeoffResponse::TakeoffResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TakeoffResponse)
}
TakeoffResponse::TakeoffResponse(const TakeoffResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TakeoffResponse)
}
void TakeoffResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TakeoffResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
TakeoffResponse::~TakeoffResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TakeoffResponse)
SharedDtor();
}
void TakeoffResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void TakeoffResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TakeoffResponse& TakeoffResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TakeoffResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TakeoffResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TakeoffResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* TakeoffResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TakeoffResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TakeoffResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TakeoffResponse)
return target;
}
size_t TakeoffResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TakeoffResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TakeoffResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TakeoffResponse)
GOOGLE_DCHECK_NE(&from, this);
const TakeoffResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TakeoffResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TakeoffResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TakeoffResponse)
MergeFrom(*source);
}
}
void TakeoffResponse::MergeFrom(const TakeoffResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TakeoffResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void TakeoffResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TakeoffResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TakeoffResponse::CopyFrom(const TakeoffResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TakeoffResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TakeoffResponse::IsInitialized() const {
return true;
}
void TakeoffResponse::InternalSwap(TakeoffResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TakeoffResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void LandRequest::InitAsDefaultInstance() {
}
class LandRequest::_Internal {
public:
};
LandRequest::LandRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.LandRequest)
}
LandRequest::LandRequest(const LandRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.LandRequest)
}
void LandRequest::SharedCtor() {
}
LandRequest::~LandRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.LandRequest)
SharedDtor();
}
void LandRequest::SharedDtor() {
}
void LandRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const LandRequest& LandRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LandRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void LandRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.LandRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* LandRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* LandRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.LandRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.LandRequest)
return target;
}
size_t LandRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.LandRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void LandRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.LandRequest)
GOOGLE_DCHECK_NE(&from, this);
const LandRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LandRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.LandRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.LandRequest)
MergeFrom(*source);
}
}
void LandRequest::MergeFrom(const LandRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.LandRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void LandRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.LandRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LandRequest::CopyFrom(const LandRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.LandRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LandRequest::IsInitialized() const {
return true;
}
void LandRequest::InternalSwap(LandRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata LandRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void LandResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_LandResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class LandResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const LandResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
LandResponse::_Internal::action_result(const LandResponse* msg) {
return *msg->action_result_;
}
LandResponse::LandResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.LandResponse)
}
LandResponse::LandResponse(const LandResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.LandResponse)
}
void LandResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_LandResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
LandResponse::~LandResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.LandResponse)
SharedDtor();
}
void LandResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void LandResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const LandResponse& LandResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LandResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void LandResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.LandResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* LandResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* LandResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.LandResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.LandResponse)
return target;
}
size_t LandResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.LandResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void LandResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.LandResponse)
GOOGLE_DCHECK_NE(&from, this);
const LandResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LandResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.LandResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.LandResponse)
MergeFrom(*source);
}
}
void LandResponse::MergeFrom(const LandResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.LandResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void LandResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.LandResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LandResponse::CopyFrom(const LandResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.LandResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LandResponse::IsInitialized() const {
return true;
}
void LandResponse::InternalSwap(LandResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata LandResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void RebootRequest::InitAsDefaultInstance() {
}
class RebootRequest::_Internal {
public:
};
RebootRequest::RebootRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.RebootRequest)
}
RebootRequest::RebootRequest(const RebootRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.RebootRequest)
}
void RebootRequest::SharedCtor() {
}
RebootRequest::~RebootRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.RebootRequest)
SharedDtor();
}
void RebootRequest::SharedDtor() {
}
void RebootRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const RebootRequest& RebootRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_RebootRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void RebootRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.RebootRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* RebootRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* RebootRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.RebootRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.RebootRequest)
return target;
}
size_t RebootRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.RebootRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void RebootRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.RebootRequest)
GOOGLE_DCHECK_NE(&from, this);
const RebootRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<RebootRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.RebootRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.RebootRequest)
MergeFrom(*source);
}
}
void RebootRequest::MergeFrom(const RebootRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.RebootRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void RebootRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.RebootRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RebootRequest::CopyFrom(const RebootRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.RebootRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RebootRequest::IsInitialized() const {
return true;
}
void RebootRequest::InternalSwap(RebootRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata RebootRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void RebootResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_RebootResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class RebootResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const RebootResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
RebootResponse::_Internal::action_result(const RebootResponse* msg) {
return *msg->action_result_;
}
RebootResponse::RebootResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.RebootResponse)
}
RebootResponse::RebootResponse(const RebootResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.RebootResponse)
}
void RebootResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_RebootResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
RebootResponse::~RebootResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.RebootResponse)
SharedDtor();
}
void RebootResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void RebootResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const RebootResponse& RebootResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_RebootResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void RebootResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.RebootResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* RebootResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* RebootResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.RebootResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.RebootResponse)
return target;
}
size_t RebootResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.RebootResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void RebootResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.RebootResponse)
GOOGLE_DCHECK_NE(&from, this);
const RebootResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<RebootResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.RebootResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.RebootResponse)
MergeFrom(*source);
}
}
void RebootResponse::MergeFrom(const RebootResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.RebootResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void RebootResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.RebootResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RebootResponse::CopyFrom(const RebootResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.RebootResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RebootResponse::IsInitialized() const {
return true;
}
void RebootResponse::InternalSwap(RebootResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata RebootResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void KillRequest::InitAsDefaultInstance() {
}
class KillRequest::_Internal {
public:
};
KillRequest::KillRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.KillRequest)
}
KillRequest::KillRequest(const KillRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.KillRequest)
}
void KillRequest::SharedCtor() {
}
KillRequest::~KillRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.KillRequest)
SharedDtor();
}
void KillRequest::SharedDtor() {
}
void KillRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const KillRequest& KillRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_KillRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void KillRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.KillRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* KillRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* KillRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.KillRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.KillRequest)
return target;
}
size_t KillRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.KillRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void KillRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.KillRequest)
GOOGLE_DCHECK_NE(&from, this);
const KillRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<KillRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.KillRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.KillRequest)
MergeFrom(*source);
}
}
void KillRequest::MergeFrom(const KillRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.KillRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void KillRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.KillRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void KillRequest::CopyFrom(const KillRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.KillRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool KillRequest::IsInitialized() const {
return true;
}
void KillRequest::InternalSwap(KillRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata KillRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void KillResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_KillResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class KillResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const KillResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
KillResponse::_Internal::action_result(const KillResponse* msg) {
return *msg->action_result_;
}
KillResponse::KillResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.KillResponse)
}
KillResponse::KillResponse(const KillResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.KillResponse)
}
void KillResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_KillResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
KillResponse::~KillResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.KillResponse)
SharedDtor();
}
void KillResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void KillResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const KillResponse& KillResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_KillResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void KillResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.KillResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* KillResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* KillResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.KillResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.KillResponse)
return target;
}
size_t KillResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.KillResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void KillResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.KillResponse)
GOOGLE_DCHECK_NE(&from, this);
const KillResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<KillResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.KillResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.KillResponse)
MergeFrom(*source);
}
}
void KillResponse::MergeFrom(const KillResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.KillResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void KillResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.KillResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void KillResponse::CopyFrom(const KillResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.KillResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool KillResponse::IsInitialized() const {
return true;
}
void KillResponse::InternalSwap(KillResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata KillResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void ReturnToLaunchRequest::InitAsDefaultInstance() {
}
class ReturnToLaunchRequest::_Internal {
public:
};
ReturnToLaunchRequest::ReturnToLaunchRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.ReturnToLaunchRequest)
}
ReturnToLaunchRequest::ReturnToLaunchRequest(const ReturnToLaunchRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.ReturnToLaunchRequest)
}
void ReturnToLaunchRequest::SharedCtor() {
}
ReturnToLaunchRequest::~ReturnToLaunchRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.ReturnToLaunchRequest)
SharedDtor();
}
void ReturnToLaunchRequest::SharedDtor() {
}
void ReturnToLaunchRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const ReturnToLaunchRequest& ReturnToLaunchRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ReturnToLaunchRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void ReturnToLaunchRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.ReturnToLaunchRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* ReturnToLaunchRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ReturnToLaunchRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.ReturnToLaunchRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.ReturnToLaunchRequest)
return target;
}
size_t ReturnToLaunchRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.ReturnToLaunchRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void ReturnToLaunchRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.ReturnToLaunchRequest)
GOOGLE_DCHECK_NE(&from, this);
const ReturnToLaunchRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ReturnToLaunchRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.ReturnToLaunchRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.ReturnToLaunchRequest)
MergeFrom(*source);
}
}
void ReturnToLaunchRequest::MergeFrom(const ReturnToLaunchRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.ReturnToLaunchRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void ReturnToLaunchRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.ReturnToLaunchRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReturnToLaunchRequest::CopyFrom(const ReturnToLaunchRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.ReturnToLaunchRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ReturnToLaunchRequest::IsInitialized() const {
return true;
}
void ReturnToLaunchRequest::InternalSwap(ReturnToLaunchRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ReturnToLaunchRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void ReturnToLaunchResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_ReturnToLaunchResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class ReturnToLaunchResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const ReturnToLaunchResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
ReturnToLaunchResponse::_Internal::action_result(const ReturnToLaunchResponse* msg) {
return *msg->action_result_;
}
ReturnToLaunchResponse::ReturnToLaunchResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.ReturnToLaunchResponse)
}
ReturnToLaunchResponse::ReturnToLaunchResponse(const ReturnToLaunchResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.ReturnToLaunchResponse)
}
void ReturnToLaunchResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ReturnToLaunchResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
ReturnToLaunchResponse::~ReturnToLaunchResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.ReturnToLaunchResponse)
SharedDtor();
}
void ReturnToLaunchResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void ReturnToLaunchResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const ReturnToLaunchResponse& ReturnToLaunchResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ReturnToLaunchResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void ReturnToLaunchResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.ReturnToLaunchResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* ReturnToLaunchResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ReturnToLaunchResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.ReturnToLaunchResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.ReturnToLaunchResponse)
return target;
}
size_t ReturnToLaunchResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.ReturnToLaunchResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void ReturnToLaunchResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.ReturnToLaunchResponse)
GOOGLE_DCHECK_NE(&from, this);
const ReturnToLaunchResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ReturnToLaunchResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.ReturnToLaunchResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.ReturnToLaunchResponse)
MergeFrom(*source);
}
}
void ReturnToLaunchResponse::MergeFrom(const ReturnToLaunchResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.ReturnToLaunchResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void ReturnToLaunchResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.ReturnToLaunchResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReturnToLaunchResponse::CopyFrom(const ReturnToLaunchResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.ReturnToLaunchResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ReturnToLaunchResponse::IsInitialized() const {
return true;
}
void ReturnToLaunchResponse::InternalSwap(ReturnToLaunchResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ReturnToLaunchResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TransitionToFixedWingRequest::InitAsDefaultInstance() {
}
class TransitionToFixedWingRequest::_Internal {
public:
};
TransitionToFixedWingRequest::TransitionToFixedWingRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TransitionToFixedWingRequest)
}
TransitionToFixedWingRequest::TransitionToFixedWingRequest(const TransitionToFixedWingRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TransitionToFixedWingRequest)
}
void TransitionToFixedWingRequest::SharedCtor() {
}
TransitionToFixedWingRequest::~TransitionToFixedWingRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TransitionToFixedWingRequest)
SharedDtor();
}
void TransitionToFixedWingRequest::SharedDtor() {
}
void TransitionToFixedWingRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TransitionToFixedWingRequest& TransitionToFixedWingRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TransitionToFixedWingRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TransitionToFixedWingRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* TransitionToFixedWingRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TransitionToFixedWingRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TransitionToFixedWingRequest)
return target;
}
size_t TransitionToFixedWingRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TransitionToFixedWingRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
GOOGLE_DCHECK_NE(&from, this);
const TransitionToFixedWingRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TransitionToFixedWingRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TransitionToFixedWingRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TransitionToFixedWingRequest)
MergeFrom(*source);
}
}
void TransitionToFixedWingRequest::MergeFrom(const TransitionToFixedWingRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void TransitionToFixedWingRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TransitionToFixedWingRequest::CopyFrom(const TransitionToFixedWingRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TransitionToFixedWingRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TransitionToFixedWingRequest::IsInitialized() const {
return true;
}
void TransitionToFixedWingRequest::InternalSwap(TransitionToFixedWingRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TransitionToFixedWingRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TransitionToFixedWingResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_TransitionToFixedWingResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class TransitionToFixedWingResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const TransitionToFixedWingResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
TransitionToFixedWingResponse::_Internal::action_result(const TransitionToFixedWingResponse* msg) {
return *msg->action_result_;
}
TransitionToFixedWingResponse::TransitionToFixedWingResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TransitionToFixedWingResponse)
}
TransitionToFixedWingResponse::TransitionToFixedWingResponse(const TransitionToFixedWingResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TransitionToFixedWingResponse)
}
void TransitionToFixedWingResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TransitionToFixedWingResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
TransitionToFixedWingResponse::~TransitionToFixedWingResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TransitionToFixedWingResponse)
SharedDtor();
}
void TransitionToFixedWingResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void TransitionToFixedWingResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TransitionToFixedWingResponse& TransitionToFixedWingResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TransitionToFixedWingResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TransitionToFixedWingResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* TransitionToFixedWingResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TransitionToFixedWingResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TransitionToFixedWingResponse)
return target;
}
size_t TransitionToFixedWingResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TransitionToFixedWingResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
GOOGLE_DCHECK_NE(&from, this);
const TransitionToFixedWingResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TransitionToFixedWingResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TransitionToFixedWingResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TransitionToFixedWingResponse)
MergeFrom(*source);
}
}
void TransitionToFixedWingResponse::MergeFrom(const TransitionToFixedWingResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void TransitionToFixedWingResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TransitionToFixedWingResponse::CopyFrom(const TransitionToFixedWingResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TransitionToFixedWingResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TransitionToFixedWingResponse::IsInitialized() const {
return true;
}
void TransitionToFixedWingResponse::InternalSwap(TransitionToFixedWingResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TransitionToFixedWingResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TransitionToMulticopterRequest::InitAsDefaultInstance() {
}
class TransitionToMulticopterRequest::_Internal {
public:
};
TransitionToMulticopterRequest::TransitionToMulticopterRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TransitionToMulticopterRequest)
}
TransitionToMulticopterRequest::TransitionToMulticopterRequest(const TransitionToMulticopterRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TransitionToMulticopterRequest)
}
void TransitionToMulticopterRequest::SharedCtor() {
}
TransitionToMulticopterRequest::~TransitionToMulticopterRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TransitionToMulticopterRequest)
SharedDtor();
}
void TransitionToMulticopterRequest::SharedDtor() {
}
void TransitionToMulticopterRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TransitionToMulticopterRequest& TransitionToMulticopterRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TransitionToMulticopterRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TransitionToMulticopterRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* TransitionToMulticopterRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TransitionToMulticopterRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TransitionToMulticopterRequest)
return target;
}
size_t TransitionToMulticopterRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TransitionToMulticopterRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
GOOGLE_DCHECK_NE(&from, this);
const TransitionToMulticopterRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TransitionToMulticopterRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TransitionToMulticopterRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TransitionToMulticopterRequest)
MergeFrom(*source);
}
}
void TransitionToMulticopterRequest::MergeFrom(const TransitionToMulticopterRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void TransitionToMulticopterRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TransitionToMulticopterRequest::CopyFrom(const TransitionToMulticopterRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TransitionToMulticopterRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TransitionToMulticopterRequest::IsInitialized() const {
return true;
}
void TransitionToMulticopterRequest::InternalSwap(TransitionToMulticopterRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TransitionToMulticopterRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void TransitionToMulticopterResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_TransitionToMulticopterResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class TransitionToMulticopterResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const TransitionToMulticopterResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
TransitionToMulticopterResponse::_Internal::action_result(const TransitionToMulticopterResponse* msg) {
return *msg->action_result_;
}
TransitionToMulticopterResponse::TransitionToMulticopterResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.TransitionToMulticopterResponse)
}
TransitionToMulticopterResponse::TransitionToMulticopterResponse(const TransitionToMulticopterResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.TransitionToMulticopterResponse)
}
void TransitionToMulticopterResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TransitionToMulticopterResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
TransitionToMulticopterResponse::~TransitionToMulticopterResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.TransitionToMulticopterResponse)
SharedDtor();
}
void TransitionToMulticopterResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void TransitionToMulticopterResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const TransitionToMulticopterResponse& TransitionToMulticopterResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TransitionToMulticopterResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void TransitionToMulticopterResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* TransitionToMulticopterResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* TransitionToMulticopterResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.TransitionToMulticopterResponse)
return target;
}
size_t TransitionToMulticopterResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void TransitionToMulticopterResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
GOOGLE_DCHECK_NE(&from, this);
const TransitionToMulticopterResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TransitionToMulticopterResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.TransitionToMulticopterResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.TransitionToMulticopterResponse)
MergeFrom(*source);
}
}
void TransitionToMulticopterResponse::MergeFrom(const TransitionToMulticopterResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void TransitionToMulticopterResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TransitionToMulticopterResponse::CopyFrom(const TransitionToMulticopterResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.TransitionToMulticopterResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TransitionToMulticopterResponse::IsInitialized() const {
return true;
}
void TransitionToMulticopterResponse::InternalSwap(TransitionToMulticopterResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata TransitionToMulticopterResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetTakeoffAltitudeRequest::InitAsDefaultInstance() {
}
class GetTakeoffAltitudeRequest::_Internal {
public:
};
GetTakeoffAltitudeRequest::GetTakeoffAltitudeRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
}
GetTakeoffAltitudeRequest::GetTakeoffAltitudeRequest(const GetTakeoffAltitudeRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
}
void GetTakeoffAltitudeRequest::SharedCtor() {
}
GetTakeoffAltitudeRequest::~GetTakeoffAltitudeRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
SharedDtor();
}
void GetTakeoffAltitudeRequest::SharedDtor() {
}
void GetTakeoffAltitudeRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetTakeoffAltitudeRequest& GetTakeoffAltitudeRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetTakeoffAltitudeRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetTakeoffAltitudeRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* GetTakeoffAltitudeRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetTakeoffAltitudeRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
return target;
}
size_t GetTakeoffAltitudeRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetTakeoffAltitudeRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
const GetTakeoffAltitudeRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetTakeoffAltitudeRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
MergeFrom(*source);
}
}
void GetTakeoffAltitudeRequest::MergeFrom(const GetTakeoffAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void GetTakeoffAltitudeRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetTakeoffAltitudeRequest::CopyFrom(const GetTakeoffAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetTakeoffAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetTakeoffAltitudeRequest::IsInitialized() const {
return true;
}
void GetTakeoffAltitudeRequest::InternalSwap(GetTakeoffAltitudeRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetTakeoffAltitudeRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetTakeoffAltitudeResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_GetTakeoffAltitudeResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class GetTakeoffAltitudeResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const GetTakeoffAltitudeResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
GetTakeoffAltitudeResponse::_Internal::action_result(const GetTakeoffAltitudeResponse* msg) {
return *msg->action_result_;
}
GetTakeoffAltitudeResponse::GetTakeoffAltitudeResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
}
GetTakeoffAltitudeResponse::GetTakeoffAltitudeResponse(const GetTakeoffAltitudeResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
altitude_ = from.altitude_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
}
void GetTakeoffAltitudeResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto.base);
::memset(&action_result_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&altitude_) -
reinterpret_cast<char*>(&action_result_)) + sizeof(altitude_));
}
GetTakeoffAltitudeResponse::~GetTakeoffAltitudeResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
SharedDtor();
}
void GetTakeoffAltitudeResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void GetTakeoffAltitudeResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetTakeoffAltitudeResponse& GetTakeoffAltitudeResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetTakeoffAltitudeResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetTakeoffAltitudeResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
altitude_ = 0;
_internal_metadata_.Clear();
}
const char* GetTakeoffAltitudeResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// float altitude = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21)) {
altitude_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetTakeoffAltitudeResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
// float altitude = 2;
if (!(this->altitude() <= 0 && this->altitude() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_altitude(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
return target;
}
size_t GetTakeoffAltitudeResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
// float altitude = 2;
if (!(this->altitude() <= 0 && this->altitude() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetTakeoffAltitudeResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
const GetTakeoffAltitudeResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetTakeoffAltitudeResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
MergeFrom(*source);
}
}
void GetTakeoffAltitudeResponse::MergeFrom(const GetTakeoffAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
if (!(from.altitude() <= 0 && from.altitude() >= 0)) {
_internal_set_altitude(from._internal_altitude());
}
}
void GetTakeoffAltitudeResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetTakeoffAltitudeResponse::CopyFrom(const GetTakeoffAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetTakeoffAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetTakeoffAltitudeResponse::IsInitialized() const {
return true;
}
void GetTakeoffAltitudeResponse::InternalSwap(GetTakeoffAltitudeResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
swap(altitude_, other->altitude_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetTakeoffAltitudeResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetTakeoffAltitudeRequest::InitAsDefaultInstance() {
}
class SetTakeoffAltitudeRequest::_Internal {
public:
};
SetTakeoffAltitudeRequest::SetTakeoffAltitudeRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
}
SetTakeoffAltitudeRequest::SetTakeoffAltitudeRequest(const SetTakeoffAltitudeRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
altitude_ = from.altitude_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
}
void SetTakeoffAltitudeRequest::SharedCtor() {
altitude_ = 0;
}
SetTakeoffAltitudeRequest::~SetTakeoffAltitudeRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
SharedDtor();
}
void SetTakeoffAltitudeRequest::SharedDtor() {
}
void SetTakeoffAltitudeRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetTakeoffAltitudeRequest& SetTakeoffAltitudeRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetTakeoffAltitudeRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetTakeoffAltitudeRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
altitude_ = 0;
_internal_metadata_.Clear();
}
const char* SetTakeoffAltitudeRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// float altitude = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
altitude_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetTakeoffAltitudeRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// float altitude = 1;
if (!(this->altitude() <= 0 && this->altitude() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_altitude(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
return target;
}
size_t SetTakeoffAltitudeRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// float altitude = 1;
if (!(this->altitude() <= 0 && this->altitude() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetTakeoffAltitudeRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
const SetTakeoffAltitudeRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetTakeoffAltitudeRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
MergeFrom(*source);
}
}
void SetTakeoffAltitudeRequest::MergeFrom(const SetTakeoffAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (!(from.altitude() <= 0 && from.altitude() >= 0)) {
_internal_set_altitude(from._internal_altitude());
}
}
void SetTakeoffAltitudeRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetTakeoffAltitudeRequest::CopyFrom(const SetTakeoffAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetTakeoffAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetTakeoffAltitudeRequest::IsInitialized() const {
return true;
}
void SetTakeoffAltitudeRequest::InternalSwap(SetTakeoffAltitudeRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(altitude_, other->altitude_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetTakeoffAltitudeRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetTakeoffAltitudeResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_SetTakeoffAltitudeResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class SetTakeoffAltitudeResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const SetTakeoffAltitudeResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
SetTakeoffAltitudeResponse::_Internal::action_result(const SetTakeoffAltitudeResponse* msg) {
return *msg->action_result_;
}
SetTakeoffAltitudeResponse::SetTakeoffAltitudeResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
}
SetTakeoffAltitudeResponse::SetTakeoffAltitudeResponse(const SetTakeoffAltitudeResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
}
void SetTakeoffAltitudeResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
SetTakeoffAltitudeResponse::~SetTakeoffAltitudeResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
SharedDtor();
}
void SetTakeoffAltitudeResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void SetTakeoffAltitudeResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetTakeoffAltitudeResponse& SetTakeoffAltitudeResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetTakeoffAltitudeResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetTakeoffAltitudeResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* SetTakeoffAltitudeResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetTakeoffAltitudeResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
return target;
}
size_t SetTakeoffAltitudeResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetTakeoffAltitudeResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
const SetTakeoffAltitudeResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetTakeoffAltitudeResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
MergeFrom(*source);
}
}
void SetTakeoffAltitudeResponse::MergeFrom(const SetTakeoffAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void SetTakeoffAltitudeResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetTakeoffAltitudeResponse::CopyFrom(const SetTakeoffAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetTakeoffAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetTakeoffAltitudeResponse::IsInitialized() const {
return true;
}
void SetTakeoffAltitudeResponse::InternalSwap(SetTakeoffAltitudeResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetTakeoffAltitudeResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetMaximumSpeedRequest::InitAsDefaultInstance() {
}
class GetMaximumSpeedRequest::_Internal {
public:
};
GetMaximumSpeedRequest::GetMaximumSpeedRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetMaximumSpeedRequest)
}
GetMaximumSpeedRequest::GetMaximumSpeedRequest(const GetMaximumSpeedRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetMaximumSpeedRequest)
}
void GetMaximumSpeedRequest::SharedCtor() {
}
GetMaximumSpeedRequest::~GetMaximumSpeedRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetMaximumSpeedRequest)
SharedDtor();
}
void GetMaximumSpeedRequest::SharedDtor() {
}
void GetMaximumSpeedRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetMaximumSpeedRequest& GetMaximumSpeedRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetMaximumSpeedRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetMaximumSpeedRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* GetMaximumSpeedRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetMaximumSpeedRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetMaximumSpeedRequest)
return target;
}
size_t GetMaximumSpeedRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetMaximumSpeedRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
GOOGLE_DCHECK_NE(&from, this);
const GetMaximumSpeedRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetMaximumSpeedRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetMaximumSpeedRequest)
MergeFrom(*source);
}
}
void GetMaximumSpeedRequest::MergeFrom(const GetMaximumSpeedRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void GetMaximumSpeedRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetMaximumSpeedRequest::CopyFrom(const GetMaximumSpeedRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetMaximumSpeedRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetMaximumSpeedRequest::IsInitialized() const {
return true;
}
void GetMaximumSpeedRequest::InternalSwap(GetMaximumSpeedRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetMaximumSpeedRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetMaximumSpeedResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_GetMaximumSpeedResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class GetMaximumSpeedResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const GetMaximumSpeedResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
GetMaximumSpeedResponse::_Internal::action_result(const GetMaximumSpeedResponse* msg) {
return *msg->action_result_;
}
GetMaximumSpeedResponse::GetMaximumSpeedResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetMaximumSpeedResponse)
}
GetMaximumSpeedResponse::GetMaximumSpeedResponse(const GetMaximumSpeedResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
speed_ = from.speed_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetMaximumSpeedResponse)
}
void GetMaximumSpeedResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_GetMaximumSpeedResponse_action_2faction_2eproto.base);
::memset(&action_result_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&speed_) -
reinterpret_cast<char*>(&action_result_)) + sizeof(speed_));
}
GetMaximumSpeedResponse::~GetMaximumSpeedResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetMaximumSpeedResponse)
SharedDtor();
}
void GetMaximumSpeedResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void GetMaximumSpeedResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetMaximumSpeedResponse& GetMaximumSpeedResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetMaximumSpeedResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetMaximumSpeedResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
speed_ = 0;
_internal_metadata_.Clear();
}
const char* GetMaximumSpeedResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// float speed = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21)) {
speed_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetMaximumSpeedResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
// float speed = 2;
if (!(this->speed() <= 0 && this->speed() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_speed(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetMaximumSpeedResponse)
return target;
}
size_t GetMaximumSpeedResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
// float speed = 2;
if (!(this->speed() <= 0 && this->speed() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetMaximumSpeedResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
GOOGLE_DCHECK_NE(&from, this);
const GetMaximumSpeedResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetMaximumSpeedResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetMaximumSpeedResponse)
MergeFrom(*source);
}
}
void GetMaximumSpeedResponse::MergeFrom(const GetMaximumSpeedResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
if (!(from.speed() <= 0 && from.speed() >= 0)) {
_internal_set_speed(from._internal_speed());
}
}
void GetMaximumSpeedResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetMaximumSpeedResponse::CopyFrom(const GetMaximumSpeedResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetMaximumSpeedResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetMaximumSpeedResponse::IsInitialized() const {
return true;
}
void GetMaximumSpeedResponse::InternalSwap(GetMaximumSpeedResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
swap(speed_, other->speed_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetMaximumSpeedResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetMaximumSpeedRequest::InitAsDefaultInstance() {
}
class SetMaximumSpeedRequest::_Internal {
public:
};
SetMaximumSpeedRequest::SetMaximumSpeedRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetMaximumSpeedRequest)
}
SetMaximumSpeedRequest::SetMaximumSpeedRequest(const SetMaximumSpeedRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
speed_ = from.speed_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetMaximumSpeedRequest)
}
void SetMaximumSpeedRequest::SharedCtor() {
speed_ = 0;
}
SetMaximumSpeedRequest::~SetMaximumSpeedRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetMaximumSpeedRequest)
SharedDtor();
}
void SetMaximumSpeedRequest::SharedDtor() {
}
void SetMaximumSpeedRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetMaximumSpeedRequest& SetMaximumSpeedRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetMaximumSpeedRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetMaximumSpeedRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
speed_ = 0;
_internal_metadata_.Clear();
}
const char* SetMaximumSpeedRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// float speed = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
speed_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetMaximumSpeedRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// float speed = 1;
if (!(this->speed() <= 0 && this->speed() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_speed(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetMaximumSpeedRequest)
return target;
}
size_t SetMaximumSpeedRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// float speed = 1;
if (!(this->speed() <= 0 && this->speed() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetMaximumSpeedRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
GOOGLE_DCHECK_NE(&from, this);
const SetMaximumSpeedRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetMaximumSpeedRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetMaximumSpeedRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetMaximumSpeedRequest)
MergeFrom(*source);
}
}
void SetMaximumSpeedRequest::MergeFrom(const SetMaximumSpeedRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (!(from.speed() <= 0 && from.speed() >= 0)) {
_internal_set_speed(from._internal_speed());
}
}
void SetMaximumSpeedRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetMaximumSpeedRequest::CopyFrom(const SetMaximumSpeedRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetMaximumSpeedRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetMaximumSpeedRequest::IsInitialized() const {
return true;
}
void SetMaximumSpeedRequest::InternalSwap(SetMaximumSpeedRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(speed_, other->speed_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetMaximumSpeedRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetMaximumSpeedResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_SetMaximumSpeedResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class SetMaximumSpeedResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const SetMaximumSpeedResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
SetMaximumSpeedResponse::_Internal::action_result(const SetMaximumSpeedResponse* msg) {
return *msg->action_result_;
}
SetMaximumSpeedResponse::SetMaximumSpeedResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetMaximumSpeedResponse)
}
SetMaximumSpeedResponse::SetMaximumSpeedResponse(const SetMaximumSpeedResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetMaximumSpeedResponse)
}
void SetMaximumSpeedResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SetMaximumSpeedResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
SetMaximumSpeedResponse::~SetMaximumSpeedResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetMaximumSpeedResponse)
SharedDtor();
}
void SetMaximumSpeedResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void SetMaximumSpeedResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetMaximumSpeedResponse& SetMaximumSpeedResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetMaximumSpeedResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetMaximumSpeedResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* SetMaximumSpeedResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetMaximumSpeedResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetMaximumSpeedResponse)
return target;
}
size_t SetMaximumSpeedResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetMaximumSpeedResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
GOOGLE_DCHECK_NE(&from, this);
const SetMaximumSpeedResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetMaximumSpeedResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetMaximumSpeedResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetMaximumSpeedResponse)
MergeFrom(*source);
}
}
void SetMaximumSpeedResponse::MergeFrom(const SetMaximumSpeedResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void SetMaximumSpeedResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetMaximumSpeedResponse::CopyFrom(const SetMaximumSpeedResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetMaximumSpeedResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetMaximumSpeedResponse::IsInitialized() const {
return true;
}
void SetMaximumSpeedResponse::InternalSwap(SetMaximumSpeedResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetMaximumSpeedResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetReturnToLaunchAltitudeRequest::InitAsDefaultInstance() {
}
class GetReturnToLaunchAltitudeRequest::_Internal {
public:
};
GetReturnToLaunchAltitudeRequest::GetReturnToLaunchAltitudeRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
}
GetReturnToLaunchAltitudeRequest::GetReturnToLaunchAltitudeRequest(const GetReturnToLaunchAltitudeRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
}
void GetReturnToLaunchAltitudeRequest::SharedCtor() {
}
GetReturnToLaunchAltitudeRequest::~GetReturnToLaunchAltitudeRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
SharedDtor();
}
void GetReturnToLaunchAltitudeRequest::SharedDtor() {
}
void GetReturnToLaunchAltitudeRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetReturnToLaunchAltitudeRequest& GetReturnToLaunchAltitudeRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetReturnToLaunchAltitudeRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetReturnToLaunchAltitudeRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_internal_metadata_.Clear();
}
const char* GetReturnToLaunchAltitudeRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetReturnToLaunchAltitudeRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
return target;
}
size_t GetReturnToLaunchAltitudeRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetReturnToLaunchAltitudeRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
const GetReturnToLaunchAltitudeRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetReturnToLaunchAltitudeRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
MergeFrom(*source);
}
}
void GetReturnToLaunchAltitudeRequest::MergeFrom(const GetReturnToLaunchAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
}
void GetReturnToLaunchAltitudeRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetReturnToLaunchAltitudeRequest::CopyFrom(const GetReturnToLaunchAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetReturnToLaunchAltitudeRequest::IsInitialized() const {
return true;
}
void GetReturnToLaunchAltitudeRequest::InternalSwap(GetReturnToLaunchAltitudeRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetReturnToLaunchAltitudeRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void GetReturnToLaunchAltitudeResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_GetReturnToLaunchAltitudeResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class GetReturnToLaunchAltitudeResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const GetReturnToLaunchAltitudeResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
GetReturnToLaunchAltitudeResponse::_Internal::action_result(const GetReturnToLaunchAltitudeResponse* msg) {
return *msg->action_result_;
}
GetReturnToLaunchAltitudeResponse::GetReturnToLaunchAltitudeResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
}
GetReturnToLaunchAltitudeResponse::GetReturnToLaunchAltitudeResponse(const GetReturnToLaunchAltitudeResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
relative_altitude_m_ = from.relative_altitude_m_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
}
void GetReturnToLaunchAltitudeResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base);
::memset(&action_result_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&relative_altitude_m_) -
reinterpret_cast<char*>(&action_result_)) + sizeof(relative_altitude_m_));
}
GetReturnToLaunchAltitudeResponse::~GetReturnToLaunchAltitudeResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
SharedDtor();
}
void GetReturnToLaunchAltitudeResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void GetReturnToLaunchAltitudeResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const GetReturnToLaunchAltitudeResponse& GetReturnToLaunchAltitudeResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_GetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void GetReturnToLaunchAltitudeResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
relative_altitude_m_ = 0;
_internal_metadata_.Clear();
}
const char* GetReturnToLaunchAltitudeResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
// float relative_altitude_m = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21)) {
relative_altitude_m_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* GetReturnToLaunchAltitudeResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
// float relative_altitude_m = 2;
if (!(this->relative_altitude_m() <= 0 && this->relative_altitude_m() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_relative_altitude_m(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
return target;
}
size_t GetReturnToLaunchAltitudeResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
// float relative_altitude_m = 2;
if (!(this->relative_altitude_m() <= 0 && this->relative_altitude_m() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void GetReturnToLaunchAltitudeResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
const GetReturnToLaunchAltitudeResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GetReturnToLaunchAltitudeResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
MergeFrom(*source);
}
}
void GetReturnToLaunchAltitudeResponse::MergeFrom(const GetReturnToLaunchAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
if (!(from.relative_altitude_m() <= 0 && from.relative_altitude_m() >= 0)) {
_internal_set_relative_altitude_m(from._internal_relative_altitude_m());
}
}
void GetReturnToLaunchAltitudeResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void GetReturnToLaunchAltitudeResponse::CopyFrom(const GetReturnToLaunchAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.GetReturnToLaunchAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GetReturnToLaunchAltitudeResponse::IsInitialized() const {
return true;
}
void GetReturnToLaunchAltitudeResponse::InternalSwap(GetReturnToLaunchAltitudeResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
swap(relative_altitude_m_, other->relative_altitude_m_);
}
::PROTOBUF_NAMESPACE_ID::Metadata GetReturnToLaunchAltitudeResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetReturnToLaunchAltitudeRequest::InitAsDefaultInstance() {
}
class SetReturnToLaunchAltitudeRequest::_Internal {
public:
};
SetReturnToLaunchAltitudeRequest::SetReturnToLaunchAltitudeRequest()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
}
SetReturnToLaunchAltitudeRequest::SetReturnToLaunchAltitudeRequest(const SetReturnToLaunchAltitudeRequest& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
relative_altitude_m_ = from.relative_altitude_m_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
}
void SetReturnToLaunchAltitudeRequest::SharedCtor() {
relative_altitude_m_ = 0;
}
SetReturnToLaunchAltitudeRequest::~SetReturnToLaunchAltitudeRequest() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
SharedDtor();
}
void SetReturnToLaunchAltitudeRequest::SharedDtor() {
}
void SetReturnToLaunchAltitudeRequest::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetReturnToLaunchAltitudeRequest& SetReturnToLaunchAltitudeRequest::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetReturnToLaunchAltitudeRequest_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetReturnToLaunchAltitudeRequest::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
relative_altitude_m_ = 0;
_internal_metadata_.Clear();
}
const char* SetReturnToLaunchAltitudeRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// float relative_altitude_m = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
relative_altitude_m_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
ptr += sizeof(float);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetReturnToLaunchAltitudeRequest::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// float relative_altitude_m = 1;
if (!(this->relative_altitude_m() <= 0 && this->relative_altitude_m() >= 0)) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_relative_altitude_m(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
return target;
}
size_t SetReturnToLaunchAltitudeRequest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// float relative_altitude_m = 1;
if (!(this->relative_altitude_m() <= 0 && this->relative_altitude_m() >= 0)) {
total_size += 1 + 4;
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetReturnToLaunchAltitudeRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
const SetReturnToLaunchAltitudeRequest* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetReturnToLaunchAltitudeRequest>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
MergeFrom(*source);
}
}
void SetReturnToLaunchAltitudeRequest::MergeFrom(const SetReturnToLaunchAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (!(from.relative_altitude_m() <= 0 && from.relative_altitude_m() >= 0)) {
_internal_set_relative_altitude_m(from._internal_relative_altitude_m());
}
}
void SetReturnToLaunchAltitudeRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetReturnToLaunchAltitudeRequest::CopyFrom(const SetReturnToLaunchAltitudeRequest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeRequest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetReturnToLaunchAltitudeRequest::IsInitialized() const {
return true;
}
void SetReturnToLaunchAltitudeRequest::InternalSwap(SetReturnToLaunchAltitudeRequest* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(relative_altitude_m_, other->relative_altitude_m_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetReturnToLaunchAltitudeRequest::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void SetReturnToLaunchAltitudeResponse::InitAsDefaultInstance() {
::mavsdk::rpc::action::_SetReturnToLaunchAltitudeResponse_default_instance_._instance.get_mutable()->action_result_ = const_cast< ::mavsdk::rpc::action::ActionResult*>(
::mavsdk::rpc::action::ActionResult::internal_default_instance());
}
class SetReturnToLaunchAltitudeResponse::_Internal {
public:
static const ::mavsdk::rpc::action::ActionResult& action_result(const SetReturnToLaunchAltitudeResponse* msg);
};
const ::mavsdk::rpc::action::ActionResult&
SetReturnToLaunchAltitudeResponse::_Internal::action_result(const SetReturnToLaunchAltitudeResponse* msg) {
return *msg->action_result_;
}
SetReturnToLaunchAltitudeResponse::SetReturnToLaunchAltitudeResponse()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
}
SetReturnToLaunchAltitudeResponse::SetReturnToLaunchAltitudeResponse(const SetReturnToLaunchAltitudeResponse& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from._internal_has_action_result()) {
action_result_ = new ::mavsdk::rpc::action::ActionResult(*from.action_result_);
} else {
action_result_ = nullptr;
}
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
}
void SetReturnToLaunchAltitudeResponse::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base);
action_result_ = nullptr;
}
SetReturnToLaunchAltitudeResponse::~SetReturnToLaunchAltitudeResponse() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
SharedDtor();
}
void SetReturnToLaunchAltitudeResponse::SharedDtor() {
if (this != internal_default_instance()) delete action_result_;
}
void SetReturnToLaunchAltitudeResponse::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const SetReturnToLaunchAltitudeResponse& SetReturnToLaunchAltitudeResponse::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_SetReturnToLaunchAltitudeResponse_action_2faction_2eproto.base);
return *internal_default_instance();
}
void SetReturnToLaunchAltitudeResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == nullptr && action_result_ != nullptr) {
delete action_result_;
}
action_result_ = nullptr;
_internal_metadata_.Clear();
}
const char* SetReturnToLaunchAltitudeResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult action_result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_action_result(), ptr);
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* SetReturnToLaunchAltitudeResponse::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(
1, _Internal::action_result(this), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
return target;
}
size_t SetReturnToLaunchAltitudeResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult action_result = 1;
if (this->has_action_result()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*action_result_);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void SetReturnToLaunchAltitudeResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
const SetReturnToLaunchAltitudeResponse* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<SetReturnToLaunchAltitudeResponse>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
MergeFrom(*source);
}
}
void SetReturnToLaunchAltitudeResponse::MergeFrom(const SetReturnToLaunchAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_action_result()) {
_internal_mutable_action_result()->::mavsdk::rpc::action::ActionResult::MergeFrom(from._internal_action_result());
}
}
void SetReturnToLaunchAltitudeResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetReturnToLaunchAltitudeResponse::CopyFrom(const SetReturnToLaunchAltitudeResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.SetReturnToLaunchAltitudeResponse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetReturnToLaunchAltitudeResponse::IsInitialized() const {
return true;
}
void SetReturnToLaunchAltitudeResponse::InternalSwap(SetReturnToLaunchAltitudeResponse* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(action_result_, other->action_result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata SetReturnToLaunchAltitudeResponse::GetMetadata() const {
return GetMetadataStatic();
}
// ===================================================================
void ActionResult::InitAsDefaultInstance() {
}
class ActionResult::_Internal {
public:
};
ActionResult::ActionResult()
: ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
SharedCtor();
// @@protoc_insertion_point(constructor:mavsdk.rpc.action.ActionResult)
}
ActionResult::ActionResult(const ActionResult& from)
: ::PROTOBUF_NAMESPACE_ID::Message(),
_internal_metadata_(nullptr) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
result_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_result_str().empty()) {
result_str_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.result_str_);
}
result_ = from.result_;
// @@protoc_insertion_point(copy_constructor:mavsdk.rpc.action.ActionResult)
}
void ActionResult::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ActionResult_action_2faction_2eproto.base);
result_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
result_ = 0;
}
ActionResult::~ActionResult() {
// @@protoc_insertion_point(destructor:mavsdk.rpc.action.ActionResult)
SharedDtor();
}
void ActionResult::SharedDtor() {
result_str_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void ActionResult::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const ActionResult& ActionResult::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ActionResult_action_2faction_2eproto.base);
return *internal_default_instance();
}
void ActionResult::Clear() {
// @@protoc_insertion_point(message_clear_start:mavsdk.rpc.action.ActionResult)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
result_str_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
result_ = 0;
_internal_metadata_.Clear();
}
const char* ActionResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// .mavsdk.rpc.action.ActionResult.Result result = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
CHK_(ptr);
_internal_set_result(static_cast<::mavsdk::rpc::action::ActionResult_Result>(val));
} else goto handle_unusual;
continue;
// string result_str = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
auto str = _internal_mutable_result_str();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mavsdk.rpc.action.ActionResult.result_str"));
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* ActionResult::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.action.ActionResult)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .mavsdk.rpc.action.ActionResult.Result result = 1;
if (this->result() != 0) {
target = stream->EnsureSpace(target);
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
1, this->_internal_result(), target);
}
// string result_str = 2;
if (this->result_str().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_result_str().data(), static_cast<int>(this->_internal_result_str().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"mavsdk.rpc.action.ActionResult.result_str");
target = stream->WriteStringMaybeAliased(
2, this->_internal_result_str(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields(), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.action.ActionResult)
return target;
}
size_t ActionResult::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.action.ActionResult)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// string result_str = 2;
if (this->result_str().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_result_str());
}
// .mavsdk.rpc.action.ActionResult.Result result = 1;
if (this->result() != 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void ActionResult::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:mavsdk.rpc.action.ActionResult)
GOOGLE_DCHECK_NE(&from, this);
const ActionResult* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ActionResult>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:mavsdk.rpc.action.ActionResult)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:mavsdk.rpc.action.ActionResult)
MergeFrom(*source);
}
}
void ActionResult::MergeFrom(const ActionResult& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.action.ActionResult)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.result_str().size() > 0) {
result_str_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.result_str_);
}
if (from.result() != 0) {
_internal_set_result(from._internal_result());
}
}
void ActionResult::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:mavsdk.rpc.action.ActionResult)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ActionResult::CopyFrom(const ActionResult& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.action.ActionResult)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ActionResult::IsInitialized() const {
return true;
}
void ActionResult::InternalSwap(ActionResult* other) {
using std::swap;
_internal_metadata_.Swap(&other->_internal_metadata_);
result_str_.Swap(&other->result_str_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
swap(result_, other->result_);
}
::PROTOBUF_NAMESPACE_ID::Metadata ActionResult::GetMetadata() const {
return GetMetadataStatic();
}
// @@protoc_insertion_point(namespace_scope)
} // namespace action
} // namespace rpc
} // namespace mavsdk
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::ArmRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::ArmRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::ArmRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::ArmResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::ArmResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::ArmResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::DisarmRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::DisarmRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::DisarmRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::DisarmResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::DisarmResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::DisarmResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TakeoffRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TakeoffRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TakeoffRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TakeoffResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TakeoffResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TakeoffResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::LandRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::LandRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::LandRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::LandResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::LandResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::LandResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::RebootRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::RebootRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::RebootRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::RebootResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::RebootResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::RebootResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::KillRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::KillRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::KillRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::KillResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::KillResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::KillResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::ReturnToLaunchRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::ReturnToLaunchRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::ReturnToLaunchRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::ReturnToLaunchResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::ReturnToLaunchResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::ReturnToLaunchResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TransitionToFixedWingRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TransitionToFixedWingRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TransitionToFixedWingRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TransitionToFixedWingResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TransitionToFixedWingResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TransitionToFixedWingResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TransitionToMulticopterRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TransitionToMulticopterRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TransitionToMulticopterRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::TransitionToMulticopterResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::TransitionToMulticopterResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::TransitionToMulticopterResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetTakeoffAltitudeRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetTakeoffAltitudeRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetTakeoffAltitudeRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetTakeoffAltitudeResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetTakeoffAltitudeResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetTakeoffAltitudeResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetTakeoffAltitudeRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetTakeoffAltitudeRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetTakeoffAltitudeRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetTakeoffAltitudeResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetTakeoffAltitudeResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetTakeoffAltitudeResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetMaximumSpeedRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetMaximumSpeedRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetMaximumSpeedRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetMaximumSpeedResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetMaximumSpeedResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetMaximumSpeedResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetMaximumSpeedRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetMaximumSpeedRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetMaximumSpeedRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetMaximumSpeedResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetMaximumSpeedResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetMaximumSpeedResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetReturnToLaunchAltitudeRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::GetReturnToLaunchAltitudeResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetReturnToLaunchAltitudeRequest >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::SetReturnToLaunchAltitudeResponse >(arena);
}
template<> PROTOBUF_NOINLINE ::mavsdk::rpc::action::ActionResult* Arena::CreateMaybeMessage< ::mavsdk::rpc::action::ActionResult >(Arena* arena) {
return Arena::CreateInternal< ::mavsdk::rpc::action::ActionResult >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
| [
"jonas.vautherin@gmail.com"
] | jonas.vautherin@gmail.com |
f3a2b6f8102f8fb4d95a475ddc7e6113f8880a5d | 830fb4157e63cdb7dcbbe07d94a63e6ca91f362c | /WickedEngine/wiArchive.cpp | 3f2fa3e698df9ed11249b2f7711388639316959d | [
"MIT",
"Zlib",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | JohanAR/WickedEngine | 791cdac2afe52c1e007a554f73d2c0676782c09c | da70338ec7b9baa126d9c0c60d1eb8c772093222 | refs/heads/master | 2022-11-26T12:03:42.038662 | 2020-07-12T23:04:16 | 2020-07-12T23:04:16 | 279,321,145 | 0 | 0 | NOASSERTION | 2020-07-13T14:10:57 | 2020-07-13T14:10:56 | null | UTF-8 | C++ | false | false | 2,082 | cpp | #include "wiArchive.h"
#include "wiHelper.h"
#include <fstream>
#include <sstream>
using namespace std;
// this should always be only INCREMENTED and only if a new serialization is implemeted somewhere!
uint64_t __archiveVersion = 46;
// this is the version number of which below the archive is not compatible with the current version
uint64_t __archiveVersionBarrier = 22;
// version history is logged in ArchiveVersionHistory.txt file!
wiArchive::wiArchive()
{
CreateEmpty();
}
wiArchive::wiArchive(const std::string& fileName, bool readMode) : fileName(fileName), readMode(readMode)
{
if (!fileName.empty())
{
if (readMode)
{
if (wiHelper::FileRead(fileName, DATA))
{
(*this) >> version;
if (version < __archiveVersionBarrier)
{
stringstream ss("");
ss << "The archive version (" << version << ") is no longer supported!";
wiHelper::messageBox(ss.str(), "Error!");
Close();
}
if (version > __archiveVersion)
{
stringstream ss("");
ss << "The archive version (" << version << ") is higher than the program's ("<<__archiveVersion<<")!";
wiHelper::messageBox(ss.str(), "Error!");
Close();
}
}
}
else
{
CreateEmpty();
}
}
}
void wiArchive::CreateEmpty()
{
readMode = false;
pos = 0;
version = __archiveVersion;
DATA.resize(128); // starting size
(*this) << version;
}
void wiArchive::SetReadModeAndResetPos(bool isReadMode)
{
readMode = isReadMode;
pos = 0;
if (readMode)
{
(*this) >> version;
}
else
{
(*this) << version;
}
}
bool wiArchive::IsOpen()
{
// when it is open, DATA is not null because it contains the version number at least!
return !DATA.empty();
}
void wiArchive::Close()
{
if (!readMode && !fileName.empty())
{
SaveFile(fileName);
}
DATA.clear();
}
bool wiArchive::SaveFile(const std::string& fileName)
{
return wiHelper::FileWrite(fileName, DATA.data(), pos);
}
string wiArchive::GetSourceDirectory() const
{
return wiHelper::GetDirectoryFromPath(fileName);
}
string wiArchive::GetSourceFileName() const
{
return fileName;
}
| [
"turanszkij@gmail.com"
] | turanszkij@gmail.com |
fee34f244a4def5f2ba7bbc865dd98a60760f282 | baea2a0e9587d1de36e9b03e82160ece8dfa5686 | /BLG 233E (Data Structures)/Lab/9/tree.cpp | 244ecd4c8236a809d89ab64d335a868592be4c7a | [] | no_license | A0L0XIIV/ITU_Undergrad_Projects | bcaed1b867737fd4900e8a2acc746bb8fa477d25 | 54bef07d2f85daaa3a7b4d2dba25a967ec791734 | refs/heads/master | 2021-07-02T08:13:29.509267 | 2020-11-12T19:08:55 | 2020-11-12T19:08:55 | 178,455,504 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,705 | cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
struct node{
int index,sum,mn,mx,num;
struct node *left,*right;
}*root;
int N;
int *ar;
void update( node *p ){
if( p->left && p->right ){
p->num=1+p->left->num+p->right->num;
p->sum=p->index+p->left->sum+p->right->sum;
p->mn=min(p->index,min(p->left->mn,p->right->mn));
p->mx=max(p->index,max(p->left->mx,p->right->mx));
}
else if( p->left && !p->right ){
p->num=1+p->left->num;
p->sum=p->index+p->left->sum;
p->mn=min(p->index,p->left->mn);
p->mx=max(p->index,p->left->mx);
}
}
void add( node *p , int k ){
if( !p->left ){
p->left=new node;
p->left->index=p->left->sum=p->left->mn=p->left->mx=k;
p->left->num=1;
p->left->left=NULL;
p->left->right=NULL;
}
else if( !p->right ){
p->right=new node;
p->right->index=p->right->sum=p->right->mn=p->right->mx=k;
p->right->num=1;
p->right->left=NULL;
p->right->right=NULL;
}
else if( p->left->num==p->right->num )
add(p->left,k);
else
add(p->right,k);
update(p);
}
void createTree(){
cout << "Enter N: ";
cin >> N;
root=new node;
ar=new int[N];
for( int i=0 ; i<N ; i++ )
ar[i]=rand()%N;
root->index=root->mn=root->mx=ar[0];
root->num=1;
for( int i=1 ; i<N ; i++ )
add(root,ar[i]);
for( int i=0 ; i<N ; i++ )
cout << ar[i] << ' ';
cout << endl;
delete(ar);
}
void printPreorder( node *p ){
printf("%d ",p->index );
if( p->left )
printPreorder(p->left);
if( p->right )
printPreorder(p->right);
}
void printInorder( node *p ){
if( p->left )
printInorder(p->left);
printf("%d ",p->index );
if( p->right )
printInorder(p->right);
}
void printPostorder( node *p ){
if( p->left )
printPostorder(p->left);
if( p->right )
printPostorder(p->right);
printf("%d ",p->index );
}
void removeTree( node *p ){
if( p->left )
removeTree(p->left);
if( p->right )
removeTree(p->right);
p->left=NULL;
p->right=NULL;
delete(p);
}
int findMax(){
return root->mx;
}
int findMin(){
return root->mn;
}
int findNumNode(){
return root->num;
}
int findNumLeaf( node *p ){
if( p->left && p->right )
return findNumLeaf(p->left)+findNumLeaf(p->right);
if( p->left && !p->right )
return findNumLeaf(p->left);
return 1;
}
int calculateDepth( node *p , int dep ){
if( p->left && p->right )
return max(calculateDepth(p->left,dep+1),calculateDepth(p->right,dep+1));
if( p->left && !p->right )
return calculateDepth(p->left,dep+1);
return dep;
}
int calculateSum(){
return root->sum;
}
double calcualateAverage(){
return (double)root->sum/(double)N;
}
int main(){
srand(time(NULL));
createTree();
string s;
while(22){
cin.ignore(1000,'\n');
cin >> s;
if( s=="create" )
createTree();
else if( s=="remove" ){
removeTree(root);
root=NULL;
}
else if( s=="pre" ){
printPreorder(root);
cout << endl;
}
else if( s=="in" ){
printInorder(root);
cout << endl;
}
else if( s=="post" ){
printPostorder(root);
cout << endl;
}
else if( s=="max" )
cout << "Maximum value of tree is: " << findMax() << endl;
else if( s=="min" )
cout << "Minimum value of tree is: " << findMin() << endl;
else if( s=="num" )
cout << "Number of nodes in the tree is: " << findNumNode() << endl;
else if( s=="leaf" )
cout << "Number of leaves in the tree is: " << findNumLeaf(root) << endl;
else if( s=="depth" )
cout << "Depth of the tree is: " << calculateDepth(root,1) << endl;
else if( s=="sum" )
cout << "Sum of all values in the tree is: " << calculateSum() << endl;
else if( s=="average" )
cout << "Average of all values in the tree is: " << calcualateAverage() << endl;
else if( s=="exit" )
break;
else
cout << "Invalid choice" << endl;
}
if( root )
removeTree(root);
return 0;
}
| [
"brnky_95@hotmail.com"
] | brnky_95@hotmail.com |
1f1ce4f1fdccb37944e6a2b4a87c5517fc72d471 | d5f2a48fedcbf1246dfeca0a5e6b35427994f1e8 | /src/FastqExtract/main.cpp | 499e5fdf72a30d4a38e5d30e768aaaa5f21657cb | [
"MIT"
] | permissive | wxb263stu/ngs-bits | b741693a70c21b4c2babb5f93549ec571c613fd6 | 99992e1c7bda0c6fa5ed5cd2ba774088293d5836 | refs/heads/master | 2020-03-22T03:00:08.143544 | 2018-06-27T08:17:52 | 2018-06-27T08:17:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,168 | cpp | #include "ToolBase.h"
#include "Helper.h"
#include "FastqFileStream.h"
#include <QSet>
#include <QFile>
class ConcreteTool
: public ToolBase
{
Q_OBJECT
public:
ConcreteTool(int& argc, char *argv[])
: ToolBase(argc, argv)
{
}
virtual void setup()
{
setDescription("Extracts reads from a FASTQ file according to an ID list. Trims the reads if lengths are given.");
addInfile("in", "Input FASTQ file (gzipped or plain).", false);
addInfile("ids", "Input TSV file containing IDs (without the '@') in the first column and optional length in the second column.", false);
addOutfile("out", "Output FASTQ file.", false);
//optional
addFlag("v", "Invert match: keep non-matching reads.");
}
virtual void main()
{
//init
bool v = getFlag("v");
//load ids and lengths
QHash<QByteArray, int> ids;
QSharedPointer<QFile> file = Helper::openFileForReading(getInfile("ids"));
while (!file->atEnd())
{
QByteArray line = file->readLine().trimmed();
if (line.isEmpty() || line[0]=='#') continue;
QList<QByteArray> parts = line.split('\t');
int length = -1;
if (parts.count()>1)
{
length = Helper::toInt(parts[1], "length value");
}
ids.insert(parts[0], length);
}
//open output stream
FastqOutfileStream outfile(getOutfile("out"), false);
//parse input and write output
FastqFileStream stream(getInfile("in"));
FastqEntry entry;
while (!stream.atEnd())
{
stream.readEntry(entry);
QByteArray id = entry.header.trimmed();
id = id.mid(1);
int comment_start = id.indexOf(' ');
if (comment_start!=-1) id = id.left(comment_start);
int length = ids.value(id, -2);
if (length==-2) //id not in list
{
if (!v) continue;
outfile.write(entry);
}
else if (length==-1) //id is in list, but no length given
{
if (v) continue;
outfile.write(entry);
}
else if (length>=1) //id is in list and length given
{
if (v) continue;
entry.bases.resize(length);
entry.qualities.resize(length);
outfile.write(entry);
}
}
}
};
#include "main.moc"
int main(int argc, char *argv[])
{
ConcreteTool tool(argc, argv);
return tool.execute();
}
| [
"marc.sturm@med.uni-tuebingen.de"
] | marc.sturm@med.uni-tuebingen.de |
f8e3971a2cd6f1687c4493e589e3672346575326 | 9ce99d4b9fed2c4b867f4bf050c04d7afd297dc4 | /src/LuzInterface.hpp | f00184ac0603f601e93ca2a3d966d5a853395d5f | [] | no_license | ezzee10/dyasc-baliza | e3a20840e19072d3a079f551608a68489da29f17 | 5afbacab87723d76eb2fe854995549d115a9227f | refs/heads/master | 2023-01-23T01:42:04.617121 | 2020-12-10T23:19:28 | 2020-12-10T23:19:28 | 314,878,799 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 413 | hpp | #ifndef INTERFACE_LUZ_H
#define INTERFACE_LUZ_H
class LuzInterface{
public:
virtual void apagarLuces() = 0;
virtual void encenderLuzVerde() = 0;
virtual void encenderLuzAmarilla() = 0;
virtual void encenderLuzRoja() = 0;
virtual void parpadearLuzVerde(int tiempo, int cantidadParpadeos) = 0;
virtual void parpadearLuzRoja(int tiempo, int cantidadParpadeos) = 0;
};
#endif | [
"ezequiel.colombano@gmail.com"
] | ezequiel.colombano@gmail.com |
08110f21a8944c41cafac56a80ed179b7b1040ac | b090cb9bc30ac595675d8aa253fde95aef2ce5ea | /trunk/src/c/toolkits/mumps/mumpsincludes.h | 2712a9a94e1c94bef1de51d1ad04e70c618cd5e3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | eyhl/issm | 5ae1500715c258d7988e2ef344c5c1fd15be55f7 | 1013e74c28ed663ebb8c9d398d9be0964d002667 | refs/heads/master | 2022-01-05T14:31:23.235538 | 2019-01-15T13:13:08 | 2019-01-15T13:13:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 963 | h | /* \file mumpsincludes.h
* \brief all includes for MUMPS layer
*/
#ifndef _MUMPS_INCLUDES_H_
#define _MUMPS_INCLUDES_H_
/*{{{*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
#endif
#include "../../shared/Numerics/types.h"
/*}}}*/
class Parameters;
template <class doubletype> class SparseRow;
void MpiDenseMumpsSolve(IssmDouble* uf,int uf_M,int uf_n, IssmDouble* Kff,int Kff_M, int Kff_N, int Kff_m, IssmDouble* pf, int pf_M, int pf_m, Parameters* parameters);
void MpiSparseMumpsSolve(IssmDouble* uf,int uf_M,int uf_n, SparseRow<IssmDouble>** Kff,int Kff_M, int Kff_N, int Kff_m, IssmDouble* pf, int pf_M, int pf_m, Parameters* parameters);
#if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)
// call back functions:
ADOLC_ext_fct_iArr mumpsSolveEDF;
ADOLC_ext_fct_iArr_fos_reverse fos_reverse_mumpsSolveEDF;
ADOLC_ext_fct_iArr_fov_reverse fov_reverse_mumpsSolveEDF;
#endif
#endif
| [
"cummings.evan@gmail.com"
] | cummings.evan@gmail.com |
655b766ca7a50e6ca04231e55ef8cdf998c00a5d | 24b8aef808a1722b29ee22dc26b2dec0447db427 | /PAT-Advanced/最短路径/1003 Emergency (25 分)/1003(BF).cpp | 46ee6c85fae2346e37beafb0490b8182304817a9 | [] | no_license | drincs/100-day-plan | 63f080a5328a58cb6f1fe1e97677a13f05d50c45 | ff06270f5d8d53fea3d34d990bb3ff336bb77557 | refs/heads/main | 2023-07-25T10:10:52.797163 | 2021-09-09T10:25:31 | 2021-09-09T10:25:31 | 359,845,885 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,950 | cpp | #include <iostream>
#include <vector>
#include <string.h>
#include <set>
using namespace std;
const int MAXN = 500;
const int INF = 1000000000;
struct Node
{
int v, dis;
Node(int _v, int _dis) : v(_v), dis(_dis) {}
};
vector<Node> Adj[MAXN];
int weight[MAXN];
int d[MAXN], num[MAXN], w[MAXN];
set<int> pre[MAXN];
int n, m, C1, C2;
void Bellman(int s)
{
fill(d, d + MAXN, INF);
memset(num, 0, sizeof(num));
memset(w, 0, sizeof(w));
d[s] = 0;
num[s] = 1;
w[s] = weight[s];
for (int i = 0; i < n - 1; i++)
{
for (int u = 0; u < n; u++)
{
for (int j = 0; j < Adj[u].size(); j++)
{
int v = Adj[u][j].v;
int dis = Adj[u][j].dis;
if (dis + d[u] < d[v])
{
d[v] = d[u] + dis;
w[v] = w[u] + weight[v];
num[v] = num[u];
pre[v].clear();
pre[v].insert(u);
}
else if (dis + d[u] == d[v])
{
if (w[u] + weight[v] > w[v])
{
w[v] = w[u] + weight[v];
}
pre[v].insert(u);
num[v] = 0;
set<int>::iterator it = pre[v].begin();
for (it; it != pre[v].end(); it++)
{
num[v] += num[*it];
}
}
}
}
}
}
int main()
{
scanf("%d%d%d%d", &n, &m, &C1, &C2);
for (int i = 0; i < n; i++)
{
scanf("%d", &weight[i]);
}
for (int i = 0; i < m; i++)
{
int c1, c2, dis;
scanf("%d%d%d", &c1, &c2, &dis);
Adj[c1].push_back(Node(c2, dis));
Adj[c2].push_back(Node(c1, dis));
}
Bellman(C1);
printf("%d %d\n", num[C2], w[C2]);
system("pause");
return 0;
} | [
"drincs@github"
] | drincs@github |
1267adce5f96359f13acbf4423cff56a897fd470 | fa0c642ba67143982d3381f66c029690b6d2bd17 | /Source/Engine/Platform/win/GameCenter/winGameCenter.h | d2919c12f39555b17950db669a9242a443cf4800 | [
"MIT"
] | permissive | blockspacer/EasyGameEngine | 3f605fb2d5747ab250ef8929b0b60e5a41cf6966 | da0b0667138573948cbd2e90e56ece5c42cb0392 | refs/heads/master | 2023-05-05T20:01:31.532452 | 2021-06-01T13:35:54 | 2021-06-01T13:35:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 748 | h | //! @file winGameCenter.h
//! @author LiCode
//! @version 1.1.0.621
//! @date 2011/01/17
//! Copyright 2009-2010 LiCode's Union.
#pragma once
namespace EGE
{
//----------------------------------------------------------------------------
// winGameCenter
//----------------------------------------------------------------------------
class winGameCenter : public TGameCenter< IGameCenter >
{
private:
public:
winGameCenter( );
virtual ~winGameCenter( );
// IGameCenter Interface
public:
virtual _ubool IsAvailable( ) const override;
};
//----------------------------------------------------------------------------
// winGameCenter Implementation
//----------------------------------------------------------------------------
} | [
"zopenge@126.com"
] | zopenge@126.com |
751cb2944cc06da5cb59f7654e2c9eb0091b6182 | 26f1dff9d6aa92e9dd75f812fe142ce03cea1048 | /C++/StringAnalytic/build-StringAnalytic-Kit_local-Debug/moc_dynamicallycreatingcontrol.cpp | 962ec2d82e8e7ea70c2df24bd901d2069833b3b2 | [] | no_license | xionghui19920922/my_code | 59c9a6411a3554ad0193820fe5a1e8f64307fd84 | 41b446efca90bb1ce08bdaba519899c128812187 | refs/heads/master | 2020-03-21T07:09:00.998920 | 2018-07-11T09:30:08 | 2018-07-11T09:30:08 | 138,263,482 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,356 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'dynamicallycreatingcontrol.h'
**
** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.7)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../StringAnalytic/dynamicallycreatingcontrol.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'dynamicallycreatingcontrol.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.7. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_DynamicallyCreatingControl[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: signature, parameters, type, tag, flags
28, 27, 27, 27, 0x05,
// slots: signature, parameters, type, tag, flags
43, 27, 27, 27, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_DynamicallyCreatingControl[] = {
"DynamicallyCreatingControl\0\0deleteSignal()\0"
"deleteControl()\0"
};
void DynamicallyCreatingControl::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
DynamicallyCreatingControl *_t = static_cast<DynamicallyCreatingControl *>(_o);
switch (_id) {
case 0: _t->deleteSignal(); break;
case 1: _t->deleteControl(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObjectExtraData DynamicallyCreatingControl::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject DynamicallyCreatingControl::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_DynamicallyCreatingControl,
qt_meta_data_DynamicallyCreatingControl, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &DynamicallyCreatingControl::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *DynamicallyCreatingControl::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *DynamicallyCreatingControl::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_DynamicallyCreatingControl))
return static_cast<void*>(const_cast< DynamicallyCreatingControl*>(this));
return QObject::qt_metacast(_clname);
}
int DynamicallyCreatingControl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
}
return _id;
}
// SIGNAL 0
void DynamicallyCreatingControl::deleteSignal()
{
QMetaObject::activate(this, &staticMetaObject, 0, 0);
}
QT_END_MOC_NAMESPACE
| [
"1279019704@qq.com"
] | 1279019704@qq.com |
23617724910a04d85bf0c45081f5430f69deea58 | 69cef548bd7bb0b578beb1388492af9f18b80558 | /Implementation/Anton and Danik - 734A - Codeforces.cpp | b00ab020ab96eab2477c2e7ff5a01b95dea4499e | [] | no_license | PortgasD-Sam/Competitive-Programming | e0d55051224c88e7081cb373cc79085dd85c6110 | 26bf4f91a775a58bdc3112cab80d9f6c0bdce2f3 | refs/heads/master | 2020-04-12T16:17:05.151299 | 2019-09-21T16:36:57 | 2019-09-21T16:36:57 | 162,607,829 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 392 | cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int c = 0, cc = 0;
for(int i = 0; i < n; i++)
if(s[i] == 'D') c++;
else cc++;
if(c == cc)
cout << "Friendship" << endl;
else if(c > cc)
cout << "Danik" <<endl;
else
cout << "Anton" << endl;
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
dcaceb9649ce5ac0b84b5f6f5622c28d03786115 | 8242a7ace39a890f2356d763d5c600715177c2fd | /src/can_frame_stream.cpp | 5e0b3d5a5e8dc6fe1590160e5d7aa50c864a18aa | [] | no_license | miguelfazenda/SCDTR-Project | fd89f70a849852941caa0a177b059be955ad64e8 | dc0617c90919e1d1e1fe749120ab683234bbfa0b | refs/heads/main | 2023-06-09T23:45:40.160912 | 2021-06-29T22:30:14 | 2021-06-29T22:30:14 | 314,923,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33 | cpp | #include "can_frame_stream.h"
| [
"miguelsfazenda@gmail.com"
] | miguelsfazenda@gmail.com |
fc523e7ea4db9eb3a5ac3754d7a4e67e15ad2d7c | 4ab17b76fdc1dea1000c4823a87af6a31c6c0cf3 | /SceneServer/SvcTimer.h | fb8806c15c5df3d25d1036cc9e6f76fa79ed1197 | [] | no_license | liunatural/HXService | 358c02aaee1a4a789ac981406b2114ceadb110e7 | 854dfcfc0a83a1f991172d66911cb4c676ff0808 | refs/heads/master | 2020-04-02T05:37:46.676755 | 2018-10-23T02:17:48 | 2018-10-23T02:17:48 | 154,093,326 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 574 | h | #pragma once
#include <chrono>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "boost/asio.hpp"
#include "HXLibNetwork.h"
#include "PlayerManager.h"
using namespace boost::asio;
using boost::asio::io_service;
//毫秒级定时器, 每隔30毫秒触发一次, 更新玩家的位置信息
class SvcTimer
{
public:
SvcTimer(io_service& ios, PlayerManager*& playerMgr);
virtual ~SvcTimer();
void handler();
private:
deadline_timer mTimer;
PlayerManager* mPlayMgr;
char buffer[HXMessagePackage::max_body_length] = { 0 };
};
| [
"liunatural@sina.com"
] | liunatural@sina.com |
48f1f369defde602c7d48bdbd7497da41603774a | 0bf4e9718ac2e2845b2227d427862e957701071f | /tc/checkit.cpp | 0afbce9b3ef33996077e19388678cd103317368a | [] | no_license | unjambonakap/prog_contest | adfd6552d396f4845132f3ad416f98d8a5c9efb8 | e538cf6a1686539afb1d06181252e9b3376e8023 | refs/heads/master | 2022-10-18T07:33:46.591777 | 2022-09-30T14:44:47 | 2022-09-30T15:00:33 | 145,024,455 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,463 | cpp | #include <stdio.h>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
using namespace std;
class BuildingReorganization
{
public:
long long real_calc(vector<long long> G, int remain) {
G.push_back(99999999999LL);
long long res = 0;
int n = G.size();
sort(G.begin(), G.end());
for (int i=0; i<n; i++) {
if (!remain) break;
int now_cover = min((long long)remain, (i+1)*(long long)(G[i+1]-G[i]));
remain -= now_cover;
int same_cover = now_cover / (i+1);
int partial_cover = now_cover % (i+1);
res += (G[i]*(long long)same_cover+same_cover*(long long)(same_cover-1)/2)*(i+1);
res += (G[i]+same_cover) * (long long)partial_cover;
}
return res;
}
long long calc(vector<int> H, int target, int ll, int rr, int A, int B, int cost) {
vector<long long> G;
for (int i=ll; i<=rr; i++)
if (i != A && i != B) G.push_back(abs(target-i)*cost + H[i]);
return real_calc(G, H[target]);
}
long long theMin(vector <int> H, int A, int B, int cost)
{
int n = H.size();
long long def = H[A]*(long long)(H[A]-1)/2 + H[B]*(long long)(H[B]-1)/2;
long long res = -1;
for (int i=0; i<n; i++) {
if (i) continue;
if ((i==A) || (i==B)) continue;
int p1_idx = 0;
int p4_idx = H[A];
if (i==0 || (A==0 && i==1) || (A==0 && B==1 && i==2)) p1_idx = H[A];
while (p1_idx+100 < p4_idx) {
int p2_idx = (p1_idx * 29LL + p4_idx) / 30;
int p3_idx = (p1_idx + p4_idx * 29LL) / 30;
H[A] -= p2_idx; long long s2 = calc(H, A, 0, i-1, A, B, cost); s2 += p2_idx*(long long)abs(i-A)*cost + H[i]*(long long)p2_idx + p2_idx*(long long)(p2_idx-1)/2; H[i] += p2_idx;
s2 += calc(H, B, i, n-1, A, B, cost); H[i] -= p2_idx; H[A] += p2_idx;
H[A] -= p3_idx; long long s3 = calc(H, A, 0, i-1, A, B, cost); s3 += p3_idx*(long long)abs(i-A)*cost + H[i]*(long long)p3_idx + p3_idx*(long long)(p3_idx-1)/2; H[i] += p3_idx;
s3 += calc(H, B, i, n-1, A, B, cost); H[i] -= p3_idx; H[A] += p3_idx;
// printf("%d [%d] [%d] %d : %lld %lld\n", p1_idx, p2_idx, p3_idx, p4_idx, s2, s3);
if (s2 > s3) p1_idx = p2_idx; else p4_idx = p3_idx;
}
for (int j=p1_idx; j<=p4_idx; j++) {
H[A] -= j; long long s2 = calc(H, A, 0, i-1, A, B, cost);
// printf("i = %d j = %d s2 = %lld\n", i, j, s2);
printf("<< cost %d : %Ld \n",j, j*(long long)abs(i-A)*cost + H[i]*(long long)j + j*(long long)(j-1)/2);
s2 += j*(long long)abs(i-A)*cost + H[i]*(long long)j + j*(long long)(j-1)/2; H[i] += j+10000;
printf("%Ld\n", s2);
printf("%Ld\n", calc(H, B, i, n-1, A, B, cost));
// printf("i = %d j = %d s2 = %lld\n", i, j, s2);
s2 += calc(H, B, i, n-1, A, B, cost); H[i] -= j; H[A] += j;
// printf("i = %d j = %d s2 = %lld\n", i, j, s2);
cout<<s2<<endl;
if (res == -1 || res > s2){
res = s2;
}
}
}
return def + res;
};
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); if ((Case == -1) || (Case == 6)) test_case_6(); if ((Case == -1) || (Case == 7)) test_case_7(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const long long &Expected, const long long &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { int Arr0[] = {5, 5, 5}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; int Arg2 = 2; int Arg3 = 10; long long Arg4 = 215LL; verify_case(0, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_1() { int Arr0[] = {5, 5, 5, 5}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; int Arg2 = 3; int Arg3 = 10; long long Arg4 = 190LL; verify_case(1, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_2() { int Arr0[] = {5, 50, 1, 50, 5}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; int Arg2 = 4; int Arg3 = 10; long long Arg4 = 275LL; verify_case(2, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_3() { int Arr0[] = {5, 50, 1, 50, 5}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; int Arg2 = 4; int Arg3 = 1000; long long Arg4 = 10540LL; verify_case(3, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_4() { int Arr0[] = {5, 50, 1, 50, 5}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 1; int Arg2 = 3; int Arg3 = 1000; long long Arg4 = 104428LL; verify_case(4, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_5() { int Arr0[] = {4,1,1,1000,1,1}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 0; int Arg2 = 4; int Arg3 = 1; long long Arg4 = 20LL; verify_case(5, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_6() { int Arr0[] = {157,10,157,979797,152152152,156,4,77,157,79}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 3; int Arg2 = 4; int Arg3 = 123; long long Arg4 = 13041277280686205LL; verify_case(6, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
void test_case_7() { int Arr0[] = {346455317,453638062,491871419,297060164,426458223,53746370,422461742,231053793,309679268,297959075,
76653026,277375296,411684823,427164497,257399925,224643292,114988354,457289888,51199847,199807287,
110648220,303379857,435712111,245040291,401790144,260999362,6953083,385721020,438059362,434000869,
481788278,70215282,135651128,68577856,448298562,11191117,408997160,407134756,10781024,267655550,
183460325,284786399,222774818,193425138,51658225,117130718,352764522,342521474,147243649,265160879}; vector <int> Arg0(Arr0, Arr0 + (sizeof(Arr0) / sizeof(Arr0[0]))); int Arg1 = 2; int Arg2 = 44; int Arg3 = 9986066; long long Arg4 = 234928185619577559LL; verify_case(7, Arg4, theMin(Arg0, Arg1, Arg2, Arg3)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main(){
BuildingReorganization ___test;
___test.run_test(7);
}
| [
"benoit@uuu.com"
] | benoit@uuu.com |
28031f8ac6f31beb68ccdc9200ce2572bff6285e | a96d7042faa12cdc92a96708410fd4a390a3e4c8 | /child/ThumbChildWidget.h | a988b61b7f965e742bbb6b90ff3b5632715f233e | [] | no_license | Onglu/AlbumTool | 2bb3961eb2be3e4b89c7629d0f888ff810d5c7ea | b2a3db9a2736898a92b8454c7c44637e14a69f47 | refs/heads/master | 2016-09-05T13:53:37.683649 | 2013-09-03T07:53:58 | 2013-09-03T07:54:02 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,263 | h | #ifndef THUMBCHILDWIDGET_H
#define THUMBCHILDWIDGET_H
#include "child/PictureChildWidget.h"
#include "proxy/PictureProxyWidget.h"
typedef PictureProxyWidget ThumbProxyWidget;
class ThumbChildWidget : public PictureChildWidget
{
Q_OBJECT
public:
explicit ThumbChildWidget(int index,
const QString &mimeType,
const QString &file,
qreal angle = 0,
Qt::Axis axis = Qt::ZAxis,
TaskPageWidget *parent = 0);
const QVariantMap &getBelongings(void) const {return m_belongings;}
// 设置/获取图片的索引
void setId(int id){m_id = id;/* zero-based index */}
int getId(void) const {return m_id;}
// 更新照片列表
static void updateList(const QStringList &photosList){m_photosList = photosList;}
signals:
void itemReplaced(const QString ¤t, const QString &replaced);
protected:
void dropEvent(QDropEvent *event);
private:
int m_id; // A zero-based id number of every photo which added in a album photoslist
QVariantMap m_belongings;
static QStringList m_photosList;
};
#endif // THUMBCHILDWIDGET_H
| [
"ongluth@yeah.net"
] | ongluth@yeah.net |
f57c6cac55b669973061c03bb65ebe4f1473a6dc | 30e1dc84fe8c54d26ef4a1aff000a83af6f612be | /src/external/boost/boost_1_68_0/libs/filesystem/test/issues/10641.cpp | 9e2e95dcc0a2f9e6c0f2a982aa78faf8284b151e | [
"BSL-1.0",
"BSD-3-Clause"
] | permissive | Sitispeaks/turicreate | 0bda7c21ee97f5ae7dc09502f6a72abcb729536d | d42280b16cb466a608e7e723d8edfbe5977253b6 | refs/heads/main | 2023-05-19T17:55:21.938724 | 2021-06-14T17:53:17 | 2021-06-14T17:53:17 | 385,034,849 | 1 | 0 | BSD-3-Clause | 2021-07-11T19:23:21 | 2021-07-11T19:23:20 | null | UTF-8 | C++ | false | false | 469 | cpp | #include <iostream>
#include <boost/filesystem/path.hpp>
using namespace std;
namespace fs = boost::filesystem;
int main(int argc, char** argv)
{
try
{
fs::path my_path("test/test.txt");
cout << "current path is " << my_path << endl;
cout << "parent path is " << my_path.parent_path() << endl;
}
catch(std::exception& e) {
cerr << endl << "Error during execution: " << e.what() << endl << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
| [
"znation@apple.com"
] | znation@apple.com |
83823d5973c3eaec144492ff2037dd387ca67a93 | 381b75fe68a4da258e2e60a97105b66ac47214e4 | /src/blockencodings.h | 2a6643d31ba064cda8c8c6d3d9eb29c91c641dd8 | [
"MIT"
] | permissive | lipcoin/lipcoin | 3a5997dfc9193ee7dee6f9fa0adc1cb5fb8c92a3 | 7afc0a02d63620e5a5601474cca131cb0cf3bbe4 | refs/heads/master | 2021-01-24T07:57:56.248620 | 2018-03-17T19:04:38 | 2018-03-17T19:04:38 | 112,155,869 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,079 | h | // Copyright (c) 2016 The LipCoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef LIPCOIN_BLOCK_ENCODINGS_H
#define LIPCOIN_BLOCK_ENCODINGS_H
#include "primitives/block.h"
#include <memory>
class CTxMemPool;
// Dumb helper to handle CTransaction compression at serialize-time
struct TransactionCompressor {
private:
CTransactionRef& tx;
public:
TransactionCompressor(CTransactionRef& txIn) : tx(txIn) {}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(tx); //TODO: Compress tx encoding
}
};
class BlockTransactionsRequest {
public:
// A BlockTransactionsRequest message
uint256 blockhash;
std::vector<uint16_t> indexes;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(blockhash);
uint64_t indexes_size = (uint64_t)indexes.size();
READWRITE(COMPACTSIZE(indexes_size));
if (ser_action.ForRead()) {
size_t i = 0;
while (indexes.size() < indexes_size) {
indexes.resize(std::min((uint64_t)(1000 + indexes.size()), indexes_size));
for (; i < indexes.size(); i++) {
uint64_t index = 0;
READWRITE(COMPACTSIZE(index));
if (index > std::numeric_limits<uint16_t>::max())
throw std::ios_base::failure("index overflowed 16 bits");
indexes[i] = index;
}
}
uint16_t offset = 0;
for (size_t j = 0; j < indexes.size(); j++) {
if (uint64_t(indexes[j]) + uint64_t(offset) > std::numeric_limits<uint16_t>::max())
throw std::ios_base::failure("indexes overflowed 16 bits");
indexes[j] = indexes[j] + offset;
offset = indexes[j] + 1;
}
} else {
for (size_t i = 0; i < indexes.size(); i++) {
uint64_t index = indexes[i] - (i == 0 ? 0 : (indexes[i - 1] + 1));
READWRITE(COMPACTSIZE(index));
}
}
}
};
class BlockTransactions {
public:
// A BlockTransactions message
uint256 blockhash;
std::vector<CTransactionRef> txn;
BlockTransactions() {}
BlockTransactions(const BlockTransactionsRequest& req) :
blockhash(req.blockhash), txn(req.indexes.size()) {}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(blockhash);
uint64_t txn_size = (uint64_t)txn.size();
READWRITE(COMPACTSIZE(txn_size));
if (ser_action.ForRead()) {
size_t i = 0;
while (txn.size() < txn_size) {
txn.resize(std::min((uint64_t)(1000 + txn.size()), txn_size));
for (; i < txn.size(); i++)
READWRITE(REF(TransactionCompressor(txn[i])));
}
} else {
for (size_t i = 0; i < txn.size(); i++)
READWRITE(REF(TransactionCompressor(txn[i])));
}
}
};
// Dumb serialization/storage-helper for CBlockHeaderAndShortTxIDs and PartiallyDownloadedBlock
struct PrefilledTransaction {
// Used as an offset since last prefilled tx in CBlockHeaderAndShortTxIDs,
// as a proper transaction-in-block-index in PartiallyDownloadedBlock
uint16_t index;
CTransactionRef tx;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
uint64_t idx = index;
READWRITE(COMPACTSIZE(idx));
if (idx > std::numeric_limits<uint16_t>::max())
throw std::ios_base::failure("index overflowed 16-bits");
index = idx;
READWRITE(REF(TransactionCompressor(tx)));
}
};
typedef enum ReadStatus_t
{
READ_STATUS_OK,
READ_STATUS_INVALID, // Invalid object, peer is sending bogus crap
READ_STATUS_FAILED, // Failed to process object
READ_STATUS_CHECKBLOCK_FAILED, // Used only by FillBlock to indicate a
// failure in CheckBlock.
} ReadStatus;
class CBlockHeaderAndShortTxIDs {
private:
mutable uint64_t shorttxidk0, shorttxidk1;
uint64_t nonce;
void FillShortTxIDSelector() const;
friend class PartiallyDownloadedBlock;
static const int SHORTTXIDS_LENGTH = 6;
protected:
std::vector<uint64_t> shorttxids;
std::vector<PrefilledTransaction> prefilledtxn;
public:
CBlockHeader header;
// Dummy for deserialization
CBlockHeaderAndShortTxIDs() {}
CBlockHeaderAndShortTxIDs(const CBlock& block, bool fUseWTXID);
uint64_t GetShortID(const uint256& txhash) const;
size_t BlockTxCount() const { return shorttxids.size() + prefilledtxn.size(); }
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(header);
READWRITE(nonce);
uint64_t shorttxids_size = (uint64_t)shorttxids.size();
READWRITE(COMPACTSIZE(shorttxids_size));
if (ser_action.ForRead()) {
size_t i = 0;
while (shorttxids.size() < shorttxids_size) {
shorttxids.resize(std::min((uint64_t)(1000 + shorttxids.size()), shorttxids_size));
for (; i < shorttxids.size(); i++) {
uint32_t lsb = 0; uint16_t msb = 0;
READWRITE(lsb);
READWRITE(msb);
shorttxids[i] = (uint64_t(msb) << 32) | uint64_t(lsb);
static_assert(SHORTTXIDS_LENGTH == 6, "shorttxids serialization assumes 6-byte shorttxids");
}
}
} else {
for (size_t i = 0; i < shorttxids.size(); i++) {
uint32_t lsb = shorttxids[i] & 0xffffffff;
uint16_t msb = (shorttxids[i] >> 32) & 0xffff;
READWRITE(lsb);
READWRITE(msb);
}
}
READWRITE(prefilledtxn);
if (ser_action.ForRead())
FillShortTxIDSelector();
}
};
class PartiallyDownloadedBlock {
protected:
std::vector<CTransactionRef> txn_available;
size_t prefilled_count = 0, mempool_count = 0, extra_count = 0;
CTxMemPool* pool;
public:
CBlockHeader header;
PartiallyDownloadedBlock(CTxMemPool* poolIn) : pool(poolIn) {}
// extra_txn is a list of extra transactions to look at, in <witness hash, reference> form
ReadStatus InitData(const CBlockHeaderAndShortTxIDs& cmpctblock, const std::vector<std::pair<uint256, CTransactionRef>>& extra_txn);
bool IsTxAvailable(size_t index) const;
ReadStatus FillBlock(CBlock& block, const std::vector<CTransactionRef>& vtx_missing);
};
#endif
| [
"support@lipcoins.org"
] | support@lipcoins.org |
a56c2bfdfaf4f2bbd25eadc05652c0167e2ebc4f | fd84339974276ac1ad7b34567d9fcfe2369a4bc6 | /include/libmatrix-client/MessageUtils.h | 9d0ede400aad331c858b3dd1a5c0c4f0897ea238 | [
"MIT"
] | permissive | polysoft1/libmatrix-client | 8d7e6b923d9d4e6f5ec10d1dc0a88ecc6dbd85d8 | eb9d0f1705b62c61c35858edcc2ffa3204f1fbc3 | refs/heads/master | 2023-07-11T21:39:53.803309 | 2020-11-16T18:56:20 | 2020-11-16T18:56:20 | 273,743,562 | 2 | 0 | MIT | 2020-11-16T18:56:21 | 2020-06-20T16:24:43 | C++ | UTF-8 | C++ | false | false | 319 | h | #ifndef __MESSAGE_UTILS_H__
#define __MESSAGE_UTILS_H__
#include <iostream>
#include <vector>
#include <string>
#include <nlohmann/json.hpp>
#include "Messages.h"
void parseMessages(std::vector<LibMatrix::Message> &messages, const nlohmann::json &body);
std::string findRoomName(const nlohmann::json &body);
#endif
| [
"keith@mailtux.net"
] | keith@mailtux.net |
3ed995ee2d2a5b926b59ba32c306555c0dc4121a | 9c04607c6a658060a16c269cb673e5818a7074cf | /src/lib/mapped-file.cc | eff873fa2ae68b6c0f98ecfecafffa13b6e768b6 | [
"Apache-2.0"
] | permissive | demitasse/openfst | 5e0029065f85126c7853bc3c5ba762cdbc66d01b | 6e4a66f7747e921dd2c220ee49927d0a2b69febf | refs/heads/master | 2020-06-11T08:39:08.108955 | 2017-11-18T13:54:53 | 2017-11-18T13:54:53 | 75,707,831 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,094 | cc | // See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
#include <fst/mapped-file.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <algorithm>
#include <ios>
#include <memory>
static const size_t kMaxReadChunk = 256 * 1024 * 1024; // 256 MB
namespace fst {
// Alignment required for mapping structures (in bytes.) Regions of memory
// that are not aligned upon a 128 bit boundary will be read from the file
// instead. This is consistent with the alignment boundary set in the
// const and compact fst code.
const int MappedFile::kArchAlignment = 16;
MappedFile::MappedFile(const MemoryRegion& region) : region_(region) {}
MappedFile::~MappedFile() {
if (region_.size != 0) {
if (region_.mmap) {
VLOG(1) << "munmap'ed " << region_.size << " bytes at " << region_.mmap;
if (munmap(region_.mmap, region_.size) != 0) {
LOG(ERROR) << "Failed to unmap region: " << strerror(errno);
}
} else {
if (region_.data) {
operator delete(static_cast<char*>(region_.data) - region_.offset);
}
}
}
}
MappedFile* MappedFile::Allocate(size_t size, int align) {
MemoryRegion region;
region.data = nullptr;
region.offset = 0;
if (size > 0) {
char* buffer = static_cast<char*>(operator new(size + align));
size_t address = reinterpret_cast<size_t>(buffer);
region.offset = kArchAlignment - (address % align);
region.data = buffer + region.offset;
}
region.mmap = nullptr;
region.size = size;
return new MappedFile(region);
}
MappedFile* MappedFile::Borrow(void* data) {
MemoryRegion region;
region.data = data;
region.mmap = data;
region.size = 0;
region.offset = 0;
return new MappedFile(region);
}
MappedFile* MappedFile::Map(std::istream* s, bool memorymap,
const string& source, size_t size) {
std::streampos spos = s->tellg();
VLOG(1) << "memorymap: " << (memorymap ? "true" : "false") << " source: \""
<< source << "\""
<< " size: " << size << " offset: " << spos;
if (memorymap && spos >= 0 && spos % kArchAlignment == 0) {
size_t pos = spos;
int fd = open(source.c_str(), O_RDONLY);
if (fd != -1) {
int pagesize = sysconf(_SC_PAGESIZE);
off_t offset = pos % pagesize;
off_t upsize = size + offset;
void* map =
mmap(nullptr, upsize, PROT_READ, MAP_SHARED, fd, pos - offset);
char* data = reinterpret_cast<char*>(map);
if (close(fd) == 0 && map != MAP_FAILED) {
MemoryRegion region;
region.mmap = map;
region.size = upsize;
region.data = reinterpret_cast<void*>(data + offset);
region.offset = offset;
std::unique_ptr<MappedFile> mmf(new MappedFile(region));
s->seekg(pos + size, std::ios::beg);
if (s) {
VLOG(1) << "mmap'ed region of " << size << " at offset " << pos
<< " from " << source << " to addr " << map;
return mmf.release();
}
} else {
LOG(INFO) << "Mapping of file failed: " << strerror(errno);
}
}
}
// If all else fails resort to reading from file into allocated buffer.
if (memorymap) {
LOG(WARNING) << "File mapping at offset " << spos << " of file " << source
<< " could not be honored, reading instead.";
}
// Read the file into the buffer in chunks not larger than kMaxReadChunk.
std::unique_ptr<MappedFile> mf(Allocate(size));
char* buffer = reinterpret_cast<char*>(mf->mutable_data());
while (size > 0) {
const size_t next_size = std::min(size, kMaxReadChunk);
std::streampos current_pos = s->tellg();
if (!s->read(buffer, next_size)) {
LOG(ERROR) << "Failed to read " << next_size << " bytes at offset "
<< current_pos << "from \"" << source << "\".";
return nullptr;
}
size -= next_size;
buffer += next_size;
VLOG(2) << "Read " << next_size << " bytes. " << size << " remaining.";
}
return mf.release();
}
} // namespace fst
| [
"dvn.demitasse@gmail.com"
] | dvn.demitasse@gmail.com |
293930d9a75f28150ddcc4c66c935d856f8fe038 | eca916978c6966314723a9104f7a42acbcee25cc | /main.cpp | ee33ddc4c76cab2153950b44786da07329945103 | [] | no_license | wmentzer/VideoGen | 498780c8e373f0378e8527ba663d744fcf515481 | 258427d2e2914720ac3806ccc3c986a13a6b9c5a | refs/heads/master | 2021-05-15T11:46:55.177491 | 2017-11-21T03:58:31 | 2017-11-21T03:58:31 | 108,356,740 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,706 | cpp | #include <iostream>
#include "Frame.h"
#include "Rectangle.h"
#include <sstream>
#include <sys/stat.h>
#include <stdio.h>
#include <cassert>
#include <cstdint>
#include <vector>
using namespace std;
int create(Frame f, vector<Rectangle> rec) {
// Construct the ffmpeg command to run.
const char * cmd =
"ffmpeg "
"-y "
"-hide_banner "
"-f rawvideo " // input to be raw video data
"-pixel_format rgb24 "
"-video_size 720x480 "
"-r 60 " // frames per second
"-i - " // read data from the standard input stream
"-pix_fmt yuv420p " // to render with Quicktime
"-vcodec mpeg4 "
"-an " // no audio
"-q:v 5 " // quality level; 1 <= q <= 32
"output.mp4 ";
// Run the ffmpeg command and get pipe to write into its standard input stream.
FILE * pipe = popen(cmd, "w");
if (pipe == 0) {
cout << "error: " << strerror(errno) << endl;
return 1;
}
// Write video frames into the pipe.
int num_frames = f.getDuration() * f.getFPS();
for (int i = 0; i < num_frames; ++i) {
double time_in_seconds = i / f.getFPS();
f.draw_frame(time_in_seconds, rec);
fwrite(f.getArray(), 3, W * H, pipe);
}
fflush(pipe);
pclose(pipe);
cout << "num_frames: " << num_frames << endl;
cout << "Done." << endl;
return 0;
};
int main(int argc, char * argv[]) {
Frame f;
Rectangle r1(10,20,0,0,0x00,0xff,0x00);
Rectangle r2(10,20,55,55,0x00,0x00,0xff);
Rectangle r3(10,20,44,44,0xff,0x00,0x00);
Rectangle r4(10,20,99,99,0xff,0xff,0x00);
vector<Rectangle> rec;
rec.push_back(r1);
rec.push_back(r2);
rec.push_back(r3);
rec.push_back(r4);
create(f, rec);
}
| [
"willmentzer20@gmail.com"
] | willmentzer20@gmail.com |
225eea43e3f81acfa73638a4b1b02daf5c7226b9 | 6fe8432ba2a569be475186700163cc2fe09470b5 | /UMMOTemplate/Source/UMMOTemplate/Reflection/ReflectonPlayerController.cpp | fdfcf2f9ee2b3a5ca2604de0db5f98eef087c404 | [] | no_license | perpet99/UnrealMMOTemplate | e966ba331236d835f5b3b001013655cd84f7770b | dff87cb3893b2a011d48779e687f00802c1bc51b | refs/heads/master | 2020-06-04T05:13:01.445492 | 2020-03-04T22:45:51 | 2020-03-04T22:45:51 | 191,884,719 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 553 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "ReflectionPlayerController.h"
void AReflectionPlayerController::BeginPlay()
{
Super::BeginPlay();
}
void AReflectionPlayerController::Tick(float delta)
{
Super::Tick(delta);
}
void AReflectionPlayerController::SendChat_CS_Implementation(const FString & chat)
{
}
bool AReflectionPlayerController::SendChat_CS_Validate(const FString & chat)
{
return true;
}
void AReflectionPlayerController::SendChat_SC_Implementation(const FString & chat)
{
} | [
"perpet99@gmail.com"
] | perpet99@gmail.com |
7fc25a8937db93075435b6d36d3729a30f5104c4 | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive2/ba/ce5bac19397de5/main.cpp | 8fe6d91ae74e7ed9f8e6966380b185e09b4215af | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 252 | cpp | #ifndef BIRTHDAY_H
#define BIRTHDAY_H
#include <iostream>
class Birthday
{
public:
Birthday(int y, int m, int d) : y(y), m(m), d(d) {}
friend std::ostream& operator<<(std::ostream& os, const Birthday& bd);
private:
int y, m, d;
};
#endif | [
"francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df"
] | francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df |
024fd9e587aca02ae3c7fe63f705e75102bb6216 | 786de89be635eb21295070a6a3452f3a7fe6712c | /psddl_hdf2psana/tags/V00-02-02/include/usdusb.h | 30c545420a1456cb3415919ecbcb51edb2c5193d | [] | no_license | connectthefuture/psdmrepo | 85267cfe8d54564f99e17035efe931077c8f7a37 | f32870a987a7493e7bf0f0a5c1712a5a030ef199 | refs/heads/master | 2021-01-13T03:26:35.494026 | 2015-09-03T22:22:11 | 2015-09-03T22:22:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,209 | h | #ifndef PSDDL_HDF2PSANA_USDUSB_H
#define PSDDL_HDF2PSANA_USDUSB_H 1
//--------------------------------------------------------------------------
// File and Version Information:
// $Id$
//
// Description:
// Hand-written supporting types for DDL-HDF5 mapping.
//
//------------------------------------------------------------------------
//-----------------
// C/C++ Headers --
//-----------------
//----------------------
// Base Class Headers --
//----------------------
//-------------------------------
// Collaborating Class Headers --
//-------------------------------
#include "hdf5pp/Group.h"
#include "hdf5pp/Type.h"
#include "psddl_psana/usdusb.ddl.h"
namespace psddl_hdf2psana {
namespace UsdUsb {
// ===============================================================
// UsbUsd::DataV1 schema version 0
// ===============================================================
namespace ns_DataV1_v0 {
struct dataset_data {
static hdf5pp::Type native_type();
static hdf5pp::Type stored_type();
dataset_data();
~dataset_data();
int32_t e_count[4]; // data in v0 are stored as uint32_t but interface requires int32_t
uint16_t analog_in[4];
uint32_t timestamp;
uint8_t digital_in;
};
}
class DataV1_v0 : public Psana::UsdUsb::DataV1 {
public:
typedef Psana::UsdUsb::DataV1 PsanaType;
DataV1_v0() {}
DataV1_v0(hdf5pp::Group group, hsize_t idx)
: m_group(group), m_idx(idx) {}
DataV1_v0(const boost::shared_ptr<UsdUsb::ns_DataV1_v0::dataset_data>& ds) : m_ds_data(ds) {}
virtual ~DataV1_v0() {}
virtual uint8_t digital_in() const;
virtual uint32_t timestamp() const;
virtual ndarray<const uint8_t, 1> status() const;
virtual ndarray<const uint16_t, 1> analog_in() const;
/** Return lower 24 bits of _count array as signed integer values. */
ndarray<const int32_t, 1> encoder_count() const;
private:
mutable hdf5pp::Group m_group;
hsize_t m_idx;
mutable boost::shared_ptr<UsdUsb::ns_DataV1_v0::dataset_data> m_ds_data;
void read_ds_data() const;
};
void store_DataV1_v0(const Psana::UsdUsb::DataV1& obj, hdf5pp::Group group, bool append);
} // namespace UsdUsb
} // namespace psddl_hdf2psana
#endif // PSDDL_HDF2PSANA_USDUSB_H
| [
"salnikov@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7"
] | salnikov@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7 |
ff31d74cf75e2b293c22fc0196e0d299b3a709e1 | 09f8313c055d4f0f6a852b3a04cc8f2ceb8bfb44 | /OpenGL_2_ForSid/OpenGL_2_ForSid/Engine/CubeMesh.cpp | 0033c94fbb889909f350bfd13e5cc725de7018d3 | [
"MIT"
] | permissive | Enderderder/OpenGL_Sum2 | b436e6093a69898fc3caf64efeb0a5bd065893c0 | 712ae5053c097885490ef8793e4f1c856f3f21a2 | refs/heads/master | 2020-03-30T23:06:56.674792 | 2018-10-09T01:36:07 | 2018-10-09T01:36:07 | 151,690,957 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,111 | cpp |
// This Include
#include "CubeMesh.h"
CCubeMesh::CCubeMesh()
{
GLfloat cubeVertices[] = {
// Positions // Normals // Tex Coords
// Front Face
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // 0
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // 1
1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // 2
-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // 3
// Right Face
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 4
1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // 5
1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // 6
1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // 7
// Back Face
1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // 8
-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // 9
-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // 10
1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // 11
// Left Face
-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 12
-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // 13
-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // 14
-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // 15
// Top Face
-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, // 16
1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // 17
1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // 18
-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // 19
// Bottom Face
-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // 20
1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // 21
1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // 22
-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // 23
};
GLuint cubeIndices[] = {
// Front Face // Left Face
0, 1, 2, 12, 13, 14,
0, 2, 3, 12, 14, 15,
// Right Face // Top Face
4, 5, 6, 16, 17, 18,
4, 6, 7, 16, 18, 19,
// Back Face // Bottom Face
8, 9, 10, 20, 21, 22,
8, 10, 11, 20, 22, 23,
};
// Bind the Vertices and Indices into the VAO
GLuint VBO, EBO;
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), cubeVertices, GL_STATIC_DRAW);
glGenBuffers(1, &EBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(cubeIndices), cubeIndices, GL_STATIC_DRAW);
// Bind attribute pointer for shader pipeline
glVertexAttribPointer(
0,
3,
GL_FLOAT,
GL_FALSE,
8 * sizeof(GL_FLOAT),
(GLvoid*)0
);
glEnableVertexAttribArray(0);
glVertexAttribPointer(
1,
3,
GL_FLOAT,
GL_FALSE,
8 * sizeof(GL_FLOAT),
(GLvoid*)(3 * sizeof(GL_FLOAT))
);
glEnableVertexAttribArray(1);
glVertexAttribPointer(
2,
2,
GL_FLOAT,
GL_FALSE,
8 * sizeof(GLfloat),
(GLvoid*)(6 * sizeof(GLfloat))
);
glEnableVertexAttribArray(2);
// Unbind the VAO after generating
glBindVertexArray(0);
}
CCubeMesh::~CCubeMesh() {}
void CCubeMesh::RenderMesh()
{
glBindVertexArray(m_vao);
glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
}
| [
"richardwulansari@gmail.com"
] | richardwulansari@gmail.com |
268959e5c5e0ff6e180ee4c3295da5b1dd1a9dcd | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/xgboost/xgboost-old-new/xgboost-old-new-joern/dmlc_xgboost_old_new_old_function_610.cpp | 0ce7bd3824df42dc7f9c3b19f9e53d73b8888199 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 286 | cpp | inline FILE *FopenTry( const char *fname , const char *flag ){
FILE *fp = fopen64( fname , flag );
if( fp == NULL ){
fprintf( stderr, "can not open file \"%s\"\n",fname );
exit( -1 );
}
return fp;
} | [
"993273596@qq.com"
] | 993273596@qq.com |
bb03c9f29fdb0b281cd4b1e6d491284feb5ed152 | cebf12cdb2df5dcdc59b71c42f53d3351ac57254 | /sources/wupgrade.h | 2a2a44525f3db4e0b903900fa15ef9da27f840ca | [] | no_license | desire2020/Lisperarian | b0d8a7ca22e811fdb00bdae1784dd73ae2505108 | 263cc107d72aa25ab00f26327ed0717a38b600c8 | refs/heads/master | 2021-01-10T11:59:36.660542 | 2015-11-24T04:23:49 | 2015-11-24T04:23:49 | 44,802,238 | 7 | 1 | null | 2015-11-21T14:35:15 | 2015-10-23T09:01:11 | null | UTF-8 | C++ | false | false | 648 | h | #ifndef WUPGRADE_H
#define WUPGRADE_H
#include <QWidget>
#include <QLabel>
#include <QGridLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QMessageBox>
namespace Ui {
class WUpgrade;
}
class WUpgrade : public QWidget
{
Q_OBJECT
public:
explicit WUpgrade(QWidget *parent = 0);
~WUpgrade();
private:
Ui::WUpgrade *ui;
QLineEdit *usrLineEdit, *autLineEdit;
QLabel *usrLabel, *autLabel;
QGridLayout *gridlayout;
QPushButton *okBtn;
QPushButton *cancelBtn;
QVBoxLayout *vboxLayout;
private slots:
virtual void accept();
};
#endif // WUPGRADE_H
| [
"desire2020@126.com"
] | desire2020@126.com |
e18b3663dc8edf7bb8bc691ecc357fd840de17bf | d75aaf856223405f18fb25b4379059f798692649 | /proto_src/test.pb.h | 4a0395ce2c5ef92b6ab74dc5ffecc4e795ea7a9c | [] | no_license | 4Second2None/server_src | a66706ea9006b906c04d234bda2115782ee07a5a | 5e44a5f52d38773c440030dd9bb295f7c382c245 | refs/heads/master | 2020-12-30T19:58:39.343994 | 2013-10-28T05:14:28 | 2013-10-28T05:14:28 | 13,920,613 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | true | 5,942 | h | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: test.proto
#ifndef PROTOBUF_test_2eproto__INCLUDED
#define PROTOBUF_test_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2005000
#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 2005000 < GOOGLE_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/generated_message_util.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_test_2eproto();
void protobuf_AssignDesc_test_2eproto();
void protobuf_ShutdownFile_test_2eproto();
class A;
// ===================================================================
class A : public ::google::protobuf::Message {
public:
A();
virtual ~A();
A(const A& from);
inline A& operator=(const A& from) {
CopyFrom(from);
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _unknown_fields_;
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return &_unknown_fields_;
}
static const ::google::protobuf::Descriptor* descriptor();
static const A& default_instance();
void Swap(A* other);
// implements Message ----------------------------------------------
A* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const A& from);
void MergeFrom(const A& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// required string info = 1;
inline bool has_info() const;
inline void clear_info();
static const int kInfoFieldNumber = 1;
inline const ::std::string& info() const;
inline void set_info(const ::std::string& value);
inline void set_info(const char* value);
inline void set_info(const char* value, size_t size);
inline ::std::string* mutable_info();
inline ::std::string* release_info();
inline void set_allocated_info(::std::string* info);
// @@protoc_insertion_point(class_scope:A)
private:
inline void set_has_info();
inline void clear_has_info();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::std::string* info_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
friend void protobuf_AddDesc_test_2eproto();
friend void protobuf_AssignDesc_test_2eproto();
friend void protobuf_ShutdownFile_test_2eproto();
void InitAsDefaultInstance();
static A* default_instance_;
};
// ===================================================================
// ===================================================================
// A
// required string info = 1;
inline bool A::has_info() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void A::set_has_info() {
_has_bits_[0] |= 0x00000001u;
}
inline void A::clear_has_info() {
_has_bits_[0] &= ~0x00000001u;
}
inline void A::clear_info() {
if (info_ != &::google::protobuf::internal::kEmptyString) {
info_->clear();
}
clear_has_info();
}
inline const ::std::string& A::info() const {
return *info_;
}
inline void A::set_info(const ::std::string& value) {
set_has_info();
if (info_ == &::google::protobuf::internal::kEmptyString) {
info_ = new ::std::string;
}
info_->assign(value);
}
inline void A::set_info(const char* value) {
set_has_info();
if (info_ == &::google::protobuf::internal::kEmptyString) {
info_ = new ::std::string;
}
info_->assign(value);
}
inline void A::set_info(const char* value, size_t size) {
set_has_info();
if (info_ == &::google::protobuf::internal::kEmptyString) {
info_ = new ::std::string;
}
info_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* A::mutable_info() {
set_has_info();
if (info_ == &::google::protobuf::internal::kEmptyString) {
info_ = new ::std::string;
}
return info_;
}
inline ::std::string* A::release_info() {
clear_has_info();
if (info_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = info_;
info_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void A::set_allocated_info(::std::string* info) {
if (info_ != &::google::protobuf::internal::kEmptyString) {
delete info_;
}
if (info) {
set_has_info();
info_ = info;
} else {
clear_has_info();
info_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// @@protoc_insertion_point(namespace_scope)
#ifndef SWIG
namespace google {
namespace protobuf {
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_test_2eproto__INCLUDED
| [
"tinysrc@163.com"
] | tinysrc@163.com |
9beacf0e8bda338d2ce245cf39c0ca3740dbf2b6 | b3e407455b1f102a78da67cb5ed873883be2a152 | /make-gen/main.cpp | ce7b449024d5284052122d710765fe4be4e26fa1 | [
"MIT"
] | permissive | mika314/brekout | 2238a8faa3198451f12fd5d72596ec2d4195793e | 5ef4a08a84d250c5de340e593c1770ab92a4e8a9 | refs/heads/main | 2023-08-17T15:14:26.289464 | 2021-10-04T00:25:39 | 2021-10-04T00:25:39 | 412,663,104 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,349 | cpp | #include <filesystem>
#include <fstream>
#include <iostream>
#include <vector>
int main()
{
const auto outDir = "";
const auto sndDir = "snd/";
const auto spriteDir = "sprite/";
std::vector<std::string> wavs;
for (const auto &file : std::filesystem::directory_iterator(sndDir))
if (file.path().extension() == ".wav")
wavs.push_back(file.path().stem());
std::vector<std::string> bmps;
for (const auto &file : std::filesystem::directory_iterator(spriteDir))
if (file.path().extension() == ".tif")
bmps.push_back(file.path().stem());
std::cout << "ALL:";
for (auto p : wavs)
std::cout << " " << outDir << p << ".wav.gen.hpp";
for (auto p : bmps)
std::cout << " " << outDir << p << ".bmp.gen.hpp";
std::cout << "\n\techo done\n";
for (auto p : wavs)
{
std::cout << outDir << p << ".wav.gen.hpp: " << sndDir << p << ".wav\n"
<< "\txxd -i " << sndDir << p << ".wav > " << outDir << p << ".wav.gen.hpp\n";
}
for (auto p : bmps)
{
std::cout << outDir << p << ".bmp.gen.hpp: " << spriteDir << p << ".bmp\n"
<< "\txxd -i " << spriteDir << p << ".bmp > " << outDir << p << ".bmp.gen.hpp\n";
std::cout << spriteDir << p << ".bmp: " << spriteDir << p << ".tif\n"
<< "\tconvert " << spriteDir << p << ".tif " << spriteDir << p << ".bmp\n";
}
}
| [
"mika@mika.global"
] | mika@mika.global |
af64958255b1b813b088d55eb4a580524aa039e6 | 6f4a7f6b9ae067a4589b6196a3c6a19323836fbd | /12.10/Source.cpp | 89431e091f6950518f0967b4488385842ad1fc2d | [] | no_license | IrynaChycherska/12.10 | 18d067b19790e8ba20a466d20ef8177c9ee566a1 | adde93527f4d397ac3f882b423753a6eb8c67bef | refs/heads/master | 2023-02-04T05:15:10.350644 | 2020-12-25T17:36:17 | 2020-12-25T17:36:17 | 324,405,845 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 4,089 | cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <Windows.h>
#include <stdlib.h>
using namespace std;
typedef int Info;
struct Node
{
Node* left,
* right;
Info info;
};
Node* CreateTree(int nodeCount);
void PrintTree(Node* root, int level);
Node* FindMax(Node* root);
Node* BinarySearchDelete(Node* root, Info value);
Node* BinarySearchInsert(Node*& root, Info value, bool& found);
Node* CreateTree1(int nodeCount);
int Count(Node* root);
int main()
{
int N;
cout << "Enter nodes count: "; cin >> N;
Node* root = CreateTree(N);
Info value;
bool found = false;
int menuItem;
do {
cout << endl << endl << endl;
cout << "Dia:" << endl << endl;
cout << " [1] - add" << endl;
cout << " [2] - delete a binary search tree elemen " << endl;
cout << " [3] - finding tree nodes" << endl;
cout << " [4] - number of descendants" << endl;
cout << " [5] - number of nodes" << endl;
cout << " [0] - exit" << endl << endl;
cout << "Enter a value: "; cin >> menuItem;
cout << endl << endl << endl;
switch (menuItem)
{
case 1:
CreateTree(N);
PrintTree(root, 0);
break;
case 2:
cout << "delete value: "; cin >> value;
root = BinarySearchDelete(root, value);
break;
case 3:
cout << "value: "; cin >> value;
BinarySearchInsert(root, value, found);
break;
case 4:
CreateTree1(N);
break;
case 5:
Count(root);
break;
case 0:
break;
default:
cout << "Ви ввели помилкове значення! "
"Слід ввести число - номер вибраного пункту меню" << endl;
}
} while (menuItem != 0);
return 0;
}
Node* CreateTree(int nodeCount)
{
if (nodeCount == 0)
return NULL;
else
{
Node* newNode = new Node;
cout << " Enter node value: ";
cin >> newNode->info;
int leftCount = nodeCount / 2;
int rightCount = nodeCount - leftCount - 1;
newNode->left = CreateTree(leftCount);
newNode->right = CreateTree(rightCount);
return newNode;
}
}
void PrintTree(Node* root, int level)
{
if (root != NULL)
{
PrintTree(root->right, level + 1);
for (int i = 1; i <= level; i++)
cout << " ";
cout << root->info << endl;
PrintTree(root->left, level + 1);
}
}
Node* FindMax(Node* root) {
if (root
->right != NULL
)
return FindMax(root
->right);
else
return root;
}
Node* BinarySearchDelete(Node* root, Info value)
{
if (NULL == root) return NULL;
if (root->info == value)
{
if (NULL == root->left && NULL == root->right)
{
delete root;
return NULL;
}
if (NULL == root->right && root->left != NULL)
{
Node* temp = root->left;
delete root;
return temp;
}
if (NULL == root->left && root->right != NULL)
{
Node* temp = root->right;
delete root;
return temp;
}
root->info = FindMax(root->left)->info;
root->left = BinarySearchDelete(root->left, root->info);
return root;
}
if (value < root->info)
{
root->left = BinarySearchDelete(root->left, value);
return root;
}
if (value > root->info)
{
root->right = BinarySearchDelete(root->right, value);
return root;
}
return root;
}
Node* BinarySearchInsert(Node*& root, Info value, bool& found)
{
if (root == NULL)
{
root = new Node;
root->info = value;
root->left = NULL;
root->right = NULL;
found = false;
return root;
}
else
if (value == root->info)
{
found = true;
return root;
}
else
if (value < root->info)
return BinarySearchInsert(root->left, value, found);
else
return BinarySearchInsert(root->right, value, found);
}
Node* CreateTree1(int nodeCount)
{
if (nodeCount == 0)
return NULL;
else
{
Node* newNode = new Node;
cout << " Enter node value: ";
int N;
N = rand();
cout << "N = " << N << endl;
cin >> newNode->info;
int leftCount = nodeCount / 2;
int rightCount = nodeCount - leftCount - 1;
newNode->left = CreateTree(leftCount);
newNode->right = CreateTree(rightCount);
return newNode;
}
}
int Count(Node* root)
{
if (root == NULL)
return 0;
else
return 1 + Count(root->left) + Count(root->right);
}
| [
"iryna.chycherska.itis.2020@lpnu.ua"
] | iryna.chycherska.itis.2020@lpnu.ua |
475eb80158e280b198e8417d84fa2028125c9345 | 32acee5e0e04e52ae6cb37ba4b5a9ef76ff5e7e4 | /Client/Codes/Dragon_Fireball.cpp | 08ec61fe3339e5daee7316b06caa9c02f8902b52 | [] | no_license | Repell/DragOn | 4fc777ddf09ef2ff4fc66e067f9d056e29c3b133 | 6e49e6ab27d7e193acc2d02b444721d3245d3ed5 | refs/heads/master | 2020-06-19T22:46:32.733968 | 2019-08-07T12:49:13 | 2019-08-07T12:49:13 | 196,902,561 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 6,165 | cpp | #include "stdafx.h"
#include "Dragon_Fireball.h"
#include "Export_Function.h"
#define _ATTACK_UP_END 3
#define _ATTACK_DOWN_END 5
#define _ATTACK_MID_END 7
#define _QUAKEEND 10
#define _SPEED 6000.f
#define _RADIUS 30.f
CDragon_Fireball::CDragon_Fireball(LPDIRECT3DDEVICE9 pDevice)
: CGameObject(pDevice),
m_LifeTime(0.0)
{
ZeroMemory(&m_tInfo, sizeof(ENGINE::UNITINFO));
}
HRESULT CDragon_Fireball::Add_Component()
{
ENGINE::CComponent* pComponent = nullptr;
/////////INSERT COMPONENT/////////
pComponent = m_pMesh = dynamic_cast<ENGINE::CStaticMesh*>
(ENGINE::Clone_Resources(RESOURCE_LOGO, L"Mesh_Fireball"));
NULL_CHECK_RETURN(m_pMesh, E_FAIL);
m_MapComponent[ENGINE::COMP_DYNAMIC].emplace(L"Com_Mesh", pComponent);
//Transform Component
pComponent = m_pTransform = ENGINE::CTransform::Create(_vec3(0.f, 0.f, -1.f));
NULL_CHECK_RETURN(pComponent, E_FAIL);
m_MapComponent[ENGINE::COMP_DYNAMIC].emplace(L"Com_Transform", pComponent);
m_pTransform->m_vScale = {0.1f, 0.1f, 0.1f};
//Sphere Collider
pComponent = m_pSphereColl = ENGINE::CSphereColl::Create(m_pGraphicDev, _RADIUS, m_tInfo.m_fRadius);
NULL_CHECK_RETURN(pComponent, E_FAIL);
m_MapComponent[ENGINE::COMP_STATIC].emplace(L"Com_SphereColl", pComponent);
//Renderer Component
pComponent = m_pRenderer = ENGINE::Get_Renderer();
pComponent->AddRef();
NULL_CHECK_RETURN(pComponent, E_FAIL);
m_MapComponent[ENGINE::COMP_STATIC].emplace(L"Com_Renderer", pComponent);
//Shader
pComponent = m_pShader = dynamic_cast<ENGINE::CShader*>(ENGINE::Clone(L"Shader_Transform"));
NULL_CHECK_RETURN(pComponent, E_FAIL);
m_MapComponent[ENGINE::COMP_STATIC].emplace(L"Com_Shader", pComponent);
return S_OK;
}
HRESULT CDragon_Fireball::Ready_Object(ENGINE::UNITINFO tInfo)
{
m_tInfo = tInfo;
Add_Component();
m_pSphereColl->Set_Scale(0.1f);
m_pTransform->m_vInfo[ENGINE::INFO_POS] = tInfo.m_vPos;
m_pTransform->m_vScale = tInfo.m_vScale;
m_pTransform->m_vAngle = tInfo.m_vAngle;
m_pTransform->m_vLook = tInfo.m_vDir;
return S_OK;
}
_int CDragon_Fireball::Update_Object(const _double & TimeDelta)
{
m_LifeTime += TimeDelta;
CGameObject::Update_Object(TimeDelta);
//Fly Fireball
m_pTransform->m_vInfo[ENGINE::INFO_POS] += m_tInfo.m_vDir * _SPEED * -TimeDelta;
//Target Check
if (Check_FireballColl() || m_LifeTime > 10.f)
return END_EVENT;
m_pRenderer->Add_RenderGroup(ENGINE::RENDER_NONALPHA, this);
return NO_EVENT;
}
void CDragon_Fireball::Render_Object()
{
///////////////////////////////////////////// Shader Transform
LPD3DXEFFECT pEffect = m_pShader->Get_EffectHandle();
if (nullptr == pEffect)
return;
pEffect->AddRef();
if (FAILED(SetUp_ConstantTable(pEffect)))
return;
pEffect->Begin(nullptr, 0);
pEffect->BeginPass(0);
//////////////////////////////////////// Shader Target
m_pMesh->Render_Meshes();
////////////////////////////////////////
pEffect->EndPass();
pEffect->End();
ENGINE::Safe_Release(pEffect);
//////////////////////////////////////// Shader End
m_pSphereColl->Render_SphereColl(&m_pTransform->m_matWorld);
//_tchar szStr[MAX_PATH] = L"";
//_vec3 vPos = m_pTransform->m_vInfo[ENGINE::INFO_POS];
//swprintf_s(szStr, L"X : %3.2f, Y : %3.2f, Z : %3.2f ", vPos.x, vPos.y, vPos.z);
//ENGINE::Render_Font(L"Sp", szStr, &_vec2(10.f, 100.f), D3DXCOLOR(1.f, 1.f, 1.f, 1.f));
}
_bool CDragon_Fireball::Check_FireballColl()
{
ENGINE::CLayer* pLayer = ENGINE::Get_Management()->Get_Layer(ENGINE::CLayer::OBJECT);
for (auto pList : pLayer->Get_MapObject(L"Boss_Blue"))
{
ENGINE::CTransform* pTrans = dynamic_cast<ENGINE::CTransform*>
(pList->Get_Component(L"Com_Transform", ENGINE::COMP_DYNAMIC));
if (pTrans->Get_Dead())
continue;
ENGINE::CSphereColl* pTargetHead = dynamic_cast<ENGINE::CSphereColl*>
(pList->Get_Component(L"Com_SphereHead", ENGINE::COMP_STATIC));
ENGINE::CSphereColl* pTargetBody = dynamic_cast<ENGINE::CSphereColl*>
(pList->Get_Component(L"Com_SphereBody", ENGINE::COMP_STATIC));
_uint attIdx = pTrans->m_iCurAniIndex;
if (m_pSphereColl->Check_ComponentColl(pTargetBody) && !pTrans->m_bWeak)
{
switch (attIdx)
{
case _ATTACK_UP_END:
//ÀÌÆåÆ® ÆãÆã
//ü·Â ¶³¾îÁü
pTargetBody->m_bHit = TRUE;
pTargetBody->Get_iHp(2);
break;
case _ATTACK_DOWN_END:
//ÀÌÆåÆ® ÆãÆã
//ü·Â ¶³¾îÁü
pTargetBody->m_bHit = TRUE;
pTargetBody->Get_iHp(2);
break;
case _ATTACK_MID_END:
//ÀÌÆåÆ® ÆãÆã
//ü·Â ¶³¾îÁü
pTargetBody->m_bHit = TRUE;
pTargetBody->Get_iHp(2);
break;
case _QUAKEEND:
//ÀÌÆåÆ® ÆãÆã
//ü·Â ¶³¾îÁü
pTargetBody->m_bHit = TRUE;
pTargetBody->Get_iHp(2);
break;
}
if (pTargetBody->Get_iHp() <= 0)
pTrans->m_bWeak = TRUE;
CGameObject* pObject = CEffect_Tex::Create(m_pGraphicDev, m_pTransform->m_vInfo[ENGINE::INFO_POS], 1.f);
ENGINE::Get_Management()->Add_GameObject(ENGINE::CLayer::OBJECT, L"kaboom", pObject);
return TRUE;
}
if (m_pSphereColl->Check_ComponentColl(pTargetHead) && pTrans->m_bWeak)
{
if (pTargetHead->Get_iHp() != 0)
pTargetHead->Get_iHp(2);
return TRUE;
}
}
return FALSE;
}
HRESULT CDragon_Fireball::SetUp_ConstantTable(LPD3DXEFFECT pEffect)
{
if (nullptr == pEffect)
return E_FAIL;
pEffect->AddRef();
_matrix matWorld, matView, matProj;
D3DXMatrixIdentity(&matWorld);
//D3DXMatrixTranslation(&matWorld, 0.f, 0.f, 80.f);
matWorld *= m_pTransform->m_matWorld;
m_pGraphicDev->GetTransform(D3DTS_VIEW, &matView);
m_pGraphicDev->GetTransform(D3DTS_PROJECTION, &matProj);
pEffect->SetMatrix("g_matWorld", &matWorld);
pEffect->SetMatrix("g_matView", &matView);
pEffect->SetMatrix("g_matProj", &matProj);
ENGINE::Safe_Release(pEffect);
return S_OK;
}
CDragon_Fireball * CDragon_Fireball::Create(LPDIRECT3DDEVICE9 pGraphicDev, ENGINE::UNITINFO tInfo)
{
CDragon_Fireball* pInstance = new CDragon_Fireball(pGraphicDev);
if (FAILED(pInstance->Ready_Object(tInfo)))
ENGINE::Safe_Release(pInstance);
return pInstance;
}
void CDragon_Fireball::Free()
{
CGameObject::Free();
}
| [
"EASTNOTE@EASTNOTE"
] | EASTNOTE@EASTNOTE |
c1017e2e6f65b33bbd605e3ee5d25b78ad5cdb9b | e12e905251a65232d34d03448efadfe9f12bf625 | /Source/main.cpp | 7753e667f8d00fdd0ace83e3a98c678e97db1366 | [] | no_license | mkuzdal/Frackman | 205ecd2e48d697e70064982df7473b2f00a50354 | 73cd3b347c56c24a59260d52008840f1b6f2d9a2 | refs/heads/master | 2021-01-11T11:28:19.508354 | 2017-01-26T23:56:40 | 2017-01-26T23:56:40 | 80,166,475 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,079 | cpp | #include "GameController.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
// If your program is having trouble finding the Assets directory,
// replace the string literal with a full path name to the directory,
// e.g., "Z:/CS32/BoulderBlast/Assets" or "/Users/fred/cs32/BoulderBlast/Assets"
const string assetDirectory = "/Users/MKuzdal/Desktop/CS32/FrackManProject3/DerivedData/FrackMan/Build/Products/Debug/Assets";
class GameWorld;
GameWorld* createStudentWorld(string assetDir = "");
int main(int argc, char* argv[])
{
{
string path = assetDirectory;
if (!path.empty())
path += '/';
const string someAsset = "frack1.tga";
ifstream ifs(path + someAsset);
if (!ifs)
{
cout << "Cannot find " << someAsset << " in ";
cout << (assetDirectory.empty() ? "current directory"
: assetDirectory) << endl;
return 1;
}
}
srand(static_cast<unsigned int>(time(nullptr)));
GameWorld* gw = createStudentWorld(assetDirectory);
Game().run(argc, argv, gw, "FrackMan");
}
| [
"noreply@github.com"
] | noreply@github.com |
9a7f43d5fbf3d3e55225411495b7274af4708b1d | 8e581ec1e79a33d923e63be70fa77b7c667053b7 | /Priority/sources/GestionnaireDesTags.cpp | baff4384eeea69e85d1a2e2462dfffabef5cb316 | [
"MIT"
] | permissive | SacreDeBirmanie/Priority | d9c7c7273f7aa7b7e4509804bc188d2b23c47b03 | 2ae77bcdf3f21bbccd63cd74715a2bec8d3dd129 | refs/heads/master | 2021-01-17T12:56:31.804376 | 2017-03-20T22:38:18 | 2017-03-20T22:38:18 | 84,075,121 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,084 | cpp | #include "headers/GestionnaireDesTags.hpp"
#include "headers/GestionnaireEnregistrementTag.hpp"
#include <iostream>
//public
GestionnaireDesTags::GestionnaireDesTags(){
;
}
void GestionnaireDesTags::recupererLesTags(){
QStringList tags = GestionnaireEnregistrementTag::listeDesTags();
QStringListIterator iterator(tags);
while (iterator.hasNext()){
Tag* tmp = new Tag(iterator.next().toLocal8Bit().constData());
this->lestags.insert(tmp->getNom(), tmp);
recupererLesFichiers(tmp);
}
}
bool GestionnaireDesTags::creerUnNouveauTag(QString nom_tag){
QHash<QString, Tag*>::iterator i = this->lestags.find(nom_tag);
if(i == this->lestags.end()){
//mise a jour dans la mémoire
GestionnaireEnregistrementTag::creerTag(nom_tag);
//mise a jour de la liste
this->ajouterTagByString(nom_tag);
return true;
}
else{
return false;
}
}
void GestionnaireDesTags::supprimerTag(QString nom_tag){
QHash<QString, Tag*>::iterator i = this->lestags.find(nom_tag);
if(i != this->lestags.end()){
//mise a jour de la memoire
GestionnaireEnregistrementTag::supprimerTag(nom_tag);
//mise a jour de la liste
this->supprimerTagListe(nom_tag);
}
else{
;
}
}
void GestionnaireDesTags::tagger(QString nom_tag, QString chemin_fichier){
QHash<QString, Tag*>::iterator i = this->lestags.find(nom_tag);
if(i != this->lestags.end()){
if(i.value()->ajouterFichier(chemin_fichier)){
GestionnaireEnregistrementTag *memoire = new GestionnaireEnregistrementTag(nom_tag);
memoire->tagger(chemin_fichier);
}
else{
;
}
}
else{
;
}
}
void GestionnaireDesTags::tagger(QString nom_tag, QStringList noms_fichiers){
QHash<QString, Tag*>::iterator i = this->lestags.find(nom_tag);
if(i != this->lestags.end()){
QStringListIterator iterator(noms_fichiers);
GestionnaireEnregistrementTag *memoire = new GestionnaireEnregistrementTag(nom_tag);
while (iterator.hasNext()){
QString tmp = iterator.next().toLocal8Bit().constData();
if(i.value()->ajouterFichier(tmp)){
memoire->tagger(tmp);
}
else{
;
}
}
}
else{
;
}
}
void GestionnaireDesTags::detagger(QString nom_tag, QString chemin_fichier){
GestionnaireEnregistrementTag *memoire = new GestionnaireEnregistrementTag(nom_tag);
memoire->detagger(chemin_fichier);
Tag * tag = getTag(nom_tag);
tag->supprimerFichier(chemin_fichier);
}
void GestionnaireDesTags::detagger(QString nom_tag, QStringList fichiers){
QHash<QString, Tag*>::iterator i = this->lestags.find(nom_tag);
if(i != this->lestags.end()){
QStringListIterator iterator(fichiers);
GestionnaireEnregistrementTag *memoire = new GestionnaireEnregistrementTag(nom_tag);
while (iterator.hasNext()){
detagger(nom_tag, iterator.next().toLocal8Bit().constData());
}
}
else{
;
}
}
QStringList GestionnaireDesTags::listeDesNomTags(){
QHash<QString, Tag*>::iterator i = this->lestags.begin();
QStringList laliste;
while (i != this->lestags.end()){
laliste.append(i.value()->getNom());
i++;
}
return laliste;
}
QStringList GestionnaireDesTags::listeDesNomTags(QString nom_fichier){
QHash<QString, Tag*>::const_iterator i = lestags.constBegin();
QStringList laliste;
while (i != lestags.end()){
Tag* tmp = i.value();
if(tmp->getFichiers().contains(nom_fichier)){
laliste.append(tmp->getNom());
}
i++;
}
return laliste;
}
int GestionnaireDesTags::compterFichiers(QString nom_tag){
QHash<QString, Tag*>::const_iterator i = this->lestags.find(nom_tag);
int tmp = 0;
int count = 0;
while (i != this->lestags.end() && i.key() == nom_tag && count<3) {
tmp = i.value()->compterFichiers();
i++;
}
return tmp;
}
//private
Tag* GestionnaireDesTags::getTag(QString nom_tag){
QHash<QString, Tag*>::const_iterator i = this->lestags.find(nom_tag);
while (i != this->lestags.end() && i.key() == nom_tag) {
return i.value();
}
return NULL;
}
QStringList GestionnaireDesTags::recupererLesFichiers(Tag* tag){
GestionnaireEnregistrementTag *document = new GestionnaireEnregistrementTag(tag->getNom());
QStringList liste = document->recupererFichiers();
QStringListIterator iterator(liste);
while (iterator.hasNext()){
tag->ajouterFichier(iterator.next().toLocal8Bit().constData());
}
return liste;
}
void GestionnaireDesTags::ajouterTagByString(QString nom){
Tag* tmp_tag = new Tag(nom);
this->lestags.insert(tmp_tag->getNom(),tmp_tag);
}
void GestionnaireDesTags::supprimerTagListe(QString nom_tag){
this->lestags.remove(nom_tag);
}
| [
"neoflash93@gmail.com"
] | neoflash93@gmail.com |
1605a67d39afee0c80a74155a29a7b0686ac380c | 0a325a8baa5b92fd0517234019ae17108e8a52ca | /UI/PropertyUI.h | abec686b3e84e71673f102f104a6bf21f1507959 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | byungwoo733/SHADERed | 7a243dc091d50acb1a30b441339aa3d5c3283e8c | a3512c33142ad6f7dc9eebeb9a91794c6e3cf0bb | refs/heads/master | 2020-06-24T05:15:37.959833 | 2019-07-19T11:18:05 | 2019-07-19T11:18:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 771 | h | #pragma once
#include "UIView.h"
namespace ed
{
class PropertyUI : public UIView
{
public:
PropertyUI(GUIManager* ui, ed::InterfaceManager* objects, const std::string& name = "", bool visible = true) : UIView(ui, objects, name, visible),
m_current(nullptr), m_currentRT(nullptr) {
memset(m_itemName, 0, 64 * sizeof(char));
}
virtual void OnEvent(const ml::Event& e);
virtual void Update(float delta);
void Open(ed::PipelineItem* item);
void Open(const std::string& name, ed::RenderTextureObject* obj);
inline std::string CurrentItemName() { return m_current->Name; }
inline bool HasItemSelected() { return m_current != nullptr; }
private:
char m_itemName[64];
ed::PipelineItem* m_current;
ed::RenderTextureObject* m_currentRT;
};
} | [
"dfranx00@gmail.com"
] | dfranx00@gmail.com |
5ef5c8467139877121f792fb01050dc438e551f4 | 15dea4de84765fd04efb0367247e94657e76515b | /source/3rdparty/won/msg/Routing/MMsgRoutingMuteClient.cpp | 8d64a2a67dbf5706a3407b98e4028fa1bfb908ad | [] | no_license | dppereyra/darkreign2 | 4893a628a89642121d230e6e02aa353636566be8 | 85c83fdbb4b4e32aa5f816ebfcaf286b5457a11d | refs/heads/master | 2020-12-30T13:22:17.657084 | 2017-01-30T21:20:28 | 2017-01-30T21:20:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,693 | cpp | #include "common/won.h"
#include "msg/BadMsgException.h"
#include "msg/MServiceTypes.h"
#include "MMsgTypesRouting.h"
#include "MMsgRoutingMuteClient.h"
namespace {
using WONMsg::RoutingServerClientIdFlagMessage;
using WONMsg::RoutingServerMessage;
using WONMsg::MMsgRoutingMuteClient;
};
MMsgRoutingMuteClient::MMsgRoutingMuteClient(bool flagOnOrOff) :
RoutingServerClientIdFlagMessage(flagOnOrOff)
{
SetServiceType(WONMsg::MiniRoutingServer);
SetMessageType(WONMsg::RoutingMuteClient);
}
MMsgRoutingMuteClient::~MMsgRoutingMuteClient(void)
{}
MMsgRoutingMuteClient::MMsgRoutingMuteClient(const MMsgRoutingMuteClient& theMsgR) :
RoutingServerClientIdFlagMessage(theMsgR)
{}
MMsgRoutingMuteClient::MMsgRoutingMuteClient(const RoutingServerMessage& theMsgR) :
RoutingServerClientIdFlagMessage(theMsgR)
{
Unpack();
}
MMsgRoutingMuteClient& MMsgRoutingMuteClient::operator =(const MMsgRoutingMuteClient& theMsgR)
{
if (this != &theMsgR)
RoutingServerClientIdFlagMessage::operator=(theMsgR);
return *this;
}
void* MMsgRoutingMuteClient::Pack(void)
{
WTRACE("MMsgRoutingMuteClient::Pack");
SetServiceType(WONMsg::MiniRoutingServer);
SetMessageType(WONMsg::RoutingMuteClient);
RoutingServerClientIdFlagMessage::Pack();
return GetDataPtr();
}
void MMsgRoutingMuteClient::Unpack(void)
{
WTRACE("MMsgRoutingMuteClient::Unpack");
RoutingServerClientIdFlagMessage::Unpack();
if (GetServiceType() != WONMsg::MiniRoutingServer ||
GetMessageType() != WONMsg::RoutingMuteClient)
{
WDBG_AH("MMsgRoutingMuteClient::Unpack Not a RoutingMuteClient message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a RoutingMuteClient message.");
}
} | [
"eider@protonmail.com"
] | eider@protonmail.com |
b212aa0e809d9876fe70ca844e92b16459af5d26 | 808a3265cc9f4ca122677cdafb309eab7d537df9 | /MapCreator/FilterDlg.cpp | 8e39634e29ca83518625e2716da1f51d3f2e8adc | [] | no_license | wuye9036/LevelUp | 532e53bae32abd917b6596071acf91f7609c7b3b | 177edc187bcd933cb48afa19fbca3d38074911af | refs/heads/master | 2021-01-01T19:46:29.912742 | 2012-11-16T12:38:28 | 2012-11-16T12:38:28 | 6,682,331 | 12 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 47 | cpp | #include "StdAfx.h"
#include ".\filterdlg.h"
| [
"wuye9036@gmail.com"
] | wuye9036@gmail.com |
0ec60030221921b05066a5ce48fccbc4ad51c50f | f6d13171a6e73616a253d3786d53282efd581fc7 | /tute2/containers.cpp | 3de633b3fe23ad2bbdddb449c46c4ec8304da4a0 | [] | no_license | stanleyhon/comp-sixsixsevenone | ea6e5f6423110c6f9371ae16de8a8278e59cacda | 3094384d1e8cfdc2424938ce75f94a00452d9b3a | refs/heads/master | 2020-04-04T14:19:09.145632 | 2014-10-31T04:45:50 | 2014-10-31T04:45:50 | 22,456,451 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,266 | cpp | #include <iostream>
#include <deque>
#include <list>
void print_all (std::deque<double> * dq1, std::deque<int> * dq2, std::list<int> * list);
int main (void) {
std::deque<double> dq1;
std::deque<int> dq2;
std::list<int> list;
dq1.push_back (500);
dq1.push_back (500);
dq1.push_back (500);
dq1.push_back (500);
dq1.push_back (500);
dq2.push_back (4);
dq2.push_back (4);
dq2.push_back (4);
dq2.push_back (4);
dq2.push_back (4);
dq2.push_back (4);
list.push_back (12);
list.push_back (12);
list.push_back (12);
list.push_back (12);
dq1.assign (list.begin (), list.end ());
list.assign (dq2.begin (), dq2.end ());
print_all (&dq1, &dq2, &list);
return 0;
}
void print_all (std::deque<double> * dq1, std::deque<int> * dq2, std::list<int> * list) {
std::cout << "DQ1:\n";
for (auto i = (*dq1).begin (); i != (*dq1).end (); i++) {
std::cout << *i << std::endl;
}
std::cout << "\nDQ2:\n";
for (auto i = (*dq2).begin (); i != (*dq2).end (); i++) {
std::cout << *i << std::endl;
}
std::cout << "\nlist:\n";
for (auto i = (*list).begin (); i != (*list).end (); i++) {
std::cout << *i << std::endl;
}
return;
}
| [
"stanleyhon348@gmail.com"
] | stanleyhon348@gmail.com |
09b327a0ea11482d493cbef133c7f98012207148 | 9a1fc67df0d8ee76a2d962e8ee5ce0fb445486a2 | /C++ Lab/Project 4/Rectangle.cpp | f9e1c700ee5383c8f7937ab69cc3d5870b89c2ef | [] | no_license | TheeEmuu/School | cd074b316219185a7fd3647bfeb13d626838dc26 | 5812affd92199c6d658472d91136a0f069315f0c | refs/heads/master | 2023-01-10T01:04:05.605543 | 2020-11-13T15:18:22 | 2020-11-13T15:18:22 | 291,618,978 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 817 | cpp | #include "Rectangle.h"
#include <stdlib.h>
#include <sstream>
#include <iostream>
Rectangle::Rectangle(int x1, int y1, int x2, int y2, int i) {
a.first = x1;
a.second = y1;
b.first = x2;
b.second = y2;
size = abs(x2 - x1) * abs(x2 - x1);
id = i;
}
bool Rectangle::overlaps(Rectangle other) {
return a.first <= other.a.first && a.second <= other.a.second && b.first >= other.b.first && b.second >= other.b.second;
}
bool Rectangle::compare(Rectangle a, Rectangle b) {
return a.size > b.size;
}
int Rectangle::getSize() const {
return size;
}
std::string Rectangle::toString() {
std::stringstream ss;
ss << a.first << ' ' << a.second << ' ' << b.first << ' ' << b.second;
std::string s = ss.str();
return s;
}
int Rectangle::getId() const {
return id;
}
| [
"chertangoldsmith@gmail.com"
] | chertangoldsmith@gmail.com |
5e52f56e8f4526d4770950774ed2702976724b0b | 012582308ed95bbfc32633808081a8d41dcf350c | /noise_generator.h | 0f28684d3d7b7a1b6520736d95c2dff1007ece9c | [] | no_license | erikhallin/Kaufen | a55b4dcf2499a6dac8f34a73dfabee115b102578 | 7e3a34535b78619cb8c383c20ae95cf68c43e32d | refs/heads/master | 2020-07-03T05:09:41.121906 | 2019-08-11T17:18:04 | 2019-08-11T17:18:04 | 201,793,711 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 802 | h | #ifndef NOISE_GENERATOR_H
#define NOISE_GENERATOR_H
class noise_generator
{
public:
//Constructors
noise_generator();
noise_generator(float persistance,float frequency,float amplitude,int number_of_octaves,int seed);
//Variables
bool m_ready;
//Functions
float set_settings(float persistance,float frequency,float amplitude,int number_of_octaves,int seed);
float get_noise(float x);
private:
//Variables
int m_number_of_octaves,m_seed;
float m_persistance,m_frequency,m_amplitude;
//Functions
float Noise(int x);
float SmoothNoise(float x);
float CosineInterpolation(float a,float b,float x);
float InterpolatedNoise(float x);
};
#endif // NOISE_GENERATOR_H
| [
"erik-hallin@hotmail.com"
] | erik-hallin@hotmail.com |
894ecdf2c07d98f45d57b9d63706ee389d27931e | f72f8d6ae5b98a8fc89ed633f687cfd0a5ae054f | /ffscriptUT/ScriptCompilerUT.cpp | 5014ee29dbadb67e06fe2fb4b103ea6bde7f1dd5 | [
"MIT"
] | permissive | VincentPT/xscript | 20469bd934b3b0a551ce9b1143f1b6a1a068f1f4 | 11489c2de3ccb279d634e5787b6ed038fd8cc05b | refs/heads/master | 2023-08-28T19:36:04.840095 | 2023-07-23T16:30:45 | 2023-07-23T16:30:45 | 397,819,881 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,120 | cpp | /******************************************************************
* File: ScriptCompilerUT.cpp
* Description: Test cases for using ScriptCompiler to register types
* and functions in a C Lambda application.
* Author: Vincent Pham
*
* Copyright (c) 2018 VincentPT.
** Distributed under the MIT License (http://opensource.org/licenses/MIT)
**
*
**********************************************************************/
#include "fftest.hpp"
#include "../ffscript/ScriptCompiler.h"
#include "BasicFunction.h"
#include "FunctionFactory.h"
#include "BasicType.h"
using namespace std;
using namespace ffscript;
namespace ffscriptUT
{
namespace ScriptCompilerUT
{
FF_TEST_FUNCTION(ScriptCompilerTest,testScriptCompiler1)
{
ScriptCompiler scriptCompiler;
string type = "int";
int id = scriptCompiler.registType(type);
auto registType = scriptCompiler.getType(id);
//regist type must be success
FF_EXPECT_NE(-1, id);
//registered type must be same the type using to regist
FF_EXPECT_EQ(type, registType);
}
FF_TEST_FUNCTION(ScriptCompilerTest,testScriptCompiler2)
{
ScriptCompiler scriptCompiler;
string type = "int";
int id = scriptCompiler.registType(type);
id = scriptCompiler.registType(type);
//regist type must be failed at second time
FF_EXPECT_TRUE(IS_UNKNOWN_TYPE(id));
}
FF_TEST_FUNCTION(ScriptCompilerTest,testScriptCompiler3)
{
ScriptCompiler scriptCompiler;
string type1 = "int";
string type2 = "float";
int id1 = scriptCompiler.registType(type1);
int id2 = scriptCompiler.registType(type2);
//regist type must be success
FF_EXPECT_NE(-1, id1);
FF_EXPECT_NE(-1, id2);
//registered type must be difference each time
FF_EXPECT_NE(id1, id2);
}
FF_TEST_FUNCTION(ScriptCompilerTest,testScriptCompiler4)
{
ScriptCompiler scriptCompiler;
string type = "int";
int id1 = scriptCompiler.registType(type);
int id2 = scriptCompiler.getType(type);
//regist type must be success
FF_EXPECT_NE(-1, id1);
//registered type must be same the type using to regist
FF_EXPECT_EQ(id1, id2);
}
FF_TEST_FUNCTION(ScriptCompilerTest,testRegisterFunction1)
{
ScriptCompiler scriptCompiler;
FunctionFactoryCdecl sumFactor(nullptr, ScriptType());
const BasicTypes& basicType = scriptCompiler.getTypeManager()->getBasicTypes();
scriptCompiler.getTypeManager()->registerBasicTypes(&scriptCompiler);
int id0 = scriptCompiler.registFunction("test", "double, int", &sumFactor);
int id1 = scriptCompiler.registFunction("sum", "", &sumFactor);
int id2 = scriptCompiler.registFunction("sum", "int", &sumFactor);
int id3 = scriptCompiler.registFunction("sum", "int,double", &sumFactor);
int id4 = scriptCompiler.registFunction("sum", "int,float", &sumFactor);
int id5 = scriptCompiler.registFunction("sum", "int,float,float", &sumFactor);
int id6 = scriptCompiler.registFunction("sum", "", &sumFactor);
int id7 = scriptCompiler.registFunction("sum", "int,double", &sumFactor);
int id8 = scriptCompiler.registFunction("sum", "int,float,float", &sumFactor);
FF_EXPECT_TRUE(id0 != -1, L"function 'test' must be registerd successfully!");
FF_EXPECT_TRUE(id1 != -1, L"function 'sum()' must be registerd successfully!");
FF_EXPECT_TRUE(id2 != -1, L"function 'sum(int)' must be registerd successfully!");
FF_EXPECT_TRUE(id3 != -1, L"function 'sum(int,double)' must be registerd successfully!");
FF_EXPECT_TRUE(id4 != -1, L"function 'sum(int,float)' must be registerd successfully!");
FF_EXPECT_TRUE(id5 != -1, L"function 'sum(int,float,float)' must be registerd successfully!");
FF_EXPECT_TRUE(id0 != id1, L"function 'test' and 'sum' must be registerd with diffrent id");
FF_EXPECT_TRUE(id6 == -1, L"function 'sum()' is register twice and should not regiser at second time");
FF_EXPECT_TRUE(id7 == -1, L"function 'sum(int,double)' is register twice and should not regiser at second time");
FF_EXPECT_TRUE(id8 == -1, L"function 'sum(int,float,float)' is register twice and should not regiser at second time");
}
};
}
| [
"minhpta@outlook.com"
] | minhpta@outlook.com |
4d78416ce9e47889104598a3ea3f73858cde569e | a93a2dbfa545632a95ca111a84bf45d0ec802dfd | /cpp/Recursion/Theory/tail_recursion_1.cpp | dac09d225550c2243335f46eaee20611dd4a1d00 | [] | no_license | Raghav-Bajaj/HacktoberFest-2 | 0af9e902be6aa1d1c1d38d52914d52c9e1c17f21 | 23f0d0048f842dca4f102a3c368c78304b6a243f | refs/heads/master | 2023-08-13T08:40:58.607609 | 2021-10-18T18:15:03 | 2021-10-18T18:15:03 | 413,308,857 | 1 | 2 | null | 2021-10-06T10:21:31 | 2021-10-04T07:00:51 | Jupyter Notebook | UTF-8 | C++ | false | false | 179 | cpp | #include <iostream>
using namespace std;
void fun(int n)
{
if (n == 0)
return;
cout << n << " ";
fun(n - 1);
}
int main()
{
fun(3);
} | [
"noreply@github.com"
] | noreply@github.com |
9eae8b90e7f31b5c35c31961a528dd3a4739fc9e | f6cecd4e3ca6f66ba36505173d959db53745036f | /ios/vendored/sdk44/react-native-reanimated/Common/cpp/headers/SharedItems/ShareableValue.h | 11d57e1d2576ab73a3dfa6a01a08d29ade3bb378 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | Simek/expo | 6d3844eb75206c72c35b91c8f1752328aee99749 | 6f3c4a42304030fc2d2fbd213b07c1aac6785206 | refs/heads/main | 2023-02-05T11:30:58.908890 | 2022-07-19T10:03:07 | 2022-07-19T10:03:07 | 222,480,219 | 1 | 0 | MIT | 2022-08-18T08:43:17 | 2019-11-18T15:23:00 | Objective-C | UTF-8 | C++ | false | false | 1,827 | h | #pragma once
#include <ABI44_0_0jsi/ABI44_0_0jsi.h>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "HostFunctionHandler.h"
#include "JSIStoreValueUser.h"
#include "LayoutAnimationsProxy.h"
#include "RuntimeManager.h"
#include "Scheduler.h"
#include "SharedParent.h"
#include "ValueWrapper.h"
#include "WorkletsCache.h"
using namespace ABI44_0_0facebook;
namespace ABI44_0_0reanimated {
class ShareableValue : public std::enable_shared_from_this<ShareableValue>,
public StoreUser {
friend WorkletsCache;
friend FrozenObject;
friend LayoutAnimationsProxy;
friend void extractMutables(
jsi::Runtime &rt,
std::shared_ptr<ShareableValue> sv,
std::vector<std::shared_ptr<MutableValue>> &res);
private:
RuntimeManager *runtimeManager;
std::unique_ptr<ValueWrapper> valueContainer;
std::unique_ptr<jsi::Value> hostValue;
std::weak_ptr<jsi::Value> remoteValue;
bool containsHostFunction = false;
ShareableValue(RuntimeManager *runtimeManager, std::shared_ptr<Scheduler> s)
: StoreUser(s, *runtimeManager), runtimeManager(runtimeManager) {}
jsi::Value toJSValue(jsi::Runtime &rt);
jsi::Object createHost(
jsi::Runtime &rt,
std::shared_ptr<jsi::HostObject> host);
void adapt(jsi::Runtime &rt, const jsi::Value &value, ValueType objectType);
void adaptCache(jsi::Runtime &rt, const jsi::Value &value);
std::string demangleExceptionName(std::string toDemangle);
public:
ValueType type = ValueType::UndefinedType;
static std::shared_ptr<ShareableValue> adapt(
jsi::Runtime &rt,
const jsi::Value &value,
RuntimeManager *runtimeManager,
ValueType objectType = ValueType::UndefinedType);
jsi::Value getValue(jsi::Runtime &rt);
};
} // namespace reanimated
| [
"noreply@github.com"
] | noreply@github.com |
eb33aaa7455e539a67780bd1faf4180e39dca6cf | 90bfa13bc59f44f81892245b5d4828676bd1fc5c | /sourcecode/CommAudio_Client/CommAudio_Client/dialog.cpp | 6bb4c6b1bd640c7e84c648d3c21ee7a13a1042e1 | [] | no_license | JnBrandrick/Comm-Audio | dcaa564b0325fd08e10b0ca70a94be73a53d776c | 04dbaedd1c0a0148fe763d998760b37665daa33a | refs/heads/master | 2021-01-15T21:53:55.630811 | 2015-04-09T03:39:16 | 2015-04-09T03:39:16 | 31,507,629 | 0 | 0 | null | 2015-03-01T19:22:38 | 2015-03-01T19:22:38 | null | UTF-8 | C++ | false | false | 5,258 | cpp | /**********************************************************************
*
** SOURCE FILE: dialog.cpp - Custom dialog class
**
** PROGRAM: Linux Chat Program
**
** FUNCTIONS:
** explicit Dialog(QWidget *parent = 0);
** ~Dialog();
**
**
** DATE: March 7th, 2015
**
**
** DESIGNER: Rhea Lauzon A00881688
**
**
** PROGRAMMER: Rhea Lauzon A00881688
**
** NOTES:
** Dialog class for the launch of the chat program.
*************************************************************************/
#define WIN32_LEAN_AND_MEAN
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <iostream>
#include <QMessageBox>
#include "dialog.h"
#include "ui_dialog.h"
#include "controlChannel.h"
#include "unicastSong.h"
#include "multicast.h"
using namespace std;
/*****************************************************************
** Function: Dialog
**
** Date: March 7th, 2015
**
** Revisions:
**
**
** Designer: Rhea Lauzon
**
** Programmer: Rhea Lauzon
**
** Interface:
** Dialog(QWidget *parent)
** QWidget *parent -- parent widget
**
** Returns:
** N/A (Constructor)
**
** Notes:
** Dialog window constructor.
**
*******************************************************************/
Dialog::Dialog(QWidget *parent) :QDialog(parent), ui(new Ui::Dialog)
{
ui->setupUi(this);
//add the connect button function on push
connect(ui->connectButton, SIGNAL(pressed()), this, SLOT(connectMulticast()));
}
/*****************************************************************
** Function: ~Dialog (Destructor)
**
** Date: March 7th, 2015
**
** Revisions:
**
**
** Designer: Rhea Lauzon
**
** Programmer: Rhea Lauzon
**
** Interface:
** ~Dialog()
**
** Returns:
** N/A (Destructor)
**
** Notes:
** Destructs the dialog object
**
*******************************************************************/
Dialog::~Dialog()
{
delete ui;
}
/*****************************************************************
** Function: connectMulticast
**
** Date: March 7th, 2015
**
** Revisions:
**
**
** Designer: Rhea Lauzon
**
** Programmer: Rhea Lauzon
**
** Interface:
** bool connectMulticast()
**
** Returns:
** bool -- True upon successful connection,
** False on fail
**
** Notes:
** Calls the connect multicast function and opens the main GUI
*******************************************************************/
bool Dialog::connectMulticast()
{
//get the user entered address
QString address = ui->addressField->text();
//check if there is data
if (address.isEmpty())
{
return false;
}
else
{
//connected to the server succesfully
if ( Dialog::initialConnect(address) )
{
this->hide();
}
else
{
cerr << "cannot connect :( connect to server failed.";
return false;
}
}
return true;
}
/*****************************************************************
** Function: reject
**
** Date: March 18th, 2015
**
** Revisions:
**
**
** Designer: Rhea Lauzon
**
** Programmer: Rhea Lauzon
**
** Interface:
** void reject()
**
** Returns:
** void
**
** Notes:
** Overriden method to trigger close events when disconnecting.
**
*******************************************************************/
void Dialog::reject()
{
QMessageBox::StandardButton resBtn = QMessageBox::Yes;
resBtn = QMessageBox::question( this, "Close the Audio Streamer",
tr("Are you sure you want to quit?\n"),
QMessageBox::Cancel | QMessageBox::Yes,
QMessageBox::Yes);
if (resBtn == QMessageBox::Yes)
{
QDialog::reject();
//close the entire program
exit(0);
}
}
/*******************************************************************
** Function: initialConnect
**
** Date: March 27th, 2015
**
** Revisions:
**
**
** Designer: Rhea Lauzon
**
** Programmer: Rhea Lauzon
**
** Interface:
** bool initialConnect(QString address)
** QString address -- Address to conect to
**
**
** Returns:
** bool -- returns true on success and false on fail
**
** Notes:
** Does the initial connection on program start.
**********************************************************************/
bool Dialog::initialConnect(QString address)
{
struct hostent *he;
struct hostent *multi;
//convert the QString to a string
string IP = address.toStdString();
string multicastIP = "234.5.6.7";
/* resolve hostname */
if ((he = gethostbyname(IP.c_str())) == NULL)
{
//error getting the host
cerr << "Failed to retrieve host" << endl;
exit(1);
}
//Resolve multicast
if ((multi = gethostbyname(multicastIP.c_str())) == NULL)
{
//error getting the host
cerr << "Failed to retrieve host" << endl;
exit(1);
}
//create the control channel
if (setupControlChannel(he) < 0)
{
cerr << "Unable to open control channel." << endl;
exit(1);
}
struct in_addr ia;
memcpy((void*)multi->h_addr,(void*)&ia, multi->h_length);
StartMulticast(ia);
return true;
}
| [
"mikechimick@gmail.com"
] | mikechimick@gmail.com |
0aed2ecfb9df16554c7b9c8b9a03841be1d72a9a | dc11693557b088c61c0f773ceecc55cfe1cb5a36 | /sms/receive1/receive1.ino | cb380ab0429cf1e471dadbc124e474e0e161a048 | [] | no_license | irwan75/Arduino-Project | c849c6eaa092630fc18c8378b840848ad72a5437 | 200fae5cb229a13eb6bea60b79e641555e8ef256 | refs/heads/master | 2022-06-04T00:12:16.611056 | 2020-05-04T08:40:24 | 2020-05-04T08:40:24 | 261,112,907 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,008 | ino | #include <GSM.h>
#define PINNUMBER "" // Nomor PIN kartu SIM (jika ada)
GSM gsmAccess;
GSM_SMS sms;
char senderNumber[20]; // array untuk menampung teks pesan
void setup() {
Serial.begin(9600);
Serial.println("SMS Messages Receiver");
boolean notConnected = true;
// Start GSM connection
while (notConnected) {
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Gagal Mengakses Kartu SIM");
delay(1000);
}
}
Serial.println("Kartu SIM terAkses");
Serial.println("Menunggu SMS...");
}
void loop() {
char c;
if (sms.available()) { // Jika ada SMS Masuk
Serial.println("SMS Masuk dari:");
sms.remoteNumber(senderNumber, 20); // menampung nomor pengirim
Serial.println(senderNumber); // print nomor pengirim
while (c = sms.read()) { // print isi SMS
Serial.print(c);
}
sms.flush(); // Hapus SMS dari Memori
Serial.println("SMS terhapus");
}
delay(1000);
}
| [
"irwan.ardyansah75@gmail.com"
] | irwan.ardyansah75@gmail.com |
24217e60394ee9e684f2efc3fa0c898ece443f19 | c8978de06690e42b687100be727b941859a66f39 | /Competitive_coding/Remove_ll_elements.cpp | 3d4bdabaa0e88a1d38498fef812a72b569f886a0 | [] | no_license | Rasa16/DSA_Contest_Codes | d6e725e1c6916dca8b1c2c8ad6a100620d4215bb | 741c4f1ca5520abf7ef0d937d313e39ce09d4ea4 | refs/heads/main | 2023-08-28T14:26:09.455045 | 2021-10-21T06:46:02 | 2021-10-21T06:46:02 | 369,836,182 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 860 | cpp | //https://leetcode.com/problems/remove-linked-list-elements/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* removeElements(ListNode* head, int val) {
if(head == NULL)
return NULL;
ListNode* dummy = new ListNode(0);
dummy->next = head;
ListNode* p = dummy;
while(p && p->next){
if(p->next->val == val){
ListNode* temp = p->next;
p->next = temp->next;
delete(temp);
}else
p = p->next;
}
return dummy->next;
}
};
| [
"noreply@github.com"
] | noreply@github.com |
b04436b83ddf2f86f6bf515cf04f0e364e18c2e8 | 56b0c908ef9a8eb51a9cf516f43001cb424d0906 | /poker/src/LYTable.cpp | 20174d50117e82f2e01b771468b7e3ab5e2b30ee | [
"Apache-2.0",
"BSD-2-Clause"
] | permissive | vforks/libpoker | 46f81d3a8b41aed8c14f692e6e8bdfee8807bcff | a2c60884fc5c8e31455fb39e432c49e0df55956b | refs/heads/master | 2021-09-25T02:41:10.010549 | 2018-10-17T09:36:09 | 2018-10-17T09:36:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,202 | cpp | /*
* LYTable.cpp
*
* Created on: 2013-7-5
* Author: caiqingfeng
*/
#include "LYTable.h"
//#include <boost/foreach.hpp>
//#include "common/src/my_log.h"
#include "libmrock/common/src/LYUtils.h"
LYTable::LYTable(const std::string &tid, unsigned int ts, enum LYTableStatus sta,
const std::string &nm, std::string creator)
{
_id = tid;
status = sta;
name = nm;
total_seats = ts;
owner = creator;
game_round = 0;
assurance_flag = 0;
assurance_income = 0;
for (unsigned int i = 0; i < total_seats; i++)
{
LYSeat *seat = new LYSeat((enum LYApplicant) (i + 1));
LYSeatPtr sp(seat);
seats.push_back(sp);
}
trunk = NULL;
last_duration = 0;
started_at = 0;
total_buyin = 0;
occupied_seat_number = 0;
// last_polling_at = 0;
}
LYTable::LYTable()
{
status = LYTableOpen;
total_seats = 0;
game_round = 0;
trunk = NULL;
assurance_flag = 0;
assurance_income = 0;
last_duration = 0;
started_at = 0;
total_buyin = 0;
occupied_seat_number = 0;
// last_polling_at = 0;
}
LYTable::~LYTable()
{
}
const std::string& LYTable::getOwner()
{
return owner;
}
void LYTable::setOwner(const std::string &uid)
{
owner = uid;
}
void LYTable::setServerHandler(const std::string& hdl)
{
server_handler = hdl;
}
//Trunk管理
/*
* 创建一个新Trunk,如果当前Trunk的状态是正在运行,则返回
*/
void LYTable::openTrunk(const std::string &trunk_id, const std::string &trunk_name,
const std::string &player, const std::string &prof_id)
{
}
/*
* 创建一个新Trunk,如果当前Trunk的状态是正在运行,则返回
*/
void LYTable::openTrunk(const std::string &trunk_id)
{
}
void LYTable::openTrunk(const std::string &trunk_id, const std::string &trunk_name,
const std::string &player, LYPokerProfile *prof)
{
}
/*
* 创建一个新Trunk,如果当前Trunk的状态是正在运行,则返回
*/
void LYTable::openTrunk(LYTrunk *trk)
{
trunk = trk;
//set profile of trunk
trunk->activeProfile();
}
/*
* 关闭current_trunk,如果当前Trunk还有一个Game在运行,则设置Trunk状态为closing
* NextGame时将会检查Trunk状态,是否为准备关闭或者已经关闭状态
* 现阶段假设Trunk会一直运行,跟桌子的生命周期完全一样
*/
void LYTable::closeTrunk()
{
// LY_LOG_DBG("closeTrunk not implemented yet!");
delete trunk;
trunk = NULL;
}
bool LYTable::isTableOpen()
{
int now = time(NULL);
if (last_duration > 0 && now > (started_at+last_duration*60)) {
return false;
}
return (this->status == LYTableOpen || this->status == LYTableInGame);
}
int LYTable::getTimeLeft()
{
int now = time(NULL);
return (started_at+last_duration*60) - now;
}
//-----------玩家动作 begin
void LYTable::enterTable(const std::string &uid)
{
// std::cout << "player join table, uid=" << uid << std::endl;
std::vector<std::string>::iterator it = players.begin();
for (; it!=players.end(); it++) {
// std::cout << "111111player join table, uid=" << *it << std::endl;
if (*it == uid) {
return;
}
}
players.push_back(uid);
// this->addStandby(player);
}
void LYTable::leaveTable(const std::string &uid)
{
// LY_LOG_DBG("player leave table, uid=" << uid);
std::vector<std::string>::iterator it = players.begin();
for (; it != players.end(); it++) {
if (*it == uid) {
players.erase(it);
break;
}
}
}
/*
* 20150209修改,增加一个状态SeatReserved
*/
void LYTable::takeSeat(enum LYApplicant seat_no, unsigned int buyin, const std::string &uid) //有人坐在某个位子上
{
LYSeatPtr seat = fetchSeat(seat_no);
if (NULL == seat.get()) return;
bool can_take_this_seat = false;
switch (seat->status)
{
case LYSeatOccupied:
case LYSeatInGame:
return;
case LYSeatOpen:
can_take_this_seat = true;
break;
case LYSeatReserved:
if (seat->playerId == uid) can_take_this_seat = true;
break;
default:
break;
}
if (can_take_this_seat) {
seat->occupy(buyin, uid);
occupied_seat_number ++;
}
total_buyin += buyin;
return;
}
void LYTable::buyin(enum LYApplicant seat_no, unsigned int buyin, const std::string &uid) //有人坐在某个位子上
{
LYSeatPtr seat = fetchSeat(seat_no);
if (NULL == seat.get() || seat->getStatus() == LYSeatOpen) {
// LY_LOG_ERR("status should be not occupied first! " << seat_no);
return;
}
seat->buyin(buyin, uid);
total_buyin += buyin;
return;
}
void LYTable::leaveSeat(enum LYApplicant seat_no, int &cash_out_req, const std::string &uid) //有人坐在某个位子上
{
LYSeatPtr seat = fetchSeat(seat_no);
// if (!this->isGameOver() && (NULL == seat.get() || seat->isInGame())) {
if (NULL == seat.get()) {
// LY_LOG_ERR("cannot leave an empty seat or a seat in game! " << seat_no);
return;
}
cash_out_req = seat->getChipsAtHand();
seat->reset();
occupied_seat_number --;
return;
}
void LYTable::leaveSeatButReserve(enum LYApplicant seat_no)
{
LYSeatPtr seat = fetchSeat(seat_no);
if (!this->isGameOver() && (NULL == seat.get() || seat->isInGame())) {
// LY_LOG_ERR("cannot leave an empty seat or a seat in game! " << seat_no);
return;
}
seat->reset();
seat->status = LYSeatReserved;
occupied_seat_number --;
return;
}
void LYTable::forceLeaveSeat(enum LYApplicant seat_no)
{
LYSeatPtr seat = fetchSeat(seat_no);
seat->reset();
if (occupied_seat_number > 0) {
occupied_seat_number --;
}
return;
}
//-----------玩家动作 end
std::vector<std::string> LYTable::getNeighbors(const std::string &uid)
{
std::vector<std::string> neighbors;
if (!this->playerInTable(uid)) {
return neighbors;
}
std::vector<std::string>::iterator it = players.begin();
for (; it != players.end(); it++) {
if (*it != uid) {
neighbors.push_back(*it);
}
}
return neighbors;
}
bool LYTable::playerInTable(const std::string &uid)
{
std::vector<std::string>::iterator it = players.begin();
for (; it != players.end(); it++) {
if (*it == uid) {
return true;
}
}
return false;
}
std::vector<std::string> LYTable::getAllPlayers()
{
return players;
}
std::vector<LYSeatPtr> LYTable::getAllSeats()
{
return seats;
}
LYSeatPtr LYTable::fetchSeat(enum LYApplicant player)
{
//caiqingfeng 20130418, 不能调用Game的接口,因为需要在没有Game的时候调用
// if (NULL == dealer.get() || NULL == dealer->scene.get())
// return LYSeatPtr();
// return dealer->scene->fetchSeat(player);
if ((unsigned int)player < 1 || (unsigned int)player > 9) {
// LY_LOG_ERR("player must be between 1..9, " << (unsigned int)player);
return LYSeatPtr();
}
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr seat = *it;
if (seat->isMe(player)) {
return seat;
}
}
return LYSeatPtr();
}
bool LYTable::isOpen(enum LYApplicant player)
{
LYSeatPtr seat = fetchSeat(player);
if (seat.get() == NULL) return true;
return (seat->status == LYSeatOpen);
}
LYSeatPtr LYTable::fetchNextOccupiedSeat(enum LYApplicant player)
{
//caiqingfeng 20130418, 不能调用Game的接口,因为需要在没有Game的时候调用
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->isMe(player) || st->hasSmallerSeatNo(player) || st->getStatus() == LYSeatOpen) continue;
if (st->getChipsAtHand() > 0 &&
(st->isOccupied())) {
return st;
}
}
it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->isMe(player) || st->hasBiggerSeatNo(player) || st->getStatus() == LYSeatOpen) continue;
if (st->getChipsAtHand() > 0 &&
(st->isOccupied())) {
return st;
}
}
return LYSeatPtr();
}
//caiqingfeng 20130418, 不能调用Game的接口,因为需要在没有Game的时候调用
LYSeatPtr LYTable::fetchNextSeatInGame(enum LYApplicant player)
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->hasBiggerSeatNo(player) && st->isInGame()){
return st;
}
}
it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->hasSmallerSeatNo(player) && st->isInGame()){
return st;
}
}
return LYSeatPtr();
}
LYSeatPtr LYTable::fetchFirstOccupiedSeat()
{
// LY_LOG_DBG("entering fetchFirstOccupiedSeat");
//caiqingfeng 20130418, 不能调用Game的接口,因为需要在没有Game的时候调用
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
// LY_LOG_DBG("KKKK \n" << st->serialize().toString());
if (st->getStatus() == LYSeatOpen) continue;
if (st->getStatus() == LYSeatOccupied) {
if (st->getChipsAtHand() > 0) return st;
continue;
}
continue;
// return st;
}
return LYSeatPtr();
}
//all seats occupied including in game
const unsigned int LYTable::totalSeatsInGame()
{
unsigned int count = 0;
//caiqingfeng 20130418, 不能调用Game的接口,因为需要在没有Game的时候调用
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->getStatus() == LYSeatOpen) continue;
if (st->getStatus() == LYSeatOccupied) {
if (st->getChipsAtHand() > 0) count++;
continue;
}
count++;
}
return count;
}
LYSeatPtr LYTable::fetchNextSeat(enum LYApplicant player)
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->hasBiggerSeatNo(player)) {
return st;
}
}
it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr st = *it;
if (st->hasSmallerSeatNo(player)) {
return st;
}
}
return LYSeatPtr();
}
const unsigned int LYTable::getSeatedPlayers()
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
unsigned int seated = 0;
for (; it != seats.end(); it++) {
if ((*it)->isSeated()) {
seated++;
}
}
return seated;
}
bool LYTable::havePlayer(const std::string &player)
{
std::vector<std::string>::iterator it = players.begin();
for (; it!=players.end(); it++) {
if (*it == player) return true;
}
return false;
}
LYSeatPtr LYTable::fetchSeatByPlayerId(const std::string &player)
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
for(; it != seats.end(); it++) {
LYSeatPtr seat = *it;
if (seat.get() != NULL && seat->status != LYSeatOpen && seat->isMe(player)) {
return seat;
}
}
return LYSeatPtr();
}
void LYTable::setProfile(const std::string &prof)
{
profile_id = prof;
if (NULL == trunk || this->owner != LUYUN_HOUSE) {
return;
}
trunk->profile_id = prof;
}
std::string LYTable::getProfile()
{
if (this->profile_id != "") {
return this->profile_id;
}
if (NULL == trunk) {
return std::string("");
}
return trunk->profile_id;
}
std::string LYTable::getSeatedPlayerId(enum LYApplicant player)
{
LYSeatPtr seat = fetchSeat(player);
if (NULL == seat.get()) {
return "";
}
return seat->playerId;
}
std::vector<LYSeatPtr> LYTable::findReservedSeats()
{
std::vector<LYSeatPtr> sts;
std::vector<LYSeatPtr>::iterator it = seats.begin();
for (; it != seats.end(); it++) {
if ((*it)->status == LYSeatReserved) {
sts.push_back(*it);
}
}
return sts;
}
std::vector < std::pair<std::string, std::string> > LYTable::table2kvps()
{
std::vector < std::pair<std::string, std::string> > key_value_pairs;
if (this->_id == "") {
this->_id = LYUtils::genId();
}
std::pair < std::string, std::string > kvp;
kvp.first = "_id";
kvp.second = this->_id;
key_value_pairs.push_back(kvp);
kvp.first = "name";
kvp.second = this->name;
key_value_pairs.push_back(kvp);
kvp.first = "owner";
kvp.second = this->owner;
key_value_pairs.push_back(kvp);
kvp.first = "total_games";
kvp.second = std::to_string(this->game_round);
key_value_pairs.push_back(kvp);
kvp.first = "total_buyin";
kvp.second = std::to_string(this->total_buyin);
key_value_pairs.push_back(kvp);
kvp.first = "assurance_income";
kvp.second = std::to_string(this->assurance_income);
key_value_pairs.push_back(kvp);
kvp.first = "assurance_flag";
kvp.second = std::to_string(this->assurance_flag);
key_value_pairs.push_back(kvp);
kvp.first = "started_at";
kvp.second = std::to_string(this->started_at);
key_value_pairs.push_back(kvp);
kvp.first = "last_duration";
kvp.second = std::to_string(this->last_duration);
key_value_pairs.push_back(kvp);
/*
* integer should be processed to string
*/
kvp.first = "status";
kvp.second = std::to_string(this->status);
// LY_LOG_DBG("status:"+table->status);
key_value_pairs.push_back(kvp);
kvp.first = "total_seats";
kvp.second = std::to_string(this->total_seats);
// LY_LOG_DBG("total_seats:"+table->total_seats);
key_value_pairs.push_back(kvp);
// kvp.first = "timeout";
// kvp.second = std::to_string(this->timeout);
//// LY_LOG_DBG("total_seats:"+table->total_seats);
// key_value_pairs.push_back(kvp);
//
kvp.first = "occupied_seat_number";
kvp.second = std::to_string(this->occupied_seat_number);
// LY_LOG_DBG("total_seats:"+table->total_seats);
key_value_pairs.push_back(kvp);
kvp.first = "profile_id";
kvp.second = this->profile_id;
// LY_LOG_DBG("total_seats:"+table->total_seats);
key_value_pairs.push_back(kvp);
// kvp.first = "timestamp";
// kvp.second = std::to_string(time(NULL));
// key_value_pairs.push_back(kvp);
//
return key_value_pairs;
}
unsigned int LYTable::getTotalBuyin()
{
return total_buyin;
}
/*
* 服务器重置seat的游戏状态
*/
void LYTable::resetAllSeatsForNewGame()
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
for (; it!=seats.end(); it++) {
LYSeatPtr seat = *it;
seat->resetForGame();
}
}
/*
* 客户端或者从DB中恢复table/seats,首先将其完全重置
*/
void LYTable::resetAllSeats()
{
std::vector<LYSeatPtr>::iterator it = seats.begin();
for (; it!=seats.end(); it++) {
LYSeatPtr seat = *it;
seat->reset();
}
}
void LYTable::clearCurrentGame() {
resetAllSeatsForNewGame();
if (trunk == NULL) {
return;
}
trunk->clearCurrentGame();
}
| [
"caiqingfeng@roadclouding.com"
] | caiqingfeng@roadclouding.com |
6cbf69e05902135c5ad4b09d19c3f9a8025fba73 | 64561c631acfe1916184b84ec4c7124be35af2c7 | /code/graphique.h | fc9a894d0e8919efc1f8129d00c6eb5182efb85d | [] | no_license | phamnuhuyentrang/oriented-object-programmation | da1a3630429a30dd0ff1e1983c4a66d86099bdcc | 8b22d3321cba2df64482c83563b50d217d1e88b1 | refs/heads/master | 2020-07-27T14:08:29.522504 | 2019-07-01T03:04:46 | 2019-07-01T03:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,830 | h | #ifndef GRAPHIQUE_H
#define GRAPHIQUE_H
#include <QtCharts>
#include <QWidget>
#include <QDate>
#include <QBarCategoryAxis>
#include "trading.h"
#include "indicateur.h"
enum Couleur { rouge, vert };
/**
* \class Classe Bougie
* \details Cette classe affiche l'évolution du cours sur une journée
*/
class Bougie : public QCandlestickSet {
Q_OBJECT
CoursOHLCV* cours;
Couleur couleur;
string forme;
public:
//! constructeur
/**
* \details Le constructeur fait l'analyse des formes de bougies
* \param CoursOHLCV
* \param timestamp
* \param pointeur QWidget
*/
Bougie(CoursOHLCV* c, qreal timestamp = 0.0, QObject *parent = nullptr);
string getForme() const { return forme; }
Couleur getCouleur() const { return couleur; }
CoursOHLCV& getCoursOHLCV() { return *cours; }
const CoursOHLCV& getCoursOHLCV() const { return *cours; }
signals:
void clickBougie(Bougie* c);
private slots:
void viewCoursOHLCV(){ emit clickBougie(this); }
};
/**
* \class Classe Graphique
* \details Cela est une classe abstraite qui conserve une reference sur une EvolutionCours
*/
class Graphique : public QWidget {
Q_OBJECT
EvolutionCours& evolution;
public:
explicit Graphique(EvolutionCours& e, QWidget *parent = nullptr):QWidget(parent), evolution(e) {}
EvolutionCours& getEvolution() const { return evolution; }
virtual ~Graphique() {}
signals:
private slots:
public slots:
};
/**
* \class Classe Graphique_Chandelier
* \details Cette classe trace un graphique contenant 9/10 bougie sur la période [j-10; j-1]
* Elle donne la possibilité d'afficher l'indicateur EMA
*/
class Graphique_Chandelier : public Graphique {
Q_OBJECT
QCandlestickSeries* series; // un ensemble de bougies
QChart *chart; // un graphique sur un ensemble de bougies
QChartView *chartView; // un viewer de graphique
QLineEdit* open; // barres d’édition
QLineEdit* high;
QLineEdit* low;
QLineEdit* close;
QLabel* openl; // labels
QLabel* highl;
QLabel* lowl;
QLabel* closel;
QHBoxLayout* copen; // couches de placement
QHBoxLayout* chigh;
QHBoxLayout* clow;
QHBoxLayout* cclose;
QVBoxLayout* coucheCours;
QHBoxLayout* fenetre;
Bougie* lastBougieClicked;
QHBoxLayout* cForme;
QCheckBox* formCBox;
QLabel* formeBougiel;
QLineEdit* formeBougie;
QLineSeries *emaSeries;
//QChart *chart;
//QChartView *chartView;
//QHBoxLayout *layout;
EMA* ema;
QBarCategoryAxis *axisX;
QValueAxis *axisY;
static double max;
static double min;
public:
//! constructeur
/**
* \details Le constructeur crée un graphique prennant les bougies
* \param EvolutionCours
* \param date de la simulation
* \param pointeur QWidget
*/
explicit Graphique_Chandelier(EvolutionCours& e, QDate& date, QWidget *parent = nullptr);
//!methode getMax
/**
* \details Cette methode renvoie la valeur max des données affichées
* \return valeurMax
*/
static double getMax();
//!methode getMin
/**
* \details Cette methode renvoie la valeur min des données affichées
* \return valeurMin
*/
static double getMin();
signals:
private slots:
void viewCoursOHLCV(Bougie* b);
void showFormes(Bougie* b);
public slots:
void activateEMA(bool val){
emaSeries->setVisible(val);
}
};
/**
* \class Classe Graphique_Barre
* \details Cette classe trace un graphique en barre reprenant les volumes échangés sur la période [j-10; j-1]
*/
class Graphique_Barre : public Graphique {
Q_OBJECT
QBarSet *set;
QBarSeries *series;
QChart *chart;
QChartView *chartView;
QHBoxLayout *layout;
public:
explicit Graphique_Barre(EvolutionCours& e, QDate& date, QWidget *parent = nullptr);
signals:
private slots:
public slots:
};
/**
* \class Classe Graphique_EMA
* \details Cette classe trace un graphique de l'indicateur EMA
*/
class Graphique_EMA : public Graphique{
Q_OBJECT
QLineSeries *emaSeries;
QChart *chart;
QChartView *chartView;
QHBoxLayout *layout;
EMA* ema;
QBarCategoryAxis *axisX;
//QValueAxis *axisY;
public:
explicit Graphique_EMA(EvolutionCours& e,QDate& date, QWidget *parent = nullptr);
signals:
private slots:
void activateEMA(bool val){
emaSeries->setVisible(val);
}
// void activateMACD(bool val){
// MACD_series->setVisible();
// MACD_signal->setVisible();
// MACD_histogram->setVisible();
// }
public slots:
};
/**
* \class Classe Graphique_MACD
* \details Cette classe trace un graphique de l'indicateur MACD
*/
class Graphique_MACD : public Graphique {
Q_OBJECT
QLineSeries *macdSeries;
QLineSeries *macdSignalSeries;
QStackedBarSeries *macdHistogramSeries;
//QBarSeries *macdHistogramSeries;
QVBoxLayout *layout;
MACD* macds;
QBarSet *setPos;
QBarSet *setNeg;
QChart *chart;
QChartView *chartView;
QBarCategoryAxis *axisX;
QValueAxis *axisY;
public:
explicit Graphique_MACD(EvolutionCours& e,QDate& date, QWidget *parent = nullptr);
signals:
private slots:
public slots:
};
/**
* \class Classe Graphique_RSI
* \details Cette classe trace un graphique de l'indicateur RSI
*/
class Graphique_RSI : public Graphique {
Q_OBJECT
//QBarSeries *rsiSeries;
//QBarSet *set;
QLineSeries *rsiSeries;
QLineSeries *topSeries;
QLineSeries *bottomSeries;
QHBoxLayout *layout;
QChart *chart;
QChartView *chartView;
RSI* rsi;
QBarCategoryAxis *axisX;
QValueAxis *axisY;
public:
explicit Graphique_RSI(EvolutionCours& e,QDate& date, QWidget *parent = nullptr);
signals:
private slots:
public slots:
};
//class Graphique_Line
#endif // GRAPHIQUE_H
| [
"minh.doan@etu.utc.fr"
] | minh.doan@etu.utc.fr |
50f635bf969a53d6ac86e0938c512779c719d040 | af8d5c36efd838bf066b59c4f34569144c665813 | /Compressonator/Source/CMP_MeshCompressor/Draco/src/draco/core/draco_types.h | 4a34d7045a3334212be0d360cef8e8c3cef2276a | [
"Apache-2.0",
"MIT"
] | permissive | ux3d/glTF-Compressonator | 524d413bbe205688b8eb0741f8de23a197b01990 | 2880f0f29d47423d06d223ccc4d188bb57fc4bda | refs/heads/master | 2020-06-14T16:04:01.213047 | 2019-09-25T15:36:21 | 2019-09-25T15:36:21 | 195,050,049 | 2 | 0 | MIT | 2019-07-24T06:26:44 | 2019-07-03T12:34:31 | C++ | UTF-8 | C++ | false | false | 1,131 | h | // Copyright 2016 The Draco Authors.
//
// 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.
//
#ifndef DRACO_CORE_DRACO_TYPES_H_
#define DRACO_CORE_DRACO_TYPES_H_
#include <stdint.h>
#include <string>
#include "draco/draco_features.h"
namespace draco {
enum DataType {
// Not a legal value for DataType. Used to indicate a field has not been set.
DT_INVALID = 0,
DT_INT8,
DT_UINT8,
DT_INT16,
DT_UINT16,
DT_INT32,
DT_UINT32,
DT_INT64,
DT_UINT64,
DT_FLOAT32,
DT_FLOAT64,
DT_BOOL,
DT_TYPES_COUNT
};
int32_t DataTypeLength(DataType dt);
} // namespace draco
#endif // DRACO_CORE_DRACO_TYPES_H_
| [
"dwilkinson@me.com"
] | dwilkinson@me.com |
b93d131234fefd5635ecfe15b16e7e96cc11f2f5 | 4d463d9188a5c2e25e0c58cf45ff9beadde016bf | /src/x86/instruction_handling.cpp | 544d0c327479b62433b4bad14e0e09b99fd42aa8 | [
"BSD-2-Clause"
] | permissive | Supercip971/x86-emulator | 97025e462132f2e6a6fa968a8420cab0761266fa | 08a21f7ed9393e8d1d7c550c3e4b6c41984f4b7d | refs/heads/main | 2023-08-15T17:47:59.891966 | 2021-10-20T01:49:21 | 2021-10-20T01:49:21 | 406,946,454 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,597 | cpp | #include "x86/emulator_64.hpp"
namespace fp
{
void x86_emulator::write_op_rm(uint64_t value, const x86_instruction &instruction)
{
auto mod = instruction.mod_rm.get_mod();
if (mod == 3)
{
registers.get_register(instruction.mod_rm.get_rm()) = value;
}
else
{
error$("mod: {} not supported", mod);
}
}
uint64_t x86_emulator::read_op_rm(const x86_instruction &instruction)
{
return registers.get_register(instruction.mod_rm.get_rm());
}
void x86_emulator::write_op_reg(uint64_t value, const x86_instruction &instruction)
{
auto mod = instruction.mod_rm.get_mod();
if (mod == 3)
{
registers.get_register(instruction.mod_rm.get_reg()) = value;
}
else
{
error$("mod: {} not supported", mod);
}
}
uint64_t x86_emulator::read_op_reg(const x86_instruction &instruction)
{
return registers.get_register(instruction.mod_rm.get_reg());
}
int x86_emulator::ins_invalid(x86_instruction &instruction)
{
error$("invalid/unsupported instruction: (at: {:#x})", registers.prip);
log$("instruction info:");
instruction.dump();
return 0;
}
int x86_emulator::ins_endbr64([[maybe_unused]] x86_instruction &instruction)
{
log$("unsupported endbr instruction");
return 1;
}
int x86_emulator::ins_xor(x86_instruction &instruction)
{
if (instruction.encoding == x86_op_encoding::MODRM_MODREG)
{
log$("xor [rm reg]: {} {}", instruction.mod_rm.get_rm(), instruction.mod_rm.get_reg());
uint64_t a = read_op_rm(instruction);
uint64_t b = read_op_reg(instruction);
write_op_rm(a ^ b, instruction);
return 1;
}
log$("xor instruction: {} - {} - {}", instruction.mod_rm.get_mod(), instruction.mod_rm.get_reg(), instruction.mod_rm.get_rm());
return 0;
}
int x86_emulator::ins_mov(x86_instruction &instruction)
{
if (instruction.encoding == x86_op_encoding::MODRM_MODREG)
{
log$("mov [rm reg]: {} {}", instruction.mod_rm.get_rm(), instruction.mod_rm.get_reg());
uint64_t b = read_op_reg(instruction);
write_op_rm(b, instruction);
return 1;
}
log$("mov instruction: {} - {} - {}", instruction.mod_rm.get_mod(), instruction.mod_rm.get_reg(), instruction.mod_rm.get_rm());
return 0;
}
int x86_emulator::ins_push(x86_instruction &instruction)
{
if (instruction.encoding == x86_op_encoding::RD)
{
log$("push instruction ({}) not supported !", instruction.rd);
return 1;
}
log$("push instruction: {}", instruction.rd);
return 0;
}
} // namespace fp
| [
"supercyp971@gmail.com"
] | supercyp971@gmail.com |
a99af35ae0596db91e3a120334ad71d0116349f5 | 81eeb1b0ea8722a73ddaa18f8b914b981a9e18e3 | /rx90/moveit_tutorials/doc/rx90_rviz_control/src/Rx90.cpp | 5e1a414fb88c3eb2d352e89a1e51850a5db93963 | [] | no_license | zlmone/TERRINet | 9b750220f1dcce15bb839d5a635ddbdd90c18a45 | 89a830c48335b6fb37b8e2472bff040408247fc3 | refs/heads/master | 2023-07-09T02:09:03.539347 | 2019-12-02T10:46:35 | 2019-12-02T10:46:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,111 | cpp | //
// C++ Implementation: Rx90
//
// Description:
//
//
// <franroyal@yahoo.es>
//
//
#include "Rx90.h"
#include <sstream>
#include <cmath>
#include <stdexcept>
#include "std_msgs/Float64.h"
#include "gazebo_msgs/ApplyJointEffort.h"
#include "ros/ros.h"
#include <time.h>
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/planning_scene_interface/planning_scene_interface.h>
#include <moveit_msgs/DisplayRobotState.h>
#include <moveit_msgs/DisplayTrajectory.h>
#include <math.h>
#include <moveit_msgs/AttachedCollisionObject.h>
#include <moveit_msgs/CollisionObject.h>
#include <tf/transform_datatypes.h>
#include <moveit_visual_tools/moveit_visual_tools.h>
#include <gazebo/physics/physics.hh>
#include <gazebo/transport/transport.hh>
#include <gazebo/msgs/msgs.hh>
#include <gazebo/gazebo_client.hh>
#include "sensor_msgs/JointState.h"
#include "rx90_control/Set_activation.h"
#include <cstdlib>
#include <gazebo/common/Plugin.hh>
#include "std_msgs/String.h"
#include <iostream>
#include <string>
#define pi 3.14159265359
#define DELTA_VH 25
#define DELTA_DIAG (0.707 * DELTA_VH)
#define END "\r\n"
bool mandar_accion=true;
int contador_contactos=0;
using namespace LibSerial;
template<typename F>
F truncate(const F& f,int decs)
{
int i1 = floor(f);
F rmnd = f - i1;
int i2 = static_cast<int> (rmnd * pow(10, decs));
F f1 = i2 / pow(10, decs);
return i1 + f1;
}
Rx90::Rx90(const std::string& serialPort, const std::string& originPoint)
{
init(serialPort, originPoint);
x = 0.0;
y = 0.0;
}
Rx90::~Rx90()
{
close();
}
void Rx90::init(const std::string& serialPort, const std::string& originPoint)
{
serial.Open(serialPort.c_str());
serial.SetBaudRate(SerialStreamBuf::BAUD_9600);
serial.SetParity(SerialStreamBuf::PARITY_NONE);
serial.SetCharSize(SerialStreamBuf::CHAR_SIZE_8);
serial.SetFlowControl(SerialStreamBuf::FLOW_CONTROL_NONE);
serial.SetNumOfStopBits(1);
serial.unsetf(std::ios_base::skipws);
// Set origin precision point
std::stringstream command_origin, command_pose;
command_origin << "DO SET #ORIGIN=#PPOINT(" << originPoint.c_str() << ")";
command_pose << "DO SET #POSE=#PPOINT(" << originPoint.c_str() << ")";
std::cout << originPoint.c_str() << std::endl;
sendCommand(command_origin.str());
sendCommand(command_pose.str());
sendCommand("SPEED 10");
sendCommand("DO ABOVE");
sendCommand("DO MOVE #ORIGIN");
sendCommand("HERE ORIGIN", true);
sendCommand("DO OPENI");
sendCommand("DO ENABLE CP");
}
void Rx90::close()
{
serial.Close();
}
void Rx90::sendCommand(const std::string& command, bool waitQuestionMark)
{
if (serial.IsOpen())
{
serial << command << END;
if (waitQuestionMark)
{
char qm;
do
{
serial >> qm;
} while (qm != '?');
serial << END;
}
char r;
do
{
serial >> r;
std::cout << r;
} while (r != '.');
}
else
{
std::cout << "Serial port not opened" << std::endl;
}
}
void Rx90::panic()
{
sendCommand("PANIC");
}
void Rx90::move(const Action& action)
{
std::string Point;
char pos;
switch (action)
{
case NONE:
break;
case UP:
y += DELTA_VH;
break;
case DOWN:
y -= DELTA_VH;
break;
case RIGHT:
x += DELTA_VH;
break;
case LEFT:
x -= DELTA_VH;
break;
case UP_RIGHT:
x += DELTA_DIAG;
y += DELTA_DIAG;
break;
case UP_LEFT:
x -= DELTA_DIAG;
y += DELTA_DIAG;
break;
case DOWN_LEFT:
x -= DELTA_DIAG;
y -= DELTA_DIAG;
break;
case DOWN_RIGHT:
x += DELTA_DIAG;
y -= DELTA_DIAG;
break;
case CATCH:
catchIt();
break;
case OPEN:
openIt();
break;
case KNOW:
know_position();
break;
case POSITION:
std::cout<<" Do you want to introduce the position or the joints?[p/j]:"<<std::endl;
std::cin>>pos;
if(pos=='p'){
rviz();
}
else if(pos=='j')
{
gazebo(0,-90,90,0,0,0,'n');
}
else
{
std::cout<<"Wrong character"<<std::endl;
}
break;
default:
std::cout << "unexpected!";
}
// send the command
if (action != POSITION)
{
std::stringstream sstr;
sstr << "DO SET P"
<< "=SHIFT(POSE BY " << (int)x << "," << (int)y << ",0)";
std::string command = sstr.str();
sendCommand(command);
sendCommand("SPEED 10");
sendCommand("DO MOVES P");
}
else
{
}
}
void Rx90::move_position(const std::string& PPoint)
{
/*std::string Point;
Point = "100,-77,-43,55,45,-43";*/
std::stringstream command_pose;
command_pose << "DO SET #POSE=#PPOINT(" << PPoint.c_str() << ")";
sendCommand(command_pose.str());
sendCommand("SPEED 10");
sendCommand("DO ABOVE");
sendCommand("DO MOVE #POSE");
}
void Rx90::catchIt()
{
//VISUALIZATION AND MOVING THE GRIPPER
ros::NodeHandle n;
ros::ServiceClient client = n.serviceClient<gazebo_msgs::ApplyJointEffort>("/gazebo/apply_joint_effort");
gazebo_msgs::ApplyJointEffort lgripper_2,rgripper_2, mgripper_2;
mgripper_2.request.joint_name = "rx90_2::RX90_MGRIPPER_JOINT";
//mgripper_2.request.effort = -99;
mgripper_2.request.effort = -20;
mgripper_2.request.start_time = ros::Time(0);
mgripper_2.request.duration = ros::Duration(-1);
lgripper_2.request.joint_name = "rx90_2::RX90_LGRIPPER_JOINT";
//lgripper_2.request.effort = 99;
lgripper_2.request.effort = 20;
lgripper_2.request.start_time = ros::Time(0);
lgripper_2.request.duration = ros::Duration(-1);
rgripper_2.request.joint_name = "rx90_2::RX90_RGRIPPER_JOINT";
rgripper_2.request.effort = -20;
rgripper_2.request.start_time = ros::Time(0);
rgripper_2.request.duration = ros::Duration(-1);
client.call(lgripper_2);
client.call(rgripper_2);
client.call(mgripper_2);
//sleep(5);
//mgripper_2.request.effort = -150;
//client.call(mgripper_2);
//CLIENT FOR MOVING THE OBJECT
ros::ServiceClient service_client = n.serviceClient<rx90_control::Set_activation>("Set_activation");
rx90_control::Set_activation srv;
srv.request.activation = 1;
if (!service_client.call(srv))
{
ROS_ERROR("Failed to call service Set_activation_client");
}
sendCommand("DO CLOSEI");
}
void Rx90::openIt(){
//Gazebo gripper visualization
ros::NodeHandle n;
ros::ServiceClient client = n.serviceClient<gazebo_msgs::ApplyJointEffort>("/gazebo/apply_joint_effort");
gazebo_msgs::ApplyJointEffort lgripper_2,rgripper_2, mgripper_2;
mgripper_2.request.joint_name = "rx90_2::RX90_MGRIPPER_JOINT";
//mgripper_2.request.effort = 99; //abrir
mgripper_2.request.effort = 20;
mgripper_2.request.start_time = ros::Time(0);
mgripper_2.request.duration = ros::Duration(-1);
lgripper_2.request.joint_name = "rx90_2::RX90_LGRIPPER_JOINT";
lgripper_2.request.effort = -20;
lgripper_2.request.start_time = ros::Time(0);
lgripper_2.request.duration = ros::Duration(-1);
rgripper_2.request.joint_name = "rx90_2::RX90_RGRIPPER_JOINT";
rgripper_2.request.effort = 20;
rgripper_2.request.start_time = ros::Time(0);
rgripper_2.request.duration = ros::Duration(-1);
client.call(mgripper_2);
client.call(lgripper_2);
client.call(rgripper_2);
//OBJECT FALLING
ros::ServiceClient service_client = n.serviceClient<rx90_control::Set_activation>("Set_activation");
rx90_control::Set_activation srv;
srv.request.activation = 0;
if (!service_client.call(srv))
{
ROS_ERROR("Failed to call service Set_activation_client");
}
sendCommand("DO OPENI");
}
void Callback(const sensor_msgs::JointState::ConstPtr& msg){
std::cout<<"\nj1:"<<msg->position[0]*360/(2*pi)
<<"\nj2:"<<msg->position[1]*360/(2*pi)+90
<<"\nj3:"<<msg->position[2]*360/(2*pi)-90 //esto esta aquí debido al cambio de coordenadas por el rx90 real
<<"\nj4:"<<msg->position[3]*360/(2*pi)
<<"\nj5:"<<msg->position[4]*360/(2*pi)
<<"\nj6:"<<msg->position[5]*360/(2*pi)
<<std::endl;
}
void Rx90::know_position(){
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/rx90_2/joint_states", 10,Callback);
//sleep(0.5);
int milisec = 500; // length of time to sleep, in miliseconds
struct timespec req = {0};
req.tv_sec = 0;
req.tv_nsec = milisec * 1000000L;
nanosleep(&req, (struct timespec *)NULL);
//nanosleep(500);
}
void Rx90::printAction(const Action& action)
{
std::cout << "Rx90::printAction: ";
switch (action)
{
case NONE:
std::cout << "none!";
break;
case UP:
std::cout << "up!";
break;
case DOWN:
std::cout << "down!";
break;
case RIGHT:
std::cout << "right!";
break;
case LEFT:
std::cout << "left!";
break;
case UP_RIGHT:
std::cout << "up-right!";
break;
case UP_LEFT:
std::cout << "up-left!";
break;
case DOWN_LEFT:
std::cout << "down-left!";
break;
case DOWN_RIGHT:
std::cout << "down-right!";
break;
case CATCH:
std::cout << "catch!";
break;
case OPEN:
std::cout << "open!";
break;
case POSITION:
std::cout << "moving to a position!";
break;
default:
std::cout << "unexpected!";
}
std::cout << std::endl;
}
void Rx90::rviz()
{
//ros::NodeHandle node_handle;
//ros::AsyncSpinner spinner(1);
//spinner.start();
static const std::string PLANNING_GROUP = "rx90_arm";
moveit::planning_interface::MoveGroupInterface move_group(PLANNING_GROUP);
moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
const robot_state::JointModelGroup* joint_model_group =
move_group.getCurrentState()->getJointModelGroup(PLANNING_GROUP);
namespace rvt = rviz_visual_tools;
moveit_visual_tools::MoveItVisualTools visual_tools("world"); // puede ser world
visual_tools.deleteAllMarkers();
visual_tools.loadRemoteControl();
Eigen::Affine3d text_pose = Eigen::Affine3d::Identity();
text_pose.translation().z() = 1.75;
visual_tools.publishText(text_pose, "Rx90 rviz control", rvt::WHITE, rvt::XLARGE);
visual_tools.trigger();
ROS_INFO_NAMED("tutorial", "Reference frame: %s", move_group.getPlanningFrame().c_str());
ROS_INFO_NAMED("tutorial", "End effector link: %s", move_group.getEndEffectorLink().c_str());
// z minimo real=270mm-370
// eje x e y cambiados
// al y le pones signo contrario
float x, y, z, rotx, roty, rotz, aux;
char send_position = 'y';
// std::string stg_x, stg_y, stg_z, stg_r, stg_p, stg_w;
std::string Point;
geometry_msgs::Pose target_pose1;
moveit::planning_interface::MoveGroupInterface::Plan my_plan;
bool success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
tf::Quaternion q;
printf("\033[01;33m");
printf("\nMoving to a pose. Enter the desired pose (milimeters and degrees)\n");
printf("\nx:");
std::cin >> x;
printf("\ny:");
std::cin >> y;
printf("\nz:");
std::cin >> z;
printf("\nrotx:");
std::cin >> rotx;
printf("\nroty:");
std::cin >> roty;
printf("\nrotz:");
std::cin >> rotz;
printf("\033[01;33m");
// cambio de coordenadas para el real
// y maxima 970, en simulacion 1080
// z max 970, minimo es -284. en simulacon la minima es 100 y maxima 1500. punto intermedio 500
// x max 970
// y=180 mira hacia abajo, 0 hacia arriba y 90 recto.
// posiciones que se le van a enviiar -89.57,-393.16,580.48,-167.73,73.76,-103.63
//-406.54,-273.28,847.70,-147.53,35.53,-147.83
// calibrar el robot es en putty:
//.cal
//.do ready
// 65.67,-355.19,k617.37,-145.87,53.40,-117.86
y = y * 1080 / 970;
x = x * 1080 / 970;
z = z + 284;
z = z * 1350 / 1254;
z = z + 100;
aux = x;
x = y;
y = aux;
x = (-1) * x;
x = x / 1000;
y = y / 1000;
z = z / 1000;
rotz = rotz + 90;
roty = roty - 90;
// changing into radians
rotx = rotx * 2 * pi / 360;
roty = roty * 2 * pi / 360;
rotz = rotz * 2 * pi / 360;
q.setEulerZYX(rotz, roty, rotx);
if (z < 0.1)
{
printf("\033[1;31m");
printf("\n[ERROR]: Variable 'z' must be mayor than 100");
printf("\033[1;31m");
}
else
{
target_pose1.orientation.w = q.w();
target_pose1.position.x = x;
target_pose1.position.y = y;
target_pose1.position.z = z;
target_pose1.orientation.x = q.x();
target_pose1.orientation.y = q.y();
target_pose1.orientation.z = q.z();
move_group.setPoseTarget(target_pose1);
move_group.move();
// move_group.setRPYTarget(xx,yy,zz);
success = (move_group.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
ROS_INFO_NAMED("tutorial", "Visualizing plan 1 (pose goal) %s", success ? "" : "FAILED");
ROS_INFO_NAMED("tutorial", "Visualizing plan 1 as trajectory line");
visual_tools.publishAxisLabeled(target_pose1, "pose1");
visual_tools.publishText(text_pose, "Pose Goal", rvt::WHITE, rvt::XLARGE);
visual_tools.publishTrajectoryLine(my_plan.trajectory_, joint_model_group);
visual_tools.trigger();
printf("\nSend position to Gazebo?:[y/n]");
std::cin >> send_position;
if (send_position == 'y')
{
std::cout << "Reading joints positions " << std::endl;
moveit::core::RobotStatePtr current_state = move_group.getCurrentState();
std::vector<double> joint_group_positions;
current_state->copyJointGroupPositions(joint_model_group, joint_group_positions);
float j1,j2,j3,j4,j5,j6;
// Cambio de coordenadas de gazebo a robot real para enviarselas al rx90
j1=joint_group_positions[0]*360/(2*pi)*(-1);
j2=joint_group_positions[1]*360/(2*pi);
j2=j2-90;
j3=joint_group_positions[2]*360/(2*pi);
j3=j3+90;
j4=joint_group_positions[3]*360/(2*pi);
j5=joint_group_positions[4]*360/(2*pi);
j6=joint_group_positions[5]*360/(2*pi);
gazebo(j1,j2,j3,j4,j5,j6,'y');
}
}
//rviz_check_collision(); //not necesary in our case
}
void Rx90::rviz_check_collision(){
robot_model_loader::RobotModelLoader robot_model_loader("robot_description");
robot_model::RobotModelPtr kinematic_model = robot_model_loader.getModel();
planning_scene::PlanningScene planning_scene(kinematic_model);
collision_detection::CollisionRequest collision_request;
collision_detection::CollisionResult collision_result;
planning_scene.checkSelfCollision(collision_request, collision_result);
ROS_INFO_STREAM("[Checking collision]: Current state is "
<< (collision_result.collision ? "in" : "not in")
<< " self collision");
}
//void cb(ConstWorldStatisticsPtr &_msg)
void Rx90::callb(ConstContactsPtr &_msg)
{
//std::cout<<_msg->contact_size()<<std::endl;
//si hay contacto que no deje mandar acción a el robot real
if(_msg->contact_size()!=0)
{
mandar_accion=false;
contador_contactos=0;
}
else{
contador_contactos++;
}
//si ya no está tocando...
if(contador_contactos==10){
mandar_accion=true;
}
}
void Rx90::gazebo(float _j1, float _j2, float _j3, float _j4, float _j5, float _j6, char send){
std_msgs::Float64 msg;
msg.data = 0;
ros::NodeHandle n;
char send_position='y';
ros::Publisher pub_shoulder_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_SHOULDER_JOINT_position_controller/command", 1000);
ros::Publisher pub_arm_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_ARM_JOINT_position_controller/command", 1000);
ros::Publisher pub_elbow_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_ELBOW_JOINT_position_controller/command", 1000);
ros::Publisher pub_forearm_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_FOREARM_JOINT_position_controller/command", 1000);
ros::Publisher pub_wrist_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_WRIST_JOINT_position_controller/command", 1000);
ros::Publisher pub_flange_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_FLANGE_JOINT_position_controller/command", 1000);
ros::Publisher pub_lgripper_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_LGRIPPER_JOINT_position_controller/command", 1000);
ros::Publisher pub_rgripper_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_RGRIPPER_JOINT_position_controller/command", 1000);
ros::Publisher pub_mgripper_1 = n.advertise<std_msgs::Float64>("/rx90_1/RX90_MGRIPPER_JOINT_position_controller/command", 1000);
ros::Publisher pub_shoulder_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_SHOULDER_JOINT_position_controller/command", 1000);
ros::Publisher pub_arm_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_ARM_JOINT_position_controller/command", 1000);
ros::Publisher pub_elbow_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_ELBOW_JOINT_position_controller/command", 1000);
ros::Publisher pub_forearm_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_FOREARM_JOINT_position_controller/command", 1000);
ros::Publisher pub_wrist_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_WRIST_JOINT_position_controller/command", 1000);
ros::Publisher pub_flange_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_FLANGE_JOINT_position_controller/command", 1000);
ros::Publisher pub_lgripper_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_LGRIPPER_JOINT_position_controller/command", 1000);
ros::Publisher pub_rgripper_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_RGRIPPER_JOINT_position_controller/command", 1000);
ros::Publisher pub_mgripper_2 = n.advertise<std_msgs::Float64>("/rx90_2/RX90_MGRIPPER_JOINT_position_controller/command", 1000);
gazebo::transport::NodePtr node(new gazebo::transport::Node());
node->Init();
// Listen to Gazebo topic for cheking collisions(different from ros topics)
gazebo::transport::SubscriberPtr sub = node->Subscribe("~/physics/contacts", Rx90::callb);
//gazebo::transport::SubscriberPtr sub = node->Subscribe("~/world_stats", cb);
ros::Rate loop_rate(10);
float j1,j2,j3,j4,j5,j6;
if(send=='n') //Las posiciones de las joints no vienen de la función rviz
{
printf("\nREADY! give me the joints in degrees (j1,j2,j3,j4,j5,j6)"); //Coordenadas del sistema de referencia del mando del Rx90
printf("\nj1:");
std::cin>>j1;
printf("\nj2:");
std::cin>>j2;
printf("\nj3:");
std::cin>>j3;
printf("\nj4:");
std::cin>>j4;
printf("\nj5:");
std::cin>>j5;
printf("\nj6:");
std::cin>>j6;
// truncamos para que podamos enviar las posiciones
j1=truncate(j1,0);
j2=truncate(j2,0);
j3=truncate(j3,0);
j4=truncate(j4,0);
j5=truncate(j5,0);
j6=truncate(j6,0);
}
else
{
std::cout<<"Gazebo function"<<std::endl; //Coordenadas del sistema de referencia del mando del Rx90
sleep(2);
j1=truncate(_j1,0);
j2=truncate(_j2,0);
j3=truncate(_j3,0);
j4=truncate(_j4,0);
j5=truncate(_j5,0);
j6=truncate(_j6,0);
}
int prohibited_joint=0;
/* if(j1>155 || j1< -155)
{
printf("\n[ERROR]: Joint 1 max limit is 155º and min limit is -155º .Exiting...\n");
prohibited_joint=1;
}
else if(j2> 18 || j2< -198){
printf("\n[ERROR]: Joint 2 max limit is 18º and min limit is -198º .Exiting...\n");
prohibited_joint=1;
}
else if(j3> 231 || j3< -52){
printf("\n[ERROR]: Joint 3 max limit is 231º and min limit is -52º .Exiting...\n");
prohibited_joint=1;
}
else if(j4> 268 || j4< -268){
printf("\n[ERROR]: Joint 4 max limit is 268º and min limit is -268º .Exiting...\n");
prohibited_joint=1;
}
else if(j5> 118 || j5< -102){
printf("\n[ERROR]: Joint 5 max limit is 118º and min limit is -102º .Exiting...\n");
prohibited_joint=1;
}
else if(j6> 268 || j6< -268){
printf("\n[ERROR]: Joint 6 max limit is 268º and min limit is -268º. Exiting...\n");
prohibited_joint=1;
}*/
if(prohibited_joint==0){
//Se hace antes para no pillar las transformaciones a Gazebo
std::string Joints;
std::string stg_j1,stg_j2,stg_j3,stg_j4,stg_j5,stg_j6;
stg_j1 =static_cast<std::ostringstream*>(&(std::ostringstream() << j1))->str();
stg_j2 =static_cast<std::ostringstream*>(&(std::ostringstream() << j2))->str();
stg_j3 =static_cast<std::ostringstream*>(&(std::ostringstream() << j3))->str();
stg_j4 =static_cast<std::ostringstream*>(&(std::ostringstream() << j4))->str();
stg_j5 =static_cast<std::ostringstream*>(&(std::ostringstream() << j5))->str();
stg_j6 =static_cast<std::ostringstream*>(&(std::ostringstream() << j6))->str();
//Changing to radians and changing the sign Lo cambio aquí porque es peor cambiar el urdf
//Este cambio solo sirve para la simulación de gazebo
j1=j1*2*pi/360;
j1=j1* (-1);
j2=j2+90;
j2=j2*2*pi/360;
j3=j3-90;
j3=j3*2*pi/360;
j4=j4*2*pi/360;
j5=j5*2*pi/360;
j6=j6*2*pi/360;
//Publicación en gazebo
msg.data=j1;
pub_shoulder_2.publish(msg);
msg.data=j2;
pub_arm_2.publish(msg);
msg.data=j3;
pub_elbow_2.publish(msg);
msg.data=j4;
pub_forearm_2.publish(msg);
msg.data=j5;
pub_wrist_2.publish(msg);
msg.data=j6;
pub_flange_2.publish(msg);
std::cout<<"Waiting 10 seconds for checking collisions in gazebo..."<<std::endl;
sleep(10);
////////////////////////////////////////////Meter restricciones de los joints para dejar enviar o no
if(mandar_accion==true){
printf("\nSend position to real Rx90?:[y/n]");
std::cin>>send_position;
if(send_position=='y')
{
//Se manda sin los cambios de coordenadas realizados a Gazebo
Joints=stg_j1+","+stg_j2+","+stg_j3+","+stg_j4+","+stg_j5+","+stg_j6;
std::cout<< "\n" << Joints <<std::endl;
std::cout<<"posiciones mandadas"<<std::endl;
move_position(Joints);
}
}
else{
printf("\nYou can't send real position due to collisions\n");
//reseteamos mandar cción para la proxima iteracción
mandar_accion=true;
}
contador_contactos=0;
}
}
| [
"luismarzor@gmail.com"
] | luismarzor@gmail.com |
b2882d8d1cd12d95e925d51f56d0cb111f2442ec | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/git/new_hunk_4445.cpp | 1615581eb2778212cf74278c413e8bccf11dc70d | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 188 | cpp | save_commit_buffer = 0;
if (longformat && abbrev == 0)
die(_("--long is incompatible with --abbrev=0"));
if (contains) {
const char **args = xmalloc((7 + argc) * sizeof(char *));
| [
"993273596@qq.com"
] | 993273596@qq.com |
98c9a1e6b9c495bb5615c5879c5bcc5aa361423a | 193b65f84570c7dbf0402a9213eaafba18f3fe78 | /BaekJoon_11051/BaekJoon_11051/Main.cpp | d70e660767091ea1c1f13337295053414eb835b5 | [] | no_license | nostrado/Algorithm | b43e9d5d662f6735624df56664c7ecec30123d62 | b32a1933f727d6938b006522e3e24693abb089e9 | refs/heads/master | 2021-06-12T02:11:02.521784 | 2017-02-12T11:45:37 | 2017-02-12T11:45:37 | 71,788,431 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 745 | cpp | /*
- 이항 계수 2(11051) / BaekJoon Online Judge
- 2016.11.26
- 작성자: solstar
- 파스칼의삼각형, 동적 계획법
- 나머지 연산의 성질:
(a+b) mod n = (a mod n + b mod n) mod n (사용)
(a-b) mod n = (a mod n - b mod n) mod n
(axb) mod n = (a mod n x b mod n) mod n
*/
#include <iostream>
#include <algorithm>
using namespace std;
const long long mod = 10007;
int board[1001][1001];
int main(void) {
int N = 0, K = 0;
cin >> N >> K;
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= min(i, K); j++) {
if (j == 0 || j == i) {
board[i][j] = 1;
}
else {
board[i][j] = (board[i - 1][j - 1] + board[i - 1][j]) % mod;
}
}
}
cout << board[N][K] << "\n";
return 0;
} | [
"mar1st1145@gmail.com"
] | mar1st1145@gmail.com |
bc4350579c91c477b99f339d29dc62be0bd2e666 | 8faee0b01b9afed32bb5b7ef1ab0dcbc46788b5b | /source/src/app/netcache/time_man.cpp | d592d641b04d8c0f455f0dce37957d2774ca598e | [] | no_license | jackgopack4/pico-blast | 5fe3fa1944b727465845e1ead1a3c563b43734fb | cde1bd03900d72d0246cb58a66b41e5dc17329dd | refs/heads/master | 2021-01-14T12:31:05.676311 | 2014-05-17T19:22:05 | 2014-05-17T19:22:05 | 16,808,473 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,139 | cpp | /* $Id: time_man.cpp 369331 2012-07-18 15:07:38Z gouriano $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: Pavel Ivanov
*
*/
#include "task_server_pch.hpp"
#include <corelib/ncbireg.hpp>
#include "time_man.hpp"
BEGIN_NCBI_SCOPE;
class CTZAdjuster : public CSrvTask
{
public:
CTZAdjuster(void);
virtual ~CTZAdjuster(void);
private:
virtual void ExecuteSlice(TSrvThreadNum thr_num);
};
CSrvTime s_SrvStartTime;
CSrvTime s_LastJiffyTime;
Uint4 s_CurJiffies = 0;
CSrvTime s_JiffyTime;
static time_t s_TZAdjustment = 0;
static CTZAdjuster* s_Adjuster = NULL;
static Uint4
s_InitTZAdjustment(void)
{
#ifdef NCBI_OS_LINUX
CSrvTime srv_t = CSrvTime::Current();
struct tm t;
gmtime_r(&srv_t.Sec(), &t);
t.tm_isdst = -1;
time_t loc_time = mktime(&t);
s_TZAdjustment = srv_t.Sec() - loc_time;
// Return number of seconds until it's 1 second after the hour boundary
return (60 - t.tm_min) * 60 - (t.tm_sec - 1);
#else
return 0;
#endif
}
void
InitTime(void)
{
s_LastJiffyTime = s_SrvStartTime = CSrvTime::Current();
s_InitTZAdjustment();
}
void
InitTimeMan(void)
{
s_Adjuster = new CTZAdjuster();
s_Adjuster->SetRunnable();
}
void
ConfigureTimeMan(CNcbiRegistry* reg, CTempString section)
{
Uint4 clock_freq = Uint4(reg->GetInt(section, "jiffies_per_sec", 100));
s_JiffyTime.NSec() = kUSecsPerSecond * kNSecsPerUSec / clock_freq;
}
void
IncCurJiffies(void)
{
s_LastJiffyTime = CSrvTime::Current();
++s_CurJiffies;
}
static inline void
s_Print1Dig(char*& buf, int num)
{
*(buf++) = char(num + '0');
}
static inline void
s_Print2Digs(char*& buf, int num)
{
int hi = num / 10;
s_Print1Dig(buf, hi);
s_Print1Dig(buf, num - hi * 10);
}
static inline void
s_Print3Digs(char*& buf, int num)
{
int hi = num / 100;
s_Print1Dig(buf, hi);
s_Print2Digs(buf, num - hi * 100);
}
static inline void
s_Print4Digs(char*& buf, int num)
{
int hi = num / 100;
s_Print2Digs(buf, hi);
s_Print2Digs(buf, num - hi * 100);
}
static inline void
s_Print6Digs(char*& buf, int num)
{
int hi = num / 100;
s_Print4Digs(buf, hi);
s_Print2Digs(buf, num - hi * 100);
}
Uint1
CSrvTime::Print(char* buf, EFormatType fmt) const
{
char* start_buf = buf;
#ifdef NCBI_OS_LINUX
time_t sec = tv_sec + s_TZAdjustment;
struct tm t;
gmtime_r(&sec, &t);
switch (fmt) {
case eFmtLogging:
s_Print4Digs(buf, t.tm_year + 1900);
*(buf++) = '-';
s_Print2Digs(buf, t.tm_mon + 1);
*(buf++) = '-';
s_Print2Digs(buf, t.tm_mday);
*(buf++) = 'T';
s_Print2Digs(buf, t.tm_hour);
*(buf++) = ':';
s_Print2Digs(buf, t.tm_min);
*(buf++) = ':';
s_Print2Digs(buf, t.tm_sec);
*(buf++) = '.';
s_Print6Digs(buf, int(tv_nsec / kNSecsPerUSec));
break;
case eFmtHumanSeconds:
case eFmtHumanUSecs:
s_Print2Digs(buf, t.tm_mon + 1);
*(buf++) = '/';
s_Print2Digs(buf, t.tm_mday);
*(buf++) = '/';
s_Print4Digs(buf, t.tm_year + 1900);
*(buf++) = ' ';
s_Print2Digs(buf, t.tm_hour);
*(buf++) = ':';
s_Print2Digs(buf, t.tm_min);
*(buf++) = ':';
s_Print2Digs(buf, t.tm_sec);
if (fmt == eFmtHumanUSecs) {
*(buf++) = '.';
s_Print6Digs(buf, int(tv_nsec / kNSecsPerUSec));
}
break;
default:
abort();
}
#endif
*buf = '\0';
return Uint1(buf - start_buf);
}
int
CSrvTime::TZAdjustment(void)
{
return int(s_TZAdjustment);
}
CTZAdjuster::CTZAdjuster(void)
{}
CTZAdjuster::~CTZAdjuster(void)
{}
void
CTZAdjuster::ExecuteSlice(TSrvThreadNum /* thr_num */)
{
// on one second after an hour, calculates difference with GMT time
Uint4 delay = s_InitTZAdjustment();
if (!CTaskServer::IsInShutdown())
RunAfter(delay);
}
END_NCBI_SCOPE;
| [
"jackgopack4@gmail.com"
] | jackgopack4@gmail.com |
221237599be8a0ad53e3eddfa6b13d606b1aa69d | 3e5b2b44d04e738e6c107ad99bb38912bce74df4 | /Algorithm-C++/Algorithm/HeapTestHelper.cpp | 722d0f0f316b598322151ced2cabbdb9c04d4334 | [] | no_license | birneysky/SwiftStudy | 16073f1234c1eb905cb544529deae3dc29478641 | 047a552fb9cc2b07639e815ce2ad8ba61503cadc | refs/heads/master | 2021-01-13T11:18:29.755367 | 2019-05-14T09:03:15 | 2019-05-14T09:03:15 | 81,413,203 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 665 | cpp | //
// HeapTestHelper.cpp
// Algorithm
//
// Created by birneysky on 2017/2/25.
// Copyright © 2017年 birneysky. All rights reserved.
//
#include "HeapTestHelper.hpp"
#include "MaxHeap.hpp"
#include <iostream>
void HeapTestHelper::testHeap()
{
int n = 100;
MaxHeap<int> maxHeap = MaxHeap<int>(n);
std::cout << "max heap size : " << maxHeap.size() << std::endl;
srand((unsigned int)(time(NULL)));
for( int i = 0; i <15; i++ ){
maxHeap.insert(rand() % 100);
}
// maxHeap.testPrint();
maxHeap.extractMax();
// maxHeap.testPrint();
// std::cout << "max heap size : " << maxHeap.size() << std::endl;
}
| [
"birneysky@163.com"
] | birneysky@163.com |
60e6813f879440bafd782d9057f5f34677ce44af | a8f4ba1a8144d461e4bfe7c41e674615de10ee34 | /client/Classes/AchievementSystem/AchievementSurvival.cpp | c5d3a7a80c6c7485ac0dbe8fa458ee23c65676d8 | [
"Apache-2.0"
] | permissive | gdtdftdqtd/BaseWar | 0e8ff1e9a8809b32bfe11474da5aa94f8b556fe3 | c1c98a9f431ebca7944a55495938da0334319afb | refs/heads/master | 2023-03-08T13:00:20.847125 | 2023-02-12T15:05:40 | 2023-02-12T15:05:40 | 42,637,417 | 0 | 0 | Apache-2.0 | 2023-02-12T15:05:41 | 2015-09-17T05:47:29 | C++ | UTF-8 | C++ | false | false | 838 | cpp | /*
* Tools.cpp
*
* Created on: 11.01.2014
* Author: Planke
*/
#include "AchievementSurvival.h"
#include "../Tools/Tools.h"
AchievementSurvival::AchievementSurvival(AchievementSurvivalEnum min) :
Achievement("", "", "Survivor", "", 20) {
switch (min) {
case SURVIVLE_5:
_min = 5;
break;
case SURVIVLE_11:
_min = 11;
break;
case SURVIVLE_23:
_min = 23;
break;
case SURVIVLE_41:
_min = 41;
break;
}
_description = "Survive " + Tools::toString(_min) + " minutes at survival difficulty.";
_image = "achievementSurvival" + Tools::toString(_min) + ".png";
_persistentLoadSaveId = "cachievementSurvival" + Tools::toString((int) min);
_timeAchieved = getAchievementAchievedPersistent();
}
bool AchievementSurvival::isAchievedInternCalculation() {
return false;
}
| [
"klaus.plankensteiner@gmx.at"
] | klaus.plankensteiner@gmx.at |
ab8518328f6937a6d90fc8ee03f97eb959d0bc74 | 9736e73ddb97fdc40ecd12c57915722ce01b78ed | /pporoshin_task_4/func_sim/func_memory/func_memory.cpp | a06fcd214d045b1a6f286cc89fc9348b4785ba56 | [
"MIT"
] | permissive | MIPT-ILab/mipt-mips-old-branches | 2f1a96c90234f1cf21341b949fc105dcdbd18454 | a4e17025999b15d423601cf38a84234c5c037b33 | refs/heads/master | 2021-03-12T18:00:25.684770 | 2017-05-17T21:13:56 | 2017-05-17T21:13:56 | 91,449,696 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,783 | cpp | /**
* func_memory.cpp - the module implementing the concept of
* programer-visible memory space accesing via memory address.
* @author Alexander Titov <alexander.igorevich.titov@gmail.com>
* Copyright 2012 uArchSim iLab project
*/
// Generic C
#include <cassert>
#include <cstdlib>
#include <cstring> // for strcmp function
// Generic C++
#include <iostream>
#include <string>
#include <sstream>
// uArchSim modules
#include <func_memory.h>
FuncMemory::FuncMemory( const char* executable_file_name)
: start_PC( NO_VAL64)
{
const char* const section_names[] = {".data", ".text"};
this->Init(executable_file_name, section_names, 2);
}
void FuncMemory::Init( const char* executable_file_name,
const char* const elf_sections_names[],
unsigned short num_of_elf_sections)
{
assert( executable_file_name != NULL);
assert( elf_sections_names != NULL);
assert( num_of_elf_sections > 0);
for ( unsigned short i = 0; i < num_of_elf_sections; ++i)
{
// create the section
ElfSection* sect = new ElfSection( executable_file_name,
elf_sections_names[i]);
// Insert the pointer to the section into the map
// where the section start address is used as a key.
pair<Iter, bool /*is not duplicated*/> status =
this->sections.insert( make_pair( sect->startAddr(), sect));
// It is assumed that the first instruction in the ".text" section
// is the first instruction of the program.
if ( strcmp( elf_sections_names[ i], ".text") == 0)
{
this->start_PC = sect->startAddr();
}
if ( status.second == false) // a section with the same start addr
{ // has already been added
cerr << "ERROR: section \"" << elf_sections_names[i] << "\" exists more"
<< endl << "then two time in the list of ELF sections passed into"
<< endl << "the constructor of a functional memory object" << endl;
exit( EXIT_FAILURE);
}
}
// Check that the start PC was initialized.
if ( this->start_PC == NO_VAL64)
{
cerr << "ERROR: start PC was not set. It means that section \".text\""
<< endl << "was not provide to the constructor of the functional memory"
<< endl;
exit( EXIT_FAILURE);
}
}
FuncMemory::~FuncMemory()
{
// free memory that was allocate in the constructor for ELF sections
for ( Iter it = this->sections.begin(); it != this->sections.end(); ++it)
delete (*it).second; // delete an ELF section object through a pointer to it
}
uint64 FuncMemory::read( uint64 addr, unsigned short num_of_bytes) const
{
assert( num_of_bytes > 0);
// check that the requested data can be returned via uint64
assert( num_of_bytes <= sizeof( uint64));
// Recieve an iterator of the section which start address
// is greater than the read address
ConstIter nextSectIt = this->sections.upper_bound( addr);
// Check that this section is not the first,
// Otherwise that the read address refer to the location
// outside the memory.
assert( nextSectIt != this->sections.begin());
// The data has be in the previous section
const ElfSection* sect = (*( --nextSectIt)).second;
assert( sect->isInside( addr, num_of_bytes));
return sect->read( addr, num_of_bytes);
}
void FuncMemory::write( uint64 value, uint64 addr, unsigned short num_of_bytes)
{
assert( num_of_bytes > 0);
// check that the requested data can be returned via uint64
assert( num_of_bytes <= sizeof( uint64));
// Recieve an iterator of the section which start address
// is greater than the read address
Iter nextSectIt = this->sections.upper_bound( addr);
// Check that this section is not the first,
// Otherwise that the read address refer to the location
// outside the memory.
assert( nextSectIt != this->sections.begin());
// The data has be in the previous section
ElfSection* sect = (*( --nextSectIt)).second;
assert( sect->isInside( addr, num_of_bytes));
sect->write( value, addr, num_of_bytes);
}
uint64 FuncMemory::startPC() const
{
return this->start_PC;
}
string FuncMemory::dump( string indent) const
{
ostringstream oss;
oss << "Dump all the ELF sections of the functional memory" << endl;
// dumpt content of each section with an indent of two blanks
for ( ConstIter it = this->sections.begin(); it != this->sections.end(); ++it)
oss << (( *it).second)->dump( " ");
return oss.str();
}
| [
"alexander.igorevich.titov@gmail.com@8191d7f6-0415-6e15-5cfd-e6cccd3c4e6a"
] | alexander.igorevich.titov@gmail.com@8191d7f6-0415-6e15-5cfd-e6cccd3c4e6a |
2d6f14d0dbb1f0bf1fd3d7434eeb82f5aaa23935 | 91a3a43bd5ee66923e11ad13d11213e367d5f9d5 | /src/Magnum/Math/DualQuaternion.h | 154afb96fd634dffa73d870dd660233a31ec2b49 | [
"MIT"
] | permissive | peterdachuan/magnum | b85d59ffbb37678ac094ad0a57778bcf3971da82 | d4ee9b7184ae900252d8bb41990f195dede4885e | refs/heads/master | 2021-01-21T02:24:04.126886 | 2015-10-06T18:06:50 | 2015-10-06T18:06:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,868 | h | #ifndef Magnum_Math_DualQuaternion_h
#define Magnum_Math_DualQuaternion_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
/** @file
* @brief Class @ref Magnum::Math::DualQuaternion
*/
#include "Magnum/Math/Dual.h"
#include "Magnum/Math/Matrix4.h"
#include "Magnum/Math/Quaternion.h"
namespace Magnum { namespace Math {
namespace Implementation {
template<class, class> struct DualQuaternionConverter;
}
/**
@brief Dual quaternion
@tparam T Underlying data type
Represents 3D rotation and translation. See @ref transformations for brief
introduction.
@see @ref Magnum::DualQuaternion, @ref Magnum::DualQuaterniond, @ref Dual,
@ref Quaternion, @ref Matrix4
*/
template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
public:
typedef T Type; /**< @brief Underlying data type */
/**
* @brief Rotation dual quaternion
* @param angle Rotation angle (counterclockwise)
* @param normalizedAxis Normalized rotation axis
*
* Expects that the rotation axis is normalized. @f[
* \hat q = [\boldsymbol a \cdot sin \frac \theta 2, cos \frac \theta 2] + \epsilon [\boldsymbol 0, 0]
* @f]
* @see @ref rotation() const, @ref Quaternion::rotation(),
* @ref Matrix4::rotation(), @ref DualComplex::rotation(),
* @ref Vector3::xAxis(), @ref Vector3::yAxis(),
* @ref Vector3::zAxis(), @ref Vector::isNormalized()
*/
static DualQuaternion<T> rotation(Rad<T> angle, const Vector3<T>& normalizedAxis) {
return {Quaternion<T>::rotation(angle, normalizedAxis), {{}, T(0)}};
}
/** @todo Rotation about axis with arbitrary origin, screw motion */
/**
* @brief Translation dual quaternion
* @param vector Translation vector
*
* @f[
* \hat q = [\boldsymbol 0, 1] + \epsilon [\frac{\boldsymbol v}{2}, 0]
* @f]
* @see @ref translation() const,
* @ref Matrix4::translation(const Vector3<T>&),
* @ref DualComplex::translation(), @ref Vector3::xAxis(),
* @ref Vector3::yAxis(), @ref Vector3::zAxis()
*/
static DualQuaternion<T> translation(const Vector3<T>& vector) {
return {{}, {vector/T(2), T(0)}};
}
/**
* @brief Create dual quaternion from transformation matrix
*
* Expects that the matrix represents rigid transformation.
* @see @ref toMatrix(), @ref Quaternion::fromMatrix(),
* @ref Matrix4::isRigidTransformation()
*/
static DualQuaternion<T> fromMatrix(const Matrix4<T>& matrix) {
CORRADE_ASSERT(matrix.isRigidTransformation(),
"Math::DualQuaternion::fromMatrix(): the matrix doesn't represent rigid transformation", {});
Quaternion<T> q = Implementation::quaternionFromMatrix(matrix.rotationScaling());
return {q, Quaternion<T>(matrix.translation()/2)*q};
}
/**
* @brief Default constructor
*
* Creates unit dual quaternion. @f[
* \hat q = [\boldsymbol 0, 1] + \epsilon [\boldsymbol 0, 0]
* @f]
*/
constexpr /*implicit*/ DualQuaternion(IdentityInitT = IdentityInit)
/** @todoc remove workaround when doxygen is sane */
#ifndef DOXYGEN_GENERATING_OUTPUT
: Dual<Quaternion<T>>({}, {{}, T(0)})
#endif
{}
/** @brief Construct zero-initialized dual quaternion */
constexpr explicit DualQuaternion(ZeroInitT)
/** @todoc remove workaround when doxygen is sane */
#ifndef DOXYGEN_GENERATING_OUTPUT
/* MSVC 2015 can't handle {} here */
: Dual<Quaternion<T>>(Quaternion<T>{ZeroInit}, Quaternion<T>{ZeroInit})
#endif
{}
/** @brief Construct without initializing the contents */
explicit DualQuaternion(NoInitT)
/** @todoc remove workaround when doxygen is sane */
#ifndef DOXYGEN_GENERATING_OUTPUT
/* MSVC 2015 can't handle {} here */
: Dual<Quaternion<T>>(NoInit)
#endif
{}
/**
* @brief Construct dual quaternion from real and dual part
*
* @f[
* \hat q = q_0 + \epsilon q_\epsilon
* @f]
*/
constexpr /*implicit*/ DualQuaternion(const Quaternion<T>& real, const Quaternion<T>& dual = Quaternion<T>({}, T(0))): Dual<Quaternion<T>>(real, dual) {}
/**
* @brief Construct dual quaternion from vector
*
* To be used in transformations later. @f[
* \hat q = [\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]
* @f]
* @see @ref transformPointNormalized()
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
constexpr explicit DualQuaternion(const Vector3<T>& vector);
#else
constexpr explicit DualQuaternion(const Vector3<T>& vector): Dual<Quaternion<T>>({}, {vector, T(0)}) {}
#endif
/** @brief Construct dual quaternion from external representation */
template<class U, class V = decltype(Implementation::DualQuaternionConverter<T, U>::from(std::declval<U>()))>
#ifndef CORRADE_MSVC2015_COMPATIBILITY
/* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */
constexpr
#endif
explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter<T, U>::from(other)} {}
/** @brief Copy constructor */
constexpr DualQuaternion(const Dual<Quaternion<T>>& other): Dual<Quaternion<T>>(other) {}
/** @brief Convert dual quaternion to external representation */
template<class U, class V = decltype(Implementation::DualQuaternionConverter<T, U>::to(std::declval<DualQuaternion<T>>()))> constexpr explicit operator U() const {
return Implementation::DualQuaternionConverter<T, U>::to(*this);
}
/**
* @brief Whether the dual quaternion is normalized
*
* Dual quaternion is normalized if it has unit length: @f[
* |\hat q|^2 = |\hat q| = 1 + \epsilon 0
* @f]
* @see @ref lengthSquared(), @ref normalized()
* @todoc Improve the equation as in Quaternion::isNormalized()
*/
bool isNormalized() const {
/* Comparing dual part classically, as comparing sqrt() of it would
lead to overly strict precision */
Dual<T> a = lengthSquared();
return Implementation::isNormalizedSquared(a.real()) &&
TypeTraits<T>::equals(a.dual(), T(0));
}
/**
* @brief Rotation part of unit dual quaternion
*
* @see @ref Quaternion::angle(), @ref Quaternion::axis()
*/
constexpr Quaternion<T> rotation() const {
return Dual<Quaternion<T>>::real();
}
/**
* @brief Translation part of unit dual quaternion
*
* @f[
* \boldsymbol a = 2 (q_\epsilon q_0^*)_V
* @f]
* @see @ref translation(const Vector3<T>&)
*/
Vector3<T> translation() const {
return (Dual<Quaternion<T>>::dual()*Dual<Quaternion<T>>::real().conjugated()).vector()*T(2);
}
/**
* @brief Convert dual quaternion to transformation matrix
*
* @see @ref fromMatrix(), @ref Quaternion::toMatrix()
*/
Matrix4<T> toMatrix() const {
return Matrix4<T>::from(Dual<Quaternion<T>>::real().toMatrix(), translation());
}
/**
* @brief Quaternion-conjugated dual quaternion
*
* @f[
* \hat q^* = q_0^* + q_\epsilon^*
* @f]
* @see @ref dualConjugated(), @ref conjugated(),
* @ref Quaternion::conjugated()
*/
DualQuaternion<T> quaternionConjugated() const {
return {Dual<Quaternion<T>>::real().conjugated(), Dual<Quaternion<T>>::dual().conjugated()};
}
/**
* @brief Dual-conjugated dual quaternion
*
* @f[
* \overline{\hat q} = q_0 - \epsilon q_\epsilon
* @f]
* @see @ref quaternionConjugated(), @ref conjugated(),
* @ref Dual::conjugated()
*/
DualQuaternion<T> dualConjugated() const {
return Dual<Quaternion<T>>::conjugated();
}
/**
* @brief Conjugated dual quaternion
*
* Both quaternion and dual conjugation. @f[
* \overline{\hat q^*} = q_0^* - \epsilon q_\epsilon^* = q_0^* + \epsilon [\boldsymbol q_{V \epsilon}, -q_{S \epsilon}]
* @f]
* @see @ref quaternionConjugated(), @ref dualConjugated(),
* @ref Quaternion::conjugated(), @ref Dual::conjugated()
*/
DualQuaternion<T> conjugated() const {
return {Dual<Quaternion<T>>::real().conjugated(), {Dual<Quaternion<T>>::dual().vector(), -Dual<Quaternion<T>>::dual().scalar()}};
}
/**
* @brief Dual quaternion length squared
*
* Should be used instead of @ref length() for comparing dual
* quaternion length with other values, because it doesn't compute the
* square root. @f[
* |\hat q|^2 = \sqrt{\hat q^* \hat q}^2 = q_0 \cdot q_0 + \epsilon 2 (q_0 \cdot q_\epsilon)
* @f]
*/
Dual<T> lengthSquared() const {
return {Dual<Quaternion<T>>::real().dot(), T(2)*dot(Dual<Quaternion<T>>::real(), Dual<Quaternion<T>>::dual())};
}
/**
* @brief Dual quaternion length
*
* See @ref lengthSquared() which is faster for comparing length with other
* values. @f[
* |\hat q| = \sqrt{\hat q^* \hat q} = |q_0| + \epsilon \frac{q_0 \cdot q_\epsilon}{|q_0|}
* @f]
*/
Dual<T> length() const {
return Math::sqrt(lengthSquared());
}
/**
* @brief Normalized dual quaternion (of unit length)
*
* @see @ref isNormalized()
*/
DualQuaternion<T> normalized() const {
return (*this)/length();
}
/**
* @brief Inverted dual quaternion
*
* See @ref invertedNormalized() which is faster for normalized dual
* quaternions. @f[
* \hat q^{-1} = \frac{\hat q^*}{|\hat q|^2}
* @f]
*/
DualQuaternion<T> inverted() const {
return quaternionConjugated()/lengthSquared();
}
/**
* @brief Inverted normalized dual quaternion
*
* Equivalent to @ref quaternionConjugated(). Expects that the
* quaternion is normalized. @f[
* \hat q^{-1} = \frac{\hat q^*}{|\hat q|^2} = \hat q^*
* @f]
* @see @ref isNormalized(), @ref inverted()
*/
DualQuaternion<T> invertedNormalized() const {
CORRADE_ASSERT(isNormalized(),
"Math::DualQuaternion::invertedNormalized(): dual quaternion must be normalized", {});
return quaternionConjugated();
}
/**
* @brief Rotate and translate point with dual quaternion
*
* See @ref transformPointNormalized(), which is faster for normalized
* dual quaternions. @f[
* v' = \hat q v \overline{\hat q^{-1}} = \hat q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^{-1}}
* @f]
* @see @ref DualQuaternion(const Vector3<T>&), @ref dual(),
* @ref Matrix4::transformPoint(),
* @ref Quaternion::transformVector(),
* @ref DualComplex::transformPoint()
*/
Vector3<T> transformPoint(const Vector3<T>& vector) const {
return ((*this)*DualQuaternion<T>(vector)*inverted().dualConjugated()).dual().vector();
}
/**
* @brief Rotate and translate point with normalized dual quaternion
*
* Faster alternative to @ref transformPoint(), expects that the dual
* quaternion is normalized. @f[
* v' = \hat q v \overline{\hat q^{-1}} = \hat q v \overline{\hat q^*} = \hat q ([\boldsymbol 0, 1] + \epsilon [\boldsymbol v, 0]) \overline{\hat q^*}
* @f]
* @see @ref isNormalized(), @ref DualQuaternion(const Vector3<T>&),
* @ref dual(), @ref Matrix4::transformPoint(),
* @ref Quaternion::transformVectorNormalized(),
* @ref DualComplex::transformPoint()
*/
Vector3<T> transformPointNormalized(const Vector3<T>& vector) const {
CORRADE_ASSERT(isNormalized(),
"Math::DualQuaternion::transformPointNormalized(): dual quaternion must be normalized", {});
return ((*this)*DualQuaternion<T>(vector)*conjugated()).dual().vector();
}
MAGNUM_DUAL_SUBCLASS_IMPLEMENTATION(DualQuaternion, Quaternion)
};
/** @debugoperator{Magnum::Math::DualQuaternion} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const DualQuaternion<T>& value) {
return debug << "DualQuaternion({{" << Corrade::Utility::Debug::nospace
<< value.real().vector().x() << Corrade::Utility::Debug::nospace << ","
<< value.real().vector().y() << Corrade::Utility::Debug::nospace << ","
<< value.real().vector().z() << Corrade::Utility::Debug::nospace << "},"
<< value.real().scalar() << Corrade::Utility::Debug::nospace << "}, {{"
<< Corrade::Utility::Debug::nospace
<< value.dual().vector().x() << Corrade::Utility::Debug::nospace << ","
<< value.dual().vector().y() << Corrade::Utility::Debug::nospace << ","
<< value.dual().vector().z() << Corrade::Utility::Debug::nospace << "},"
<< value.dual().scalar() << Corrade::Utility::Debug::nospace << "})";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Float>&);
#ifndef MAGNUM_TARGET_GLES
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Double>&);
#endif
#endif
}}
#endif
| [
"mosra@centrum.cz"
] | mosra@centrum.cz |
9cf3e263d68ab97189d6a4eea165447c722c4dba | f189b22968f11aa3f6fc0857ff529ca2f48d8d51 | /endstops.h | df42b245b0f6eaac1242db4ac89b6acc01e1e314 | [] | no_license | Waterfox/SPB_01 | 87da89ee320695cdaef9c3cec0e270bd73cb9ca0 | 24bd74372d2873ecfbf158c84687cf73d91b6143 | refs/heads/master | 2021-06-02T15:06:46.581767 | 2019-10-02T00:35:09 | 2019-10-02T00:35:09 | 126,921,106 | 1 | 1 | null | 2018-12-12T06:08:28 | 2018-03-27T03:06:04 | C++ | UTF-8 | C++ | false | false | 632 | h | #ifndef endstops_H
#define endstops_H
#include <Arduino.h>
/* endstops class:
* manages endstop interrupts and available motion states
* the upper endstop is "max"
* the lower endstop is "min"
*/
class endstops {
public:
endstops();
~endstops();
void endstops_init();
void check_endstops();
bool enUp;
bool enDown;
};
#endif
//endstop callbacks - can't be a part of the endstop class to attach interrupt.
void max_callback();
void min_callback();
//buttons
void buttons_init();
void check_estop();
void check_start();
void estop_callback();
void start_callback();
| [
"rob.a.edwards@gmail.com"
] | rob.a.edwards@gmail.com |
e82b49e2e56b13f948d3373aac51441faab287f9 | 864b61a5fcb63e86c51ded0429b86e60b747b64a | /lite/kernels/arm/increment_compute.cc | 0c645ba877ffe36d0e1efa8dff684d7218bb87af | [
"Apache-2.0"
] | permissive | OFShare/Paddle-Lite | 24136fe63dc5fcc8345cc944074b7a26306f7f63 | 75ff7f44b4b22cd2bd5a239dd51d81600056afd6 | refs/heads/develop | 2023-05-30T11:25:33.276176 | 2021-06-10T06:21:17 | 2021-06-10T06:21:17 | 323,313,050 | 1 | 0 | Apache-2.0 | 2021-02-01T06:22:06 | 2020-12-21T11:14:47 | C++ | UTF-8 | C++ | false | false | 1,054 | cc | // Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "lite/kernels/host/increment_compute.h"
REGISTER_LITE_KERNEL(increment,
kARM,
kAny,
kNCHW,
paddle::lite::kernels::host::IncrementCompute,
def)
.BindInput("X", {LiteType::GetTensorTy(TARGET(kARM), PRECISION(kAny))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kARM), PRECISION(kAny))})
.Finalize();
| [
"noreply@github.com"
] | noreply@github.com |
d3f5cfb5c9fde2a9624f55e7b9e37059cc93fb0e | 9eb2eb4de471b6c522ecb6e11bd1d10ee3bf1c29 | /src/gigablast/IndexReadInfo.cpp | 7871a5dd8ee69e8260d15f039970b611709091c1 | [
"Apache-2.0"
] | permissive | fossabot/kblast | 6df5a5c6d4ae708a6813963f0dac990d94710a91 | 37b89fd6ba5ce429be5a69e2c6160da8a6aa21e6 | refs/heads/main | 2023-07-25T04:06:20.527449 | 2021-09-08T04:15:07 | 2021-09-08T04:15:07 | 404,208,031 | 1 | 0 | Apache-2.0 | 2021-09-08T04:15:02 | 2021-09-08T04:15:01 | null | UTF-8 | C++ | false | false | 13,189 | cpp | // SPDX-License-Identifier: Apache-2.0
//
// Copyright 2000-2014 Matt Wells
// Copyright 2004-2013 Gigablast, Inc.
// Copyright 2013 Web Research Properties, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "gb-include.h"
#include "IndexReadInfo.h"
#include "Datedb.h"
IndexReadInfo::IndexReadInfo() {
m_numLists = 0;
m_isDone = false;
}
// . initialize initial read info
// . sets m_readSizes[i] for each list
// . sets startKey/endKey for each list, too
// . startKey set passed endKey to indicate no reading
void IndexReadInfo::init ( Query *q ,
long long *termFreqs ,
long docsWanted , char callNum ,
long stage0 ,
long *tierStage,
bool useDateLists , bool sortByDate ,
unsigned long date1 , unsigned long date2 ,
bool isDebug ) {
// save ptr but don't copy
m_q = q;
m_useDateLists = useDateLists;
m_sortByDate = sortByDate;
m_date1 = date1;
m_date2 = date2;
m_isDebug = isDebug;
if ( m_useDateLists ) m_ks = 16;
else m_ks = 12;
m_hks = m_ks - 6;
// . now set m_includeList array
// . set to false if we determine termId to be ousted due to dpf
// . loop over each termId in the query
for ( long i = 0 ; i < m_q->getNumTerms() ; i++ ) {
// ignore some
//m_ignore [i] = m_q->m_ignore[i];
// no need to gen keys if ignored
//if ( m_ignore[i] ) continue;
// nothing ignored initially
m_ignore[i] = false;
// make our arrays 1-1 with those in Query class, q
if ( m_useDateLists ) {
// remember, date is complemented in the key, so use
// the larger date for the startKey
*(key128_t *)&m_startKeys [i*m_ks] =
g_datedb.makeStartKey(m_q->getTermId(i),m_date2);
*(key128_t *)&m_endKeys [i*m_ks] =
g_datedb.makeEndKey (m_q->getTermId(i),m_date1);
continue;
}
*(key_t *)&m_startKeys [i*m_ks] =
g_indexdb.makeStartKey ( m_q->getTermId(i) );
*(key_t *)&m_endKeys [i*m_ks] =
g_indexdb.makeEndKey ( m_q->getTermId(i) );
}
// no negatives
for ( long i = 0; i < MAX_TIERS; i++ ){
if ( tierStage[i] < 0 )
tierStage[i] = 0;
}
// -1 means to use default
if ( stage0 <= 0 ) {
// adjust for dateLists, proportionally
if ( m_useDateLists )
m_stage[0] = (tierStage[0] * (16-6)) / (12-6);
else
m_stage[0] = tierStage[0]; // STAGE0;
}
else
m_stage[0] = stage0 * m_hks + 6;
// for all the other stages just get the same tier size
for ( long i = 1; i < MAX_TIERS; i++ ){
// adjust for dateLists, proportionally
if ( m_useDateLists )
m_stage[i] = (tierStage[i] * (16-6)) / (12-6);
else
m_stage[i] = tierStage[i];
}
// set # of lists
m_numLists = m_q->getNumTerms();
// we're not done yet, we haven't even begun
m_isDone = false;
// . how many docs do we need to read to get docsWanted hits?
// . HITS = (X2 * ... * XN) / T^N
// . where Xi is docs read from each list
// . T is the total # of docs in the index
// . this assumes no dependence between the words
// . So let's just start off reading 10,000, then 30k more then 60k
// . So we break up our 100k truncation limit that way
long toRead = m_stage[(int)callNum];
long long def = getStage0Default() ;
long long *tf = termFreqs ;
// . ...but if we're only reading 1 list...
// . keys are 6 bytes each, first key is 12 bytes
// . this made our result count inaccurate
// . since we had to round up to half a PAGE_SIZE
// (#defined to be 16k in RdbMap.h) we would never estimate at lower
// than about 4,000 docids for one-word queries
// . so, since we're going to read at least a PAGE_SIZE anyway,
// removing this should not slow us down!!
// . actually, should speed us up if all the guys site cluster which
// is especially probable for rare terms --- all from the same site
// . SECONDLY, now i use Msg39::getStageNum() to do prettier clustering
// and that requires us to be consistent with our stages from Next
// 10 to Next 10
//if ( m_q->getNumTerms() <= 1 ) toRead = docsWanted * 6 + 6;
// now loop through all non-ignored lists
for ( long i = 0 ; i < m_numLists ; i++ ) {
// ignore lists that should be
if ( m_ignore[i] ) { m_readSizes[i]=0; continue; }
// don't include excluded lists in this calculation
if ( m_q->m_qterms[i].m_termSign == '-' )
m_readSizes[i] = m_stage[MAX_TIERS - 1] ; // STAGESUM;
else if ( m_q->m_qterms[i].m_underNOT )
m_readSizes[i] = m_stage[MAX_TIERS - 1] ; // STAGESUM;
else if ( m_q->m_qterms[i].m_piped )
m_readSizes[i] = m_stage[MAX_TIERS - 1] ; // STAGESUM;
//m_readSizes[i] = g_indexdb.getTruncationLimit() *6+6;
// m_readSizes[i] = g_indexdb.getTruncationLimit()*6 ;
// . this is set to max if we got more than 1 ignored list
// . later we will use dynamic truncation
/*else if (useNewTierSizing && m_q->m_termFreqs[i] > tierStage2)
m_readSizes[i] = tierStage2;
else if (useNewTierSizing && m_q->m_termFreqs[i] > tierStage1)
m_readSizes[i] = tierStage1;*/
else m_readSizes[i] = toRead;
// . when user specifies the s0=X cgi parm and X is like 4M
// try to avoid allocating so much space when we do not need
// . mark is using s0 to get exact hit counts
long long max = tf[i] * m_hks+m_hks +GB_INDEXDB_PAGE_SIZE*10 ;
if ( max < def ) max = def;
if ( m_readSizes[i] > max ) m_readSizes[i] = max;
// debug msg
if ( m_isDebug || g_conf.m_logDebugQuery )
logf ( LOG_DEBUG,"query: ReadInfo: "
"newreadSizes[%li]=%li",i,
m_readSizes[i] );
// sanity check
if ( m_readSizes[i] > ( 500 * 1024 * 1024 ) ||
m_readSizes[i] < 0 ){
log( "minRecSize = %li", m_readSizes[i] );
char *xx=NULL; *xx=0;
}
}
// return for now
return;
}
long IndexReadInfo::getStage0Default ( ) { return STAGE0; }
// . updates m_readSizes
// . sets m_isDone to true if all lists are exhausted
void IndexReadInfo::update ( IndexList *lists, long numLists,
char callNum ) {
// loop over all lists and update m_startKeys[i]
for ( long i = 0 ; i < numLists ; i++ ) {
// ignore lists that should be
if ( m_ignore[i] ) continue;
// . how many docIds did we read into this list?
// . double the size since the lists are compress to half now
//long docsRead = lists[i].getListSize() / 6 ;
// . remove the endKey put at the end by RdbList::appendLists()
// . iff we did NOT do a merge
//if ( ! didMerge && docsRead > 0 ) docsRead--;
// debug
//log("startKey for list #%li is n1=%lx,n0=%llx "
// "(docsRead=%li)",
// i,m_startKeys[i].n1,m_startKeys[i].n0,docsRead);
// . if we read less than supposed to, this list is exhausted
// so we set m_ignore[i] to true so we don't read again
// . we also now update termFreq to it's exact value
// . ok this condition doesn't apply now because when we
// append lists so that they are all less than a common
// endKey some lose some keys so the minRecSizes goes down
// . we should just see that if the # read is 0!
//if ( docsRead < m_docsToRead[i] ) {
if ( lists[i].getListSize() < m_readSizes[i] ) {
m_ignore [i] = true;
//m_readSizes[i] = 0;
continue;
}
// if we didn't meet our quota...
//else if ( docsRead < m_docsToRead[i] )
// m_startKeys [i] = m_endKeys [i] ;
// point to last compressed 6 byte key in list
char *list = (char *)lists[i].getList();
long listSize = lists[i].getListSize();
// don't seg fault
if ( listSize < m_hks ) {
m_ignore [i] = true;
// keep the old readsize
// m_readSizes[i] = 0;
continue;
}
// we now do NOT call appendLists() again since
// we're using fast superMerges
//char *lastPart = list + listSize - 6;
char *lastPart = list + listSize - m_hks;
// . we update m_startKey to the endKey of each list
// . get the startKey now
//key_t startKey = m_startKeys[i];
char *startKey = &m_startKeys[i*m_ks];
// . load lastPart into lower 6 bytes of "startKey"
// . little endian
//memcpy ( &startKey , lastPart , 6 );
memcpy ( startKey , lastPart , m_hks );
// debug msg
//log("pre-startKey for list #%li is n1=%lx,n0=%llx",
// i,startKey.n1,startKey.n0);
// sanity checks
//if ( startKey < m_startKeys[i] ) {
if ( KEYCMP(startKey,&m_startKeys[i*m_ks],m_ks)<0 ) {
log("query: bad startKey. "
"a.n1=%016llx a.n0=%016llx < "
"b.n1=%016llx b.n0=%016llx" ,
KEY1(startKey,m_ks),
KEY0(startKey ),
KEY1(&m_startKeys[i*m_ks],m_ks),
KEY0(&m_startKeys[i*m_ks] ));
//startKey.n1 = 0xffffffff;
//startKey.n0 = 0xffffffffffffffffLL;
}
// update startKey to read the next piece now
//m_startKeys[i] = startKey;
KEYSET(&m_startKeys[i*m_ks],startKey,m_ks);
// add 1 to startKey
//m_startKeys[i] += (unsigned long) 1;
KEYADD(&m_startKeys[i*m_ks],1,m_ks);
// debug msg
//log("NOW startKey for list #%li is n1=%lx,n0=%llx",
// i,m_startKeys[i].n1,m_startKeys[i].n0);
// . increase termFreqs if we read more than was estimated
// . no! just changes # of total results when clicking Next 10
//if ( docsRead > m_q->m_termFreqs[i] )
// m_q->m_termFreqs[i] = docsRead;
}
// break if a list can read more, if it can read more, that is
long i;
for ( i = 0 ; i < numLists ; i++ ) if ( ! m_ignore[i] ) break;
// if all lists are exhausted, set m_isDone
if ( i >= numLists ) { m_isDone = true; return; }
// . based on # of results we got how much more should we have to read
// to get what we want, "docsWanted"
// . just base it on linear proportion
// . keep in mind, if we double the amount to read we will quadruple
// the results if reading 2 indexLists, x8 if reading from 3.
// . that doesn't take into account phrases though...
// . let's just do it this way
// loop over all lists and update m_startKeys[i] and m_totalDocsRead
for ( long i = 0 ; i < numLists ; i++ ) {
// ignore lists that should be
if ( m_ignore[i] ) continue;
// update each list's docs to read
m_readSizes[i] = m_stage[(int)callNum];
/* if ( m_readSizes[i] < m_stage[0])
m_readSizes[i] = m_stage0;
else if ( m_readSizes[i] < m_stage[1])
m_readSizes[i] = m_stage1;
else
m_readSizes[i] = m_stage2;*/
// debug msg
log("newreadSizes[%li]=%li",i,m_readSizes[i]);
}
}
// . updates m_readSizes
// . sets m_isDone to true if all lists are exhausted
// . used by virtual split in msg3b to check if we're done or not.
void IndexReadInfo::update ( long long *termFreqs,
long numLists,
char callNum ) {
// loop over all lists and update m_startKeys[i]
for ( long i = 0 ; i < numLists ; i++ ) {
// ignore lists that should be
if ( m_ignore[i] ) continue;
// . how many bytes did we read ? Since these are
// . half keys, multiply termFreqs by 6 and add 6 for the
// . first key which is full 12 bytes
long long listSize = termFreqs[i] * 6 + 6;
if ( listSize < m_readSizes[i] ) {
m_ignore [i] = true;
//m_readSizes[i] = 0;
continue;
}
// if we didn't meet our quota...
//else if ( docsRead < m_docsToRead[i] )
// m_startKeys [i] = m_endKeys [i] ;
// point to last compressed 6 byte key in list
//char *list = (char *)lists[i].getList();
// don't seg fault
if ( listSize < m_hks ) {
m_ignore [i] = true;
//m_readSizes[i] = 0;
continue;
}
}
// break if a list can read more, if it can read more, that is
long i;
for ( i = 0 ; i < numLists ; i++ ) if ( ! m_ignore[i] ) break;
// if all lists are exhausted, set m_isDone
if ( i >= numLists ) { m_isDone = true; return; }
// . based on # of results we got how much more should we have to read
// to get what we want, "docsWanted"
// . just base it on linear proportion
// . keep in mind, if we double the amount to read we will quadruple
// the results if reading 2 indexLists, x8 if reading from 3.
// . that doesn't take into account phrases though...
// . let's just do it this way
// loop over all lists and update m_startKeys[i] and m_totalDocsRead
for ( long i = 0 ; i < numLists ; i++ ) {
// debug msg
//log("oldreadSizes[%li]=%li",i,m_readSizes[i]);
// update each list's docs to read if we're not on the last
// tier
if ( !m_ignore[i] && callNum < MAX_TIERS &&
m_readSizes[i] < m_stage[(int)callNum] )
m_readSizes[i] = m_stage[(int)callNum];
/*if ( m_readSizes[i] < m_stage0)
m_readSizes[i] = m_stage0;
else if ( m_readSizes[i] < m_stage1)
m_readSizes[i] = m_stage1;
else
m_readSizes[i] = m_stage2;*/
// debug msg
if ( m_isDebug || g_conf.m_logDebugQuery )
logf ( LOG_DEBUG,"query: ReadInfo: "
"newreadSizes[%li]=%li",i,m_readSizes[i] );
}
}
| [
"masanori.ogino@gmail.com"
] | masanori.ogino@gmail.com |
1d7d9ece982984a311b2fffc3e2d208b15c06b37 | 215750938b1dd4354eab9b8581eec76881502afb | /src/mfx/pi/cpx/Compex.cpp | b28818b0c6afb92cf453040b385d1b41c31f0a93 | [
"WTFPL"
] | permissive | EleonoreMizo/pedalevite | c28fd19578506bce127b4f451c709914ff374189 | 3e324801e3a1c5f19a4f764176cc89e724055a2b | refs/heads/master | 2023-05-30T12:13:26.159826 | 2023-05-01T06:53:31 | 2023-05-01T06:53:31 | 77,694,808 | 103 | 8 | null | null | null | null | UTF-8 | C++ | false | false | 10,940 | cpp | /*****************************************************************************
Compex.cpp
Author: Laurent de Soras, 2016
--- Legal stuff ---
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
*Tab=3***********************************************************************/
#if defined (_MSC_VER)
#pragma warning (1 : 4130 4223 4705 4706)
#pragma warning (4 : 4355 4786 4800)
#endif
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "fstb/Approx.h"
#include "fstb/DataAlign.h"
#include "fstb/fnc.h"
#include "fstb/ToolsSimd.h"
#include "mfx/dsp/iir/TransSZBilin.h"
#include "mfx/dsp/mix/Simd.h"
#include "mfx/pi/cpx/Compex.h"
#include "mfx/pi/cpx/Param.h"
#include "mfx/piapi/Err.h"
#include "mfx/piapi/EventParam.h"
#include "mfx/piapi/EventTs.h"
#include "mfx/piapi/EventType.h"
#include "mfx/piapi/ProcInfo.h"
#include <algorithm>
#include <cassert>
#include <cmath>
namespace mfx
{
namespace pi
{
namespace cpx
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
Compex::Compex (piapi::HostInterface &host)
: _host (host)
, _state (State_CREATED)
, _desc ()
, _state_set ()
, _param_proc (_state_set)
, _sample_freq (0)
, _param_change_flag ()
, _param_change_flag_ar ()
, _param_change_flag_vol_curves_ss ()
, _nbr_chn (1)
, _nbr_chn_in (1)
, _nbr_chn_ana (1)
, _env_fol_xptr ()
, _smoother_xptr ()
, _use_side_chain_flag (false)
, _sc_power_1 ()
, _sc_power_2 ()
, _buf_tmp ()
{
const ParamDescSet & desc_set = _desc.use_desc_set ();
_state_set.init (piapi::ParamCateg_GLOBAL, desc_set);
_state_set.set_val_nat (desc_set, Param_RATIO_L , 1);
_state_set.set_val_nat (desc_set, Param_RATIO_H , 1);
_state_set.set_val_nat (desc_set, Param_KNEE_LVL , -2);
_state_set.set_val_nat (desc_set, Param_KNEE_SHAPE, 0);
_state_set.set_val_nat (desc_set, Param_ATTACK , 0.0001);
_state_set.set_val_nat (desc_set, Param_RELEASE , 0.150);
_state_set.set_val_nat (desc_set, Param_GAIN , 0);
_state_set.add_observer (Param_RATIO_L , _param_change_flag_vol_curves_ss);
_state_set.add_observer (Param_RATIO_H , _param_change_flag_vol_curves_ss);
_state_set.add_observer (Param_KNEE_LVL , _param_change_flag_vol_curves_ss);
_state_set.add_observer (Param_KNEE_SHAPE, _param_change_flag_vol_curves_ss);
_state_set.add_observer (Param_ATTACK , _param_change_flag_ar);
_state_set.add_observer (Param_RELEASE , _param_change_flag_ar);
_state_set.add_observer (Param_GAIN , _param_change_flag_vol_curves_ss);
_param_change_flag_ar .add_observer (_param_change_flag);
_param_change_flag_vol_curves_ss.add_observer (_param_change_flag);
static const float abz [3] = { 1, 0, 0 };
usew (_smoother_xptr).set_z_eq_same (abz, abz);
}
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
piapi::PluginInterface::State Compex::do_get_state () const
{
return _state;
}
double Compex::do_get_param_val (piapi::ParamCateg categ, int index, int note_id) const
{
fstb::unused (categ, note_id);
assert (categ == piapi::ParamCateg_GLOBAL);
return _state_set.use_state (index).get_val_tgt ();
}
int Compex::do_reset (double sample_freq, int max_buf_len, int &latency)
{
latency = 0;
#if defined (fstb_HAS_SIMD)
const int buf_len = std::min (
(max_buf_len + 3) & ~3,
int (_update_resol)
);
_buf_tmp.resize (buf_len);
#else
fstb::unused (max_buf_len);
#endif
_sample_freq = float (sample_freq);
_state_set.set_sample_freq (sample_freq);
_state_set.clear_buffers ();
_param_change_flag_ar .set ();
_param_change_flag_vol_curves_ss.set ();
update_param (true);
clear_buffers ();
_param_proc.req_steady ();
_state = State_ACTIVE;
return piapi::Err_OK;
}
void Compex::do_process_block (piapi::ProcInfo &proc)
{
const int nbr_chn_in = proc._dir_arr [piapi::Dir_IN ]._nbr_chn;
const int nbr_chn_out = proc._dir_arr [piapi::Dir_OUT]._nbr_chn;
_nbr_chn_in = nbr_chn_in;
_nbr_chn_ana = nbr_chn_in;
_nbr_chn = nbr_chn_out;
// Events
_param_proc.handle_msg (proc);
if (_param_proc.is_full_reset ())
{
clear_buffers ();
}
int pos = 0;
do
{
const int max_len = _update_resol;
const int work_len = std::min (proc._nbr_spl - pos, max_len);
// Parameters
_state_set.process_block (work_len);
update_param ();
// Signal processing
process_block_part (
proc._dst_arr,
proc._src_arr,
proc._src_arr + nbr_chn_in,
pos,
pos + work_len
);
pos += work_len;
}
while (pos < proc._nbr_spl);
}
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
template <int NC>
constexpr float Compex::AddProc <NC>::process_scalar (float in)
{
return in;
}
template <>
constexpr float Compex::AddProc <2>::process_scalar (float in)
{
return in * 0.5f;
}
template <int NC>
fstb::Vf32 Compex::AddProc <NC>::process_vect (const fstb::Vf32 &in)
{
return in;
}
template <>
fstb::Vf32 Compex::AddProc <2>::process_vect (const fstb::Vf32 &in)
{
return in * fstb::Vf32 (0.5f);
}
#if ! defined (fstb_HAS_SIMD)
void Compex::Smoother::set_z_eq_same (const float bz [3], const float az [3])
{
for (auto &biq : _biq_arr)
{
biq.set_z_eq (bz, az);
}
}
void Compex::Smoother::clear_buffers ()
{
for (auto &biq : _biq_arr)
{
biq.clear_buffers ();
}
}
void Compex::Smoother::process_block_serial_immediate (float dst_ptr [], const float src_ptr [], int nbr_spl)
{
for (auto &biq : _biq_arr)
{
biq.process_block (dst_ptr, src_ptr, nbr_spl);
src_ptr = dst_ptr;
}
}
#endif // fstb_HAS_SIMD
void Compex::clear_buffers ()
{
usew (_env_fol_xptr).clear_buffers ();
usew (_smoother_xptr).clear_buffers ();
_gain_fnc.clear_buffers ();
}
void Compex::update_param (bool force_flag)
{
if (_param_change_flag_ar (true) || force_flag)
{
update_param_ar ();
}
if (_param_change_flag_vol_curves_ss (true) || force_flag)
{
update_param_vol_curves_ss ();
}
}
void Compex::update_param_ar ()
{
const float atk_t = float (_state_set.get_val_tgt_nat (Param_ATTACK));
const float atk_coef = compute_env_coef (atk_t);
usew (_env_fol_xptr).set_atk_coef (atk_coef);
const float rls_t = float (_state_set.get_val_tgt_nat (Param_RELEASE));
const float rls_coef = compute_env_coef (rls_t);
usew (_env_fol_xptr).set_rls_coef (rls_coef);
// Smoother
const float min_time = std::min (atk_t, rls_t);
assert (min_time > 0);
float f0 = 1.0f / min_time;
// We limit the smoothing to 2000 Hz. This should be enough to let pass
// most transcients with the smallest attack time.
f0 = fstb::limit (f0, 1.0f, 2000.0f);
static const float bs [3] = { 1, 0 , 0 };
static const float as [3] = { 1, 1.85f, 1 };
float bz [3];
float az [3];
const float k = dsp::iir::TransSZBilin::compute_k_approx (float (
f0 / _sample_freq
));
dsp::iir::TransSZBilin::map_s_to_z_approx (bz, az, bs, as, k);
usew (_smoother_xptr).set_z_eq_same (bz, az);
}
void Compex::update_param_vol_curves_ss ()
{
// Ratios
const float rl = float (_state_set.get_val_tgt_nat (Param_RATIO_L));
const float rh = float (_state_set.get_val_tgt_nat (Param_RATIO_H));
// Knee shape
const float knee_shape_l2 = float (_state_set.get_val_tgt_nat (Param_KNEE_SHAPE));
const float threshold_l2 =
float (_state_set.get_val_tgt_nat (Param_KNEE_LVL));
const float gain_l2 =
float (_state_set.get_val_tgt_nat (Param_GAIN));
bool autofix_flag = true;
#if 0
const float param_sc = float (_state_set.get_val_tgt_nat (Param_SIDECHAIN));
_use_side_chain_flag = (param_sc >= 0.5f);
#endif
_gain_fnc.update_curve (
rl, rh, threshold_l2, gain_l2, knee_shape_l2,
autofix_flag && ! _use_side_chain_flag
);
}
float Compex::compute_env_coef (float t) const
{
assert (t >= 0);
float coef = 1;
const float t_spl = t * float (_sample_freq);
if (t_spl > 1)
{
coef = 1.0f - fstb::Approx::exp2 (float (-fstb::LN2) / t_spl);
}
return (coef);
}
void Compex::process_block_part (float * const out_ptr_arr [], const float * const in_ptr_arr [], const float * const sc_ptr_arr [], int pos_beg, int pos_end)
{
const float * const * analyse_ptr_arr =
(_use_side_chain_flag) ? sc_ptr_arr : in_ptr_arr;
int nbr_chn_analyse = _nbr_chn_ana;
if (nbr_chn_analyse == 2)
{
_sc_power_2.prepare_env_input (
&_buf_tmp [0],
analyse_ptr_arr,
nbr_chn_analyse,
pos_beg,
pos_end
);
}
else
{
// Works also for nbr_chn_analyse > 2, but scans only the first channel.
_sc_power_1.prepare_env_input (
&_buf_tmp [0],
analyse_ptr_arr,
1,
pos_beg,
pos_end
);
}
float * tmp_ptr = &_buf_tmp [0];
const int nbr_spl = pos_end - pos_beg;
usew (_env_fol_xptr).process_block (tmp_ptr, tmp_ptr, nbr_spl);
usew (_smoother_xptr).process_block_serial_immediate (tmp_ptr, tmp_ptr, nbr_spl);
conv_env_to_log (nbr_spl);
const int pos_block_end = (nbr_spl + 3) & ~3;
int pos = 0;
// Special case for the first group of sample: we store the gain change.
{
const auto x = fstb::Vf32::load (tmp_ptr + pos);
const auto y = _gain_fnc.compute_gain <true> (x);
y.store (tmp_ptr + pos);
pos += 4;
}
// Next groups of samples
while (pos < pos_block_end)
{
const auto x = fstb::Vf32::load (tmp_ptr + pos);
const auto y = _gain_fnc.compute_gain <false> (x);
y.store (tmp_ptr + pos);
pos += 4;
}
int chn_in_index = 0;
int chn_in_step = (_nbr_chn <= _nbr_chn_in) ? 1 : 0;
for (int chn_index = 0; chn_index < _nbr_chn; ++chn_index)
{
dsp::mix::Simd <
fstb::DataAlign <false>,
fstb::DataAlign <false>
>::mult_1_1 (
out_ptr_arr [chn_index ] + pos_beg,
in_ptr_arr [chn_in_index] + pos_beg,
tmp_ptr,
nbr_spl
);
chn_in_index += chn_in_step;
}
}
void Compex::conv_env_to_log (int nbr_spl)
{
assert (nbr_spl > 0);
const int block_bnd = nbr_spl & ~3;
int pos = 0;
while (pos < block_bnd)
{
auto val = fstb::Vf32::load (&_buf_tmp [pos]);
val = fstb::Approx::log2 (val);
val.store (&_buf_tmp [pos]);
pos += 4;
}
while (pos < nbr_spl)
{
_buf_tmp [pos] = fstb::Approx::log2 (_buf_tmp [pos]);
++ pos;
}
const int clean_end = (nbr_spl + 3) & ~3;
while (pos < clean_end)
{
_buf_tmp [pos] = 0;
++ pos;
}
}
template <class T>
T & Compex::usew (WrapperAlign <T> &wrap)
{
#if defined (fstb_HAS_SIMD)
return *wrap;
#else
return wrap;
#endif
}
} // namespace cpx
} // namespace pi
} // namespace mfx
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
| [
"fuck@fuck.fuck"
] | fuck@fuck.fuck |
156cb71258c18f6eb5c0b0cfebd2cfbae8a3e0bf | 2ba7ea1556d8b17023c89afb316a79a113aa3205 | /Pow.h | 1fcdb14ab84d784f048838eca139abf2d0860457 | [] | no_license | jtang073/Calculator-Lab | a59f9dd8eb3d61cde0b578e35c940f34c69169a6 | 0ea3492d616c109cd64a8bdbdadab1be55657d1b | refs/heads/master | 2020-09-10T18:48:17.030241 | 2020-04-01T21:42:04 | 2020-04-01T21:42:04 | 221,802,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 476 | h | #ifndef __POW_H__
#define __POW_H__
#include "base.hpp"
#include "Iterator.hpp"
#include "BinaryIterator.h"
#include "visitor.h"
#include <string>
using namespace std;
class Pow : public Base {
public:
Base* left;
Base* right;
Pow(Base*, Base*);
double evaluate();
string stringify();
Base* get_left();
Base* get_right();
Iterator* create_iterator();
void accept(visitor* guest) { guest->visit_pow(); left->accept(guest); right->accept(guest);}
};
#endif
| [
"noreply@github.com"
] | noreply@github.com |
00eccc4822a37adb138cbea7a08eb04be0cab50c | 0fe9c025317b7666c88913a74950069c01387933 | /DirectX12 Game Solution/DirectX12 MainProject/Scene.h | 512adc11664a0966a74aab6d91a807836f1f294f | [] | no_license | star-217/DXTK-Effekseer | 616986959e150119718b63efb02c3173593ff4a7 | 578494433a4c4ee6c12808d044dd59e735dbfbe5 | refs/heads/master | 2023-08-20T00:52:19.061252 | 2021-10-15T04:48:26 | 2021-10-15T04:48:26 | 417,371,236 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 635 | h | //
// Scene.h
//
#pragma once
enum class NextScene : int {
Continue = 0,
MainScene,
StartScene = MainScene
};
class Scene {
public:
Scene() = default;
virtual ~Scene() = default;
Scene(Scene&&) = default;
Scene& operator= (Scene&&) = default;
Scene(Scene const&) = delete;
Scene& operator= (Scene const&) = delete;
void Start()
{
Initialize();
LoadAssets();
}
virtual void Initialize() = 0;
virtual void LoadAssets() = 0;
virtual void Terminate() = 0;
virtual void OnDeviceLost() = 0;
virtual void OnRestartSound() = 0;
virtual NextScene Update(const float deltaTime) = 0;
virtual void Render() = 0;
}; | [
""
] | |
75cdf7649a6a464b9140424e62225125cb89abbb | f36cbc8a38757c11944a9c79b0265632f7094c7f | /CebScan-Source/moc_fscontrolpanel.cpp | 4b51ff150e72ac976e73907d9e86d44da7b255e2 | [] | no_license | mapipaa/cebscan | 403cf2d6b5298ae20c30914104c4cf3d4909ee9b | 8cf78d4c8e92531310246af830e267c58dbe5ee1 | refs/heads/master | 2021-01-15T10:52:00.783678 | 2014-08-23T20:18:25 | 2014-08-23T20:18:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,869 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'fscontrolpanel.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.2.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "fscontrolpanel.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'fscontrolpanel.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.2.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_FSControlPanel_t {
QByteArrayData data[18];
char stringdata[438];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
offsetof(qt_meta_stringdata_FSControlPanel_t, stringdata) + ofs \
- idx * sizeof(QByteArrayData) \
)
static const qt_meta_stringdata_FSControlPanel_t qt_meta_stringdata_FSControlPanel = {
{
QT_MOC_LITERAL(0, 0, 14),
QT_MOC_LITERAL(1, 15, 27),
QT_MOC_LITERAL(2, 43, 0),
QT_MOC_LITERAL(3, 44, 24),
QT_MOC_LITERAL(4, 69, 25),
QT_MOC_LITERAL(5, 95, 25),
QT_MOC_LITERAL(6, 121, 26),
QT_MOC_LITERAL(7, 148, 23),
QT_MOC_LITERAL(8, 172, 25),
QT_MOC_LITERAL(9, 198, 26),
QT_MOC_LITERAL(10, 225, 27),
QT_MOC_LITERAL(11, 253, 4),
QT_MOC_LITERAL(12, 258, 30),
QT_MOC_LITERAL(13, 289, 31),
QT_MOC_LITERAL(14, 321, 20),
QT_MOC_LITERAL(15, 342, 34),
QT_MOC_LITERAL(16, 377, 34),
QT_MOC_LITERAL(17, 412, 24)
},
"FSControlPanel\0on_fetchFrameButton_clicked\0"
"\0on_laserOnButton_clicked\0"
"on_laserOffButton_clicked\0"
"on_stepLeftButton_clicked\0"
"on_stepRightButton_clicked\0"
"on_stepUpButton_clicked\0"
"on_stepDownButton_clicked\0"
"on_autoResetButton_clicked\0"
"on_laserEnable_stateChanged\0arg1\0"
"on_laserStepLeftButton_clicked\0"
"on_laserStepRightButton_clicked\0"
"on_diffImage_clicked\0"
"on_laserSwipeMaxEdit_returnPressed\0"
"on_laserSwipeMinEdit_returnPressed\0"
"on_GetLaserLines_clicked\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_FSControlPanel[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
15, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 89, 2, 0x08,
3, 0, 90, 2, 0x08,
4, 0, 91, 2, 0x08,
5, 0, 92, 2, 0x08,
6, 0, 93, 2, 0x08,
7, 0, 94, 2, 0x08,
8, 0, 95, 2, 0x08,
9, 0, 96, 2, 0x08,
10, 1, 97, 2, 0x08,
12, 0, 100, 2, 0x08,
13, 0, 101, 2, 0x08,
14, 0, 102, 2, 0x08,
15, 0, 103, 2, 0x08,
16, 0, 104, 2, 0x08,
17, 0, 105, 2, 0x08,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void FSControlPanel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
FSControlPanel *_t = static_cast<FSControlPanel *>(_o);
switch (_id) {
case 0: _t->on_fetchFrameButton_clicked(); break;
case 1: _t->on_laserOnButton_clicked(); break;
case 2: _t->on_laserOffButton_clicked(); break;
case 3: _t->on_stepLeftButton_clicked(); break;
case 4: _t->on_stepRightButton_clicked(); break;
case 5: _t->on_stepUpButton_clicked(); break;
case 6: _t->on_stepDownButton_clicked(); break;
case 7: _t->on_autoResetButton_clicked(); break;
case 8: _t->on_laserEnable_stateChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 9: _t->on_laserStepLeftButton_clicked(); break;
case 10: _t->on_laserStepRightButton_clicked(); break;
case 11: _t->on_diffImage_clicked(); break;
case 12: _t->on_laserSwipeMaxEdit_returnPressed(); break;
case 13: _t->on_laserSwipeMinEdit_returnPressed(); break;
case 14: _t->on_GetLaserLines_clicked(); break;
default: ;
}
}
}
const QMetaObject FSControlPanel::staticMetaObject = {
{ &QDialog::staticMetaObject, qt_meta_stringdata_FSControlPanel.data,
qt_meta_data_FSControlPanel, qt_static_metacall, 0, 0}
};
const QMetaObject *FSControlPanel::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *FSControlPanel::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_FSControlPanel.stringdata))
return static_cast<void*>(const_cast< FSControlPanel*>(this));
return QDialog::qt_metacast(_clname);
}
int FSControlPanel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QDialog::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 15)
qt_static_metacall(this, _c, _id, _a);
_id -= 15;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 15)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 15;
}
return _id;
}
QT_END_MOC_NAMESPACE
| [
"charlesebakeriii@gmail.com"
] | charlesebakeriii@gmail.com |
9f2b9f8fd28ab7524724ebb4d4b763d1f18c4acf | 2262f894227d5abdbb5c2d66dfc49a97128774ec | /services/view_manager/gesture_manager.cc | 47ae5fcd653552058916e4e9b3848bba31781cba | [
"BSD-3-Clause"
] | permissive | willbittner/mojo | 7e3253184351f7fbdde9e5c4b5f91ae1e6887641 | 810682eae832db3f8bc7bce01919b59d6e9538f2 | refs/heads/master | 2020-12-11T01:52:04.546158 | 2016-01-14T23:48:44 | 2016-01-14T23:48:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,352 | cc | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/view_manager/gesture_manager.h"
#include <algorithm>
#include "mojo/services/input_events/interfaces/input_events.mojom.h"
#include "mojo/services/view_manager/cpp/keys.h"
#include "services/view_manager/gesture_manager_delegate.h"
#include "services/view_manager/server_view.h"
#include "services/view_manager/view_coordinate_conversions.h"
#include "services/view_manager/view_locator.h"
#include "ui/gfx/geometry/point_f.h"
namespace view_manager {
using Views = std::vector<const ServerView*>;
namespace {
GestureManager::GestureAndConnectionId MakeGestureAndConnectionId(
const ServerView* view,
uint32_t gesture_id) {
return (static_cast<GestureManager::GestureAndConnectionId>(
view->id().connection_id)
<< 32) |
gesture_id;
}
// Returns the views (deepest first) that should receive touch events. This only
// returns one view per connection. If multiple views from the same connection
// are interested in touch events the shallowest view is returned.
Views GetTouchTargets(const ServerView* deepest) {
Views result;
const ServerView* view = deepest;
while (view) {
if (view->properties().count(mojo::kViewManagerKeyWantsTouchEvents)) {
if (!result.empty() &&
result.back()->id().connection_id == view->id().connection_id) {
result.pop_back();
}
result.push_back(view);
}
view = view->parent();
}
// TODO(sky): I'm doing this until things are converted. Seems as though we
// shouldn't do this long term.
if (result.empty())
result.push_back(deepest);
return result;
}
mojo::EventPtr CloneEventForView(const mojo::Event& event,
const ServerView* view) {
mojo::EventPtr result(event.Clone());
const gfx::PointF location(event.pointer_data->x, event.pointer_data->y);
const gfx::PointF target_location(
ConvertPointFBetweenViews(view->GetRoot(), view, location));
result->pointer_data->x = target_location.x();
result->pointer_data->y = target_location.y();
return result;
}
} // namespace
// GestureStateChange ----------------------------------------------------------
GestureStateChange::GestureStateChange()
: chosen_gesture(GestureManager::kInvalidGestureId) {
}
GestureStateChange::~GestureStateChange() {
}
// ViewIterator ----------------------------------------------------------------
// Used to iterate over a set of views.
class ViewIterator {
public:
explicit ViewIterator(const Views& views)
: views_(views), current_(views_.begin()) {}
// Advances to the next view. Returns true if there are no more views (at
// the end).
bool advance() { return ++current_ != views_.end(); }
bool at_end() const { return current_ == views_.end(); }
bool empty() const { return views_.empty(); }
const ServerView* current() const { return *current_; }
void reset_to_beginning() { current_ = views_.begin(); }
void remove(const ServerView* view) {
Views::iterator iter = std::find(views_.begin(), views_.end(), view);
DCHECK(iter != views_.end());
if (iter == current_) {
current_ = views_.erase(current_);
} else if (!at_end()) {
size_t index = current_ - views_.begin();
if (current_ > iter)
index--;
views_.erase(iter);
current_ = views_.begin() + index;
} else {
views_.erase(iter);
current_ = views_.end();
}
}
bool contains(const ServerView* view) const {
return std::find(views_.begin(), views_.end(), view) != views_.end();
}
private:
Views views_;
Views::iterator current_;
DISALLOW_COPY_AND_ASSIGN(ViewIterator);
};
// PointerAndView --------------------------------------------------------------
struct GestureManager::PointerAndView {
PointerAndView();
PointerAndView(Pointer* pointer, const ServerView* view);
// Compares two PointerAndView instances based on pointer id, then view id.
// This is really only interesting for unit tests so that they get a known
// order of events.
bool operator<(const PointerAndView& other) const;
Pointer* pointer;
const ServerView* view;
};
// Gesture ---------------------------------------------------------------------
// Gesture maintains the set of pointers and views it is attached to.
class GestureManager::Gesture {
public:
enum State { STATE_INITIAL, STATE_CANCELED, STATE_CHOSEN };
explicit Gesture(uint32_t id);
~Gesture();
uint32_t id() const { return id_; }
void Attach(Pointer* pointer, const ServerView* view);
void Detach(Pointer* pointer, const ServerView* view);
void set_state(State state) { state_ = state; }
State state() const { return state_; }
const std::set<PointerAndView>& pointers_and_views() const {
return pointers_and_views_;
}
private:
const uint32_t id_;
State state_;
std::set<PointerAndView> pointers_and_views_;
DISALLOW_COPY_AND_ASSIGN(Gesture);
};
GestureManager::Gesture::Gesture(uint32_t id) : id_(id), state_(STATE_INITIAL) {
}
GestureManager::Gesture::~Gesture() {
}
void GestureManager::Gesture::Attach(Pointer* pointer, const ServerView* view) {
pointers_and_views_.insert(PointerAndView(pointer, view));
}
void GestureManager::Gesture::Detach(Pointer* pointer, const ServerView* view) {
pointers_and_views_.erase(PointerAndView(pointer, view));
}
// Pointer ---------------------------------------------------------------------
// Pointer manages the state associated with a particular pointer from the time
// of the POINTER_DOWN to the time of the POINTER_UP (or POINTER_CANCEL). This
// state includes a mapping from view to the set of gestures the view is
// interested in. It also manages choosing gestures at the appropriate point as
// well as which view to dispatch to and the events to dispatch.
// See description in GestureManager for more.
class GestureManager::Pointer {
public:
Pointer(GestureManager* gesture_manager,
int32_t pointer_id,
const mojo::Event& event,
const Views& views);
~Pointer();
int32_t pointer_id() const { return pointer_id_; }
bool was_chosen_or_canceled() const { return was_chosen_or_canceled_; }
// Sets the set of gestures for this pointer.
void SetGestures(const ServerView* view,
uint32_t chosen_gesture_id,
const std::set<uint32_t>& possible_gesture_ids,
const std::set<uint32_t>& canceled_ids);
// Called when a Gesture we contain has been canceled.
void GestureCanceled(Gesture* gesture);
// Called when a Gesture we contain has been chosen.
void GestureChosen(Gesture* gesture, const ServerView* view);
// Process a move or up event. This may delay processing if we're waiting for
// previous results.
void ProcessEvent(const mojo::Event& event);
private:
// Corresponds to the type of event we're dispatching.
enum Phase {
// We're dispatching the initial down.
PHASE_DOWN,
// We're dispatching a move.
PHASE_MOVE,
};
// Sends the event for the current phase to the delegate.
void ForwardCurrentEvent();
// Moves |pending_event_| to |current_event_| and notifies the delegate.
void MovePendingToCurrentAndProcess();
// If |was_chosen_or_canceled_| is false and there is only one possible
// gesture and it is in the initial state, choose it. Otherwise do nothing.
void ChooseGestureIfPossible();
bool ScheduleDeleteIfNecessary();
GestureManager* gesture_manager_;
const int32_t pointer_id_;
Phase phase_;
// Used to iterate over the set of views that potentially have gestures.
ViewIterator view_iter_;
// Maps from the view to the set of possible gestures for the view.
std::map<const ServerView*, std::set<Gesture*>> view_to_gestures_;
Gesture* chosen_gesture_;
bool was_chosen_or_canceled_;
// The event we're processing. When initially created this is the supplied
// down event. When in PHASE_MOVE this is a move event.
mojo::EventPtr current_event_;
// Incoming events (move or up) are added here while while waiting for
// responses.
mojo::EventPtr pending_event_;
DISALLOW_COPY_AND_ASSIGN(Pointer);
};
GestureManager::Pointer::Pointer(GestureManager* gesture_manager,
int32_t pointer_id,
const mojo::Event& event,
const Views& views)
: gesture_manager_(gesture_manager),
pointer_id_(pointer_id),
phase_(PHASE_DOWN),
view_iter_(views),
chosen_gesture_(nullptr),
was_chosen_or_canceled_(false),
current_event_(event.Clone()) {
ForwardCurrentEvent();
}
GestureManager::Pointer::~Pointer() {
for (auto& pair : view_to_gestures_) {
for (Gesture* gesture : pair.second)
gesture_manager_->DetachGesture(gesture, this, pair.first);
}
}
void GestureManager::Pointer::SetGestures(
const ServerView* view,
uint32_t chosen_gesture_id,
const std::set<uint32_t>& possible_gesture_ids,
const std::set<uint32_t>& canceled_gesture_ids) {
if (!view_iter_.contains(view)) {
// We don't know about this view.
return;
}
// True if this is the view we're waiting for a response from.
const bool was_waiting_on =
(!was_chosen_or_canceled_ &&
(!view_iter_.at_end() && view_iter_.current() == view));
if (possible_gesture_ids.empty()) {
// The view no longer wants to be notified.
for (Gesture* gesture : view_to_gestures_[view])
gesture_manager_->DetachGesture(gesture, this, view);
view_to_gestures_.erase(view);
view_iter_.remove(view);
if (view_iter_.empty()) {
gesture_manager_->PointerHasNoGestures(this);
// WARNING: we've been deleted.
return;
}
} else {
if (was_waiting_on)
view_iter_.advance();
Gesture* to_choose = nullptr;
std::set<Gesture*> gestures;
for (auto gesture_id : possible_gesture_ids) {
Gesture* gesture = gesture_manager_->GetGesture(view, gesture_id);
gesture_manager_->AttachGesture(gesture, this, view);
gestures.insert(gesture);
if (gesture->state() == Gesture::STATE_CHOSEN &&
!was_chosen_or_canceled_) {
to_choose = gesture;
}
}
// Give preference to the supplied |chosen_gesture_id|.
if (!was_chosen_or_canceled_ && chosen_gesture_id != kInvalidGestureId) {
Gesture* gesture = gesture_manager_->GetGesture(view, chosen_gesture_id);
if (gesture->state() != Gesture::STATE_CANCELED)
to_choose = gesture;
DCHECK(possible_gesture_ids.count(gesture->id()));
gesture_manager_->AttachGesture(gesture, this, view);
}
// Tell GestureManager of any Gestures we're no longer associated with.
std::set<Gesture*> removed_gestures;
std::set_difference(
view_to_gestures_[view].begin(), view_to_gestures_[view].end(),
gestures.begin(), gestures.end(),
std::inserter(removed_gestures, removed_gestures.begin()));
view_to_gestures_[view].swap(gestures);
for (Gesture* gesture : removed_gestures)
gesture_manager_->DetachGesture(gesture, this, view);
if (chosen_gesture_ && removed_gestures.count(chosen_gesture_))
chosen_gesture_ = nullptr;
if (to_choose) {
gesture_manager_->ChooseGesture(to_choose, this, view);
} else {
// Choosing a gesture implicitly cancels all other gestures. If we didn't
// choose a gesture we need to update the state of any newly added
// gestures.
for (Gesture* gesture : gestures) {
if (gesture != chosen_gesture_ &&
(was_chosen_or_canceled_ ||
canceled_gesture_ids.count(gesture->id()))) {
gesture_manager_->CancelGesture(gesture, this, view);
}
}
}
}
if (was_waiting_on && !was_chosen_or_canceled_) {
if (view_iter_.at_end()) {
if (ScheduleDeleteIfNecessary())
return;
// If we're got all the responses, check if there is only one valid
// gesture.
ChooseGestureIfPossible();
if (!was_chosen_or_canceled_) {
// There is more than one valid gesture and none chosen. Continue
// synchronous dispatch of move events.
phase_ = PHASE_MOVE;
MovePendingToCurrentAndProcess();
}
} else {
ForwardCurrentEvent();
}
} else if (!was_chosen_or_canceled_ && phase_ != PHASE_DOWN) {
// We weren't waiting on this view but we're in the move phase. The set of
// gestures may have changed such that we only have one valid gesture. Check
// for that.
ChooseGestureIfPossible();
}
}
void GestureManager::Pointer::GestureCanceled(Gesture* gesture) {
if (was_chosen_or_canceled_ && gesture == chosen_gesture_) {
chosen_gesture_ = nullptr;
// No need to cancel other gestures as they are already canceled by virtue
// of us having been chosen.
} else if (!was_chosen_or_canceled_ && phase_ == PHASE_MOVE) {
ChooseGestureIfPossible();
}
}
void GestureManager::Pointer::GestureChosen(Gesture* gesture,
const ServerView* view) {
DCHECK(!was_chosen_or_canceled_);
was_chosen_or_canceled_ = true;
chosen_gesture_ = gesture;
for (auto& pair : view_to_gestures_) {
for (Gesture* g : pair.second) {
if (g != gesture)
gesture_manager_->CancelGesture(g, this, pair.first);
}
}
while (!view_iter_.at_end()) {
ForwardCurrentEvent();
view_iter_.advance();
}
if (ScheduleDeleteIfNecessary())
return;
phase_ = PHASE_MOVE;
MovePendingToCurrentAndProcess();
}
void GestureManager::Pointer::ProcessEvent(const mojo::Event& event) {
// |event| is either a move or up. In either case it has the new coordinates
// and is safe to replace the existing one with.
pending_event_ = event.Clone();
if (was_chosen_or_canceled_) {
MovePendingToCurrentAndProcess();
} else if (view_iter_.at_end()) {
view_iter_.reset_to_beginning();
MovePendingToCurrentAndProcess();
}
// The else case is we are waiting on a response from a view before we
// continue dispatching. When we get the response for the last view in the
// stack we'll move pending to current and start dispatching it.
}
void GestureManager::Pointer::ForwardCurrentEvent() {
DCHECK(!view_iter_.at_end());
const ServerView* view = view_iter_.current();
gesture_manager_->delegate_->ProcessEvent(
view, CloneEventForView(*current_event_, view), was_chosen_or_canceled_);
}
void GestureManager::Pointer::MovePendingToCurrentAndProcess() {
if (!pending_event_.get()) {
current_event_ = nullptr;
return;
}
current_event_ = pending_event_.Pass();
view_iter_.reset_to_beginning();
ForwardCurrentEvent();
if (was_chosen_or_canceled_) {
while (view_iter_.advance())
ForwardCurrentEvent();
if (ScheduleDeleteIfNecessary())
return;
current_event_ = nullptr;
}
}
void GestureManager::Pointer::ChooseGestureIfPossible() {
if (was_chosen_or_canceled_)
return;
Gesture* gesture_to_choose = nullptr;
const ServerView* view = nullptr;
for (auto& pair : view_to_gestures_) {
for (Gesture* gesture : pair.second) {
if (gesture->state() == Gesture::STATE_INITIAL) {
if (gesture_to_choose)
return;
view = pair.first;
gesture_to_choose = gesture;
}
}
}
if (view)
gesture_manager_->ChooseGesture(gesture_to_choose, this, view);
}
bool GestureManager::Pointer::ScheduleDeleteIfNecessary() {
if (current_event_ &&
(current_event_->action == mojo::EventType::POINTER_UP ||
current_event_->action == mojo::EventType::POINTER_CANCEL)) {
gesture_manager_->ScheduleDelete(this);
return true;
}
return false;
}
// ScheduledDeleteProcessor ---------------------------------------------------
class GestureManager::ScheduledDeleteProcessor {
public:
explicit ScheduledDeleteProcessor(GestureManager* manager)
: manager_(manager) {}
~ScheduledDeleteProcessor() { manager_->pointers_to_delete_.clear(); }
private:
GestureManager* manager_;
DISALLOW_COPY_AND_ASSIGN(ScheduledDeleteProcessor);
};
// PointerAndView --------------------------------------------------------------
GestureManager::PointerAndView::PointerAndView()
: pointer(nullptr), view(nullptr) {
}
GestureManager::PointerAndView::PointerAndView(Pointer* pointer,
const ServerView* view)
: pointer(pointer), view(view) {
}
bool GestureManager::PointerAndView::operator<(
const PointerAndView& other) const {
if (other.pointer->pointer_id() == pointer->pointer_id())
return view->id().connection_id < other.view->id().connection_id;
return pointer->pointer_id() < other.pointer->pointer_id();
}
// GestureManager --------------------------------------------------------------
// static
const uint32_t GestureManager::kInvalidGestureId = 0u;
GestureManager::GestureManager(GestureManagerDelegate* delegate,
const ServerView* root)
: delegate_(delegate), root_view_(root) {
}
GestureManager::~GestureManager() {
// Explicitly delete the pointers first as this may result in calling back to
// us to cleanup and delete gestures.
active_pointers_.clear();
}
bool GestureManager::ProcessEvent(const mojo::Event& event) {
if (!event.pointer_data)
return false;
ScheduledDeleteProcessor delete_processor(this);
const gfx::Point location(static_cast<int>(event.pointer_data->x),
static_cast<int>(event.pointer_data->y));
switch (event.action) {
case mojo::EventType::POINTER_DOWN: {
if (GetPointerById(event.pointer_data->pointer_id)) {
DVLOG(1) << "received more than one down for a pointer without a "
<< "corresponding up, id=" << event.pointer_data->pointer_id;
NOTREACHED();
return true;
}
const ServerView* deepest = FindDeepestVisibleView(root_view_, location);
Views targets(GetTouchTargets(deepest));
if (targets.empty())
return true;
scoped_ptr<Pointer> pointer(
new Pointer(this, event.pointer_data->pointer_id, event, targets));
active_pointers_.push_back(pointer.Pass());
return true;
}
case mojo::EventType::POINTER_CANCEL:
case mojo::EventType::POINTER_MOVE:
case mojo::EventType::POINTER_UP: {
Pointer* pointer = GetPointerById(event.pointer_data->pointer_id);
// We delete a pointer when it has no gestures, so it's possible to get
// here with no gestures. Additionally there is no need to explicitly
// delete |pointer| as it'll tell us when it's ready to be deleted.
if (pointer)
pointer->ProcessEvent(event);
return true;
}
default:
break;
}
return false;
}
scoped_ptr<ChangeMap> GestureManager::SetGestures(
const ServerView* view,
int32_t pointer_id,
uint32_t chosen_gesture_id,
const std::set<uint32_t>& possible_gesture_ids,
const std::set<uint32_t>& canceled_gesture_ids) {
// TODO(sky): caller should validate ids and make sure possible contains
// canceled and chosen.
DCHECK(!canceled_gesture_ids.count(kInvalidGestureId));
DCHECK(!possible_gesture_ids.count(kInvalidGestureId));
DCHECK(chosen_gesture_id == kInvalidGestureId ||
possible_gesture_ids.count(chosen_gesture_id));
DCHECK(chosen_gesture_id == kInvalidGestureId ||
!canceled_gesture_ids.count(chosen_gesture_id));
ScheduledDeleteProcessor delete_processor(this);
Pointer* pointer = GetPointerById(pointer_id);
current_change_.reset(new ChangeMap);
if (pointer) {
pointer->SetGestures(view, chosen_gesture_id, possible_gesture_ids,
canceled_gesture_ids);
}
return current_change_.Pass();
}
GestureManager::Pointer* GestureManager::GetPointerById(int32_t pointer_id) {
for (Pointer* pointer : active_pointers_) {
if (pointer->pointer_id() == pointer_id)
return pointer;
}
return nullptr;
}
void GestureManager::PointerHasNoGestures(Pointer* pointer) {
auto iter =
std::find(active_pointers_.begin(), active_pointers_.end(), pointer);
CHECK(iter != active_pointers_.end());
active_pointers_.erase(iter);
}
GestureManager::Gesture* GestureManager::GetGesture(const ServerView* view,
uint32_t gesture_id) {
GestureAndConnectionId gesture_and_connection_id =
MakeGestureAndConnectionId(view, gesture_id);
Gesture* gesture = gesture_map_[gesture_and_connection_id];
if (!gesture) {
gesture = new Gesture(gesture_id);
gesture_map_[gesture_and_connection_id] = gesture;
}
return gesture;
}
void GestureManager::AttachGesture(Gesture* gesture,
Pointer* pointer,
const ServerView* view) {
gesture->Attach(pointer, view);
}
void GestureManager::DetachGesture(Gesture* gesture,
Pointer* pointer,
const ServerView* view) {
gesture->Detach(pointer, view);
if (gesture->pointers_and_views().empty()) {
gesture_map_.erase(MakeGestureAndConnectionId(view, gesture->id()));
delete gesture;
}
}
void GestureManager::CancelGesture(Gesture* gesture,
Pointer* pointer,
const ServerView* view) {
if (gesture->state() == Gesture::STATE_CANCELED)
return;
gesture->set_state(Gesture::STATE_CANCELED);
for (auto& pointer_and_view : gesture->pointers_and_views()) {
(*current_change_)[pointer_and_view.view].canceled_gestures.insert(
gesture->id());
if (pointer_and_view.pointer != pointer)
pointer_and_view.pointer->GestureCanceled(gesture);
}
}
void GestureManager::ChooseGesture(Gesture* gesture,
Pointer* pointer,
const ServerView* view) {
if (gesture->state() == Gesture::STATE_CHOSEN) {
// This happens when |pointer| is supplied a gesture that is already
// chosen.
DCHECK((*current_change_)[view].chosen_gesture == kInvalidGestureId ||
(*current_change_)[view].chosen_gesture == gesture->id());
(*current_change_)[view].chosen_gesture = gesture->id();
pointer->GestureChosen(gesture, view);
} else {
gesture->set_state(Gesture::STATE_CHOSEN);
for (auto& pointer_and_view : gesture->pointers_and_views()) {
DCHECK((*current_change_)[pointer_and_view.view].chosen_gesture ==
kInvalidGestureId ||
(*current_change_)[pointer_and_view.view].chosen_gesture ==
gesture->id());
(*current_change_)[pointer_and_view.view].chosen_gesture = gesture->id();
pointer_and_view.pointer->GestureChosen(gesture, view);
}
}
}
void GestureManager::ScheduleDelete(Pointer* pointer) {
auto iter =
std::find(active_pointers_.begin(), active_pointers_.end(), pointer);
if (iter != active_pointers_.end()) {
active_pointers_.weak_erase(iter);
pointers_to_delete_.push_back(pointer);
}
}
} // namespace view_manager
| [
"viettrungluu@chromium.org"
] | viettrungluu@chromium.org |
c1f3f2bb1776f563040cdd1d33d963bb1485462b | 7768b3223c7c7ed88338793ff8e84422b03f4d3b | /engine/src/expressionParser.cpp | d595ba3c63ad06b8f4c788af8a49faabc73e4974 | [] | no_license | MrXester/CG-2021 | 1784c21bb00f6db5bf3608dde7a397aa3e649240 | 1e8d699df050f8192cb42f856cf31f21483a3d34 | refs/heads/main | 2023-08-03T01:12:23.623288 | 2021-10-04T11:53:50 | 2021-10-04T11:53:50 | 345,325,775 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 3,594 | cpp | #define IDNEV 0
#define SQTEV 1
#define SINEV 2
#define TANEV 3
#define COSEV 4
#define MPIEV 5
#define RNDEV 6
class ExprParser{
public:
std::map<std::string, float> hash;
std::string expression;
int error = 0;
ExprParser(std::string exp){
setExpr(exp);
}
ExprParser(){
setExpr("");
}
ExprParser(const char*exp){
setExpr(exp);
}
void setExpr(std::string exp){
error = 0;
this->expression = exp;
expression.erase(remove_if(expression.begin(), expression.end(), isspace), expression.end());
std::reverse(this->expression.begin(), this->expression.end());
}
char popChr(){
if (expression.empty()) return -1;
char res = expression.back();
expression.pop_back();
return res;
}
char peekChr(){
if (expression.empty()) return -1;
return expression.back();
}
float getValue(){
std::string res;
while(isdigit(peekChr())){
res.push_back(popChr());
}
if (peekChr() == '.'){
res.push_back(popChr());
while(isdigit(peekChr())){
res.push_back(popChr());
}
}
try{
return std::stof(res);
}
catch(std::exception& ia){
error = 1;
return 1;
}
}
float getVar(){
std::string res;
while(isalpha(peekChr())){
res.push_back(popChr());
}
try{
return hash.at(res.c_str());
}
catch(std::exception& ia){
error = 1;
return 1;
}
}
float getNextFactor(){
char check = peekChr();
float res = 0;
if(isdigit(check)){
res = getValue();
}
else if(isalpha(check)){
res = getVar();
}
else if(check=='('){
popChr();
res = eval();
popChr();
}
else if(check=='-'){
popChr();
res = getNextFactor();
res *= (-1);
}
else if(check=='~'){
popChr();
res = eval();
res = !(res);
}
else{
error = 1;
return 1;
}
return res;
}
float getNextTerm(){
float res = getNextFactor();
char check = peekChr();
while(check == '*' || check == '/'){
if (popChr() == '*'){
res *= getNextFactor();
}
else{
res /= getNextFactor();
}
check = peekChr();
}
return res;
}
float getNextExpr(){
float res = getNextTerm();
char check = peekChr();
while (check == '-' || check=='+'){
if(popChr() == '+'){
res += getNextTerm();
}
else{
res -= getNextTerm();
}
check = peekChr();
}
return res;
}
float getNextBool(){
float res = getNextExpr();
char check = peekChr();
while (check == '>' || check=='<' || check == '='){
check = popChr();
if(check == '>'){
res = (res > getNextExpr());
}
else if(check == '<') {
res = (res < getNextExpr());
}
else{
res = (res == getNextExpr());
}
check = peekChr();
}
return res;
}
float eval(){
float res = getNextBool();
char check = peekChr();
while (check == '&' || check=='|'){
char check = popChr();
if(check == '&'){
res = (res && getNextBool());
}
else if(check == '|') {
res = (res || getNextBool());
}
check = peekChr();
}
return res;
}
float evalOpts(int opt=IDNEV){
float res = this->eval();
error = !(isfinite(res));
if (!(error) || opt == MPIEV || opt == RNDEV)
switch (opt){
case SQTEV:
res = sqrt(res);
break;
case SINEV:
res = sin(res);
break;
case TANEV:
res = cos(res);
break;
case COSEV:
res = cos(res);
break;
case MPIEV:
error = 0;
res = M_PI;
break;
case RNDEV:
res = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
error = 0;
break;
default:
break;
}
error = !(isfinite(res));
return res;
}
}; | [
"76684399+MrXester@users.noreply.github.com"
] | 76684399+MrXester@users.noreply.github.com |
5053449fcfd6ac00be47e7f864da6aee19606814 | 167c7506aab0e0f2d2de0994f986b846593286b1 | /cplusplus_base_library/Qt/boost/circular_buffer/details.hpp | 6bfaff24ab6987128a8ca7d92aa1912ddcf65d88 | [] | no_license | ngzHappy/bd2 | 78ee1755c8b83b8269e7f41bf72506bfd27564de | aacfc22aa1919b5ab5f5f4473375a1e8856dc213 | refs/heads/master | 2020-05-30T07:13:50.283590 | 2016-11-20T12:36:30 | 2016-11-20T12:36:30 | 69,462,962 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,200 | hpp | // Helper classes and functions for the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2014 Glen Fernandes // C++11 allocator model support.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
#define BOOST_CIRCULAR_BUFFER_DETAILS_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <Qt/boost/iterator.hpp>
#include <Qt/boost/throw_exception.hpp>
#include <Qt/boost/container/allocator_traits.hpp>
#include <Qt/boost/move/move.hpp>
#include <Qt/boost/type_traits/is_nothrow_move_constructible.hpp>
#include <Qt/boost/utility/addressof.hpp>
#include <Qt/boost/detail/no_exceptions_support.hpp>
#include <iterator>
// Silence MS /W4 warnings like C4913:
// "user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used"
// This might happen when previously including some boost headers that overload the coma operator.
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable:4913)
#endif
namespace boost {
namespace cb_details {
template <class Traits> struct nonconst_traits;
template<class ForwardIterator, class Diff, class T, class Alloc>
void uninitialized_fill_n_with_alloc(
ForwardIterator first, Diff n, const T& item, Alloc& alloc);
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a);
/*!
\struct const_traits
\brief Defines the data types for a const iterator.
*/
template <class Traits>
struct const_traits {
// Basic types
typedef typename Traits::value_type value_type;
typedef typename Traits::const_pointer pointer;
typedef typename Traits::const_reference reference;
typedef typename Traits::size_type size_type;
typedef typename Traits::difference_type difference_type;
// Non-const traits
typedef nonconst_traits<Traits> nonconst_self;
};
/*!
\struct nonconst_traits
\brief Defines the data types for a non-const iterator.
*/
template <class Traits>
struct nonconst_traits {
// Basic types
typedef typename Traits::value_type value_type;
typedef typename Traits::pointer pointer;
typedef typename Traits::reference reference;
typedef typename Traits::size_type size_type;
typedef typename Traits::difference_type difference_type;
// Non-const traits
typedef nonconst_traits<Traits> nonconst_self;
};
/*!
\struct iterator_wrapper
\brief Helper iterator dereference wrapper.
*/
template <class Iterator>
struct iterator_wrapper {
mutable Iterator m_it;
explicit iterator_wrapper(Iterator it) : m_it(it) {}
Iterator operator () () const { return m_it++; }
private:
iterator_wrapper<Iterator>& operator = (const iterator_wrapper<Iterator>&); // do not generate
};
/*!
\struct item_wrapper
\brief Helper item dereference wrapper.
*/
template <class Pointer, class Value>
struct item_wrapper {
Value m_item;
explicit item_wrapper(Value item) : m_item(item) {}
Pointer operator () () const { return &m_item; }
private:
item_wrapper<Pointer, Value>& operator = (const item_wrapper<Pointer, Value>&); // do not generate
};
/*!
\struct assign_n
\brief Helper functor for assigning n items.
*/
template <class Value, class Alloc>
struct assign_n {
typedef typename boost::container::allocator_traits<Alloc>::size_type size_type;
size_type m_n;
Value m_item;
Alloc& m_alloc;
assign_n(size_type n, Value item, Alloc& alloc) : m_n(n), m_item(item), m_alloc(alloc) {}
template <class Pointer>
void operator () (Pointer p) const {
uninitialized_fill_n_with_alloc(p, m_n, m_item, m_alloc);
}
private:
assign_n<Value, Alloc>& operator = (const assign_n<Value, Alloc>&); // do not generate
};
/*!
\struct assign_range
\brief Helper functor for assigning range of items.
*/
template <class Iterator, class Alloc>
struct assign_range {
Iterator m_first;
Iterator m_last;
Alloc& m_alloc;
assign_range(const Iterator& first, const Iterator& last, Alloc& alloc)
: m_first(first), m_last(last), m_alloc(alloc) {}
template <class Pointer>
void operator () (Pointer p) const {
boost::cb_details::uninitialized_copy(m_first, m_last, p, m_alloc);
}
};
template <class Iterator, class Alloc>
inline assign_range<Iterator, Alloc> make_assign_range(const Iterator& first, const Iterator& last, Alloc& a) {
return assign_range<Iterator, Alloc>(first, last, a);
}
/*!
\class capacity_control
\brief Capacity controller of the space optimized circular buffer.
*/
template <class Size>
class capacity_control {
//! The capacity of the space-optimized circular buffer.
Size m_capacity;
//! The lowest guaranteed or minimum capacity of the adapted space-optimized circular buffer.
Size m_min_capacity;
public:
//! Constructor.
capacity_control(Size buffer_capacity, Size min_buffer_capacity = 0)
: m_capacity(buffer_capacity), m_min_capacity(min_buffer_capacity)
{ // Check for capacity lower than min_capacity.
BOOST_CB_ASSERT(buffer_capacity >= min_buffer_capacity);
}
// Default copy constructor.
// Default assign operator.
//! Get the capacity of the space optimized circular buffer.
Size capacity() const { return m_capacity; }
//! Get the minimal capacity of the space optimized circular buffer.
Size min_capacity() const { return m_min_capacity; }
//! Size operator - returns the capacity of the space optimized circular buffer.
operator Size() const { return m_capacity; }
};
/*!
\struct iterator
\brief Random access iterator for the circular buffer.
\param Buff The type of the underlying circular buffer.
\param Traits Basic iterator types.
\note This iterator is not circular. It was designed
for iterating from begin() to end() of the circular buffer.
*/
template <class Buff, class Traits>
struct iterator :
public boost::iterator<
std::random_access_iterator_tag,
typename Traits::value_type,
typename Traits::difference_type,
typename Traits::pointer,
typename Traits::reference>
#if BOOST_CB_ENABLE_DEBUG
, public debug_iterator_base
#endif // #if BOOST_CB_ENABLE_DEBUG
{
// Helper types
//! Base iterator.
typedef boost::iterator<
std::random_access_iterator_tag,
typename Traits::value_type,
typename Traits::difference_type,
typename Traits::pointer,
typename Traits::reference> base_iterator;
//! Non-const iterator.
typedef iterator<Buff, typename Traits::nonconst_self> nonconst_self;
// Basic types
//! The type of the elements stored in the circular buffer.
typedef typename base_iterator::value_type value_type;
//! Pointer to the element.
typedef typename base_iterator::pointer pointer;
//! Reference to the element.
typedef typename base_iterator::reference reference;
//! Size type.
typedef typename Traits::size_type size_type;
//! Difference type.
typedef typename base_iterator::difference_type difference_type;
// Member variables
//! The circular buffer where the iterator points to.
const Buff* m_buff;
//! An internal iterator.
pointer m_it;
// Construction & assignment
// Default copy constructor.
//! Default constructor.
iterator() : m_buff(0), m_it(0) {}
#if BOOST_CB_ENABLE_DEBUG
//! Copy constructor (used for converting from a non-const to a const iterator).
iterator(const nonconst_self& it) : debug_iterator_base(it), m_buff(it.m_buff), m_it(it.m_it) {}
//! Internal constructor.
/*!
\note This constructor is not intended to be used directly by the user.
*/
iterator(const Buff* cb, const pointer p) : debug_iterator_base(cb), m_buff(cb), m_it(p) {}
#else
iterator(const nonconst_self& it) : m_buff(it.m_buff), m_it(it.m_it) {}
iterator(const Buff* cb, const pointer p) : m_buff(cb), m_it(p) {}
#endif // #if BOOST_CB_ENABLE_DEBUG
//! Assign operator.
iterator& operator = (const iterator& it) {
if (this == &it)
return *this;
#if BOOST_CB_ENABLE_DEBUG
debug_iterator_base::operator =(it);
#endif // #if BOOST_CB_ENABLE_DEBUG
m_buff = it.m_buff;
m_it = it.m_it;
return *this;
}
// Random access iterator methods
//! Dereferencing operator.
reference operator * () const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end()
return *m_it;
}
//! Dereferencing operator.
pointer operator -> () const { return &(operator*()); }
//! Difference operator.
template <class Traits0>
difference_type operator - (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return linearize_pointer(*this) - linearize_pointer(it);
}
//! Increment operator (prefix).
iterator& operator ++ () {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != 0); // check for iterator pointing to end()
m_buff->increment(m_it);
if (m_it == m_buff->m_last)
m_it = 0;
return *this;
}
//! Increment operator (postfix).
iterator operator ++ (int) {
iterator<Buff, Traits> tmp = *this;
++*this;
return tmp;
}
//! Decrement operator (prefix).
iterator& operator -- () {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(m_it != m_buff->m_first); // check for iterator pointing to begin()
if (m_it == 0)
m_it = m_buff->m_last;
m_buff->decrement(m_it);
return *this;
}
//! Decrement operator (postfix).
iterator operator -- (int) {
iterator<Buff, Traits> tmp = *this;
--*this;
return tmp;
}
//! Iterator addition.
iterator& operator += (difference_type n) {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
if (n > 0) {
BOOST_CB_ASSERT(m_buff->end() - *this >= n); // check for too large n
m_it = m_buff->add(m_it, n);
if (m_it == m_buff->m_last)
m_it = 0;
} else if (n < 0) {
*this -= -n;
}
return *this;
}
//! Iterator addition.
iterator operator + (difference_type n) const { return iterator<Buff, Traits>(*this) += n; }
//! Iterator subtraction.
iterator& operator -= (difference_type n) {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
if (n > 0) {
BOOST_CB_ASSERT(*this - m_buff->begin() >= n); // check for too large n
m_it = m_buff->sub(m_it == 0 ? m_buff->m_last : m_it, n);
} else if (n < 0) {
*this += -n;
}
return *this;
}
//! Iterator subtraction.
iterator operator - (difference_type n) const { return iterator<Buff, Traits>(*this) -= n; }
//! Element access operator.
reference operator [] (difference_type n) const { return *(*this + n); }
// Equality & comparison
//! Equality.
template <class Traits0>
bool operator == (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return m_it == it.m_it;
}
//! Inequality.
template <class Traits0>
bool operator != (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return m_it != it.m_it;
}
//! Less.
template <class Traits0>
bool operator < (const iterator<Buff, Traits0>& it) const {
BOOST_CB_ASSERT(is_valid(m_buff)); // check for uninitialized or invalidated iterator
BOOST_CB_ASSERT(it.is_valid(m_buff)); // check for uninitialized or invalidated iterator
return linearize_pointer(*this) < linearize_pointer(it);
}
//! Greater.
template <class Traits0>
bool operator > (const iterator<Buff, Traits0>& it) const { return it < *this; }
//! Less or equal.
template <class Traits0>
bool operator <= (const iterator<Buff, Traits0>& it) const { return !(it < *this); }
//! Greater or equal.
template <class Traits0>
bool operator >= (const iterator<Buff, Traits0>& it) const { return !(*this < it); }
// Helpers
//! Get a pointer which would point to the same element as the iterator in case the circular buffer is linearized.
template <class Traits0>
typename Traits0::pointer linearize_pointer(const iterator<Buff, Traits0>& it) const {
return it.m_it == 0 ? m_buff->m_buff + m_buff->size() :
(it.m_it < m_buff->m_first ? it.m_it + (m_buff->m_end - m_buff->m_first)
: m_buff->m_buff + (it.m_it - m_buff->m_first));
}
};
//! Iterator addition.
template <class Buff, class Traits>
inline iterator<Buff, Traits>
operator + (typename Traits::difference_type n, const iterator<Buff, Traits>& it) {
return it + n;
}
/*!
\fn ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest)
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type.
*/
template<class InputIterator, class ForwardIterator, class Alloc>
inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
ForwardIterator next = dest;
BOOST_TRY {
for (; first != last; ++first, ++dest)
boost::container::allocator_traits<Alloc>::construct(a, boost::addressof(*dest), *first);
} BOOST_CATCH(...) {
for (; next != dest; ++next)
boost::container::allocator_traits<Alloc>::destroy(a, boost::addressof(*next));
BOOST_RETHROW
}
BOOST_CATCH_END
return dest;
}
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
true_type) {
for (; first != last; ++first, ++dest)
boost::container::allocator_traits<Alloc>::construct(a, boost::addressof(*dest), boost::move(*first));
return dest;
}
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept_impl(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a,
false_type) {
return uninitialized_copy(first, last, dest, a);
}
/*!
\fn ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest)
\brief Equivalent of <code>std::uninitialized_copy</code> but with explicit specification of value type and moves elements if they have noexcept move constructors.
*/
template<class InputIterator, class ForwardIterator, class Alloc>
ForwardIterator uninitialized_move_if_noexcept(InputIterator first, InputIterator last, ForwardIterator dest, Alloc& a) {
typedef typename boost::is_nothrow_move_constructible<typename boost::container::allocator_traits<Alloc>::value_type>::type tag_t;
return uninitialized_move_if_noexcept_impl(first, last, dest, a, tag_t());
}
/*!
\fn void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc)
\brief Equivalent of <code>std::uninitialized_fill_n</code> with allocator.
*/
template<class ForwardIterator, class Diff, class T, class Alloc>
inline void uninitialized_fill_n_with_alloc(ForwardIterator first, Diff n, const T& item, Alloc& alloc) {
ForwardIterator next = first;
BOOST_TRY {
for (; n > 0; ++first, --n)
boost::container::allocator_traits<Alloc>::construct(alloc, boost::addressof(*first), item);
} BOOST_CATCH(...) {
for (; next != first; ++next)
boost::container::allocator_traits<Alloc>::destroy(alloc, boost::addressof(*next));
BOOST_RETHROW
}
BOOST_CATCH_END
}
} // namespace cb_details
} // namespace boost
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_DETAILS_HPP)
| [
"819869472@qq.com"
] | 819869472@qq.com |
bbff85179854eeaef1130a0fc264ee929f200882 | 51f985e90ba3ad44e3ad5722c65078220477e48f | /PhotoKit-master/PhotoKit-master/src/ShareManager.h | d8c6cafddb3163cd59c2030001721eae8912d796 | [] | no_license | jason-lv-meng/study | 9444e7c4dfcd2871a232f4df9ae9acf467da89bf | 2b115a9b2eee5ccfdd92bda755bb302d99ef7aa9 | refs/heads/master | 2020-09-20T17:48:34.866238 | 2019-11-28T23:45:01 | 2019-11-28T23:45:01 | 224,551,756 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241 | h | #ifndef SHAREMANAGER_H
#define SHAREMANAGER_H
#include <QObject>
class ShareManager : public QObject
{
Q_OBJECT
public:
explicit ShareManager(QObject *parent = 0);
signals:
public slots:
};
#endif // SHAREMANAGER_H
| [
"lvmengzou2007@163.com"
] | lvmengzou2007@163.com |
4a4db6dea67636fefa0207e13e2a361dc596b129 | 5a1b1e569f53fb1189f8e8bc9fd718d603a8eed3 | /Cube3.cpp | cf2fd383826d31d9d9986079afcb072fa3a86687 | [] | no_license | Inejka/Cube | 0a24dc669dc0f581bfd7f03724ffe2d7e9930a64 | bdbf326458f12f17db5f166ec93760604fb40b86 | refs/heads/master | 2022-12-13T07:57:06.916779 | 2020-09-08T16:08:40 | 2020-09-08T16:08:40 | 293,101,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,875 | cpp | //
// Created by art on 9/2/20.
//
#include "Cube3.h"
#include <ctime>
#include <iostream>
Cube3::Cube3() : Cube(3) {}
void Cube3::command(std::string commands) {
short times;
bool isInverse;
for (int i = 0; i < commands.size(); ++i) {
times = 1;
isInverse = false;
if (commands[i] != ' ') {
if (commands[i] == '2') {
times = 2;
i++;
}
if (commands[i + 1] == '\'') isInverse = true;
switch (commands[i]) {
case 'F': {
for (int j = 0; j < times; ++j) {
isInverse ? F_() : F();
}
break;
}
case 'B': {
for (int j = 0; j < times; ++j) {
isInverse ? B_() : B();
}
break;
}
case 'L': {
for (int j = 0; j < times; ++j) {
isInverse ? L_() : L();
}
break;
}
case 'R': {
for (int j = 0; j < times; ++j) {
isInverse ? R_() : R();
}
break;
}
case 'U': {
for (int j = 0; j < times; ++j) {
isInverse ? U_() : U();
}
break;
}
case 'D': {
for (int j = 0; j < times; ++j) {
isInverse ? D_() : D();
}
break;
}
}
while (commands[i] != ' ' && i < commands.size())i++;
}
}
}
void Cube3::U() {
putOnTheSide(false);
rotateLayer(2, true);
putOnTheSide(true);
}
void Cube3::U_() {
putOnTheSide(false);
rotateLayer(2, false);
putOnTheSide(true);
}
void Cube3::D() {
putOnTheSide(true);
rotateLayer(2, true);
putOnTheSide(false);
}
void Cube3::D_() {
putOnTheSide(true);
rotateLayer(2, false);
putOnTheSide(false);
}
void Cube3::R() {
rotateLayer(2, true);
}
void Cube3::R_() {
rotateLayer(2, false);
}
void Cube3::L() {
rotateLayer(0, false);
}
void Cube3::L_() {
rotateLayer(0, true);
}
void Cube3::F() {
rotateCubeHorizontally(true);
rotateLayer(2, true);
rotateCubeHorizontally(false);
}
void Cube3::F_() {
rotateCubeHorizontally(true);
rotateLayer(2, false);
rotateCubeHorizontally(false);
}
void Cube3::B() {
rotateCubeHorizontally(true);
rotateLayer(0, true);
rotateCubeHorizontally(false);
}
void Cube3::B_() {
rotateCubeHorizontally(true);
rotateLayer(0, false);
rotateCubeHorizontally(false);
}
void Cube3::shuffle() {
srand(time(0));
int random;
for (int i = 0; i < 40; i++) {
random = rand() % 12;
switch (random) {
case 0:
L();
break;
case 1:
L_();
break;
case 2:
R();
break;
case 3:
R_();
break;
case 4:
F();
break;
case 5:
F_();
break;
case 6:
D();
break;
case 7:
D_();
break;
case 8:
B_();
break;
case 9:
B();
break;
case 10:
U();
break;
case 11:
U_();
break;
}
}
}
void Cube3::load() {
freopen("input.txt", "r", stdin);
std::cin.seekg(0);
std::cin >> (*this);
fclose(stdin);
freopen("CON", "r", stdin);
}
void Cube3::save() {
freopen("output.txt", "w", stdout);
std::cout << (*this);
fclose(stdout);
freopen("CON", "r", stdout);
}
bool check_near(const Cube &cube, int pos_x, int pos_y) {
for(int i = -1 ; i < 2 ; i++)
for(int j = -1 ; j < 2 ; j++)
if(cube.getColor(pos_x+i,pos_y+j)!=cube.getColor(pos_x+1,pos_y+1))return false;
}
bool Cube3::check() {
return (check_near(*this, 1, 4) &&
check_near(*this, 4, 4) &&
check_near(*this, 7, 4) &&
check_near(*this, 10, 4) &&
check_near(*this, 7, 1) &&
check_near(*this, 7, 7)
);
} | [
"dante12654@gmail.com"
] | dante12654@gmail.com |
403b0e6de93995b7ccd5ea7ce03e576b0e1394fa | 2232c179ab4aafbac2e53475447a5494b26aa3fb | /test/utest-common/check_mpi_functionality.cpp | 993d9ad9eab535f689658bec41f6acf74e0708be | [] | no_license | martinv/pdekit | 689986d252d13fb3ed0aa52a0f8f6edd8eef943c | 37e127c81702f62f744c11cc2483869d8079f43e | refs/heads/master | 2020-03-31T09:24:32.541648 | 2018-10-08T15:23:43 | 2018-10-08T15:23:43 | 152,095,058 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,929 | cpp | #define DONT_USE_BOOST_TEST 1
#if DONT_USE_BOOST_TEST
#include <iostream>
#include "common/MPI/MPIEnv.hpp"
#include "common/PDEKit.hpp"
using namespace pdekit;
int main(int argc, char *argv[])
{
// MPI_Init(&argc,&argv);
common::mpi::MPIEnv::instance_type &mpi_env = common::mpi::MPIEnv::instance(argc, argv);
/*
// Another option to initialize:
common::mpi::MPIEnv::instance_type &mpi_env =
common::mpi::MPIEnv::instance(); mpi_env.init(argc, argv);
*/
const Uint rank = mpi_env.rank();
if (rank == 0)
{
if (mpi_env.is_initialized())
{
std::cout << "MPI environment is properly initialized" << std::endl;
std::cout << "MPI world communicator size = " << mpi_env.comm_size() << std::endl;
}
else
{
std::cerr << "Didn't manage to initialize the mpi envirnoment properly!" << std::endl;
}
}
// MPI_Finalize();
mpi_env.finalize();
if (rank == 0)
{
if (mpi_env.is_finalized())
{
std::cout << "MPI environment was properly finalized" << std::endl;
}
else
{
std::cerr << "Didn't manage to finalize the mpi envirnoment properly!" << std::endl;
}
}
return 0;
}
#else
/// Generate automatically the 'main' function for the test module
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE mpi_functionality_test
#include <boost/test/unit_test.hpp>
/// Standard template library headers
#include <iostream>
/// PDEKIT headers
#include "common/MPI/MPIEnv.hpp"
using namespace pdekit;
// ============================================================================
struct MPI_Functionality_Fixture
{
/// common setup for each test case
MPI_Functionality_Fixture()
{
// uncomment if you want to use arguments to the test executable
m_argc = boost::unit_test::framework::master_test_suite().argc;
m_argv = boost::unit_test::framework::master_test_suite().argv;
}
/// common tear-down for each test case
~MPI_Functionality_Fixture()
{
}
/// possibly common variables/functions used on the tests below
int m_argc;
char **m_argv;
};
BOOST_FIXTURE_TEST_SUITE(MPI_Functionality_TestSuite, MPI_Functionality_Fixture)
// ============================================================================
BOOST_AUTO_TEST_CASE(mpi_functionality_parenv_init)
{
// common::mpi::MPIEnv::instance_type& mpi_env =
// common::mpi::MPIEnv::instance(m_argc,m_argv);
// BOOST_CHECK_EQUAL(mpi_env.is_initialized(), true);
MPI_Init(&m_argc, &m_argv);
}
// ============================================================================
BOOST_AUTO_TEST_CASE(mpi_functionality_parenv_finalize)
{
// common::mpi::MPIEnv::instance_type& mpi_env =
// common::mpi::MPIEnv::instance();
// mpi_env.finalize();
// BOOST_CHECK_EQUAL( mpi_env.is_finalized(), true );
MPI_Finalize();
}
// ============================================================================
BOOST_AUTO_TEST_SUITE_END()
#endif
#if 0
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE mpi_functionality
#include <boost/test/unit_test.hpp>
#include "mpi.h"
// ============================================================================
struct MPI_Functionality_Fixture
{
MPI_Functionality_Fixture()
{
m_argc = boost::unit_test::framework::master_test_suite().argc;
m_argv = boost::unit_test::framework::master_test_suite().argv;
}
int m_argc;
char** m_argv;
};
BOOST_FIXTURE_TEST_SUITE( MPI_Functionality_TestSuite, MPI_Functionality_Fixture )
// ============================================================================
BOOST_AUTO_TEST_CASE( mpi_functionality_parenv_init )
{
MPI_Init(&m_argc,&m_argv);
}
// ============================================================================
BOOST_AUTO_TEST_CASE( mpi_functionality_parenv_finalize )
{
MPI_Finalize();
}
// ============================================================================
BOOST_AUTO_TEST_SUITE_END()
#endif
| [
"martin.vymazal@gmail.com"
] | martin.vymazal@gmail.com |
9b7195016fe0281c8f2ed14fa4fbf6aadb6f39b8 | 4941cb604d70f2ff25a00673c32b19e2af52d6a0 | /oyjl/oyjl-args-qml/src/app_data.cpp | 358ed84a63f6a22207d5558ed58955132c7fff6b | [
"MIT"
] | permissive | OpenICC/config | 93a0ec3c7dba581db3db337901798dc4378b4431 | da5fcd4ae809ad193f76e1399e91c3ebb69de3fb | refs/heads/master | 2022-05-15T16:26:09.297351 | 2022-05-06T06:18:23 | 2022-05-06T06:18:23 | 71,343,163 | 2 | 2 | null | 2016-12-26T07:49:29 | 2016-10-19T09:54:15 | C | UTF-8 | C++ | false | false | 10,472 | cpp | /** @file app_data.cpp
*
* Oyjl JSON QML is a graphical renderer of UI files.
*
* @par Copyright:
* 2018 (C) Kai-Uwe Behrmann
* All Rights reserved.
*
* @par License:
* MIT <http://www.opensource.org/licenses/mit-license.php>
* @since 2018/02/26
*
* - AppData -> JSON conversion
* - a few app specific functions
*/
#include "include/app_data.h"
#include <QFileInfo>
#include <QDirIterator>
#include <QLocale>
#include <QUrl>
#include <QTextStream>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <oyjl_version.h>
#include <oyjl.h>
#if defined(Q_OS_ANDROID)
# include <QtAndroidExtras/QtAndroid>
#endif
/* Function pointer hook for Process class. If set, this function replaces shell out. */
int (*processCallback_p)(int argc, const char ** argv) = NULL;
/** @brief open a local file from disc */
QString AppData::readFile(QString url)
{
QString text;
QFile f;
if(url == "-")
{
f.open(stdin, QIODevice::ReadOnly);
LOG(QString("Load: %1").arg(url));
}
else
{
f.setFileName( url );
f.open(QIODevice::ReadOnly|QIODevice::Unbuffered);
}
QByteArray a;
if(f.isOpen())
{
a = f.readAll();
text = a;
f.close();
}
return text;
}
/** @brief read document JSON from file
*
* The function opens a JSON file. It then injects localisation, the
* locale name from Qt. The result is returned as JSON string.
*/
QString AppData::getJSON(QString url)
{
QString jui = readFile( url );
QByteArray a;
if(jui.length() == 0)
a = url.toLocal8Bit();
else
a = jui.toLocal8Bit();
QJsonParseError e;
QJsonDocument jdoc = QJsonDocument::fromJson(a,&e);
if(jdoc.isNull())
{
LOG(QString("%1: %2\n%3").arg(tr("Json is invalid")).arg(url).arg(jui));
int size = 0;
const char * fn = url.toLocal8Bit().data();
char * json = oyjlReadFile(fn, &size);
if(!size)
{
char * error = NULL;
oyjlStringAdd( &error, 0,0, "{\"error\": \"%s\"}", oyjlJsonEscape(fn,0) );
LOG(QString("No size of: %1").arg(fn));
return QString(error);
}
else
{
char * error_buffer = (char*) calloc( 256, sizeof(char) );
oyjl_val root = oyjlTreeParse( json, error_buffer, 256 );
if(error_buffer[0])
LOG(QString(error_buffer));
oyjlTreeFree( root );
}
}
QJsonObject json;
json = jdoc.object();
QLocale loc;
json["prefix"] = "LOCALE_";
json["LOCALE_info"] = loc.name();
LOG(tr("finished loading"));
return QString(QJsonDocument(json).toJson(QJsonDocument::Indented));
}
/** @brief export JSON string from internal model
*
* @param url the file name to write to
*/
void AppData::writeJSON( QString url )
{
QFile f;
if(url == "-")
f.open(stdout, QIODevice::WriteOnly);
else if(url.length())
{
f.setFileName( url );
f.open(QIODevice::WriteOnly);
}
if(f.isOpen())
{
int level = 0;
char * json = NULL;
oyjlTreeToJson( m_model, &level, &json );
if(json)
{
f.write(json);
free(json);
}
f.close();
LOG(QString("Wrote to: %1").arg(url));
}
}
#define OYJL_PIXMAPSDIRNAME "pixmaps"
#if defined(__APPLE__)
# define OS_USER_DIR "~/Library"
# define OS_GLOBAL_DIR "/Library"
# define OS_LOGO_PATH "/org.freedesktop.oyjl/" OYJL_PIXMAPSDIRNAME
# define OS_LOGO_USER_DIR OS_USER_DIR OS_LOGO_PATH
# define OS_LOGO_SYSTEM_DIR OS_GLOBAL_DIR OS_LOGO_PATH
#else
# define OS_USER_DIR "~/."
# define OS_GLOBAL_DIR "/usr/share/"
# define OS_LOGO_PATH OYJL_PIXMAPSDIRNAME
# define OS_LOGO_USER_DIR OS_USER_DIR "local/share/" OS_LOGO_PATH
# define OS_LOGO_SYSTEM_DIR OS_GLOBAL_DIR OS_LOGO_PATH
#endif
#define OYJL_LOGO_DIR OYJL_DATADIR "/" OYJL_PIXMAPSDIRNAME
typedef enum {
oyjlSCOPE_USER,
oyjlSCOPE_SYSTEM,
oyjlSCOPE_OYJL
} oyjlSCOPE_e;
/** @brief get the first file name in the logo search path
*/
QString findFile(QString pattern, oyjlSCOPE_e scope)
{
QString fn;
const char * p = NULL;
switch(scope)
{
case oyjlSCOPE_USER: p = OS_LOGO_USER_DIR; break;
case oyjlSCOPE_SYSTEM: p = OS_LOGO_SYSTEM_DIR; break;
case oyjlSCOPE_OYJL: p = OYJL_LOGO_DIR; break;
}
QString path(p);
path.replace(QString("~"), QString(QDir::homePath()));
QStringList search = QStringList() << pattern + "*";
QDirIterator it(path, search, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
QStringList files;
while (it.hasNext())
{
files << it.next();
break;
}
if(files.length())
fn = "file:/" + files[0];
return fn;
}
/** @brief search for a logo
*
* Scan first the user scope and then for system installed files.
*/
QString AppData::findLogo(QString pattern)
{
QString fn;
if (pattern.isEmpty())
return fn;
fn = findFile(pattern, oyjlSCOPE_USER);
if(fn.length() == 0)
fn = findFile(pattern, oyjlSCOPE_SYSTEM);
if(fn.length() == 0)
fn = findFile(pattern, oyjlSCOPE_OYJL);
if(fn.length() == 0)
{
QString f = pattern;
QIcon i( f );
if(!i.isNull())
fn = f;
}
return fn;
}
/** @brief Version strings for UIs
*
* @param type - 0 : compile time version
* - 1 : lib name
* - 2 : lib name
* - 3 : run time version
* @return information string
*/
QString AppData::getLibDescription(int type)
{
QString v(OYJL_VERSION_NAME);
QString p("libOyjl");
if(p[0].isLower())
p[0] = p[0].toUpper();
switch(type)
{
case 0:
return QString(v);
case 1:
return QString(tr("%1 Version")).arg(p);
case 2:
return QString(tr("%1 Version")).arg(p);
case 3:
return QString::number(oyjlVersion(0));
case 4:
{
QString qv(tr("NONE"));
return qv;
}
}
return QString("no description found for type ") + QString::number(type);
}
/** @brief modify the internal JSON model
*
* @param key object name levels separated by slash '/';
* e.g.: "org/freedesktop/oyjl/keyA" ;
* The key can contain as well array indices:
* e.g.: "org/freedesktop/oyjl/[0]/firstKey"
* @param value the actual string for the object
*/
void AppData::setOption(QString key, QString value)
{
LOG(key + ":" + value );
oyjl_val o;
char * k = oyjlStringCopy(key.toLocal8Bit().constData(), malloc);
char * v = oyjlStringCopy(value.toLocal8Bit().constData(), malloc);
if(!m_model)
m_model = oyjlTreeNew(k);
o = oyjlTreeGetValue(m_model, OYJL_CREATE_NEW, k);
oyjlValueSetString(o, v);
#if 0 // debuging
char * json = NULL;
int levels = 0;
oyjlTreeToJson(m_model, &levels, &json);
LOG(QString(json) + " \n" + k + ":" + v);
if(json) free(json);
if(k) free(k);
if(v) free(v);
#endif
}
/** @brief obtain the internal JSON model
*
* @param key object name levels separated by slash '/';
* e.g.: "org/freedesktop/oyjl/keyA" ;
* The key can contain as well array indices:
* e.g.: "org/freedesktop/oyjl/[0]/firstKey"
* @return the actual string for the object
*
* @see setOption()
*/
QString AppData::getOption(QString key)
{
oyjl_val o;
char * k = oyjlStringCopy(key.toLocal8Bit().constData(), malloc);
const char * v;
if(!m_model)
m_model = oyjlTreeNew(k);
o = oyjlTreeGetValue(m_model, 0, k);
v = OYJL_GET_STRING(o);
#if 0 // debuging
char * json = NULL;
int levels = 0;
oyjlTreeToJson(m_model, &levels, &json);
LOG(QString(json) + " \n" + k + ":" + v);
if(json) free(json);
if(k) free(k);
if(v) free(v);
#endif
return QString(v);
}
QString AppData::dumpOptions()
{
QString qstring;
if(m_model)
{
int level = 0;
char * t = NULL;
oyjlTreeToJson( m_model, &level, &t );
qstring = t;
if(t) free(t);
}
return qstring;
}
/** @brief obtain status on Linux
*/
void AppData::readBattery()
{
const char * linuxBatteryStatusFile = "/sys/class/power_supply/BAT0/status";
QFile f(linuxBatteryStatusFile);
f.open(QIODevice::ReadOnly|QIODevice::Unbuffered);
char * buf = (char*)calloc(sizeof(char),24);
if(!buf) return;
if(f.isOpen())
f.read(buf,24);
int state = 0; // no battery use
if(strstr(buf,"Discharging") != nullptr)
state = 1;
emit batteryDischarging(QVariant::fromValue(state));
free(buf);
}
/** @brief dynamically register app permissions
*/
QString AppData::requestPermission( QString name )
{
QString msg = "";
#if defined(Q_OS_ANDROID)
// e.g. name = "android.permission.WRITE_EXTERNAL_STORAGE"
if(name.startsWith("android"))
{
auto result = QtAndroid::checkPermission(name);
if(result == QtAndroid::PermissionResult::Denied)
{
QtAndroid::PermissionResultMap resultHash = QtAndroid::requestPermissionsSync(QStringList({"android.permission.WRITE_EXTERNAL_STORAGE"}));
if(resultHash[name] == QtAndroid::PermissionResult::Denied)
{
msg = tr("Permission not granted: ") + name;
LOG(msg);
}
}
}
#else
if(name.startsWith("android"))
{
msg = "Can not apply Android permission on this platform " + name;
LOG(msg);
}
#endif
return msg;
}
int AppData::hasPermission( QString name OYJL_UNUSED )
{
int has = 1;
#if defined(Q_OS_ANDROID)
// e.g. name = "android.permission.WRITE_EXTERNAL_STORAGE"
if(name.startsWith("android"))
{
auto result = QtAndroid::checkPermission(name);
if(result == QtAndroid::PermissionResult::Denied)
{
has = 0;
bool should = QtAndroid::shouldShowRequestPermissionRationale(name);
if(should == false) // Do not show again
has = -1;
}
}
#endif
return has;
}
| [
"ku.b@gmx.de"
] | ku.b@gmx.de |
a4c9ffb217ce2cd445b502ccfa9ba774bd7d0ca0 | 9e443f7680dd2241261b898d306ae7ba0e01a485 | /helper/poly_helper.cpp | 6572ec9f781b86f4bf7329b487016210cc74fba5 | [] | no_license | Huddie/Optimal_Polygon_Area | d5141037d9f2149d27625d26829d877eced3a2df | 87d05c45f97085ffcb83d4124cebe1bdc8c147f2 | refs/heads/master | 2020-05-28T06:20:15.777333 | 2019-05-27T21:13:04 | 2019-05-27T21:13:04 | 188,906,687 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,021 | cpp | #include "poly_helper.hpp"
//-------========== FROM CGAL ============-------//
void poly::mark_domains(CDT& cdt) {
for(CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){
it->info().nesting_level = -1;
}
std::list<CDT::Edge> border;
mark_domains(cdt, cdt.infinite_face(), 0, border);
while(! border.empty()){
CDT::Edge e = border.front();
border.pop_front();
CDT::Face_handle n = e.first->neighbor(e.second);
if(n->info().nesting_level == -1){
mark_domains(cdt, n, e.first->info().nesting_level+1, border);
}
}
}
void poly::mark_domains(CDT& ct,
CDT::Face_handle start,
int index,
std::list<CDT::Edge>& border )
{
if(start->info().nesting_level != -1){
return;
}
std::list<CDT::Face_handle> queue;
queue.push_back(start);
while(! queue.empty()){
CDT::Face_handle fh = queue.front();
queue.pop_front();
if(fh->info().nesting_level == -1){
fh->info().nesting_level = index;
for(int i = 0; i < 3; i++){
CDT::Edge e(fh,i);
CDT::Face_handle n = fh->neighbor(i);
if(n->info().nesting_level == -1){
if(ct.is_constrained(e)) border.push_back(e);
else queue.push_back(n);
}
}
}
}
}
//-------========== END FROM CGAL ============-------//
Triangle_WPT poly::shared_edges(Triangle_2 triangle, Polygon_2 polygon) {
int count = 0;
Segment_2 seg1, seg2;
Point_2 p1, p2, p3, p4;
Polygon_2 poly_triangle;
poly_triangle.push_back(triangle.vertex(0));
poly_triangle.push_back(triangle.vertex(1));
poly_triangle.push_back(triangle.vertex(2));
for (auto e = poly_triangle.edges_begin(); e != poly_triangle.edges_end(); ++e) {
if(std::find(polygon.edges_begin(), polygon.edges_end(), *e) != polygon.edges_end()) {
count++;
if(count == 0) seg1 = *e;
else seg2 = *e;
}
}
p1 = seg1.source();
p2 = seg1.target();
p3 = seg2.source();
p4 = seg2.target();
if(p1 == p3) return Triangle_WPT(poly_triangle, p1);
if(p1 == p4) return Triangle_WPT(poly_triangle, p1);
return Triangle_WPT(poly_triangle, p2);
}
bool poly::triangle_shares_2_edges(Triangle_2 triangle, Polygon_2 polygon) {
int count = 0;
Segment_2 seg1, seg2;
Point_2 p1, p2, p3, p4;
Polygon_2 poly_triangle;
poly_triangle.push_back(triangle.vertex(0));
poly_triangle.push_back(triangle.vertex(1));
poly_triangle.push_back(triangle.vertex(2));
for(auto e = poly_triangle.edges_begin(); e != poly_triangle.edges_end(); e++) {
if(std::find(polygon.edges_begin(), polygon.edges_end(), *e) != polygon.edges_end()
|| std::find(polygon.edges_begin(), polygon.edges_end(), (*e).opposite()) != polygon.edges_end()) {
count++;
if(count == 0) seg1 = *e;
else seg2 = *e;
}
}
return count >= 2;
}
Points poly::visabile_points(Point_2 p, Segments segs, Points check_against) {
Points pts;
if ( segs.size() <= 0 ) return pts;
bool visible;
for(auto pt : check_against) {
Segment_2 against_seg(p, pt);
visible = true;
for(auto seg : segs) {
if(CGAL::do_intersect(seg, against_seg)) {
auto res = CGAL::intersection(seg, against_seg);
const Point_2 exact_pt = boost::get<Point_2>(*res);
if(exact_pt != pt) {
visible = false;
break;
}
}
}
if ( visible ) { pts.push_back(pt); }
}
return pts;
}
Pockets poly::calculate_pockets(Polygon_2 polygon) {
Points hull = find_convex_hull(polygon);
std::set<Point_2> unordered_hull(
hull.begin(),
hull.end()
);
auto poly_it = polygon.vertices_begin();
Point_2 start, pocket_begin, pocket_end;
// Find beginning point
for(; unordered_hull.find(start) != unordered_hull.end(); poly_it++) {}
start = *poly_it;
pocket_begin = start;
std::cout << polygon << "\n";
// Find Pockets
Points pts;
Segments segs;
Pockets pkts;
poly_it++;
do {
if(poly_it == polygon.vertices_end()) poly_it = polygon.vertices_begin();
for(; unordered_hull.find(*poly_it) == unordered_hull.end(); poly_it++) {
if(poly_it == polygon.vertices_end()) poly_it = polygon.vertices_begin();
if(poly_it+1 == polygon.vertices_end()) segs.push_back(Segment_2(*poly_it, *polygon.vertices_begin()));
else segs.push_back(Segment_2(*poly_it, *(poly_it+1)));
pts.push_back(*poly_it);
}
Polygon_2 polygon;
pts.push_back(*poly_it);
for(auto p : pts) { polygon.push_back(p); }
pkts.push_back(polygon);
//for(auto v : visabile_points(pocket_begin, segs, pts)) { std::cout << v << "\n"; }
std::cout << "\n";
segs.clear();
pts.clear();
pocket_begin = *poly_it;
poly_it++;
} while(pocket_begin != start);
return pkts;
}
Points poly::make_pointset(std::ifstream &stream) {
Points points, result;
std::string _s;
long x, y;
while(std::getline(stream, _s)) {
std::istringstream iss(_s);
iss >> x >> x >> y;
points.push_back(Point_2(x, y));
}
sort( points.begin(), points.end() );
points.erase( unique( points.begin(), points.end() ), points.end() );
return points;
}
Points poly::peel(Points pts) {
Points hull = find_convex_hull(pts);
Points result;
std::set_difference(
pts.begin(), pts.end(), hull.begin(), hull.end(),
std::inserter(result, result.begin())
);
return result;
}
Points poly::find_convex_hull(Polygon_2 polygon) {
Points result;
CGAL::convex_hull_2( polygon.vertices_begin() , polygon.vertices_end(), std::back_inserter(result) );
return result;
}
Points poly::find_convex_hull(Points pts) {
Points result;
CGAL::convex_hull_2( pts.begin(), pts.end(), std::back_inserter(result) );
return result;
}
Polygon_2 poly::fekete_half_givenPt(Points pts, Points hull, size_t index) {
Polygon_2 polygon;
Points tracked, diff;
Point_2 comp;
polygon.push_back(hull[index]);
polygon.push_back(hull[(index + 1) % hull.size()]);
// std::cout << polygon << "\n";
tracked.push_back(*(polygon.vertices_begin()));
tracked.push_back(*(polygon.vertices_begin() + 1));
std::sort(
pts.begin(),
pts.end()
);
std::sort(
tracked.begin(),
tracked.end()
);
std::set_difference(
pts.begin(),
pts.end(),
tracked.begin(),
tracked.end(),
std::inserter(diff, diff.begin())
);
std::sort(
diff.begin(),
diff.end(),
poly::slopeCompare(polygon[0], polygon[1])
);
for(auto i : diff) { polygon.push_back(i); }
return polygon;
}
Polygon_2 poly::fekete_half(Points pts) {
Points hull = poly::find_convex_hull(pts);
return poly::fekete_half_givenPt(pts, hull, 0);
}
Triangles poly::find_viable_triangles(Polygon_2 pockets) {
CDT cdt;
cdt.insert_constraint(pockets.vertices_begin(), pockets.vertices_end(), true);
mark_domains(cdt);
Triangles tri;
int count=0;
for (CDT::Finite_faces_iterator fit=cdt.finite_faces_begin();
fit!=cdt.finite_faces_end();++fit)
{
if ( fit->info().in_domain() ) {
++count;
Triangle_2 triangle = cdt.triangle(fit);
if(triangle_shares_2_edges(triangle, pockets)) {
tri.push_back(shared_edges(triangle, pockets));
}
}
}
return tri;
}
Swap_Edges poly::find_viable_swaps_for_triangle(Triangle_WPT triangle, Polygon_2 polygon) {
Swap_Edges edges;
for(auto edge_it = polygon.edges_begin(); edge_it != polygon.edges_end(); edge_it++) {
for(auto edge_it_2 = polygon.edges_begin(); edge_it_2 != polygon.edges_end(); edge_it_2++) {
if(*edge_it_2 != *edge_it) {
if(CGAL::do_intersect(
Segment_2((*edge_it).source(), triangle.pt),
*edge_it_2)
&&
CGAL::do_intersect(
Segment_2((*edge_it).target(), triangle.pt),
*edge_it_2)
) {
edges.push_back(*edge_it);
}
}
}
}
return edges;
}
Polygon_2 poly::fekete_half_best_ch(std::string filename, Points pts) {
Polygon_2 best_polygon, polygon;
std::map<Triangle_WPT, Swap_Edges> triangle_swap_map;
Points hull = poly::find_convex_hull(pts);
int count = 0, not_simple;
for(auto pt : hull) {
polygon = poly::fekete_half_givenPt(pts, hull, count++);
// assert(polygon.is_simple() && "Polygon must be simple");
if (polygon.is_simple()) {
if (polygon.area() > best_polygon.area()) {
best_polygon = polygon;
}
std::cout << "Simple: " << filename << "\n";
Pockets pkts = calculate_pockets(polygon);
Triangles tris;
Swap_Edges edges;
for(Polygon_2 pkt : pkts) {
tris = find_viable_triangles(pkt);
for(Triangle_WPT tri : tris) {
std::cout << tri.triangle << "\n";
edges = poly::find_viable_swaps_for_triangle(tri, polygon);
triangle_swap_map.insert(std::pair<Triangle_WPT, Swap_Edges>(tri, edges));
}
}
}
else {
std::cout << "Not Simple: " << filename << "\n";
}
}
return best_polygon;
}
Polygon_2 poly::fekete_half_best_all(Points pts) {}
| [
"easports96@gmail.com"
] | easports96@gmail.com |
fe1e4780ed1ed661536b2f7b36f151eb5470e329 | d1853dc32105f49790ed299bcca2db3b1d718ece | /codeforces/1176/A.cpp | e02004a4023c99ae9978629c0c428477482611ea | [] | no_license | towhid1zaman/Problem__Solving | a8abbd77c68c6f1e9ff8ceecd9332a3d15f741cd | 1407bc0d44165827e8db5599e75115961d569315 | refs/heads/master | 2023-06-05T10:56:17.151354 | 2021-06-20T19:46:00 | 2021-06-26T04:47:16 | 326,334,514 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,623 | cpp | #include "bits/stdc++.h"
using namespace std;
typedef unsigned long long LL;
#define nl "\n"
#define X first
#define Y second
#define MAX INT_MAX
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define check() {printf("OK\n");}
#define srt(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define maxv(v) *max_element(v.begin(),v.end())
#define minv(v) *min_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define f() {ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);}
#define unq(v) srt(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define MOD 1000000007 // (int)1e9+7
int main(){f();
int tc;
LL n;
cin>>tc;
while(tc--)
{
int ans = 0;
cin>>n;
while(1)
{
if(n%2==0)
{
n = n/2;
ans++;
}
if(n%3==0)
{
n = ((2*n)/3);
ans++;
}
if(n%5==0)
{
n = ((n*4)/5);
ans++;
}
if(n==1){
break;
}
if(n%2 !=0 and n%3!=0 and n%5 !=0 and n !=1){
ans = -1;
break;
}
}
cout<<ans<<endl;
}
return 0;
}
| [
"towhid1zaman@gmail.com"
] | towhid1zaman@gmail.com |
86c1ae5d6b55b19dfad056aa29b566a8633de62f | f7b5424c24c2f2c1ebc46e4be616c7e1231e8669 | /src/tiny_ecs_registry.cpp | 2acda8fa70db71f0e1b6a843d3a839a31e779fe8 | [] | no_license | MacIverson/TestMiniGame | 5e3cceb5c158d03461aea6bf06f55b7141a8e84a | cce3c416d0b1a249691a03b0fc2aa73ddf23ee25 | refs/heads/master | 2023-08-24T06:57:38.852807 | 2021-10-29T19:28:28 | 2021-10-29T19:28:28 | 422,044,358 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 55 | cpp | #include "tiny_ecs_registry.hpp"
ECSRegistry registry; | [
"macman1@students.cs.ubc.ca"
] | macman1@students.cs.ubc.ca |
b87b01ce42889b7f1b2800fc220b0ac703d6c0cd | 8262dbe399110df081e82ed6dc67a7a827063a5f | /resistanceWx/MissionPanel.cpp | cde49979490f6530860ce9571729e129e5594f72 | [] | no_license | limerfox/Resistance | de660f4fbde4f357921e02f770636ed490a701ae | 24576eb3729310bed321d8579080178c35163fbe | refs/heads/master | 2020-04-29T15:21:42.962727 | 2019-04-08T22:01:11 | 2019-04-08T22:01:11 | 176,225,657 | 0 | 2 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 8,042 | cpp | // ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/tglbtn.h"
#include "wx/string.h"
#include "wx/sizer.h"
#include "wx/gbsizer.h"
#include "wx/statline.h"
#include "wx/notebook.h"
#include "wx/spinctrl.h"
#include "wx/wrapsizer.h"
#include "wx/generic/stattextg.h"
#include "resistanceWx.h"
#include "Game.h"
#include "GameAgents.h"
#include "GameRound.h"
#include "Mission.h"
#include "MissionCommand.h"
#include "AgentInMission.h"
#include "AgentVoteFor.h"
#include "Player.h"
#include "MIssionCommandPanel.h"
#include "MissionPanel.h"
MissionPanel::MissionPanel(wxPanel* missionPanel, wxBoxSizer *missionTopSizer, Mission* miss)
{
//multiMissionNote = multiMissNote;
mission = miss;
//// Панель для миссии
//wxString missionName = wxString::Format(wxT("%d-я миссия"), mission->GetMissionNumber());
//wxPanel *missionPanel = new wxPanel(multiMissionNote, wxID_ANY);
//multiMissionNote->AddPage(missionPanel, missionName);
//wxBoxSizer *missionTopSizer = new wxBoxSizer(wxVERTICAL);
wxPanel *missionInfoPanel = new wxPanel(missionPanel, wxID_ANY);
missionTopSizer->Add(missionInfoPanel, wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
wxBoxSizer *missionInfoTopSizer = new wxBoxSizer(wxHORIZONTAL);
missionInfoTopSizer->Add(new wxStaticText(missionInfoPanel, wxID_ANY, wxT("Результат")),
wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
missionInfoTopSizer->Add(new wxStaticText(missionInfoPanel, wxID_ANY, wxT("Лидер команды")),
wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
missionInfoPanel->SetSizer(missionInfoTopSizer);
missionInfoTopSizer->SetSizeHints(this);
MissionCommandPanel(missionPanel, missionTopSizer, mission->GetMissionCommand());
// Панель для голосования
wxPanel *votesPanel = new wxPanel(missionPanel, wxID_ANY);
//missionTopSizer->Add(votesPanel, wxSizerFlags().Center());
missionTopSizer->Add(votesPanel, 1, wxGROW);
wxBoxSizer *votesSizer = new wxStaticBoxSizer(new wxStaticBox(votesPanel, wxID_ANY, wxT("Голосование")), wxHORIZONTAL);
// Панель для создания
wxPanel *votesForCreationPanel = new wxPanel(votesPanel, wxID_ANY);
votesSizer->Add(votesForCreationPanel, 1, wxGROW);
wxBoxSizer *votesForCreationSizer = new wxStaticBoxSizer(new wxStaticBox(votesForCreationPanel, wxID_ANY, wxT("Создание")), wxVERTICAL);
wxPanel *votesForCreationResultPanel = new wxPanel(votesForCreationPanel, wxID_ANY);
votesForCreationSizer->Add(votesForCreationResultPanel, wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
wxBoxSizer *votesForCreationResultSizer = new wxStaticBoxSizer(new wxStaticBox(votesForCreationResultPanel, wxID_ANY, wxT("Итоги голосования")), wxHORIZONTAL);
voteForCrText = new wxStaticText(votesForCreationResultPanel, wxID_ANY, wxT("0"), wxPoint(0, 0), wxSize(40, wxDefaultCoord));
voteAgainstCrText = new wxStaticText(votesForCreationResultPanel, wxID_ANY, wxT("0"), wxPoint(0, 0), wxSize(40, wxDefaultCoord));
votesForCreationResultSizer->Add(voteForCrText, wxSizerFlags().Border(wxALL, 7));
votesForCreationResultSizer->Add(voteAgainstCrText, wxSizerFlags().Border(wxALL, 7));
votesForCreationResultPanel->SetSizer(votesForCreationResultSizer);
votesForCreationResultSizer->SetSizeHints(this);
wxPanel *votesForCreationButtonPanel = new wxPanel(votesForCreationPanel, wxID_ANY);
votesForCreationSizer->Add(votesForCreationButtonPanel, wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
wxBoxSizer *votesForCreationButtonSizer = new wxStaticBoxSizer(new wxStaticBox(votesForCreationButtonPanel, wxID_ANY, wxT("Выберите ЗА или ПРОТИВ")), wxHORIZONTAL);
votesForCreationButtonSizer->Add(new wxToggleButton(votesForCreationButtonPanel, ID_CR_FOR, wxT("ЗА")), wxSizerFlags().Border(wxALL, 7));
votesForCreationButtonSizer->Add(new wxToggleButton(votesForCreationButtonPanel, ID_CR_AGAIN, wxT("ПРОТИВ")), wxSizerFlags().Border(wxALL, 7));
Connect(ID_CR_FOR, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MissionPanel::OnCrFor));
Connect(ID_CR_AGAIN, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MissionPanel::OnCrAgn));
votesForCreationButtonPanel->SetSizer(votesForCreationButtonSizer);
votesForCreationButtonSizer->SetSizeHints(this);
//Сайзер для панели для создания
votesForCreationPanel->SetSizer(votesForCreationSizer);
votesForCreationSizer->SetSizeHints(this);
// Панель для выполнения
wxPanel *votesForExecutionPanel = new wxPanel(votesPanel, wxID_ANY);
votesSizer->Add(votesForExecutionPanel, 1, wxGROW);
wxBoxSizer *votesForExecutionSizer = new wxStaticBoxSizer(new wxStaticBox(votesForExecutionPanel, wxID_ANY, wxT("Выполнение")), wxVERTICAL);
wxPanel *votesForExecutionResultPanel = new wxPanel(votesForExecutionPanel, wxID_ANY);
votesForExecutionSizer->Add(votesForExecutionResultPanel, wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
wxBoxSizer *votesForExecutionResultSizer = new wxStaticBoxSizer(new wxStaticBox(votesForExecutionResultPanel, wxID_ANY, wxT("Итоги голосования")), wxHORIZONTAL);
voteForExecText = new wxStaticText(votesForExecutionResultPanel, wxID_ANY, wxT("0"), wxPoint(0, 0), wxSize(40, wxDefaultCoord));
voteAgainstExecText = new wxStaticText(votesForExecutionResultPanel, wxID_ANY, wxT("0"), wxPoint(0, 0), wxSize(40, wxDefaultCoord));
votesForExecutionResultSizer->Add(voteForExecText, wxSizerFlags().Border(wxALL, 7));
votesForExecutionResultSizer->Add(voteAgainstExecText, wxSizerFlags().Border(wxALL, 7));
votesForExecutionResultPanel->SetSizer(votesForExecutionResultSizer);
votesForExecutionResultSizer->SetSizeHints(this);
wxPanel *votesForExecutionButtonPanel = new wxPanel(votesForExecutionPanel, wxID_ANY);
votesForExecutionSizer->Add(votesForExecutionButtonPanel, wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
wxBoxSizer *votesForExecutionButtonSizer = new wxStaticBoxSizer(new wxStaticBox(votesForExecutionButtonPanel, wxID_ANY, wxT("Выберите ЗА или ПРОТИВ")), wxHORIZONTAL);
votesForExecutionButtonSizer->Add(new wxToggleButton(votesForExecutionButtonPanel, ID_EX_FOR, wxT("ЗА")), wxSizerFlags().Border(wxALL, 7));
votesForExecutionButtonSizer->Add(new wxToggleButton(votesForExecutionButtonPanel, ID_EX_AGAIN, wxT("ПРОТИВ")), wxSizerFlags().Border(wxALL, 7));
Connect(ID_EX_FOR, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MissionPanel::OnExFor));
Connect(ID_EX_AGAIN, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MissionPanel::OnExAgn));
votesForExecutionButtonPanel->SetSizer(votesForExecutionButtonSizer);
votesForExecutionButtonSizer->SetSizeHints(this);
//Сайзер для панели для выполнения
votesForExecutionPanel->SetSizer(votesForExecutionSizer);
votesForExecutionSizer->SetSizeHints(this);
//Сайзер для панели для голосования
votesPanel->SetSizer(votesSizer);
votesSizer->SetSizeHints(this);
////Сайзер для панели миссии
//missionPanel->SetSizer(missionTopSizer);
//missionTopSizer->SetSizeHints(this);
}
MissionPanel::~MissionPanel()
{
}
void MissionPanel::OnCrFor(wxCommandEvent& WXUNUSED(event))
{
mission->CreationVote(true, nullptr);
}
void MissionPanel::OnCrAgn(wxCommandEvent& WXUNUSED(event))
{
mission->CreationVote(false, nullptr);
}
void MissionPanel::OnExFor(wxCommandEvent& WXUNUSED(event))
{
mission->ExecutionVote(true, nullptr);
}
void MissionPanel::OnExAgn(wxCommandEvent& WXUNUSED(event))
{
mission->ExecutionVote(false, nullptr);
}
| [
"Maria@DESKTOP-P97Q35F"
] | Maria@DESKTOP-P97Q35F |
cda12cbddb4c91a46c29dd7e5e38a6a403f14a47 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/admin/netui/common/h/slist.hxx | 59b646234a2dc8976ea5fa4921b32c1223aa920b | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C++ | false | false | 13,074 | hxx | /**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
slist.hxx
LM 3.0 Generic slist package
This header file contains a generic list "macro" that can be used to
create an efficient singly linked list implementation for any type.
USAGE:
class DUMB
{
[...]
public:
int Compare( const DUMB * pd )
{ return (( _i == pd->_i ) ? 0 : (( _i < pd->_i ) ? -1 : 1 ) ); }
[...]
};
DECLARE_SLIST_OF(DUMB)
DEFINE_SLIST_OF(DUMB) // or DEFINE_EXT_SLIST_OF(DUMB)
SLIST_OF(DUMB) dumSlist;
ITER_SL_OF( DUMB ) iterDum( dumSlist );
main()
{
DUMB *pd;
pd = new DUMB( somedata );
dumSlist.Add( pd );
while ( ( pd = iterDum.Next() ) != NULL )
pd->DoSomething();
}
To use an SLIST in a class definition, then do something like:
----------- MyHeader.hxx ----------
//#include <slist.hxx>
DECLARE_SLIST_OF(DUMB)
class MYCLASS
{
private:
SLIST_OF( DUMB ) _slDumb;
...
};
----------- MyHeader.cxx ----------
//#include <slist.hxx>
//#include <MyHeader.hxx>
DEFINE_SLIST_OF(DUMB);
...
-----------------------------------
FILE HISTORY:
johnl 28-Jun-1990 Created
johnl 24-Jul-1990 Changed to use slist.cxx
johnl 11-Oct-1990 Only keeps pointers in Slist (doesn't copy)
johnl 30-Oct-1990 Made functional changes as per Peterwi's requests
(Iter doesn't advance, added some funct. to
internal nodes etc.)
johnl 7-Mar-1991 Code review changes
Johnl 9-Jul-1991 Broke SLIST into define and declare components
beng 26-Sep-1991 Removed LM_2 versions
KeithMo 23-Oct-1991 Added forward references.
*/
#ifndef _SLIST_HXX_
#define _SLIST_HXX_
// DebugPrint() declaration macro.
#if defined(DEBUG)
#define DBG_PRINT_SLIST_IMPLEMENTATION { _DebugPrint(); }
#else
#define DBG_PRINT_SLIST_IMPLEMENTATION { ; }
#endif
#define DECLARE_DBG_PRINT_SLIST \
void _DebugPrint () const ; \
void DebugPrint () const DBG_PRINT_SLIST_IMPLEMENTATION
//
// Forward references.
//
DLL_CLASS SL_NODE;
DLL_CLASS SLIST;
DLL_CLASS ITER_SL;
/*************************************************************************
NAME: SL_NODE
SYNOPSIS: Storage class for the SLIST type
INTERFACE: Set() - stores a pointer in the node
HISTORY:
beng 26-Sep-1991 Header added
**************************************************************************/
DLL_CLASS SL_NODE
{
friend class SLIST;
friend class ITER_SL;
public:
SL_NODE( SL_NODE *pslnode, VOID *pv )
: _pslnodeNext(pslnode), _pelem(pv) { }
VOID Set( SL_NODE *pslnode, VOID *pv )
{
/* Note: we guarantee the node is the last thing set
* (this allows us to do current->Set( current->Next, newelem)
* without trashing ourselves).
*/
_pelem = pv;
_pslnodeNext = pslnode;
}
SL_NODE *_pslnodeNext;
VOID * _pelem;
};
/*************************************************************************
NAME: ITER_SL
SYNOPSIS: Forward iterator for the SLIST class
The iterator "points" to the element that would be returned on the
next call to Next.
INTERFACE:
ITER_SL( ) - Constructor
~ITER_SL() - Destructor
Reset() - Reset the iterator to its initial state
operator()() - Synonym for next
Next() - Goto the next element in the list
QueryProp() - Returns the current property this iterator
is pointing to
USES: SLIST
HISTORY:
johnl 07-25-90 Created
johnl 10-11-90 Added QueryProp (request from Peterwi)
johnl 10-30-90 Removed Queryprop in favor of functional
change in iterator (item returned by next
is the current item).
**************************************************************************/
DLL_CLASS ITER_SL
{
friend class SLIST;
public:
ITER_SL( SLIST *psl );
ITER_SL( const ITER_SL& itersl );
~ITER_SL();
VOID Reset();
VOID* operator()() { return Next(); }
VOID* Next();
VOID* QueryProp();
private:
SL_NODE *_pslnodeCurrent; // Current item pointer
SLIST *_pslist; // Pointer to slist
BOOL _fUsed; // Flag to bump on first next call or not
ITER_SL *_psliterNext; // Pointer to next registered iterator
};
/*************************************************************************
NAME: SLIST
SYNOPSIS: Parameterized slist implementation
INTERFACE:
DECLARE_SLIST_OF() - Produces a declaration for an slist
of itemtype. Generally used in the header file.
DEFINE_SLIST_OF() - Produces type specific code. Should
be used once in a source file.
DEFINE_EXT_SLIST_OF() - Produces code for an slist of itemtype
with several additional methods
(IsMember, Remove(itemtype)), see below.
SLIST_OF() - Declares an slist of itemtype called
MySlist. If you do not want the
elements automatically deleted
in Clear or on destruction, then
pass FALSE to the constructor (the
fDestroy parameter defaults to TRUE.
ITER_SL_OF() - Declares an slist iterator
for iterating through the slist
Clear() - Specifically delete all elements in the slist.
IsMember() - Returns true if the element belongs to the
slist. NOTE: IS ONLY DEFINED FOR THE EXTENDED
SLIST (i.e., one that has been declared with
the DECLARE_EXT_SLIST_OF macro.
QueryNumElem() - Returns the number of elements
in the slist.
Add() - Adds the passed pointer to an object to the
slist (note, DO NOT ADD NULL POINTERS, Add WILL
Assert out if you do this).
Append() - Adds the passed pointer to the end of the
slist.
Insert() - Adds the passed pointer to the
"left" of the passed iterator.
Remove() - Finds element e and removes it from the list,
returning the item. Is only defined if the
DECLARE_EXT_SLIST_OF macro is used.
USES: ITER_SL
NOTES:
BumpIters() - For any iterators pointing to the passed
iter node, BumpIters calls iter.Next(). Used
when deleting an item from the list.
Register() - Registers an iterator with the slist
Deregister() - Deregisters an iterator with the slist
SetIters() - Sets all registered iters to the
passed value.
SetIters( CompVal, NewVal ) - Changes all registered iterators
that are pointing at SL_NODE CompVal to point to SL_NODE
NewVal (used when playing node games).
HISTORY:
Johnl 28-Jun-1990 Created
Johnl 12-Jul-1990 Made iters safe for deleting
Johnl 24-Jul-1990 Converted to use slist.cxx
KeithMo 09-Oct-1991 Win32 Conversion.
**************************************************************************/
DLL_CLASS SLIST
{
friend class ITER_SL;
public:
SLIST();
~SLIST();
// VOID Clear(); <<-- Defined in macro expansion
UINT QueryNumElem();
APIERR Add( VOID * pelem );
APIERR Append( VOID * pelem );
APIERR Insert( VOID * pelem, ITER_SL& sliter );
VOID* Remove( ITER_SL& sliter );
DECLARE_DBG_PRINT_SLIST
protected:
SL_NODE *_pslHead, *_pslTail;
ITER_SL *_psliterRegisteredIters; // Pointer to list of registered iters
protected:
VOID Register( ITER_SL * psliter );
VOID Deregister( ITER_SL * psliter );
VOID BumpIters( SL_NODE * pslnode );
VOID SetIters( SL_NODE * pslnode );
VOID SetIters( SL_NODE * CompVal, SL_NODE *NewVal );
BOOL CheckIter( ITER_SL * psliter );
SL_NODE* FindPrev( SL_NODE * pslnode );
};
/*************************************************************************
NAME: DECLARE_SLIST_OF
SYNOPSIS: Macro which expands into the type-specific portions of
the SLIST package.
NOTES:
The user can also use:
SLIST_OF( type ) - for declaring SLIST lists
ITER_SL_OF(type) - for declaring Forward iterators
See the beginning of this file for usage of this package.
HISTORY:
johnl 24-Jul-90 Created
beng 30-Apr-1991 New syntax for constructor inheritance
**************************************************************************/
#define SLIST_OF(type) SLIST_OF_##type
#define ITER_SL_OF(type) ITER_SL_##type
/*------ SLIST Macro expansion -------*/
#define DECL_SLIST_OF(type,dec) \
class dec SLIST_OF(type); \
\
class dec ITER_SL_OF(type) : public ITER_SL \
{ \
public: \
ITER_SL_OF(type)( SLIST& sl ) : ITER_SL(&sl) {; } \
ITER_SL_OF(type)( const ITER_SL_OF(type)& pitersl ) : \
ITER_SL(pitersl) {; } \
\
type* Next() \
{ return (type *)ITER_SL::Next(); } \
\
type* operator()(VOID) \
{ return Next(); } \
\
type* QueryProp() \
{ return (type *)ITER_SL::QueryProp(); } \
}; \
\
class dec SLIST_OF(type) : public SLIST \
{ \
private: \
BOOL _fDestroy; \
\
public: \
SLIST_OF(type) ( BOOL fDestroy = TRUE ) : \
SLIST( ), \
_fDestroy(fDestroy) {; } \
\
~SLIST_OF(type)() { Clear(); } \
\
VOID Clear(); \
\
APIERR Add( const type * pelemNew ) \
{ \
return SLIST::Add( (VOID *)pelemNew ); \
} \
\
APIERR Append( const type * pelemNew ) \
{ \
return SLIST::Append( (VOID *)pelemNew ) ; \
} \
\
APIERR Insert( const type *pelemNew, ITER_SL_OF(type)& sliter ) \
{ \
return SLIST::Insert( (VOID *)pelemNew, sliter ); \
} \
\
type* Remove( ITER_SL_OF(type)& sliter ) \
{ \
return (type *) SLIST::Remove( sliter ); \
} \
\
/* You can only use these */ \
/* if you use DEFINE_EXT_SLIST_OF; otherwise */ \
/* you will get unresolved externals. */ \
type* Remove( type& e ); \
BOOL IsMember( const type& e ); \
};
#define DEFINE_SLIST_OF(type) \
VOID SLIST_OF(type)::Clear() \
{ \
register SL_NODE *_pslnode = _pslHead, *_pslnodeOld = NULL; \
\
while ( _pslnode != NULL ) \
{ \
_pslnodeOld = _pslnode; \
_pslnode = _pslnode->_pslnodeNext; \
if ( _fDestroy ) \
delete ((type *)_pslnodeOld->_pelem ) ; \
delete _pslnodeOld; \
} \
_pslHead = _pslTail = NULL; \
\
SetIters( NULL ); \
}
#define DEFINE_EXT_SLIST_OF(type) \
DEFINE_SLIST_OF(type) \
\
/* Remove is here so it can see the Compare method of the element */ \
type* SLIST_OF(type)::Remove( type& e ) \
{ \
register SL_NODE *_pslnode = _pslHead, *_pslnodePrev = NULL; \
\
while ( _pslnode != NULL ) \
{ \
if ( !((type *)_pslnode->_pelem)->Compare( &e ) ) \
{ \
if ( _pslnodePrev != NULL ) /* if not first node in list */ \
{ \
_pslnodePrev->_pslnodeNext = _pslnode->_pslnodeNext; \
\
/* patch up tail pointer if last item in list */ \
if ( _pslTail == _pslnode ) \
_pslTail = _pslnodePrev; \
} \
else \
if ( _pslnode->_pslnodeNext == NULL ) \
_pslHead = _pslTail = NULL; /* only item in list */ \
else \
_pslHead = _pslnode->_pslnodeNext; \
\
BumpIters( _pslnode ); /* Move iters to next node... */ \
\
type* _pelem = (type *)_pslnode->_pelem; \
delete _pslnode; \
return _pelem; \
} \
else \
{ \
_pslnodePrev = _pslnode; \
_pslnode = _pslnode->_pslnodeNext; \
} \
} \
\
return NULL; \
} \
\
BOOL SLIST_OF(type)::IsMember( const type& e ) \
{ \
register SL_NODE *_pslnode = _pslHead; \
\
while ( _pslnode != NULL ) \
{ \
if ( !((type *)_pslnode->_pelem)->Compare( &e ) ) \
return TRUE; \
else \
_pslnode = _pslnode->_pslnodeNext; \
} \
\
return FALSE; \
}
// Helper macros for code preservation
#define DECLARE_SLIST_OF(type) \
DECL_SLIST_OF(type,DLL_TEMPLATE)
#endif // _SLIST_HXX_
| [
"seta7D5@protonmail.com"
] | seta7D5@protonmail.com |
4b7946119f82b65f05b285429471eb4452c9c3ac | a002123d4a71574324ca8aeb8c7af336ca1a60d1 | /AlphaMesher.h | 7c72c84cc6c8655ae711317bd5a82ae29793a390 | [] | no_license | flaiver/AlphaMesher | 20e98607899a4a2b8dd33c1eea6f5da86f7c9109 | ddc6b90490a7b21991938e827828eeb126d6ec55 | refs/heads/master | 2021-01-11T00:36:57.866312 | 2016-10-08T14:02:29 | 2016-10-08T14:02:29 | 70,535,504 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 444 | h | #pragma once
#include <maya/MPxNode.h>
class AlphaMesher :
public MPxNode
{
public:
AlphaMesher();
virtual ~AlphaMesher();
static MStatus initialize();
virtual MStatus compute(const MPlug& plug, MDataBlock& data);
static void* creator() { return new AlphaMesher; }
static MObject m_inTexture;
static MObject m_outMesh;
static MObject m_inScaleValue;
static MObject m_inResolution;
static MTypeId id;
};
| [
"flaiver@yahoo.com"
] | flaiver@yahoo.com |
050685219cf2659d83e53faf50bda794e503ce15 | 48ef819fa3526351615fdcaef9267bb842eb7c42 | /SDK/build/arduino/nano-nokia5110/cubos/driver_powermanager.ino | b685d317aaa102acf0a748c9de38a5bfdf565351 | [] | no_license | yacubovvs/CubOS_01b | fa2cb67e669d26598e0c240168ea4bd86f59cbd2 | 15add5d1c47fff1c23fc4d12fdece40964f52499 | refs/heads/master | 2023-06-26T06:06:12.765510 | 2021-07-28T17:40:48 | 2021-07-28T17:40:48 | 197,984,057 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 889 | ino | void power_manager_setup(){
//Buttins power
pinMode(0, OUTPUT);
digitalWrite(0, 1);
#ifdef device_has_accelerometer
pinMode(1, OUTPUT);
digitalWrite(1, 1);
#endif
#ifdef device_has_backlight_control
pinMode(10, OUTPUT);
#ifdef backlight_init
power_manager_set_backlight_strength(backlight_init);
#endif
#endif
}
#ifdef device_has_backlight_control
void power_manager_set_backlight_strength(byte backlight_strength){
analogWrite(10, 255 - backlight_strength);
}
#endif
#ifdef device_has_accelerometer
void power_manager_start_accelerometer(){
digitalWrite(1, 1);
delay(25); //need wait for reseting accelerometer
accelerometer_wake();
}
void power_manager_end_accelerometer(){
accelerometer_sleep();
digitalWrite(1, 0);
}
#endif | [
"yacubovvs@yandex.ru"
] | yacubovvs@yandex.ru |
1bec0209d9532bc19da7009e5cd5e218744e67a4 | 1d4e8ce2c978342ece091f1e0f7293f4a3d66739 | /you_tai_ridatu/heri.cpp | 338816bd700097e39d4e2a7f687bda2993c2926a | [] | no_license | DaikiIsozaki/you_tai_ridatu | 472002bc47d4bd909d7eac7ca6822993d43e82e7 | a618685899e05c7afca326f37b347805d802c8a0 | refs/heads/master | 2020-11-23T21:36:17.258920 | 2020-07-19T12:20:02 | 2020-07-19T12:20:02 | 227,830,112 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 4,963 | cpp | #include"Cube.h"
#include<d3dx9.h>
#include"direct3d.h"
#include"common.h"
#include"CubeMove.h"
#include"texture.h"
#include"sprite.h"
#include"Light.h"
#include"Camera.h"
#include "Model.h"
#include"heri.h"
#include"input.h"
#include"bullet.h"
D3DXVECTOR3 H_at(0.0f, 10.0f, -10.0f);
D3DXMATRIX g_Save_Matrix2;
float puroperaAng=0.0f;
bool bullet_flag;
float HeriAng=0.0f;
float HeriTakasa = 0.0f;
D3DXVECTOR3 CHeri;
float SpeedHeri;
D3DXVECTOR3 HFront;//カメラの向きベクトル(単位ベクトル)※必ず長さ1
D3DXVECTOR3 HRight;
D3DXVECTOR3 HUp;
static float Length;
void Heri_Init(void)
{
Model_Xfile_Load(INDEX_MODEL_HERI_HONTAI);
Model_Xfile_Load(INDEX_MODEL_HERI_PUROPERA);
bullet_flag=false;
CHeri = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
HFront = D3DXVECTOR3(0.0f, -0.5f, 1.0f);
HUp = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
D3DXVec3Cross(&HRight, &HFront, &HUp);
D3DXVec3Normalize(&HRight, &HRight);
D3DXVec3Cross(&HUp, &HRight, &HFront);
D3DXVec3Normalize(&HUp, &HUp);
D3DXVec3Normalize(&HFront, &HFront);
SpeedHeri = 0.02f;
Length = 10.0f;
}
void Heri_Uninit(void)
{
Model_Finalise(INDEX_MODEL_HERI_HONTAI);
Model_Finalise(INDEX_MODEL_HERI_PUROPERA);
}
void Heri_Updete(void)
{
/*
//ヘリ移動
if (Keyboard_IsPress(DIK_1))
{
D3DXVECTOR3 f(HFront);
f.y = 0.0f;
CHeri += f*SpeedHeri;
}
if (Keyboard_IsPress(DIK_2))
{
D3DXVECTOR3 f(HFront);
f.y = 0.0f;
CHeri -= f*SpeedHeri;
}
if (Keyboard_IsPress(DIK_4))
{
D3DXVECTOR3 f(HRight);
CHeri -= f*SpeedHeri;
}
if (Keyboard_IsPress(DIK_3))
{
D3DXVECTOR3 f(HRight);
CHeri += f*SpeedHeri;
}
puroperaAng += 2.0f;
if (Keyboard_IsTrigger(DIK_5))
{
HeriAng -= 45.0f;
D3DXMATRIX mtxR;
D3DXMatrixRotationY(&mtxR, D3DXToRadian(-45));
D3DXVec3TransformNormal(&HFront, &HFront, &mtxR);
D3DXVec3TransformNormal(&HRight, &HRight, &mtxR);
D3DXVec3TransformNormal(&HUp, &HUp, &mtxR);
}
if (Keyboard_IsTrigger(DIK_6))
{
HeriAng += 45.0f;
D3DXMATRIX mtxR;
D3DXMatrixRotationY(&mtxR, D3DXToRadian(45));
D3DXVec3TransformNormal(&HFront, &HFront, &mtxR);
D3DXVec3TransformNormal(&HRight, &HRight, &mtxR);
D3DXVec3TransformNormal(&HUp, &HUp, &mtxR);
}
if (Keyboard_IsPress(DIK_7))
{
HeriTakasa -= 0.05f;
}
if (Keyboard_IsPress(DIK_8))
{
HeriTakasa += 0.05f;
}
if (Keyboard_IsPress(DIK_0))
{
HeriAng += 10.0f;
puroperaAng = 0;
}
if (Keyboard_IsPress(DIK_SPACE))
{
Bullet_Draw(CHeri.x,CHeri.y,CHeri.z);
}
*/
}
void Heri_Draw(float x, float y, float z)
{
Direct3D_GetDevice()->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
Direct3D_GetDevice()->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
//もでる
D3DXMATRIX mtxWorldModel;
D3DXMatrixIdentity(&mtxWorldModel);//単位行列を作る
D3DXMATRIX mtxTranslationModel;
D3DXMatrixTranslation(&mtxTranslationModel, x+CHeri.x, y+HeriTakasa, z+ CHeri.z);
D3DXMATRIX mtxRotationModel;
D3DXMatrixRotationY(&mtxRotationModel, D3DXToRadian(HeriAng));
D3DXMATRIX mtxScalingModel;
D3DXMatrixScaling(&mtxScalingModel, 1.0f, 1.0f, 1.0f);
D3DXMATRIX mtxRotationModel2;
D3DXMatrixRotationY(&mtxRotationModel2, D3DXToRadian(90));
mtxWorldModel = mtxRotationModel2* mtxRotationModel*mtxScalingModel* mtxTranslationModel;
Direct3D_GetDevice()->SetTransform(D3DTS_WORLD, &mtxWorldModel);//ワールド変換行列
Model_Draw(INDEX_MODEL_HERI_HONTAI);
g_Save_Matrix2 = mtxWorldModel;
Heri_Puropera_Draw();
}
void Heri_Puropera_Draw(void)
{
Direct3D_GetDevice()->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
Direct3D_GetDevice()->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
//もでる
D3DXMATRIX mtxWorldModel2;
D3DXMatrixIdentity(&mtxWorldModel2);//単位行列を作る
D3DXMATRIX mtxTranslationModel2;
D3DXMatrixTranslation(&mtxTranslationModel2, 0.45f, 2.3f, 0.0f);
D3DXMATRIX mtxRotationModel;
D3DXMatrixRotationY(&mtxRotationModel, D3DXToRadian(puroperaAng));
mtxWorldModel2 = mtxRotationModel*mtxTranslationModel2;
D3DXMatrixMultiply(&mtxWorldModel2, &mtxWorldModel2, &g_Save_Matrix2);
Direct3D_GetDevice()->SetTransform(D3DTS_WORLD, &mtxWorldModel2);//ワールド変換行列
Model_Draw(INDEX_MODEL_HERI_PUROPERA);
//横プロペラ
D3DXMATRIX mtxTranslationModel3;
D3DXMatrixTranslation(&mtxTranslationModel2, 4.5f, 2.7f, -0.7f);
D3DXMATRIX mtxRotationModel3;
D3DXMatrixRotationZ(&mtxRotationModel3, D3DXToRadian(puroperaAng));
D3DXMATRIX mtxRotationModel3a;
D3DXMatrixRotationX(&mtxRotationModel3a, D3DXToRadian(90));
D3DXMATRIX mtxScaringModel3;
D3DXMatrixScaling(&mtxScaringModel3, 0.5f, 0.5f, 0.5f);
mtxWorldModel2 =mtxRotationModel3a*mtxRotationModel3*mtxScaringModel3*mtxTranslationModel2;
D3DXMatrixMultiply(&mtxWorldModel2, &mtxWorldModel2, &g_Save_Matrix2);
Direct3D_GetDevice()->SetTransform(D3DTS_WORLD, &mtxWorldModel2);//ワールド変換行列
Model_Draw(INDEX_MODEL_HERI_PUROPERA);
}
D3DXVECTOR3 Get_HeriFront(void)
{
return HFront;
}
| [
"daikiisozaki@gmail.com"
] | daikiisozaki@gmail.com |
727470f05728d28dfc25751243de9196fdfb42b2 | febe42791462ef7605ab65a68d39bfc6b385c952 | /Firmware/StackArray.h | 7a53b3dee6cfbda81e2ce274eac07541fc8bed18 | [
"MIT"
] | permissive | appfruits/LittleHelper | ae34fc7bb7b0ad928eed84c7eab91b72ba3f900b | 3d190620973328b8edab6ddd6df0b3e2da348dbb | refs/heads/master | 2021-05-04T10:52:34.726912 | 2017-02-24T14:56:07 | 2017-02-24T14:56:07 | 47,962,267 | 29 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,816 | h | /*
* StackArray.h
*
* Library implementing a generic, dynamic stack (array version).
*
* ---
*
* Copyright (C) 2010 Efstathios Chatzikyriakidis (contact@efxa.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ---
*
* Version 1.0
*
* 2010-09-25 Efstathios Chatzikyriakidis <contact@efxa.org>
*
* - added resize(): for growing, shrinking the array size.
*
* 2010-09-23 Efstathios Chatzikyriakidis <contact@efxa.org>
*
* - added exit(), blink(): error reporting and handling methods.
*
* 2010-09-20 Alexander Brevig <alexanderbrevig@gmail.com>
*
* - added setPrinter(): indirectly reference a Serial object.
*
* 2010-09-15 Efstathios Chatzikyriakidis <contact@efxa.org>
*
* - initial release of the library.
*
* ---
*
* For the latest version see: http://www.arduino.cc/
*/
// header defining the interface of the source.
#ifndef _STACKARRAY_H
#define _STACKARRAY_H
// include Arduino basic header.
#include <Arduino.h>
// the definition of the stack class.
template<typename T>
class StackArray {
public:
// init the stack (constructor).
StackArray ();
// clear the stack (destructor).
~StackArray ();
// push an item to the stack.
void push (const T i);
// pop an item from the stack.
T pop ();
// get an item from the stack.
T peek () const;
// get an item at index n
T at (uint16_t n) const;
// check if the stack is empty.
bool isEmpty () const;
// get the number of items in the stack.
int count () const;
// check if the stack is full.
bool isFull () const;
// set the printer of the stack.
void setPrinter (Print & p);
private:
// resize the size of the stack.
void resize (const int s);
// exit report method in case of error.
void exit (const char * m) const;
// led blinking method in case of error.
void blink () const;
// the initial size of the stack.
static const int initialSize = 2;
// the pin number of the on-board led.
static const int ledPin = 13;
Print * printer; // the printer of the stack.
T * contents; // the array of the stack.
int size; // the size of the stack.
int top; // the top index of the stack.
};
// init the stack (constructor).
template<typename T>
StackArray<T>::StackArray () {
size = 0; // set the size of stack to zero.
top = 0; // set the initial top index of the stack.
printer = NULL; // set the printer of stack to point nowhere.
// allocate enough memory for the array.
contents = (T *) malloc (sizeof (T) * initialSize);
// if there is a memory allocation error.
if (contents == NULL)
exit ("STACK: insufficient memory to initialize stack.");
// set the initial size of the stack.
size = initialSize;
}
// clear the stack (destructor).
template<typename T>
StackArray<T>::~StackArray () {
free (contents); // deallocate the array of the stack.
contents = NULL; // set stack's array pointer to nowhere.
printer = NULL; // set the printer of stack to point nowhere.
size = 0; // set the size of stack to zero.
top = 0; // set the initial top index of the stack.
}
// resize the size of the stack.
template<typename T>
void StackArray<T>::resize (const int s) {
// defensive issue.
if (s <= 0)
exit ("STACK: error due to undesirable size for stack size.");
// reallocate enough memory for the array.
contents = (T *) realloc (contents, sizeof (T) * s);
// if there is a memory allocation error.
if (contents == NULL)
exit ("STACK: insufficient memory to resize stack.");
// set the new size of the stack.
size = s;
}
// push an item to the stack.
template<typename T>
void StackArray<T>::push (const T i) {
// check if the stack is full.
if (isFull ())
// double size of array.
resize (size * 2);
// store the item to the array.
contents[top++] = i;
}
// pop an item from the stack.
template<typename T>
T StackArray<T>::pop () {
// check if the stack is empty.
if (isEmpty ())
exit ("STACK: can't pop item from stack: stack is empty.");
// fetch the top item from the array.
T item = contents[--top];
// shrink size of array if necessary.
if (!isEmpty () && (top <= size / 4))
resize (size / 2);
// return the top item from the array.
return item;
}
// get an item from the stack.
template<typename T>
T StackArray<T>::peek () const {
// check if the stack is empty.
if (isEmpty ())
exit ("STACK: can't peek item from stack: stack is empty.");
// get the top item from the array.
return contents[top - 1];
}
// get an item from the stack.
template<typename T>
T StackArray<T>::at(uint16_t n) const {
if (isEmpty())
exit ("STACK is empty");
if (n < 0)
exit("Out of range error, index < 0");
if (n > count()-1)
exit("Out of range error, index > n");
return contents[n];
}
// check if the stack is empty.
template<typename T>
bool StackArray<T>::isEmpty () const {
return top == 0;
}
// check if the stack is full.
template<typename T>
bool StackArray<T>::isFull () const {
return top == size;
}
// get the number of items in the stack.
template<typename T>
int StackArray<T>::count () const {
return top;
}
// set the printer of the stack.
template<typename T>
void StackArray<T>::setPrinter (Print & p) {
printer = &p;
}
// exit report method in case of error.
template<typename T>
void StackArray<T>::exit (const char * m) const {
// print the message if there is a printer.
if (printer)
printer->println (m);
// loop blinking until hardware reset.
blink ();
}
// led blinking method in case of error.
template<typename T>
void StackArray<T>::blink () const {
// set led pin as output.
pinMode (ledPin, OUTPUT);
// continue looping until hardware reset.
while (true) {
digitalWrite (ledPin, HIGH); // sets the LED on.
delay (250); // pauses 1/4 of second.
digitalWrite (ledPin, LOW); // sets the LED off.
delay (250); // pauses 1/4 of second.
}
// solution selected due to lack of exit() and assert().
}
#endif // _STACKARRAY_H
| [
"pschuster@me.com"
] | pschuster@me.com |
ff70ca66f0e7c60fd934e3b43d87060777a8b00b | f6a1c856a662861f680c84efbd7c790a7ffdbdee | /genesys/Counter.cpp | 0fbb58c595eae68fc6d397895de722a271e8f5c9 | [] | no_license | telmotrooper/ine5425_genesys-gui | 75cf2c41d066ebc63318664f48509720c076039c | 78dc4fe66be94a94ee6ce8b1976c4bf469396d54 | refs/heads/master | 2022-03-28T07:32:17.808576 | 2019-11-18T00:46:47 | 2019-11-18T00:46:47 | 203,665,254 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,592 | cpp | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: CounterDefaultImpl1.cpp
* Author: rafael.luiz.cancian
*
* Created on 29 de Maio de 2019, 11:24
*/
#include "Counter.h"
#include "SimulationResponse.h"
#include "Model.h"
Counter::Counter(ElementManager* elems) : ModelElement(Util::TypeOf<Counter>()) {
_addSimulationResponse(elems);
}
Counter::Counter(ElementManager* elems, std::string name) : ModelElement(Util::TypeOf<Counter>()) {
_name = name;
_addSimulationResponse(elems);
}
Counter::Counter(ElementManager* elems, std::string name, ModelElement* parent) : ModelElement(Util::TypeOf<Counter>()) {
_name = name;
_parent = parent;
_addSimulationResponse(elems);
}
Counter::Counter(const Counter& orig) : ModelElement(orig) {
}
Counter::~Counter() {
}
void Counter::_addSimulationResponse(ElementManager* elems) {
GetterMember getterMember = DefineGetterMember<Counter>(this, &Counter::getCountValue);
std::string parentName = "";
if (_parent != nullptr)
parentName = _parent->getName();
SimulationResponse* resp = new SimulationResponse(Util::TypeOf<Counter>(), parentName+":"+_name, getterMember);
elems->getParentModel()->getResponses()->insert(resp);
}
std::string Counter::show() {
return ModelElement::show() +
", count=" + std::to_string(this->_count);
}
void
Counter::clear() {
_count = 0;
}
void Counter::incCountValue(int value) {
_count += value;
}
unsigned long Counter::getCountValue() const {
return _count;
}
ModelElement* Counter::getParent() const {
return _parent;
}
PluginInformation* Counter::GetPluginInformation() {
PluginInformation* info = new PluginInformation(Util::TypeOf<Counter>(), &Counter::LoadInstance);
info->setGenerateReport(true);
return info;
}
ModelElement* Counter::LoadInstance(ElementManager* elems, std::map<std::string, std::string>* fields) {
Counter* newElement = new Counter(elems);
try {
newElement->_loadInstance(fields);
} catch (const std::exception& e) {
}
return newElement;
}
bool Counter::_loadInstance(std::map<std::string, std::string>* fields) {
return ModelElement::_loadInstance(fields);
}
std::map<std::string, std::string>* Counter::_saveInstance() {
return ModelElement::_saveInstance();
}
//std::list<std::map<std::string,std::string>*>* _saveInstance(std::string type){}
bool Counter::_check(std::string* errorMessage) {
return true;
} | [
"telmo.trooper@gmail.com"
] | telmo.trooper@gmail.com |
af6e98b27b47a681bc4bad33856b1816dcf1a555 | 45e3eb85ad842e22efefad6d3c1af327998eb297 | /AtCoder/asakatsu/2020/8/a.cpp | 41c91af0412bca275ae7535192b864225d5b5653 | [] | no_license | sawamotokai/competitive-programming | 6b5e18217c765184acfb2613b681d0ac9ec3f762 | 9659124def45447be5fccada6e835cd7e09d8f79 | refs/heads/master | 2023-06-12T06:56:01.985876 | 2021-07-05T16:55:56 | 2021-07-05T16:55:56 | 241,240,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 768 | cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++
int main() {
int N,M,A,B; cin>>N>>M>>A>>B;
int no = 0;
rep(i,M) {
int c; cin>>c;
if (N<=A) N+=B;
if (c>N && !no) no = i+1;
N-=c;
}
if (no) cout << no << endl;
else cout << "Complete" << endl;
return 0;
} | [
"kaisawamoto@gmail.com"
] | kaisawamoto@gmail.com |
5a5fe9a6324391a6d9e4e64b905a686deb092c7e | f2d3870719af1149e7074cf0c680a2aef6cbe4e2 | /Pratica4/clase/clase.ino | ddb312ac2ae03eca4500f07094745ba667547ba7 | [] | no_license | hopechan/MIP | 1937c23cf87df340d55a817a93751cdd72573dc4 | 9d106b2cf7cf47a59b4d9bdce66d915acf5f0d7d | refs/heads/master | 2022-04-22T11:55:16.882824 | 2020-04-13T21:50:13 | 2020-04-13T21:50:13 | 255,448,110 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 379 | ino | #define PINLED 5
#define PINTRAN 3
int potencia = 0;
void setup() {
pinMode(PINLED, OUTPUT);
pinMode(PINTRAN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
potencia = analogRead(A5);
Serial.println(potencia);
potencia=map(potencia,0,1023,0,255);
analogWrite(PINLED, potencia);
analogWrite(PINTRAN, potencia);
}
| [
"esperanza.duenas@unplug.studio"
] | esperanza.duenas@unplug.studio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.