blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2 values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 10.4M | extension stringclasses 122 values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cfd636cf97fb632c94e283dbca7620d8144594c3 | c5f3ce7915e43f10268dd829ff16445bc68ae09c | /cpp/triangle/triangle.cpp | db04b463d95508e7d10ff54352bd1ceeed747826 | [] | no_license | jianxx/exercism | 2e0bc1444b7f7734ca78a96ba4c16bd7069af8b3 | 808f7f0cbfd132de89deac9b914de4d39a15e20c | refs/heads/master | 2023-01-04T13:46:45.200232 | 2020-11-04T03:35:39 | 2020-11-04T03:35:39 | 292,189,311 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,082 | cpp | #include "triangle.h"
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <stdexcept>
#include <type_traits>
namespace triangle {
template <class T>
typename std::enable_if<!std::numeric_limits<T>::is_integer, bool>::type
almost_equal(T x, T y, int ulp) {
return std::fabs(x - y) <= std::numeric_limits<T>::epsilon() * std::fabs(x + y) * ulp || std::fabs(x - y) < std::numeric_limits<T>::min();
}
flavor kind(double a, double b, double c) {
if (b > c) std::swap(b, c);
if (a > c) std::swap(a, c);
if (a > b) std::swap(a, b);
if (a <= 0) throw std::domain_error("All sides have to be of length > 0!");
if (c > a + b) throw std::domain_error("The sum of the lengths of any two sides must be greater than or equal to the length of the third side!");
if (almost_equal(a, b, 2) && almost_equal(b, c, 2))
return flavor::equilateral;
else if (almost_equal(a, b, 2) || almost_equal(b, c, 2))
return flavor::isosceles;
else
return flavor::scalene;
}
} // namespace triangle
| [
"jianxx@gmail.com"
] | jianxx@gmail.com |
faa60306785c1a735ba253c877ca7cecd3e0bae1 | 41eff316a4c252dbb71441477a7354c9b192ba41 | /src/PhysX/physx/source/lowlevel/software/include/PxsContactManager.h | bf376a64a79548ae0247fd496a9da157bc8ceec9 | [] | no_license | erwincoumans/pybullet_physx | 40615fe8502cf7d7a5e297032fc4af62dbdd0821 | 70f3e11ad7a1e854d4f51992edd1650bbe4ac06a | refs/heads/master | 2021-07-01T08:02:54.367317 | 2020-10-22T21:43:34 | 2020-10-22T21:43:34 | 183,939,616 | 21 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 6,737 | h | //
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION 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 ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PXS_CONTACTMANAGER_H
#define PXS_CONTACTMANAGER_H
#include "PxvConfig.h"
#include "PxcNpWorkUnit.h"
namespace physx
{
class PxsContext;
class PxsRigidBody;
struct PxsCCDBody;
class PxsMaterialManager;
struct PxsCCDShape;
namespace Dy
{
class DynamicsContext;
}
namespace Sc
{
class ShapeInteraction;
}
enum PxsPairVisColor
{
eVIS_COLOR_SWEPTINTEGRATE_OFF = 0x000000,
eVIS_COLOR_SWEPTINTEGRATE_SLOW = 0x404040,
eVIS_COLOR_SWEPTINTEGRATE_CLEAR = 0x007f00,
eVIS_COLOR_SWEPTINTEGRATE_IMPACT = 0x1680ff,
eVIS_COLOR_SWEPTINTEGRATE_FAIL = 0x0000ff
};
/**
\brief Additional header structure for CCD contact data stream.
*/
struct PxsCCDContactHeader
{
/**
\brief Stream for next collision. The same pair can collide multiple times during multiple CCD passes.
*/
PxsCCDContactHeader* nextStream; //4 //8
/**
\brief Size (in bytes) of the CCD contact stream (not including force buffer)
*/
PxU16 contactStreamSize; //6 //10
/**
\brief Defines whether the stream is from a previous pass.
It could happen that the stream can not get allocated because we run out of memory. In that case the current event should not use the stream
from an event of the previous pass.
*/
PxU16 isFromPreviousPass; //8 //12
PxU8 pad[12 - sizeof(PxsCCDContactHeader*)]; //16
};
PX_COMPILE_TIME_ASSERT((sizeof(PxsCCDContactHeader) & 0xF) == 0);
class PxsContactManager
{
public:
PxsContactManager(PxsContext* context, PxU32 index);
~PxsContactManager();
PX_FORCE_INLINE void setDisableStrongFriction(PxU32 d) { (!d) ? mNpUnit.flags &= ~PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION
: mNpUnit.flags |= PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION; }
PX_FORCE_INLINE PxReal getRestDistance() const { return mNpUnit.restDistance; }
PX_FORCE_INLINE void setRestDistance(PxReal v) { mNpUnit.restDistance = v; }
void destroy();
PX_FORCE_INLINE PxU8 getDominance0() const { return mNpUnit.dominance0; }
PX_FORCE_INLINE void setDominance0(PxU8 v) { mNpUnit.dominance0 = v; }
PX_FORCE_INLINE PxU8 getDominance1() const { return mNpUnit.dominance1; }
PX_FORCE_INLINE void setDominance1(PxU8 v) { mNpUnit.dominance1 = v; }
PX_FORCE_INLINE PxU16 getTouchStatus() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_TOUCH); }
PX_FORCE_INLINE PxU16 touchStatusKnown() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eTOUCH_KNOWN); }
PX_FORCE_INLINE PxI32 getTouchIdx() const { return (mNpUnit.statusFlags& PxcNpWorkUnitStatusFlag::eHAS_TOUCH) ? 1 : (mNpUnit.statusFlags& PxcNpWorkUnitStatusFlag::eHAS_NO_TOUCH ? -1 : 0); }
PX_FORCE_INLINE PxU32 getIndex() const { return mNpUnit.index; }
PX_FORCE_INLINE PxU16 getHasCCDRetouch() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH); }
PX_FORCE_INLINE void clearCCDRetouch() { mNpUnit.statusFlags &= ~PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH; }
PX_FORCE_INLINE void raiseCCDRetouch() { mNpUnit.statusFlags |= PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH; }
// flags stuff - needs to be refactored
PX_FORCE_INLINE Ps::IntBool isChangeable() const { return Ps::IntBool(mFlags & PXS_CM_CHANGEABLE); }
PX_FORCE_INLINE Ps::IntBool getCCD() const { return Ps::IntBool((mFlags & PXS_CM_CCD_LINEAR) && (mNpUnit.flags & PxcNpWorkUnitFlag::eDETECT_CCD_CONTACTS)); }
PX_FORCE_INLINE Ps::IntBool getHadCCDContact() const { return Ps::IntBool(mFlags & PXS_CM_CCD_CONTACT); }
PX_FORCE_INLINE void setHadCCDContact() { mFlags |= PXS_CM_CCD_CONTACT; }
void setCCD(bool enable);
PX_FORCE_INLINE void clearCCDContactInfo() { mFlags &= ~PXS_CM_CCD_CONTACT; mNpUnit.ccdContacts = NULL; }
PX_FORCE_INLINE PxcNpWorkUnit& getWorkUnit() { return mNpUnit; }
PX_FORCE_INLINE const PxcNpWorkUnit& getWorkUnit() const { return mNpUnit; }
PX_FORCE_INLINE void* getUserData() const { return mShapeInteraction; }
// Setup solver-constraints
void resetCachedState();
void resetFrictionCachedState();
Sc::ShapeInteraction* getShapeInteraction() const { return mShapeInteraction; }
private:
//KS - moving this up - we want to get at flags
PxsRigidBody* mRigidBody0; //4 //8
PxsRigidBody* mRigidBody1; //8 //16
PxU32 mFlags; //20 //36
Sc::ShapeInteraction* mShapeInteraction; //16 //32
friend class PxsContext;
// everything required for narrow phase to run
PxcNpWorkUnit mNpUnit;
enum
{
PXS_CM_CHANGEABLE = (1<<0),
PXS_CM_CCD_LINEAR = (1<<1),
PXS_CM_CCD_CONTACT = (1 << 2)
};
friend class Dy::DynamicsContext;
friend struct PxsCCDPair;
friend class PxsIslandManager;
friend class PxsCCDContext;
friend class Sc::ShapeInteraction;
};
}
#endif
| [
"erwincoumans@google.com"
] | erwincoumans@google.com |
53e6bbbe66e3bffe2bac08d779b4e9f34da946d4 | 158fe0dea7397e3290d0261b0d6a09c7cbdcbf73 | /2sem/programming basics/16/100.cpp | 6c92f40202c2420a21310ef60f697203b065d691 | [] | no_license | NuarkNoir/UPC | c2dd6da42dc5c5d53a91948755083c8411d9f386 | cf7e5c28b427643dd3cdc8d9962d7d537b5fb0e6 | refs/heads/master | 2021-06-22T21:08:54.854324 | 2021-06-04T08:42:14 | 2021-06-04T08:42:14 | 222,354,550 | 6 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,003 | cpp | // pb_16_100.cpp
// Горбацевич Андрей
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
enum scholarship {
HI_ED = 0, SC_ED = 1, SV_RD = 2
};
struct DB_record {
char surname[32];
unsigned short age;
char city[32];
scholarship scs;
bool operator < (const DB_record& rhs) const {
string l = string(surname);
transform(l.begin(), l.end(), l.begin(), [](unsigned char c){ return tolower(c); });
string r = string(rhs.surname);
transform(r.begin(), r.end(), r.begin(), [](unsigned char c){ return tolower(c); });
return l < r;
}
};
vector<DB_record> parseDB(ifstream &ifs);
int main() {
string path_in = "in.txt"; // путь до входного файла
string path_out = "out.bin"; // путь до выходного файла
ifstream ifs(path_in);
ofstream ofs(path_out, ios::binary);
if (!ifs.is_open())
{
cerr << "Unable to open file" << endl;
return 1;
}
vector<DB_record> records = parseDB(ifs);
for (auto record : records) {
ofs.write(reinterpret_cast<char*>(&record), sizeof(record));
}
ifs.close();
ofs.close();
vector<DB_record> records_fb;
ifstream binfs(path_out, ios::binary);
while (!binfs.eof() && !binfs.fail()) {
DB_record record{};
binfs.read(reinterpret_cast<char*>(&record), sizeof(record));
if (record.age == 0) {
continue;
}
records_fb.push_back(record);
}
sort(records_fb.begin(), records_fb.end());
for (auto record : records_fb) {
cout << record.surname << endl;
cout << "\tAge: " << record.age << endl;
cout << "\tCity: " << record.city << endl;
cout << "\tScholarship: ";
switch (record.scs) {
case HI_ED:
cout << "higher";
break;
case SC_ED:
cout << "secondary";
break;
case SV_RD:
cout << "secondary vocational";
break;
}
cout << endl;
}
return 0;
}
vector<DB_record> parseDB(ifstream &ifs) {
vector<DB_record> out;
while (!ifs.fail() && !ifs.eof()) {
DB_record record{};
ifs >> record.surname;
ifs >> record.age;
ifs >> record.city;
{
string comp_str;
ifs >> comp_str;
if (comp_str[0] == '"') {
string sub_comp_str;
ifs >> sub_comp_str;
comp_str += " " + sub_comp_str;
}
if (comp_str == "higher") {
record.scs = HI_ED;
}
else if (comp_str == "secondary") {
record.scs = SC_ED;
}
else if (comp_str == "\"secondary vocational\"") {
record.scs = SV_RD;
}
}
out.push_back(record);
}
return out;
}
| [
"mrcluster@ya.ru"
] | mrcluster@ya.ru |
3fb3df3eb9498e6d408005d0c357d009320eda16 | b389f1f3075092f7cb25f45ee9bf910c55250735 | /Codeforces/Problems/ASupercentralPoint.cpp | 47eeced0aacdf8b30cd4a7a7fcac9213ebc9e464 | [] | no_license | leostd/Competitive-Programming | 7b3c4c671e799216c79aeefd2ca7d68c5d463fa6 | 4db01b81314f82c4ebb750310e5afb4894b582bd | refs/heads/master | 2023-05-13T07:04:40.512100 | 2023-05-06T10:58:28 | 2023-05-06T10:58:28 | 87,685,033 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 886 | cpp | #include "../library/lib.hpp"
#include <iostream>
using namespace std;
class ASupercentralPoint {
public:
void solve(std::istream& in, std::ostream& out) {
int n;
vector<pii> xs, ys;
pii a;
in >> n;
REP(i,n){
in >> a.first >> a.second;
xs.pb(a), ys.pb(mp(a.second, a.first));
}
sort(xs.begin(), xs.end());
sort(ys.begin(), ys.end());
int ans = 0;
REP(i,n){
int x = xs[i].first;
int y = xs[i].second;
bool left, right, up, down;
left = right = up = down = false;
REP(j,n){
if (j == i)
continue;
if (x == xs[j].first && y < xs[j].second)
up = true;
else if (x == xs[j].first && y > xs[j].second)
down = true;
else if (y == xs[j].second && x > xs[j].first)
left = true;
else if (y == xs[j].second && x < xs[j].first)
right = true;
}
ans += (right && left && up && down);
}
out << ans;
}
}; | [
"lsantel@amazon.com"
] | lsantel@amazon.com |
6df45f80e4da75ffa596de1edb5c6886af66d61a | b52d21321add25dc9d2576c100cdff483e435bed | /src/Game/Comment/FlowString/FlowString.h | ae98fccb9383057eadc595e2f95961dc6a29603c | [] | no_license | gab0626/commentgame | 1ebe6a05af26263f97e281f7e10767d03f643e93 | db5b243dc3a62b47f8bb0219cd0b64ee10bf4788 | refs/heads/master | 2020-05-29T11:31:50.796615 | 2016-05-11T22:30:45 | 2016-05-11T22:30:45 | 57,183,936 | 0 | 0 | null | 2016-04-29T16:05:43 | 2016-04-27T04:42:37 | C++ | UTF-8 | C++ | false | false | 1,360 | h | #pragma once
#include "../../AppEnv.h"
#include <memory>
#include <string>
#include <vector>
class FlowString
{
struct _m_FlowString;
std::shared_ptr<_m_FlowString> member;
public:
enum class Type
{
TOP,
MIDDLE,
BOTTOM
};
enum class Size
{
SMALL,
MIDDLE,
BIG
};
private:
public:
FlowString(const std::string& comment,
const FlowString::Size size = FlowString::Size::MIDDLE,
const FlowString::Type type = FlowString::Type::MIDDLE,
const Color& col = Color::white);
FlowString(const std::string& comment,
const FlowString::Type type,
const FlowString::Size size = FlowString::Size::MIDDLE,
const Color& col = Color::white);
private:
void setup(const std::string& comment,
const FlowString::Size size = FlowString::Size::MIDDLE,
const FlowString::Type type = FlowString::Type::MIDDLE,
const Color& col = Color::white);
public:
void drawFlow(std::vector<Font>& font);
void drawStop(std::vector<Font>& font);
void update();
bool isActive();
public:
FlowString::Type Get_Type();
size_t Get_SpawnFrame();
public:
void Set_Type(const FlowString::Type type);
void Set_SpawnFrame(const size_t spawnFrame);
}; | [
"peperontino39@docomo.ne.jp"
] | peperontino39@docomo.ne.jp |
39b4abe7a2ab0dac2268baf19dfb841939d76bb9 | af33e5b8129c2852add250146404d547ad627efa | /src/math/MatrixStack.h | bc7b63f72f541b00c80d763757e0d7793d7fea9a | [] | no_license | phosphoer/game-300 | ac5f44b7a775c0c494f40929455a60f9b7402e76 | 3d897e980fc7db863e21060721b4eb92e309e904 | refs/heads/master | 2023-01-20T02:10:15.187566 | 2020-11-25T20:54:14 | 2020-11-25T20:54:14 | 316,051,129 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 976 | h | // Nicholas Baldwin
// 2011/07/27
// All content (c) 2011 DigiPen (USA) Corporation, all rights reserved.
#pragma once
namespace Improbability
{
// templated to handle any size matrix
template<typename MatrixT>
class MatrixStack
{
public:
// constructor loads the identity in first
MatrixStack()
{
MatrixT identity;
identity.Identity();
m_stack.push_back(identity);
}
// make the current top into an identity
void LoadIdentity()
{
m_stack.back().Identity();
}
// concatenate a matrix with the top and make it the new top
void LoadMatrix(MatrixT const &matrix)
{
m_stack.back() = m_stack.back() * matrix;
}
// make a new top from the last one
void Push()
{
m_stack.push_back(m_stack.back());
}
// pop the current top
void Pop()
{
m_stack.pop_back();
}
// return the top of the stack
MatrixT Top()
{
return m_stack.back();
}
private:
// the stack
std::vector<MatrixT> m_stack;
};
} | [
"david0evans@gmail.com"
] | david0evans@gmail.com |
7e94ee3224d2f749fd8540a9af6432a7449d6afd | 9a3fd403e16941232f9d48c837ebe494b5f34023 | /Tests/FindGTK2/gtkmm/main.cpp | f468cdd4b3821540c5c9dd44ee0657d8569fb9b8 | [
"BSD-3-Clause"
] | permissive | AnomalousMedical/CMake-OldFork | 9f7735199073525ab5f6b9074829af4abffac65b | 1bf1d8d1c8de2f7156a47ecf883408574c031ac1 | refs/heads/master | 2021-06-11T11:15:48.950407 | 2017-03-11T17:07:10 | 2017-03-11T17:07:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 254 | cpp | #include <gtkmm.h>
#include "helloworld.h"
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
HelloWorld helloworld;
//Shows the window and returns when it is closed.
Gtk::Main::run(helloworld);
return 0;
}
| [
"AndrewPiper@7b0d72ad-f3cb-b44e-b30e-0ca2391ac3a1"
] | AndrewPiper@7b0d72ad-f3cb-b44e-b30e-0ca2391ac3a1 |
874836ec6caa236042e9bc2570c06925ba4668cd | 1ff6173ecfbc09b6104670612e75f9c4b59d7aa4 | /include/linq/reverse.hpp | f2a937b55d1c3cfb331db55e423a84a91e482e1d | [] | no_license | calum74/linq | 773efa768793b48b5a700f16a138172dc03a7426 | eecabb7b947413541c456ba0ef8ac2bc21bc98cd | refs/heads/master | 2022-10-20T01:58:07.061831 | 2022-10-07T09:59:22 | 2022-10-07T09:59:22 | 37,785,980 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 583 | hpp | //
// reverse.hpp
// Linq
//
// Created by Calum Grant on 20/06/2015.
// Copyright (c) 2015 Calum Grant. All rights reserved.
//
#ifndef Linq_reverse_hpp
#define Linq_reverse_hpp
namespace linq
{
template<typename T, typename Alloc>
class reverse_t : public container_store<std::vector<T, Alloc>>
{
public:
typedef T value_type;
reverse_t(const sequence<value_type> & src, Alloc alloc = Alloc()) :
container_store<std::vector<T,Alloc>>(src, alloc)
{
std::reverse(this->container.begin(), this->container.end());
}
};
}
#endif
| [
"calumgrant@github.com"
] | calumgrant@github.com |
04abbc89775cb500a34f558d4d73254cd5b3e36e | 6d21cf2eac50943ed857d39cd9bafd57a9247376 | /exercise/exercise/NonRenderObject.h | 0674c962a7a94aa43eb53cb34836ce2484d5f125 | [] | no_license | shinseona/Exercise | 180c473e9f2a4823523b8d6e6ca3c04de152c5bb | 39bb1e183c7e3a96ddb19b250e8ca39dc7ef3ef6 | refs/heads/main | 2023-01-06T08:58:44.252311 | 2020-11-04T08:38:26 | 2020-11-04T08:38:26 | 309,903,687 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 278 | h | #ifndef NONRENDEROBJECT_H
#define NONRENDEROBJECT_H
#include "Object.h"
#include "IUpdate.h"
class NonRenderObject : public Object,public IUpdate
{
public :
virtual void Update(IUpdate* iupdate)override;
virtual void ShutDown() override {}
};
#endif // !NONRENDEROBJECT_H
| [
"42831273+shinseona@users.noreply.github.com"
] | 42831273+shinseona@users.noreply.github.com |
fd9074bdfdea874e2907893abd9dbe551787171c | 1b0aadb6dc881bf363cbebbc59ac0c41a956ed5c | /xtk/Source/SyntaxEdit/XTPSyntaxEditDrawTextProcessor.h | f502ae63a6e008faa8250efcf2fa6b4db0d35e3b | [] | no_license | chinatiny/OSS | bc60236144d73ab7adcbe52cafbe610221292ba6 | 87b61b075f00b67fd34cfce557abe98ed6f5be70 | refs/heads/master | 2022-09-21T03:11:09.661243 | 2018-01-02T10:12:35 | 2018-01-02T10:12:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,463 | h | // XTPSyntaxEditDrawTextProcessor.h: interface for the CXTPSyntaxEditDrawTextProcessor class.
//
// This file is a part of the XTREME TOOLKIT PRO MFC class library.
// (c)1998-2007 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME SYNTAX EDIT LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
//////////////////////////////////////////////////////////////////////
//{{AFX_CODEJOCK_PRIVATE
#if !defined(__XTPSYNTAXEDITDRAWTEXTPROCESSOR_H__)
#define __XTPSYNTAXEDITDRAWTEXTPROCESSOR_H__
//}}AFX_CODEJOCK_PRIVATE
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Common/XTPSmartPtrInternalT.h"
//{{AFX_CODEJOCK_PRIVATE
template<class TYPE, class ARG_TYPE>
class CXTPReserveArray : protected CArray<TYPE, ARG_TYPE>
{
protected:
int m_nDataSize;
public:
CXTPReserveArray()
{
m_nDataSize = 0;
}
int GetDataSize() const
{
return m_nDataSize;
}
void SetDataSize(int nDataSize, int nReservedSize = -1, int nGrowBy = -1)
{
ASSERT(nReservedSize == -1 || nReservedSize >= nDataSize);
nReservedSize = max(nReservedSize, nDataSize);
m_nDataSize = nDataSize;
SetSize(nReservedSize, nGrowBy);
}
void AddData(ARG_TYPE newElement)
{
SetAtGrow(m_nDataSize, newElement);
m_nDataSize++;
}
void RemoveAll()
{
m_nDataSize = 0;
}
TYPE operator[](int nIndex) const
{
ASSERT(nIndex >= 0 && nIndex < GetDataSize());
return GetAt(nIndex);
}
TYPE& operator[](int nIndex)
{
ASSERT(nIndex >= 0 && nIndex < GetDataSize());
return ElementAt(nIndex);
}
// Direct Access to the element data (may return NULL)
const TYPE* GetData() const {
return CArray<TYPE, ARG_TYPE>::GetData();
}
TYPE* GetData() {
return CArray<TYPE, ARG_TYPE>::GetData();
}
};
//}}AFX_CODEJOCK_PRIVATE
//===========================================================================
// Summary:
// This helper class used by CXTPSyntaxEditCtrl as the Draw Text Processor.
// It is responsible for drawing chars and remember each char position and
// other text properties.
//===========================================================================
class _XTP_EXT_CLASS CXTPSyntaxEditDrawTextProcessor
{
public:
//-----------------------------------------------------------------------
// Summary:
// Default object constructor.
//-----------------------------------------------------------------------
CXTPSyntaxEditDrawTextProcessor();
//-----------------------------------------------------------------------
// Summary:
// Get a rectangle to draw text.
// Returns:
// A CRect with rectangle to draw text.
// See Also: SetTextRect
//-----------------------------------------------------------------------
CRect GetTextRect();
//-----------------------------------------------------------------------
// Summary:
// Set a rectangle to draw text.
// Parameters:
// rcRect - [in] A CRect object with rectangle to set.
// See Also: GetTextRect
//-----------------------------------------------------------------------
void SetTextRect(const CRect& rcRect);
//-----------------------------------------------------------------------
// Summary:
// Get a single row height.
// Returns:
// A single row height.
// See Also: RecalcRowHeight
//-----------------------------------------------------------------------
int GetRowHeight();
//-----------------------------------------------------------------------
// Summary:
// Use this method to recalculate a single row height.
// Parameters:
// pDC : [in] A pointer to device context.
// pFont : [in] A pointer to font to calculate.
// Returns:
// A single row height.
// See Also: GetRowHeight
//-----------------------------------------------------------------------
int RecalcRowHeight(CDC* pDC, CFont* pFont);
//-----------------------------------------------------------------------
// Summary:
// Get a rows count visible for text rectangle.
// Parameters:
// bWithPartlyVisible : If this parameter TRUE - partly visible row
// will be calculated too, otherwise only full
// visible rows count returned.
// Returns:
// A visible rows count.
// See Also: SetTextRect
//-----------------------------------------------------------------------
int GetRowsCount(BOOL bWithPartlyVisible);
//-----------------------------------------------------------------------
// Summary:
// Get tab size.
// Returns:
// A tab size.
// See Also: SetTabSize
//-----------------------------------------------------------------------
int GetTabSize();
//-----------------------------------------------------------------------
// Summary:
// Sets the tab size.
// Parameters:
// nTabSize : [in] The tab size to set.
// Remarks:
// Call this member function to set tab size. Size is measured in
// space character and should be between 2 to 10.
// See also: GetTabSize
//-----------------------------------------------------------------------
void SetTabSize(int nTabSize);
//-----------------------------------------------------------------------
// Summary:
// Get scroll offset for x coordinate.
// Returns:
// A scroll offset for x coordinate.
// See Also: SetScrollXOffset
//-----------------------------------------------------------------------
int GetScrollXOffset();
//-----------------------------------------------------------------------
// Summary:
// Get scroll offset for x coordinate.
// Parameters:
// nOffsetX - A scroll offset to set.
// See Also: GetScrollXOffset
//-----------------------------------------------------------------------
void SetScrollXOffset(int nOffsetX);
//-----------------------------------------------------------------------
// Summary:
// Get current text metrics.
// Returns:
// A TEXTMETRIC structure.
// See Also: RecalcRowHeight
//-----------------------------------------------------------------------
const TEXTMETRIC& GetTextMetrics();
//-----------------------------------------------------------------------
// Summary:
// Use this member function to align column index to tabs borders
// if necessary.
// Parameters:
// nRow - A zero based row index.
// nCol - A zero based column index.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// An aligned column index.
// See Also: SetTabSize, GetTabSize
//-----------------------------------------------------------------------
int AlignColIdxToTabs(int nRow, int nCol, BOOL bVirtualSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain a specified column x position
// in pixels.
// Parameters:
// nRow - A zero based row index.
// nCol - A zero based column index.
// bVirtualSpace - Is virtual space enabled.
// pnChawWidth - A pointer to int variable to receive column char
// width in pixels. May be NULL.
// Returns:
// A column start x position (in pixels).
// See Also: ColFromXPos
//-----------------------------------------------------------------------
int GetColPosX(int nRow, int nCol, int* pnChawWidth = NULL, BOOL bVirtualSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain a column for specified x position
// in pixels.
// Parameters:
// nRow - A zero based row index.
// nX - A x position (in pixels).
// rnCol - [out] A zero based column index for x position.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// TRUE if succeeded, FALSE otherwise.
// See Also: GetColPosX, AlignColIdxToTabs
//-----------------------------------------------------------------------
BOOL ColFromXPos(int nRow, int nX, int& rnCol, BOOL bVirtualSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain width of the specified row.
// Parameters:
// nRow - A zero based row index.
// Returns:
// A row width in pixels.
// See Also: GetRowsMaxWidth
//-----------------------------------------------------------------------
int GetRowWidth(int nRow);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain maximum width of all visible rows.
// Returns:
// A maximum row width in pixels.
// See Also: GetRowsWidth
//-----------------------------------------------------------------------
int GetRowsMaxWidth();
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain a row and column for specified
// point.
// Parameters:
// pt - A point to test.
// rnRow - [out] A zero based row index for y position.
// rnCol - [out] A zero based column index for x position.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// TRUE if succeeded, FALSE otherwise.
// See Also: GetColPosX, HitTestRow.
//-----------------------------------------------------------------------
BOOL HitTest(const CPoint& pt, int& rnRow, int& rnCol, BOOL bVirtualSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to obtain a row for specified y position.
// Parameters:
// nY - An y position (in pixels).
// rnRow - [out] A zero based row index for y position.
// Returns:
// TRUE if succeeded, FALSE otherwise.
// See Also: GetColPosX, HitTest.
//-----------------------------------------------------------------------
BOOL HitTestRow(int nY, int& rnRow);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to clear cached row information.
// Parameters:
// nRow - A zero based row index.
// See Also: DrawRowPart, PrintRowPart.
//-----------------------------------------------------------------------
void ResetRowInfo(int nRow);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to draw row part and store characters positions.
// Parameters:
// pDC - A pointer to device context.
// nRow - A zero based row index (or -1 to switch to finish current row drawing).
// pcszText - A string to draw.
// nchCount - A chars count to draw.
// Returns:
// The x offset for next row part.
// See Also:
// PrintRowPart
//-----------------------------------------------------------------------
int DrawRowPart(CDC* pDC, int nRow, LPCTSTR pcszText, int nchCount = -1);
//-----------------------------------------------------------------------
// Summary:
// Use this member function to draw row part and store characters positions.
// Parameters:
// pDC - A pointer to device context.
// nRow - A zero based row index (or -1 to switch to finish current
// row drawing).
// nPosY - A y offset to print specified row.
// nFlags - Additional printing options. The folowing values supported:
// DT_CALCRECT, DT_SINGLELINE, DT_WORDBREAK
// pcszText - A string to draw.
// nchCount - A chars count to draw.
// pnPrintedTextLen - A pointer to int variable to receive printed text
// length.
// Returns:
// Printed row height.
// See Also:
// DrawRowPart
//-----------------------------------------------------------------------
int PrintRowPart(CDC* pDC, int nRow, int nPosY, UINT nFlags, LPCTSTR pcszText,
int nchCount = -1, int *pnPrintedTextLen = NULL);
//-----------------------------------------------------------------------
// Summary:
// Expands the character set by putting space in the position of tab.
// Parameters:
// pszChars - [in] The text to be processed.
// strBufer - [out] Buffer for text to be created after expansion.
// nDispPos - [in] The display position to start.
// bEnableWhiteSpace - [in] The WhiteSpace mode enabled.
// Returns:
// The end display position after expansion.
//-----------------------------------------------------------------------
int ExpandChars(LPCTSTR pszChars, CString& strBuffer, int nDispPos = 0,
BOOL bEnableWhiteSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Remembers tabs positions for the row.
// Parameters:
// nRow - [in] A zero based row index.
// pcszOrigRowText - [in] The row text (not expanded).
//-----------------------------------------------------------------------
void SetRowTabPositions(int nRow, LPCTSTR pcszOrigRowText);
//-----------------------------------------------------------------------
// Summary:
// Convert display position to string position.
// Parameters:
// nRow - A zero based row index.
// nDispPos - A zero based display column index.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// The string position.
//-----------------------------------------------------------------------
int DispPosToStrPos(int nRow, int nDispPos, BOOL bVirtualSpace);
//-----------------------------------------------------------------------
// Summary:
// Convert string position to display position.
// Parameters:
// nRow - A zero based row index.
// nStrPos - A zero based string position.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// The display position.
//-----------------------------------------------------------------------
int StrPosToDispPos(int nRow, int nStrPos, BOOL bVirtualSpace = FALSE);
//-----------------------------------------------------------------------
// Summary:
// Set caret position. In/out parameters rnCol and rnRow may be
// adjusted to valid values.
// Parameters:
// pWnd - [in] A pinter to caret owner window.
// pt - [in] A point to set caret.
// szSize - [in] A caret size.
// rnRow - [in, out] A zero based row index.
// nRow - [in] A zero based row index.
// rnCol - [in, out] A zero based column index.
// bHideCaret - [in] Hide or show caret.
// bVirtualSpace - Is virtual space enabled.
// Returns:
// The display position.
//-----------------------------------------------------------------------
void SetCaretPos(CWnd* pWnd, const CSize& szSize, int nRow, int& rnCol,
BOOL bHideCaret = FALSE, BOOL bVirtualSpace = FALSE);
void SetCaretByPoint(CWnd* pWnd, const CPoint& pt, const CSize& szSize,
int& rnRow, int& rnCol, BOOL bVirtualSpace = FALSE); //<COMBINE SetCaretPos@CWnd*@const CSize&@int@int&@BOOL@BOOL >
public:
//{{AFX_CODEJOCK_PRIVATE
class _XTP_EXT_CLASS CXTPRowInfo : public CCmdTarget
{
public:
CXTPRowInfo()
{
nMaxWidth = 0;
const int cnReservedSize = 4096;
arCharsEnds.SetDataSize(0, cnReservedSize, cnReservedSize);
arTabs.SetDataSize(0, cnReservedSize, cnReservedSize);
arDispCol2StrPos.SetDataSize(0, cnReservedSize, cnReservedSize);
arStrPos2DispCol.SetDataSize(0, cnReservedSize, cnReservedSize);
}
void Reset() {
nMaxWidth = 0;
arCharsEnds.RemoveAll();
}
int nMaxWidth;
CXTPReserveArray<int, int> arCharsEnds;
CXTPReserveArray<BYTE, BYTE> arTabs;
CXTPReserveArray<int, int> arDispCol2StrPos;
CXTPReserveArray<int, int> arStrPos2DispCol;
};
CXTPRowInfo* GetRowInfo(int nRow);
//}}AFX_CODEJOCK_PRIVATE
protected:
int m_nTabSize; // Store the tab size.
TEXTMETRIC m_tmText; // Store text metrics.
int m_nSpaceWidth; // Store space char width.
CRect m_rcTextRect; // Store text rect.
int m_nRowHeight; // Store row height.
int m_nScrollXOffset; // Store scroll offset for x coordinate.
int m_nDrawingRow; // Store currently drawing row.
int m_nNextRowPosX; // Store x offset to draw next row part.
int m_nPrintingRow; // Store currently printing row.
CPoint m_ptNextPrintPos; // Store (x, y) offset to print next row part.
BOOL m_bUseOutputDC; // Use output DC for calculations.
//{{AFX_CODEJOCK_PRIVATE
typedef CXTPInternalCollectionT<CXTPRowInfo> CXTPRowsInfoArray; //
CXTPRowsInfoArray m_arRows;
//}}AFX_CODEJOCK_PRIVATE
protected:
//{{AFX_CODEJOCK_PRIVATE
// temporary buffers
CArray<int, int> m_arBuf_aDx;
CXTPReserveArray<TCHAR, TCHAR> m_arExpandCharsBuffer;
//}}AFX_CODEJOCK_PRIVATE
};
AFX_INLINE const TEXTMETRIC& CXTPSyntaxEditDrawTextProcessor::GetTextMetrics() {
return m_tmText;
}
AFX_INLINE CRect CXTPSyntaxEditDrawTextProcessor::GetTextRect() {
return m_rcTextRect;
}
AFX_INLINE void CXTPSyntaxEditDrawTextProcessor::SetTextRect(const CRect& rcRect) {
m_rcTextRect = rcRect;
}
AFX_INLINE int CXTPSyntaxEditDrawTextProcessor::GetRowHeight() {
return m_nRowHeight;
}
AFX_INLINE int CXTPSyntaxEditDrawTextProcessor::GetTabSize() {
return m_nTabSize;
}
AFX_INLINE void CXTPSyntaxEditDrawTextProcessor::SetTabSize(int nTabSize) {
m_nTabSize = nTabSize;
}
AFX_INLINE int CXTPSyntaxEditDrawTextProcessor::GetScrollXOffset() {
return m_nScrollXOffset;
}
AFX_INLINE int CXTPSyntaxEditDrawTextProcessor::GetRowsCount(BOOL bWithPartlyVisible) {
int nHeight = m_rcTextRect.Height();
int nRowH = max(1, m_nRowHeight);
int nPartly = bWithPartlyVisible ? 1 : 0;
return nHeight / nRowH + ((nHeight % nRowH) ? nPartly : 0);
}
#endif // !defined(__XTPSYNTAXEDITDRAWTEXTPROCESSOR_H__)
| [
"w.z.y2006@163.com"
] | w.z.y2006@163.com |
4c80ae8a7e5b440126656ceb8ca5dd59b4c079af | 9802284a0f2f13a6a7ac93278f8efa09cc0ec26b | /SDK/Bundle_Wooden_Plank_classes.h | 5768a59d1b00184e74c6464e1036bc4fa62b754d | [] | no_license | Berxz/Scum-SDK | 05eb0a27eec71ce89988636f04224a81a12131d8 | 74887c5497b435f535bbf8608fcf1010ff5e948c | refs/heads/master | 2021-05-17T15:38:25.915711 | 2020-03-31T06:32:10 | 2020-03-31T06:32:10 | 250,842,227 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 654 | h | #pragma once
// Name: SCUM, Version: 3.75.21350
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass Bundle_Wooden_Plank.Bundle_Wooden_Plank_C
// 0x0000 (0x0880 - 0x0880)
class ABundle_Wooden_Plank_C : public AEquipmentItem
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass Bundle_Wooden_Plank.Bundle_Wooden_Plank_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"37065724+Berxz@users.noreply.github.com"
] | 37065724+Berxz@users.noreply.github.com |
0dc17643353f0c8c930be2c8cd65f279379a160d | 3354d7dad7e51e59a9ce871807ddec6dd6c49c02 | /src/World.cxx | ce81c08a91d44f29d6e436491050a40650178ee1 | [] | no_license | maeln/Cellmate | 610d385b1e337fc9c3799106d44563813c9e721a | a45b7898ae2d771061a6d29811ebd1dc7810b3e6 | refs/heads/master | 2016-09-13T01:46:40.593736 | 2016-05-25T17:16:47 | 2016-05-25T17:16:47 | 59,430,087 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 638 | cxx | #include "World.hxx"
World::World()
{
m_width = 0;
m_height = 0;
m_space = std::vector<Cell>();
}
World::World(unsigned int width, unsigned int height, int default_state)
{
m_width = width;
m_height = height;
m_space = std::vector<Cell>(width*height, Cell(default_state));
}
World::~World()
{
m_space.clear();
}
Cell World::get_cell_at(unsigned int x, unsigned int y)
{
return m_space[x+y*m_width];
}
void World::set_cell_state_at(unsigned int x, unsigned int y, int state)
{
m_space[x+y*m_width].state = state;
}
unsigned int World::get_width()
{
return m_width;
}
unsigned int World::get_height()
{
return m_height;
}
| [
"contact@maeln.com"
] | contact@maeln.com |
e2af330af063f233f78a000f6cb47420bb435e65 | b1af8bb863a6730e6e4e93129efbad89d33cf509 | /SDK/SCUM_Armor_Tactical_Vest_03_classes.hpp | c9fd3a6b456ed5f0e1bc6be9f08293119a7f2a84 | [] | no_license | frankie-11/SCUM_SDK7.13.2020 | b3bbd8fb9b6c03120b865a6254eca6a2389ea654 | 7b48bcf9e8088aa8917c07dd6756eac90e3f693a | refs/heads/master | 2022-11-16T05:48:55.729087 | 2020-07-13T23:48:50 | 2020-07-13T23:48:50 | 279,433,512 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 822 | hpp | #pragma once
// SCUM (4.24) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass Armor_Tactical_Vest_03.Armor_Tactical_Vest_03_C
// 0x0000 (0x0730 - 0x0730)
class AArmor_Tactical_Vest_03_C : public AClothesItem
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass Armor_Tactical_Vest_03.Armor_Tactical_Vest_03_C");
return ptr;
}
void UpdateMaterialParamsOnClients();
void SetDirtiness(float* dirtiness);
void OnRep_MaterialParameters();
int GetWarmth();
int GetCapacityY();
int GetCapacityX();
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"60810131+frankie-11@users.noreply.github.com"
] | 60810131+frankie-11@users.noreply.github.com |
bbdcb84d8de49fde78781235af333cac05a9ade2 | 2d5d9e6594782c0b42af14f9da7dc50cd0d0672d | /onvif/soapMediaBindingProxy.h | 6242074e9da320479278a7b6afb95443b926499a | [] | no_license | Jin992/tracker | e37ddf948885e2e9a051ad461dc71465957eaa66 | 5abdf6993dc6f5b998669549d6a96b59b5184bbf | refs/heads/master | 2022-03-29T12:37:23.107645 | 2019-12-06T14:13:16 | 2019-12-06T14:13:16 | 226,374,259 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 146,858 | h | /* soapMediaBindingProxy.h
Generated by gSOAP 2.8.88 for onvif.h
gSOAP XML Web services tools
Copyright (C) 2000-2018, Robert van Engelen, Genivia Inc. All Rights Reserved.
The soapcpp2 tool and its generated software are released under the GPL.
This program is released under the GPL with the additional exemption that
compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
A commercial use license is available from Genivia Inc., contact@genivia.com
--------------------------------------------------------------------------------
*/
#ifndef soapMediaBindingProxy_H
#define soapMediaBindingProxy_H
#include "soapH.h"
class SOAP_CMAC MediaBindingProxy {
public:
/// Context to manage proxy IO and data
struct soap *soap;
/// flag indicating that this context is owned by this proxy and should be deleted by the destructor
bool soap_own;
/// Endpoint URL of service 'MediaBindingProxy' (change as needed)
const char *soap_endpoint;
/// Variables globally declared in onvif.h, if any
/// Construct a proxy with new managing context
MediaBindingProxy();
/// Copy constructor
MediaBindingProxy(const MediaBindingProxy& rhs);
/// Construct proxy given a shared managing context
MediaBindingProxy(struct soap*);
/// Construct proxy given a shared managing context and endpoint URL
MediaBindingProxy(struct soap*, const char *soap_endpoint_url);
/// Constructor taking an endpoint URL
MediaBindingProxy(const char *soap_endpoint_url);
/// Constructor taking input and output mode flags for the new managing context
MediaBindingProxy(soap_mode iomode);
/// Constructor taking endpoint URL and input and output mode flags for the new managing context
MediaBindingProxy(const char *soap_endpoint_url, soap_mode iomode);
/// Constructor taking input and output mode flags for the new managing context
MediaBindingProxy(soap_mode imode, soap_mode omode);
/// Destructor deletes deserialized data and its managing context, when the context was allocated by the constructor
virtual ~MediaBindingProxy();
/// Initializer used by constructors
virtual void MediaBindingProxy_init(soap_mode imode, soap_mode omode);
/// Return a copy that has a new managing context with the same engine state
virtual MediaBindingProxy *copy();
/// Copy assignment
MediaBindingProxy& operator=(const MediaBindingProxy&);
/// Delete all deserialized data (uses soap_destroy() and soap_end())
virtual void destroy();
/// Delete all deserialized data and reset to default
virtual void reset();
/// Disables and removes SOAP Header from message by setting soap->header = NULL
virtual void soap_noheader();
/// Add SOAP Header to message
virtual void soap_header(char *wsa5__MessageID, struct wsa5__RelatesToType *wsa5__RelatesTo, struct wsa5__EndpointReferenceType *wsa5__From, struct wsa5__EndpointReferenceType *wsa5__ReplyTo, struct wsa5__EndpointReferenceType *wsa5__FaultTo, char *wsa5__To, char *wsa5__Action, struct chan__ChannelInstanceType *chan__ChannelInstance, struct wsdd__AppSequenceType *wsdd__AppSequence, struct _wsse__Security *wsse__Security);
/// Get SOAP Header structure (i.e. soap->header, which is NULL when absent)
virtual ::SOAP_ENV__Header *soap_header();
/// Get SOAP Fault structure (i.e. soap->fault, which is NULL when absent)
virtual ::SOAP_ENV__Fault *soap_fault();
/// Get SOAP Fault subcode QName string (NULL when absent)
virtual const char *soap_fault_subcode();
/// Get SOAP Fault string/reason (NULL when absent)
virtual const char *soap_fault_string();
/// Get SOAP Fault detail XML string (NULL when absent)
virtual const char *soap_fault_detail();
/// Close connection (normally automatic, except for send_X ops)
virtual int soap_close_socket();
/// Force close connection (can kill a thread blocked on IO)
virtual int soap_force_close_socket();
/// Print fault
virtual void soap_print_fault(FILE*);
#ifndef WITH_LEAN
#ifndef WITH_COMPAT
/// Print fault to stream
virtual void soap_stream_fault(std::ostream&);
#endif
/// Write fault to buffer
virtual char *soap_sprint_fault(char *buf, size_t len);
#endif
//
/// Web service synchronous operation 'GetServiceCapabilities' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetServiceCapabilities(_trt__GetServiceCapabilities *trt__GetServiceCapabilities, _trt__GetServiceCapabilitiesResponse &trt__GetServiceCapabilitiesResponse) { return this->GetServiceCapabilities(NULL, NULL, trt__GetServiceCapabilities, trt__GetServiceCapabilitiesResponse); }
/// Web service synchronous operation 'GetServiceCapabilities' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetServiceCapabilities(const char *soap_endpoint_url, const char *soap_action, _trt__GetServiceCapabilities *trt__GetServiceCapabilities, _trt__GetServiceCapabilitiesResponse &trt__GetServiceCapabilitiesResponse) { return this->send_GetServiceCapabilities(soap_endpoint_url, soap_action, trt__GetServiceCapabilities) || this->recv_GetServiceCapabilities(trt__GetServiceCapabilitiesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetServiceCapabilities' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetServiceCapabilities(const char *soap_endpoint_url, const char *soap_action, _trt__GetServiceCapabilities *trt__GetServiceCapabilities);
/// Web service asynchronous operation 'recv_GetServiceCapabilities' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetServiceCapabilities(_trt__GetServiceCapabilitiesResponse &trt__GetServiceCapabilitiesResponse);
//
/// Web service synchronous operation 'GetVideoSources' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSources(_trt__GetVideoSources *trt__GetVideoSources, _trt__GetVideoSourcesResponse &trt__GetVideoSourcesResponse) { return this->GetVideoSources(NULL, NULL, trt__GetVideoSources, trt__GetVideoSourcesResponse); }
/// Web service synchronous operation 'GetVideoSources' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSources(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSources *trt__GetVideoSources, _trt__GetVideoSourcesResponse &trt__GetVideoSourcesResponse) { return this->send_GetVideoSources(soap_endpoint_url, soap_action, trt__GetVideoSources) || this->recv_GetVideoSources(trt__GetVideoSourcesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoSources' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoSources(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSources *trt__GetVideoSources);
/// Web service asynchronous operation 'recv_GetVideoSources' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoSources(_trt__GetVideoSourcesResponse &trt__GetVideoSourcesResponse);
//
/// Web service synchronous operation 'GetAudioSources' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSources(_trt__GetAudioSources *trt__GetAudioSources, _trt__GetAudioSourcesResponse &trt__GetAudioSourcesResponse) { return this->GetAudioSources(NULL, NULL, trt__GetAudioSources, trt__GetAudioSourcesResponse); }
/// Web service synchronous operation 'GetAudioSources' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSources(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSources *trt__GetAudioSources, _trt__GetAudioSourcesResponse &trt__GetAudioSourcesResponse) { return this->send_GetAudioSources(soap_endpoint_url, soap_action, trt__GetAudioSources) || this->recv_GetAudioSources(trt__GetAudioSourcesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioSources' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioSources(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSources *trt__GetAudioSources);
/// Web service asynchronous operation 'recv_GetAudioSources' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioSources(_trt__GetAudioSourcesResponse &trt__GetAudioSourcesResponse);
//
/// Web service synchronous operation 'GetAudioOutputs' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputs(_trt__GetAudioOutputs *trt__GetAudioOutputs, _trt__GetAudioOutputsResponse &trt__GetAudioOutputsResponse) { return this->GetAudioOutputs(NULL, NULL, trt__GetAudioOutputs, trt__GetAudioOutputsResponse); }
/// Web service synchronous operation 'GetAudioOutputs' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputs(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputs *trt__GetAudioOutputs, _trt__GetAudioOutputsResponse &trt__GetAudioOutputsResponse) { return this->send_GetAudioOutputs(soap_endpoint_url, soap_action, trt__GetAudioOutputs) || this->recv_GetAudioOutputs(trt__GetAudioOutputsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioOutputs' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioOutputs(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputs *trt__GetAudioOutputs);
/// Web service asynchronous operation 'recv_GetAudioOutputs' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioOutputs(_trt__GetAudioOutputsResponse &trt__GetAudioOutputsResponse);
//
/// Web service synchronous operation 'CreateProfile' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int CreateProfile(_trt__CreateProfile *trt__CreateProfile, _trt__CreateProfileResponse &trt__CreateProfileResponse) { return this->CreateProfile(NULL, NULL, trt__CreateProfile, trt__CreateProfileResponse); }
/// Web service synchronous operation 'CreateProfile' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int CreateProfile(const char *soap_endpoint_url, const char *soap_action, _trt__CreateProfile *trt__CreateProfile, _trt__CreateProfileResponse &trt__CreateProfileResponse) { return this->send_CreateProfile(soap_endpoint_url, soap_action, trt__CreateProfile) || this->recv_CreateProfile(trt__CreateProfileResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_CreateProfile' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_CreateProfile(const char *soap_endpoint_url, const char *soap_action, _trt__CreateProfile *trt__CreateProfile);
/// Web service asynchronous operation 'recv_CreateProfile' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_CreateProfile(_trt__CreateProfileResponse &trt__CreateProfileResponse);
//
/// Web service synchronous operation 'GetProfile' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetProfile(_trt__GetProfile *trt__GetProfile, _trt__GetProfileResponse &trt__GetProfileResponse) { return this->GetProfile(NULL, NULL, trt__GetProfile, trt__GetProfileResponse); }
/// Web service synchronous operation 'GetProfile' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetProfile(const char *soap_endpoint_url, const char *soap_action, _trt__GetProfile *trt__GetProfile, _trt__GetProfileResponse &trt__GetProfileResponse) { return this->send_GetProfile(soap_endpoint_url, soap_action, trt__GetProfile) || this->recv_GetProfile(trt__GetProfileResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetProfile' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetProfile(const char *soap_endpoint_url, const char *soap_action, _trt__GetProfile *trt__GetProfile);
/// Web service asynchronous operation 'recv_GetProfile' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetProfile(_trt__GetProfileResponse &trt__GetProfileResponse);
//
/// Web service synchronous operation 'GetProfiles' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetProfiles(_trt__GetProfiles *trt__GetProfiles, _trt__GetProfilesResponse &trt__GetProfilesResponse) { return this->GetProfiles(NULL, NULL, trt__GetProfiles, trt__GetProfilesResponse); }
/// Web service synchronous operation 'GetProfiles' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetProfiles(const char *soap_endpoint_url, const char *soap_action, _trt__GetProfiles *trt__GetProfiles, _trt__GetProfilesResponse &trt__GetProfilesResponse) { return this->send_GetProfiles(soap_endpoint_url, soap_action, trt__GetProfiles) || this->recv_GetProfiles(trt__GetProfilesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetProfiles' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetProfiles(const char *soap_endpoint_url, const char *soap_action, _trt__GetProfiles *trt__GetProfiles);
/// Web service asynchronous operation 'recv_GetProfiles' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetProfiles(_trt__GetProfilesResponse &trt__GetProfilesResponse);
//
/// Web service synchronous operation 'AddVideoEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoEncoderConfiguration(_trt__AddVideoEncoderConfiguration *trt__AddVideoEncoderConfiguration, _trt__AddVideoEncoderConfigurationResponse &trt__AddVideoEncoderConfigurationResponse) { return this->AddVideoEncoderConfiguration(NULL, NULL, trt__AddVideoEncoderConfiguration, trt__AddVideoEncoderConfigurationResponse); }
/// Web service synchronous operation 'AddVideoEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoEncoderConfiguration *trt__AddVideoEncoderConfiguration, _trt__AddVideoEncoderConfigurationResponse &trt__AddVideoEncoderConfigurationResponse) { return this->send_AddVideoEncoderConfiguration(soap_endpoint_url, soap_action, trt__AddVideoEncoderConfiguration) || this->recv_AddVideoEncoderConfiguration(trt__AddVideoEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddVideoEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoEncoderConfiguration *trt__AddVideoEncoderConfiguration);
/// Web service asynchronous operation 'recv_AddVideoEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddVideoEncoderConfiguration(_trt__AddVideoEncoderConfigurationResponse &trt__AddVideoEncoderConfigurationResponse);
//
/// Web service synchronous operation 'AddVideoSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoSourceConfiguration(_trt__AddVideoSourceConfiguration *trt__AddVideoSourceConfiguration, _trt__AddVideoSourceConfigurationResponse &trt__AddVideoSourceConfigurationResponse) { return this->AddVideoSourceConfiguration(NULL, NULL, trt__AddVideoSourceConfiguration, trt__AddVideoSourceConfigurationResponse); }
/// Web service synchronous operation 'AddVideoSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoSourceConfiguration *trt__AddVideoSourceConfiguration, _trt__AddVideoSourceConfigurationResponse &trt__AddVideoSourceConfigurationResponse) { return this->send_AddVideoSourceConfiguration(soap_endpoint_url, soap_action, trt__AddVideoSourceConfiguration) || this->recv_AddVideoSourceConfiguration(trt__AddVideoSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddVideoSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoSourceConfiguration *trt__AddVideoSourceConfiguration);
/// Web service asynchronous operation 'recv_AddVideoSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddVideoSourceConfiguration(_trt__AddVideoSourceConfigurationResponse &trt__AddVideoSourceConfigurationResponse);
//
/// Web service synchronous operation 'AddAudioEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioEncoderConfiguration(_trt__AddAudioEncoderConfiguration *trt__AddAudioEncoderConfiguration, _trt__AddAudioEncoderConfigurationResponse &trt__AddAudioEncoderConfigurationResponse) { return this->AddAudioEncoderConfiguration(NULL, NULL, trt__AddAudioEncoderConfiguration, trt__AddAudioEncoderConfigurationResponse); }
/// Web service synchronous operation 'AddAudioEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioEncoderConfiguration *trt__AddAudioEncoderConfiguration, _trt__AddAudioEncoderConfigurationResponse &trt__AddAudioEncoderConfigurationResponse) { return this->send_AddAudioEncoderConfiguration(soap_endpoint_url, soap_action, trt__AddAudioEncoderConfiguration) || this->recv_AddAudioEncoderConfiguration(trt__AddAudioEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddAudioEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioEncoderConfiguration *trt__AddAudioEncoderConfiguration);
/// Web service asynchronous operation 'recv_AddAudioEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddAudioEncoderConfiguration(_trt__AddAudioEncoderConfigurationResponse &trt__AddAudioEncoderConfigurationResponse);
//
/// Web service synchronous operation 'AddAudioSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioSourceConfiguration(_trt__AddAudioSourceConfiguration *trt__AddAudioSourceConfiguration, _trt__AddAudioSourceConfigurationResponse &trt__AddAudioSourceConfigurationResponse) { return this->AddAudioSourceConfiguration(NULL, NULL, trt__AddAudioSourceConfiguration, trt__AddAudioSourceConfigurationResponse); }
/// Web service synchronous operation 'AddAudioSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioSourceConfiguration *trt__AddAudioSourceConfiguration, _trt__AddAudioSourceConfigurationResponse &trt__AddAudioSourceConfigurationResponse) { return this->send_AddAudioSourceConfiguration(soap_endpoint_url, soap_action, trt__AddAudioSourceConfiguration) || this->recv_AddAudioSourceConfiguration(trt__AddAudioSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddAudioSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioSourceConfiguration *trt__AddAudioSourceConfiguration);
/// Web service asynchronous operation 'recv_AddAudioSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddAudioSourceConfiguration(_trt__AddAudioSourceConfigurationResponse &trt__AddAudioSourceConfigurationResponse);
//
/// Web service synchronous operation 'AddPTZConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddPTZConfiguration(_trt__AddPTZConfiguration *trt__AddPTZConfiguration, _trt__AddPTZConfigurationResponse &trt__AddPTZConfigurationResponse) { return this->AddPTZConfiguration(NULL, NULL, trt__AddPTZConfiguration, trt__AddPTZConfigurationResponse); }
/// Web service synchronous operation 'AddPTZConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddPTZConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddPTZConfiguration *trt__AddPTZConfiguration, _trt__AddPTZConfigurationResponse &trt__AddPTZConfigurationResponse) { return this->send_AddPTZConfiguration(soap_endpoint_url, soap_action, trt__AddPTZConfiguration) || this->recv_AddPTZConfiguration(trt__AddPTZConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddPTZConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddPTZConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddPTZConfiguration *trt__AddPTZConfiguration);
/// Web service asynchronous operation 'recv_AddPTZConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddPTZConfiguration(_trt__AddPTZConfigurationResponse &trt__AddPTZConfigurationResponse);
//
/// Web service synchronous operation 'AddVideoAnalyticsConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoAnalyticsConfiguration(_trt__AddVideoAnalyticsConfiguration *trt__AddVideoAnalyticsConfiguration, _trt__AddVideoAnalyticsConfigurationResponse &trt__AddVideoAnalyticsConfigurationResponse) { return this->AddVideoAnalyticsConfiguration(NULL, NULL, trt__AddVideoAnalyticsConfiguration, trt__AddVideoAnalyticsConfigurationResponse); }
/// Web service synchronous operation 'AddVideoAnalyticsConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoAnalyticsConfiguration *trt__AddVideoAnalyticsConfiguration, _trt__AddVideoAnalyticsConfigurationResponse &trt__AddVideoAnalyticsConfigurationResponse) { return this->send_AddVideoAnalyticsConfiguration(soap_endpoint_url, soap_action, trt__AddVideoAnalyticsConfiguration) || this->recv_AddVideoAnalyticsConfiguration(trt__AddVideoAnalyticsConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddVideoAnalyticsConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddVideoAnalyticsConfiguration *trt__AddVideoAnalyticsConfiguration);
/// Web service asynchronous operation 'recv_AddVideoAnalyticsConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddVideoAnalyticsConfiguration(_trt__AddVideoAnalyticsConfigurationResponse &trt__AddVideoAnalyticsConfigurationResponse);
//
/// Web service synchronous operation 'AddMetadataConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddMetadataConfiguration(_trt__AddMetadataConfiguration *trt__AddMetadataConfiguration, _trt__AddMetadataConfigurationResponse &trt__AddMetadataConfigurationResponse) { return this->AddMetadataConfiguration(NULL, NULL, trt__AddMetadataConfiguration, trt__AddMetadataConfigurationResponse); }
/// Web service synchronous operation 'AddMetadataConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddMetadataConfiguration *trt__AddMetadataConfiguration, _trt__AddMetadataConfigurationResponse &trt__AddMetadataConfigurationResponse) { return this->send_AddMetadataConfiguration(soap_endpoint_url, soap_action, trt__AddMetadataConfiguration) || this->recv_AddMetadataConfiguration(trt__AddMetadataConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddMetadataConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddMetadataConfiguration *trt__AddMetadataConfiguration);
/// Web service asynchronous operation 'recv_AddMetadataConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddMetadataConfiguration(_trt__AddMetadataConfigurationResponse &trt__AddMetadataConfigurationResponse);
//
/// Web service synchronous operation 'AddAudioOutputConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioOutputConfiguration(_trt__AddAudioOutputConfiguration *trt__AddAudioOutputConfiguration, _trt__AddAudioOutputConfigurationResponse &trt__AddAudioOutputConfigurationResponse) { return this->AddAudioOutputConfiguration(NULL, NULL, trt__AddAudioOutputConfiguration, trt__AddAudioOutputConfigurationResponse); }
/// Web service synchronous operation 'AddAudioOutputConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioOutputConfiguration *trt__AddAudioOutputConfiguration, _trt__AddAudioOutputConfigurationResponse &trt__AddAudioOutputConfigurationResponse) { return this->send_AddAudioOutputConfiguration(soap_endpoint_url, soap_action, trt__AddAudioOutputConfiguration) || this->recv_AddAudioOutputConfiguration(trt__AddAudioOutputConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddAudioOutputConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioOutputConfiguration *trt__AddAudioOutputConfiguration);
/// Web service asynchronous operation 'recv_AddAudioOutputConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddAudioOutputConfiguration(_trt__AddAudioOutputConfigurationResponse &trt__AddAudioOutputConfigurationResponse);
//
/// Web service synchronous operation 'AddAudioDecoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioDecoderConfiguration(_trt__AddAudioDecoderConfiguration *trt__AddAudioDecoderConfiguration, _trt__AddAudioDecoderConfigurationResponse &trt__AddAudioDecoderConfigurationResponse) { return this->AddAudioDecoderConfiguration(NULL, NULL, trt__AddAudioDecoderConfiguration, trt__AddAudioDecoderConfigurationResponse); }
/// Web service synchronous operation 'AddAudioDecoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int AddAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioDecoderConfiguration *trt__AddAudioDecoderConfiguration, _trt__AddAudioDecoderConfigurationResponse &trt__AddAudioDecoderConfigurationResponse) { return this->send_AddAudioDecoderConfiguration(soap_endpoint_url, soap_action, trt__AddAudioDecoderConfiguration) || this->recv_AddAudioDecoderConfiguration(trt__AddAudioDecoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_AddAudioDecoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_AddAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__AddAudioDecoderConfiguration *trt__AddAudioDecoderConfiguration);
/// Web service asynchronous operation 'recv_AddAudioDecoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_AddAudioDecoderConfiguration(_trt__AddAudioDecoderConfigurationResponse &trt__AddAudioDecoderConfigurationResponse);
//
/// Web service synchronous operation 'RemoveVideoEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoEncoderConfiguration(_trt__RemoveVideoEncoderConfiguration *trt__RemoveVideoEncoderConfiguration, _trt__RemoveVideoEncoderConfigurationResponse &trt__RemoveVideoEncoderConfigurationResponse) { return this->RemoveVideoEncoderConfiguration(NULL, NULL, trt__RemoveVideoEncoderConfiguration, trt__RemoveVideoEncoderConfigurationResponse); }
/// Web service synchronous operation 'RemoveVideoEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoEncoderConfiguration *trt__RemoveVideoEncoderConfiguration, _trt__RemoveVideoEncoderConfigurationResponse &trt__RemoveVideoEncoderConfigurationResponse) { return this->send_RemoveVideoEncoderConfiguration(soap_endpoint_url, soap_action, trt__RemoveVideoEncoderConfiguration) || this->recv_RemoveVideoEncoderConfiguration(trt__RemoveVideoEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveVideoEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoEncoderConfiguration *trt__RemoveVideoEncoderConfiguration);
/// Web service asynchronous operation 'recv_RemoveVideoEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveVideoEncoderConfiguration(_trt__RemoveVideoEncoderConfigurationResponse &trt__RemoveVideoEncoderConfigurationResponse);
//
/// Web service synchronous operation 'RemoveVideoSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoSourceConfiguration(_trt__RemoveVideoSourceConfiguration *trt__RemoveVideoSourceConfiguration, _trt__RemoveVideoSourceConfigurationResponse &trt__RemoveVideoSourceConfigurationResponse) { return this->RemoveVideoSourceConfiguration(NULL, NULL, trt__RemoveVideoSourceConfiguration, trt__RemoveVideoSourceConfigurationResponse); }
/// Web service synchronous operation 'RemoveVideoSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoSourceConfiguration *trt__RemoveVideoSourceConfiguration, _trt__RemoveVideoSourceConfigurationResponse &trt__RemoveVideoSourceConfigurationResponse) { return this->send_RemoveVideoSourceConfiguration(soap_endpoint_url, soap_action, trt__RemoveVideoSourceConfiguration) || this->recv_RemoveVideoSourceConfiguration(trt__RemoveVideoSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveVideoSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoSourceConfiguration *trt__RemoveVideoSourceConfiguration);
/// Web service asynchronous operation 'recv_RemoveVideoSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveVideoSourceConfiguration(_trt__RemoveVideoSourceConfigurationResponse &trt__RemoveVideoSourceConfigurationResponse);
//
/// Web service synchronous operation 'RemoveAudioEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioEncoderConfiguration(_trt__RemoveAudioEncoderConfiguration *trt__RemoveAudioEncoderConfiguration, _trt__RemoveAudioEncoderConfigurationResponse &trt__RemoveAudioEncoderConfigurationResponse) { return this->RemoveAudioEncoderConfiguration(NULL, NULL, trt__RemoveAudioEncoderConfiguration, trt__RemoveAudioEncoderConfigurationResponse); }
/// Web service synchronous operation 'RemoveAudioEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioEncoderConfiguration *trt__RemoveAudioEncoderConfiguration, _trt__RemoveAudioEncoderConfigurationResponse &trt__RemoveAudioEncoderConfigurationResponse) { return this->send_RemoveAudioEncoderConfiguration(soap_endpoint_url, soap_action, trt__RemoveAudioEncoderConfiguration) || this->recv_RemoveAudioEncoderConfiguration(trt__RemoveAudioEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveAudioEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioEncoderConfiguration *trt__RemoveAudioEncoderConfiguration);
/// Web service asynchronous operation 'recv_RemoveAudioEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveAudioEncoderConfiguration(_trt__RemoveAudioEncoderConfigurationResponse &trt__RemoveAudioEncoderConfigurationResponse);
//
/// Web service synchronous operation 'RemoveAudioSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioSourceConfiguration(_trt__RemoveAudioSourceConfiguration *trt__RemoveAudioSourceConfiguration, _trt__RemoveAudioSourceConfigurationResponse &trt__RemoveAudioSourceConfigurationResponse) { return this->RemoveAudioSourceConfiguration(NULL, NULL, trt__RemoveAudioSourceConfiguration, trt__RemoveAudioSourceConfigurationResponse); }
/// Web service synchronous operation 'RemoveAudioSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioSourceConfiguration *trt__RemoveAudioSourceConfiguration, _trt__RemoveAudioSourceConfigurationResponse &trt__RemoveAudioSourceConfigurationResponse) { return this->send_RemoveAudioSourceConfiguration(soap_endpoint_url, soap_action, trt__RemoveAudioSourceConfiguration) || this->recv_RemoveAudioSourceConfiguration(trt__RemoveAudioSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveAudioSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioSourceConfiguration *trt__RemoveAudioSourceConfiguration);
/// Web service asynchronous operation 'recv_RemoveAudioSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveAudioSourceConfiguration(_trt__RemoveAudioSourceConfigurationResponse &trt__RemoveAudioSourceConfigurationResponse);
//
/// Web service synchronous operation 'RemovePTZConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemovePTZConfiguration(_trt__RemovePTZConfiguration *trt__RemovePTZConfiguration, _trt__RemovePTZConfigurationResponse &trt__RemovePTZConfigurationResponse) { return this->RemovePTZConfiguration(NULL, NULL, trt__RemovePTZConfiguration, trt__RemovePTZConfigurationResponse); }
/// Web service synchronous operation 'RemovePTZConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemovePTZConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemovePTZConfiguration *trt__RemovePTZConfiguration, _trt__RemovePTZConfigurationResponse &trt__RemovePTZConfigurationResponse) { return this->send_RemovePTZConfiguration(soap_endpoint_url, soap_action, trt__RemovePTZConfiguration) || this->recv_RemovePTZConfiguration(trt__RemovePTZConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemovePTZConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemovePTZConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemovePTZConfiguration *trt__RemovePTZConfiguration);
/// Web service asynchronous operation 'recv_RemovePTZConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemovePTZConfiguration(_trt__RemovePTZConfigurationResponse &trt__RemovePTZConfigurationResponse);
//
/// Web service synchronous operation 'RemoveVideoAnalyticsConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoAnalyticsConfiguration(_trt__RemoveVideoAnalyticsConfiguration *trt__RemoveVideoAnalyticsConfiguration, _trt__RemoveVideoAnalyticsConfigurationResponse &trt__RemoveVideoAnalyticsConfigurationResponse) { return this->RemoveVideoAnalyticsConfiguration(NULL, NULL, trt__RemoveVideoAnalyticsConfiguration, trt__RemoveVideoAnalyticsConfigurationResponse); }
/// Web service synchronous operation 'RemoveVideoAnalyticsConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoAnalyticsConfiguration *trt__RemoveVideoAnalyticsConfiguration, _trt__RemoveVideoAnalyticsConfigurationResponse &trt__RemoveVideoAnalyticsConfigurationResponse) { return this->send_RemoveVideoAnalyticsConfiguration(soap_endpoint_url, soap_action, trt__RemoveVideoAnalyticsConfiguration) || this->recv_RemoveVideoAnalyticsConfiguration(trt__RemoveVideoAnalyticsConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveVideoAnalyticsConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveVideoAnalyticsConfiguration *trt__RemoveVideoAnalyticsConfiguration);
/// Web service asynchronous operation 'recv_RemoveVideoAnalyticsConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveVideoAnalyticsConfiguration(_trt__RemoveVideoAnalyticsConfigurationResponse &trt__RemoveVideoAnalyticsConfigurationResponse);
//
/// Web service synchronous operation 'RemoveMetadataConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveMetadataConfiguration(_trt__RemoveMetadataConfiguration *trt__RemoveMetadataConfiguration, _trt__RemoveMetadataConfigurationResponse &trt__RemoveMetadataConfigurationResponse) { return this->RemoveMetadataConfiguration(NULL, NULL, trt__RemoveMetadataConfiguration, trt__RemoveMetadataConfigurationResponse); }
/// Web service synchronous operation 'RemoveMetadataConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveMetadataConfiguration *trt__RemoveMetadataConfiguration, _trt__RemoveMetadataConfigurationResponse &trt__RemoveMetadataConfigurationResponse) { return this->send_RemoveMetadataConfiguration(soap_endpoint_url, soap_action, trt__RemoveMetadataConfiguration) || this->recv_RemoveMetadataConfiguration(trt__RemoveMetadataConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveMetadataConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveMetadataConfiguration *trt__RemoveMetadataConfiguration);
/// Web service asynchronous operation 'recv_RemoveMetadataConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveMetadataConfiguration(_trt__RemoveMetadataConfigurationResponse &trt__RemoveMetadataConfigurationResponse);
//
/// Web service synchronous operation 'RemoveAudioOutputConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioOutputConfiguration(_trt__RemoveAudioOutputConfiguration *trt__RemoveAudioOutputConfiguration, _trt__RemoveAudioOutputConfigurationResponse &trt__RemoveAudioOutputConfigurationResponse) { return this->RemoveAudioOutputConfiguration(NULL, NULL, trt__RemoveAudioOutputConfiguration, trt__RemoveAudioOutputConfigurationResponse); }
/// Web service synchronous operation 'RemoveAudioOutputConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioOutputConfiguration *trt__RemoveAudioOutputConfiguration, _trt__RemoveAudioOutputConfigurationResponse &trt__RemoveAudioOutputConfigurationResponse) { return this->send_RemoveAudioOutputConfiguration(soap_endpoint_url, soap_action, trt__RemoveAudioOutputConfiguration) || this->recv_RemoveAudioOutputConfiguration(trt__RemoveAudioOutputConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveAudioOutputConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioOutputConfiguration *trt__RemoveAudioOutputConfiguration);
/// Web service asynchronous operation 'recv_RemoveAudioOutputConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveAudioOutputConfiguration(_trt__RemoveAudioOutputConfigurationResponse &trt__RemoveAudioOutputConfigurationResponse);
//
/// Web service synchronous operation 'RemoveAudioDecoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioDecoderConfiguration(_trt__RemoveAudioDecoderConfiguration *trt__RemoveAudioDecoderConfiguration, _trt__RemoveAudioDecoderConfigurationResponse &trt__RemoveAudioDecoderConfigurationResponse) { return this->RemoveAudioDecoderConfiguration(NULL, NULL, trt__RemoveAudioDecoderConfiguration, trt__RemoveAudioDecoderConfigurationResponse); }
/// Web service synchronous operation 'RemoveAudioDecoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int RemoveAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioDecoderConfiguration *trt__RemoveAudioDecoderConfiguration, _trt__RemoveAudioDecoderConfigurationResponse &trt__RemoveAudioDecoderConfigurationResponse) { return this->send_RemoveAudioDecoderConfiguration(soap_endpoint_url, soap_action, trt__RemoveAudioDecoderConfiguration) || this->recv_RemoveAudioDecoderConfiguration(trt__RemoveAudioDecoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_RemoveAudioDecoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_RemoveAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__RemoveAudioDecoderConfiguration *trt__RemoveAudioDecoderConfiguration);
/// Web service asynchronous operation 'recv_RemoveAudioDecoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_RemoveAudioDecoderConfiguration(_trt__RemoveAudioDecoderConfigurationResponse &trt__RemoveAudioDecoderConfigurationResponse);
//
/// Web service synchronous operation 'DeleteProfile' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int DeleteProfile(_trt__DeleteProfile *trt__DeleteProfile, _trt__DeleteProfileResponse &trt__DeleteProfileResponse) { return this->DeleteProfile(NULL, NULL, trt__DeleteProfile, trt__DeleteProfileResponse); }
/// Web service synchronous operation 'DeleteProfile' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int DeleteProfile(const char *soap_endpoint_url, const char *soap_action, _trt__DeleteProfile *trt__DeleteProfile, _trt__DeleteProfileResponse &trt__DeleteProfileResponse) { return this->send_DeleteProfile(soap_endpoint_url, soap_action, trt__DeleteProfile) || this->recv_DeleteProfile(trt__DeleteProfileResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_DeleteProfile' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_DeleteProfile(const char *soap_endpoint_url, const char *soap_action, _trt__DeleteProfile *trt__DeleteProfile);
/// Web service asynchronous operation 'recv_DeleteProfile' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_DeleteProfile(_trt__DeleteProfileResponse &trt__DeleteProfileResponse);
//
/// Web service synchronous operation 'GetVideoSourceConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfigurations(_trt__GetVideoSourceConfigurations *trt__GetVideoSourceConfigurations, _trt__GetVideoSourceConfigurationsResponse &trt__GetVideoSourceConfigurationsResponse) { return this->GetVideoSourceConfigurations(NULL, NULL, trt__GetVideoSourceConfigurations, trt__GetVideoSourceConfigurationsResponse); }
/// Web service synchronous operation 'GetVideoSourceConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfigurations *trt__GetVideoSourceConfigurations, _trt__GetVideoSourceConfigurationsResponse &trt__GetVideoSourceConfigurationsResponse) { return this->send_GetVideoSourceConfigurations(soap_endpoint_url, soap_action, trt__GetVideoSourceConfigurations) || this->recv_GetVideoSourceConfigurations(trt__GetVideoSourceConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoSourceConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfigurations *trt__GetVideoSourceConfigurations);
/// Web service asynchronous operation 'recv_GetVideoSourceConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoSourceConfigurations(_trt__GetVideoSourceConfigurationsResponse &trt__GetVideoSourceConfigurationsResponse);
//
/// Web service synchronous operation 'GetVideoEncoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfigurations(_trt__GetVideoEncoderConfigurations *trt__GetVideoEncoderConfigurations, _trt__GetVideoEncoderConfigurationsResponse &trt__GetVideoEncoderConfigurationsResponse) { return this->GetVideoEncoderConfigurations(NULL, NULL, trt__GetVideoEncoderConfigurations, trt__GetVideoEncoderConfigurationsResponse); }
/// Web service synchronous operation 'GetVideoEncoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfigurations *trt__GetVideoEncoderConfigurations, _trt__GetVideoEncoderConfigurationsResponse &trt__GetVideoEncoderConfigurationsResponse) { return this->send_GetVideoEncoderConfigurations(soap_endpoint_url, soap_action, trt__GetVideoEncoderConfigurations) || this->recv_GetVideoEncoderConfigurations(trt__GetVideoEncoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoEncoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfigurations *trt__GetVideoEncoderConfigurations);
/// Web service asynchronous operation 'recv_GetVideoEncoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoEncoderConfigurations(_trt__GetVideoEncoderConfigurationsResponse &trt__GetVideoEncoderConfigurationsResponse);
//
/// Web service synchronous operation 'GetAudioSourceConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfigurations(_trt__GetAudioSourceConfigurations *trt__GetAudioSourceConfigurations, _trt__GetAudioSourceConfigurationsResponse &trt__GetAudioSourceConfigurationsResponse) { return this->GetAudioSourceConfigurations(NULL, NULL, trt__GetAudioSourceConfigurations, trt__GetAudioSourceConfigurationsResponse); }
/// Web service synchronous operation 'GetAudioSourceConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfigurations *trt__GetAudioSourceConfigurations, _trt__GetAudioSourceConfigurationsResponse &trt__GetAudioSourceConfigurationsResponse) { return this->send_GetAudioSourceConfigurations(soap_endpoint_url, soap_action, trt__GetAudioSourceConfigurations) || this->recv_GetAudioSourceConfigurations(trt__GetAudioSourceConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioSourceConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfigurations *trt__GetAudioSourceConfigurations);
/// Web service asynchronous operation 'recv_GetAudioSourceConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioSourceConfigurations(_trt__GetAudioSourceConfigurationsResponse &trt__GetAudioSourceConfigurationsResponse);
//
/// Web service synchronous operation 'GetAudioEncoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfigurations(_trt__GetAudioEncoderConfigurations *trt__GetAudioEncoderConfigurations, _trt__GetAudioEncoderConfigurationsResponse &trt__GetAudioEncoderConfigurationsResponse) { return this->GetAudioEncoderConfigurations(NULL, NULL, trt__GetAudioEncoderConfigurations, trt__GetAudioEncoderConfigurationsResponse); }
/// Web service synchronous operation 'GetAudioEncoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfigurations *trt__GetAudioEncoderConfigurations, _trt__GetAudioEncoderConfigurationsResponse &trt__GetAudioEncoderConfigurationsResponse) { return this->send_GetAudioEncoderConfigurations(soap_endpoint_url, soap_action, trt__GetAudioEncoderConfigurations) || this->recv_GetAudioEncoderConfigurations(trt__GetAudioEncoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioEncoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfigurations *trt__GetAudioEncoderConfigurations);
/// Web service asynchronous operation 'recv_GetAudioEncoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioEncoderConfigurations(_trt__GetAudioEncoderConfigurationsResponse &trt__GetAudioEncoderConfigurationsResponse);
//
/// Web service synchronous operation 'GetVideoAnalyticsConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoAnalyticsConfigurations(_trt__GetVideoAnalyticsConfigurations *trt__GetVideoAnalyticsConfigurations, _trt__GetVideoAnalyticsConfigurationsResponse &trt__GetVideoAnalyticsConfigurationsResponse) { return this->GetVideoAnalyticsConfigurations(NULL, NULL, trt__GetVideoAnalyticsConfigurations, trt__GetVideoAnalyticsConfigurationsResponse); }
/// Web service synchronous operation 'GetVideoAnalyticsConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoAnalyticsConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoAnalyticsConfigurations *trt__GetVideoAnalyticsConfigurations, _trt__GetVideoAnalyticsConfigurationsResponse &trt__GetVideoAnalyticsConfigurationsResponse) { return this->send_GetVideoAnalyticsConfigurations(soap_endpoint_url, soap_action, trt__GetVideoAnalyticsConfigurations) || this->recv_GetVideoAnalyticsConfigurations(trt__GetVideoAnalyticsConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoAnalyticsConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoAnalyticsConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoAnalyticsConfigurations *trt__GetVideoAnalyticsConfigurations);
/// Web service asynchronous operation 'recv_GetVideoAnalyticsConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoAnalyticsConfigurations(_trt__GetVideoAnalyticsConfigurationsResponse &trt__GetVideoAnalyticsConfigurationsResponse);
//
/// Web service synchronous operation 'GetMetadataConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfigurations(_trt__GetMetadataConfigurations *trt__GetMetadataConfigurations, _trt__GetMetadataConfigurationsResponse &trt__GetMetadataConfigurationsResponse) { return this->GetMetadataConfigurations(NULL, NULL, trt__GetMetadataConfigurations, trt__GetMetadataConfigurationsResponse); }
/// Web service synchronous operation 'GetMetadataConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfigurations *trt__GetMetadataConfigurations, _trt__GetMetadataConfigurationsResponse &trt__GetMetadataConfigurationsResponse) { return this->send_GetMetadataConfigurations(soap_endpoint_url, soap_action, trt__GetMetadataConfigurations) || this->recv_GetMetadataConfigurations(trt__GetMetadataConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetMetadataConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetMetadataConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfigurations *trt__GetMetadataConfigurations);
/// Web service asynchronous operation 'recv_GetMetadataConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetMetadataConfigurations(_trt__GetMetadataConfigurationsResponse &trt__GetMetadataConfigurationsResponse);
//
/// Web service synchronous operation 'GetAudioOutputConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfigurations(_trt__GetAudioOutputConfigurations *trt__GetAudioOutputConfigurations, _trt__GetAudioOutputConfigurationsResponse &trt__GetAudioOutputConfigurationsResponse) { return this->GetAudioOutputConfigurations(NULL, NULL, trt__GetAudioOutputConfigurations, trt__GetAudioOutputConfigurationsResponse); }
/// Web service synchronous operation 'GetAudioOutputConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfigurations *trt__GetAudioOutputConfigurations, _trt__GetAudioOutputConfigurationsResponse &trt__GetAudioOutputConfigurationsResponse) { return this->send_GetAudioOutputConfigurations(soap_endpoint_url, soap_action, trt__GetAudioOutputConfigurations) || this->recv_GetAudioOutputConfigurations(trt__GetAudioOutputConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioOutputConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioOutputConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfigurations *trt__GetAudioOutputConfigurations);
/// Web service asynchronous operation 'recv_GetAudioOutputConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioOutputConfigurations(_trt__GetAudioOutputConfigurationsResponse &trt__GetAudioOutputConfigurationsResponse);
//
/// Web service synchronous operation 'GetAudioDecoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfigurations(_trt__GetAudioDecoderConfigurations *trt__GetAudioDecoderConfigurations, _trt__GetAudioDecoderConfigurationsResponse &trt__GetAudioDecoderConfigurationsResponse) { return this->GetAudioDecoderConfigurations(NULL, NULL, trt__GetAudioDecoderConfigurations, trt__GetAudioDecoderConfigurationsResponse); }
/// Web service synchronous operation 'GetAudioDecoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfigurations *trt__GetAudioDecoderConfigurations, _trt__GetAudioDecoderConfigurationsResponse &trt__GetAudioDecoderConfigurationsResponse) { return this->send_GetAudioDecoderConfigurations(soap_endpoint_url, soap_action, trt__GetAudioDecoderConfigurations) || this->recv_GetAudioDecoderConfigurations(trt__GetAudioDecoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioDecoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioDecoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfigurations *trt__GetAudioDecoderConfigurations);
/// Web service asynchronous operation 'recv_GetAudioDecoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioDecoderConfigurations(_trt__GetAudioDecoderConfigurationsResponse &trt__GetAudioDecoderConfigurationsResponse);
//
/// Web service synchronous operation 'GetVideoSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfiguration(_trt__GetVideoSourceConfiguration *trt__GetVideoSourceConfiguration, _trt__GetVideoSourceConfigurationResponse &trt__GetVideoSourceConfigurationResponse) { return this->GetVideoSourceConfiguration(NULL, NULL, trt__GetVideoSourceConfiguration, trt__GetVideoSourceConfigurationResponse); }
/// Web service synchronous operation 'GetVideoSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfiguration *trt__GetVideoSourceConfiguration, _trt__GetVideoSourceConfigurationResponse &trt__GetVideoSourceConfigurationResponse) { return this->send_GetVideoSourceConfiguration(soap_endpoint_url, soap_action, trt__GetVideoSourceConfiguration) || this->recv_GetVideoSourceConfiguration(trt__GetVideoSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfiguration *trt__GetVideoSourceConfiguration);
/// Web service asynchronous operation 'recv_GetVideoSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoSourceConfiguration(_trt__GetVideoSourceConfigurationResponse &trt__GetVideoSourceConfigurationResponse);
//
/// Web service synchronous operation 'GetVideoEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfiguration(_trt__GetVideoEncoderConfiguration *trt__GetVideoEncoderConfiguration, _trt__GetVideoEncoderConfigurationResponse &trt__GetVideoEncoderConfigurationResponse) { return this->GetVideoEncoderConfiguration(NULL, NULL, trt__GetVideoEncoderConfiguration, trt__GetVideoEncoderConfigurationResponse); }
/// Web service synchronous operation 'GetVideoEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfiguration *trt__GetVideoEncoderConfiguration, _trt__GetVideoEncoderConfigurationResponse &trt__GetVideoEncoderConfigurationResponse) { return this->send_GetVideoEncoderConfiguration(soap_endpoint_url, soap_action, trt__GetVideoEncoderConfiguration) || this->recv_GetVideoEncoderConfiguration(trt__GetVideoEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfiguration *trt__GetVideoEncoderConfiguration);
/// Web service asynchronous operation 'recv_GetVideoEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoEncoderConfiguration(_trt__GetVideoEncoderConfigurationResponse &trt__GetVideoEncoderConfigurationResponse);
//
/// Web service synchronous operation 'GetAudioSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfiguration(_trt__GetAudioSourceConfiguration *trt__GetAudioSourceConfiguration, _trt__GetAudioSourceConfigurationResponse &trt__GetAudioSourceConfigurationResponse) { return this->GetAudioSourceConfiguration(NULL, NULL, trt__GetAudioSourceConfiguration, trt__GetAudioSourceConfigurationResponse); }
/// Web service synchronous operation 'GetAudioSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfiguration *trt__GetAudioSourceConfiguration, _trt__GetAudioSourceConfigurationResponse &trt__GetAudioSourceConfigurationResponse) { return this->send_GetAudioSourceConfiguration(soap_endpoint_url, soap_action, trt__GetAudioSourceConfiguration) || this->recv_GetAudioSourceConfiguration(trt__GetAudioSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfiguration *trt__GetAudioSourceConfiguration);
/// Web service asynchronous operation 'recv_GetAudioSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioSourceConfiguration(_trt__GetAudioSourceConfigurationResponse &trt__GetAudioSourceConfigurationResponse);
//
/// Web service synchronous operation 'GetAudioEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfiguration(_trt__GetAudioEncoderConfiguration *trt__GetAudioEncoderConfiguration, _trt__GetAudioEncoderConfigurationResponse &trt__GetAudioEncoderConfigurationResponse) { return this->GetAudioEncoderConfiguration(NULL, NULL, trt__GetAudioEncoderConfiguration, trt__GetAudioEncoderConfigurationResponse); }
/// Web service synchronous operation 'GetAudioEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfiguration *trt__GetAudioEncoderConfiguration, _trt__GetAudioEncoderConfigurationResponse &trt__GetAudioEncoderConfigurationResponse) { return this->send_GetAudioEncoderConfiguration(soap_endpoint_url, soap_action, trt__GetAudioEncoderConfiguration) || this->recv_GetAudioEncoderConfiguration(trt__GetAudioEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfiguration *trt__GetAudioEncoderConfiguration);
/// Web service asynchronous operation 'recv_GetAudioEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioEncoderConfiguration(_trt__GetAudioEncoderConfigurationResponse &trt__GetAudioEncoderConfigurationResponse);
//
/// Web service synchronous operation 'GetVideoAnalyticsConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoAnalyticsConfiguration(_trt__GetVideoAnalyticsConfiguration *trt__GetVideoAnalyticsConfiguration, _trt__GetVideoAnalyticsConfigurationResponse &trt__GetVideoAnalyticsConfigurationResponse) { return this->GetVideoAnalyticsConfiguration(NULL, NULL, trt__GetVideoAnalyticsConfiguration, trt__GetVideoAnalyticsConfigurationResponse); }
/// Web service synchronous operation 'GetVideoAnalyticsConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoAnalyticsConfiguration *trt__GetVideoAnalyticsConfiguration, _trt__GetVideoAnalyticsConfigurationResponse &trt__GetVideoAnalyticsConfigurationResponse) { return this->send_GetVideoAnalyticsConfiguration(soap_endpoint_url, soap_action, trt__GetVideoAnalyticsConfiguration) || this->recv_GetVideoAnalyticsConfiguration(trt__GetVideoAnalyticsConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoAnalyticsConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoAnalyticsConfiguration *trt__GetVideoAnalyticsConfiguration);
/// Web service asynchronous operation 'recv_GetVideoAnalyticsConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoAnalyticsConfiguration(_trt__GetVideoAnalyticsConfigurationResponse &trt__GetVideoAnalyticsConfigurationResponse);
//
/// Web service synchronous operation 'GetMetadataConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfiguration(_trt__GetMetadataConfiguration *trt__GetMetadataConfiguration, _trt__GetMetadataConfigurationResponse &trt__GetMetadataConfigurationResponse) { return this->GetMetadataConfiguration(NULL, NULL, trt__GetMetadataConfiguration, trt__GetMetadataConfigurationResponse); }
/// Web service synchronous operation 'GetMetadataConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfiguration *trt__GetMetadataConfiguration, _trt__GetMetadataConfigurationResponse &trt__GetMetadataConfigurationResponse) { return this->send_GetMetadataConfiguration(soap_endpoint_url, soap_action, trt__GetMetadataConfiguration) || this->recv_GetMetadataConfiguration(trt__GetMetadataConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetMetadataConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfiguration *trt__GetMetadataConfiguration);
/// Web service asynchronous operation 'recv_GetMetadataConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetMetadataConfiguration(_trt__GetMetadataConfigurationResponse &trt__GetMetadataConfigurationResponse);
//
/// Web service synchronous operation 'GetAudioOutputConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfiguration(_trt__GetAudioOutputConfiguration *trt__GetAudioOutputConfiguration, _trt__GetAudioOutputConfigurationResponse &trt__GetAudioOutputConfigurationResponse) { return this->GetAudioOutputConfiguration(NULL, NULL, trt__GetAudioOutputConfiguration, trt__GetAudioOutputConfigurationResponse); }
/// Web service synchronous operation 'GetAudioOutputConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfiguration *trt__GetAudioOutputConfiguration, _trt__GetAudioOutputConfigurationResponse &trt__GetAudioOutputConfigurationResponse) { return this->send_GetAudioOutputConfiguration(soap_endpoint_url, soap_action, trt__GetAudioOutputConfiguration) || this->recv_GetAudioOutputConfiguration(trt__GetAudioOutputConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioOutputConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfiguration *trt__GetAudioOutputConfiguration);
/// Web service asynchronous operation 'recv_GetAudioOutputConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioOutputConfiguration(_trt__GetAudioOutputConfigurationResponse &trt__GetAudioOutputConfigurationResponse);
//
/// Web service synchronous operation 'GetAudioDecoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfiguration(_trt__GetAudioDecoderConfiguration *trt__GetAudioDecoderConfiguration, _trt__GetAudioDecoderConfigurationResponse &trt__GetAudioDecoderConfigurationResponse) { return this->GetAudioDecoderConfiguration(NULL, NULL, trt__GetAudioDecoderConfiguration, trt__GetAudioDecoderConfigurationResponse); }
/// Web service synchronous operation 'GetAudioDecoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfiguration *trt__GetAudioDecoderConfiguration, _trt__GetAudioDecoderConfigurationResponse &trt__GetAudioDecoderConfigurationResponse) { return this->send_GetAudioDecoderConfiguration(soap_endpoint_url, soap_action, trt__GetAudioDecoderConfiguration) || this->recv_GetAudioDecoderConfiguration(trt__GetAudioDecoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioDecoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfiguration *trt__GetAudioDecoderConfiguration);
/// Web service asynchronous operation 'recv_GetAudioDecoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioDecoderConfiguration(_trt__GetAudioDecoderConfigurationResponse &trt__GetAudioDecoderConfigurationResponse);
//
/// Web service synchronous operation 'GetCompatibleVideoEncoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoEncoderConfigurations(_trt__GetCompatibleVideoEncoderConfigurations *trt__GetCompatibleVideoEncoderConfigurations, _trt__GetCompatibleVideoEncoderConfigurationsResponse &trt__GetCompatibleVideoEncoderConfigurationsResponse) { return this->GetCompatibleVideoEncoderConfigurations(NULL, NULL, trt__GetCompatibleVideoEncoderConfigurations, trt__GetCompatibleVideoEncoderConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleVideoEncoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoEncoderConfigurations *trt__GetCompatibleVideoEncoderConfigurations, _trt__GetCompatibleVideoEncoderConfigurationsResponse &trt__GetCompatibleVideoEncoderConfigurationsResponse) { return this->send_GetCompatibleVideoEncoderConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleVideoEncoderConfigurations) || this->recv_GetCompatibleVideoEncoderConfigurations(trt__GetCompatibleVideoEncoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleVideoEncoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleVideoEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoEncoderConfigurations *trt__GetCompatibleVideoEncoderConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleVideoEncoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleVideoEncoderConfigurations(_trt__GetCompatibleVideoEncoderConfigurationsResponse &trt__GetCompatibleVideoEncoderConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleVideoSourceConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoSourceConfigurations(_trt__GetCompatibleVideoSourceConfigurations *trt__GetCompatibleVideoSourceConfigurations, _trt__GetCompatibleVideoSourceConfigurationsResponse &trt__GetCompatibleVideoSourceConfigurationsResponse) { return this->GetCompatibleVideoSourceConfigurations(NULL, NULL, trt__GetCompatibleVideoSourceConfigurations, trt__GetCompatibleVideoSourceConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleVideoSourceConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoSourceConfigurations *trt__GetCompatibleVideoSourceConfigurations, _trt__GetCompatibleVideoSourceConfigurationsResponse &trt__GetCompatibleVideoSourceConfigurationsResponse) { return this->send_GetCompatibleVideoSourceConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleVideoSourceConfigurations) || this->recv_GetCompatibleVideoSourceConfigurations(trt__GetCompatibleVideoSourceConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleVideoSourceConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleVideoSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoSourceConfigurations *trt__GetCompatibleVideoSourceConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleVideoSourceConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleVideoSourceConfigurations(_trt__GetCompatibleVideoSourceConfigurationsResponse &trt__GetCompatibleVideoSourceConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleAudioEncoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioEncoderConfigurations(_trt__GetCompatibleAudioEncoderConfigurations *trt__GetCompatibleAudioEncoderConfigurations, _trt__GetCompatibleAudioEncoderConfigurationsResponse &trt__GetCompatibleAudioEncoderConfigurationsResponse) { return this->GetCompatibleAudioEncoderConfigurations(NULL, NULL, trt__GetCompatibleAudioEncoderConfigurations, trt__GetCompatibleAudioEncoderConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleAudioEncoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioEncoderConfigurations *trt__GetCompatibleAudioEncoderConfigurations, _trt__GetCompatibleAudioEncoderConfigurationsResponse &trt__GetCompatibleAudioEncoderConfigurationsResponse) { return this->send_GetCompatibleAudioEncoderConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleAudioEncoderConfigurations) || this->recv_GetCompatibleAudioEncoderConfigurations(trt__GetCompatibleAudioEncoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleAudioEncoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleAudioEncoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioEncoderConfigurations *trt__GetCompatibleAudioEncoderConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleAudioEncoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleAudioEncoderConfigurations(_trt__GetCompatibleAudioEncoderConfigurationsResponse &trt__GetCompatibleAudioEncoderConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleAudioSourceConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioSourceConfigurations(_trt__GetCompatibleAudioSourceConfigurations *trt__GetCompatibleAudioSourceConfigurations, _trt__GetCompatibleAudioSourceConfigurationsResponse &trt__GetCompatibleAudioSourceConfigurationsResponse) { return this->GetCompatibleAudioSourceConfigurations(NULL, NULL, trt__GetCompatibleAudioSourceConfigurations, trt__GetCompatibleAudioSourceConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleAudioSourceConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioSourceConfigurations *trt__GetCompatibleAudioSourceConfigurations, _trt__GetCompatibleAudioSourceConfigurationsResponse &trt__GetCompatibleAudioSourceConfigurationsResponse) { return this->send_GetCompatibleAudioSourceConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleAudioSourceConfigurations) || this->recv_GetCompatibleAudioSourceConfigurations(trt__GetCompatibleAudioSourceConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleAudioSourceConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleAudioSourceConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioSourceConfigurations *trt__GetCompatibleAudioSourceConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleAudioSourceConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleAudioSourceConfigurations(_trt__GetCompatibleAudioSourceConfigurationsResponse &trt__GetCompatibleAudioSourceConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleVideoAnalyticsConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoAnalyticsConfigurations(_trt__GetCompatibleVideoAnalyticsConfigurations *trt__GetCompatibleVideoAnalyticsConfigurations, _trt__GetCompatibleVideoAnalyticsConfigurationsResponse &trt__GetCompatibleVideoAnalyticsConfigurationsResponse) { return this->GetCompatibleVideoAnalyticsConfigurations(NULL, NULL, trt__GetCompatibleVideoAnalyticsConfigurations, trt__GetCompatibleVideoAnalyticsConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleVideoAnalyticsConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleVideoAnalyticsConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoAnalyticsConfigurations *trt__GetCompatibleVideoAnalyticsConfigurations, _trt__GetCompatibleVideoAnalyticsConfigurationsResponse &trt__GetCompatibleVideoAnalyticsConfigurationsResponse) { return this->send_GetCompatibleVideoAnalyticsConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleVideoAnalyticsConfigurations) || this->recv_GetCompatibleVideoAnalyticsConfigurations(trt__GetCompatibleVideoAnalyticsConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleVideoAnalyticsConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleVideoAnalyticsConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleVideoAnalyticsConfigurations *trt__GetCompatibleVideoAnalyticsConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleVideoAnalyticsConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleVideoAnalyticsConfigurations(_trt__GetCompatibleVideoAnalyticsConfigurationsResponse &trt__GetCompatibleVideoAnalyticsConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleMetadataConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleMetadataConfigurations(_trt__GetCompatibleMetadataConfigurations *trt__GetCompatibleMetadataConfigurations, _trt__GetCompatibleMetadataConfigurationsResponse &trt__GetCompatibleMetadataConfigurationsResponse) { return this->GetCompatibleMetadataConfigurations(NULL, NULL, trt__GetCompatibleMetadataConfigurations, trt__GetCompatibleMetadataConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleMetadataConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleMetadataConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleMetadataConfigurations *trt__GetCompatibleMetadataConfigurations, _trt__GetCompatibleMetadataConfigurationsResponse &trt__GetCompatibleMetadataConfigurationsResponse) { return this->send_GetCompatibleMetadataConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleMetadataConfigurations) || this->recv_GetCompatibleMetadataConfigurations(trt__GetCompatibleMetadataConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleMetadataConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleMetadataConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleMetadataConfigurations *trt__GetCompatibleMetadataConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleMetadataConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleMetadataConfigurations(_trt__GetCompatibleMetadataConfigurationsResponse &trt__GetCompatibleMetadataConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleAudioOutputConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioOutputConfigurations(_trt__GetCompatibleAudioOutputConfigurations *trt__GetCompatibleAudioOutputConfigurations, _trt__GetCompatibleAudioOutputConfigurationsResponse &trt__GetCompatibleAudioOutputConfigurationsResponse) { return this->GetCompatibleAudioOutputConfigurations(NULL, NULL, trt__GetCompatibleAudioOutputConfigurations, trt__GetCompatibleAudioOutputConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleAudioOutputConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioOutputConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioOutputConfigurations *trt__GetCompatibleAudioOutputConfigurations, _trt__GetCompatibleAudioOutputConfigurationsResponse &trt__GetCompatibleAudioOutputConfigurationsResponse) { return this->send_GetCompatibleAudioOutputConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleAudioOutputConfigurations) || this->recv_GetCompatibleAudioOutputConfigurations(trt__GetCompatibleAudioOutputConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleAudioOutputConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleAudioOutputConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioOutputConfigurations *trt__GetCompatibleAudioOutputConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleAudioOutputConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleAudioOutputConfigurations(_trt__GetCompatibleAudioOutputConfigurationsResponse &trt__GetCompatibleAudioOutputConfigurationsResponse);
//
/// Web service synchronous operation 'GetCompatibleAudioDecoderConfigurations' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioDecoderConfigurations(_trt__GetCompatibleAudioDecoderConfigurations *trt__GetCompatibleAudioDecoderConfigurations, _trt__GetCompatibleAudioDecoderConfigurationsResponse &trt__GetCompatibleAudioDecoderConfigurationsResponse) { return this->GetCompatibleAudioDecoderConfigurations(NULL, NULL, trt__GetCompatibleAudioDecoderConfigurations, trt__GetCompatibleAudioDecoderConfigurationsResponse); }
/// Web service synchronous operation 'GetCompatibleAudioDecoderConfigurations' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetCompatibleAudioDecoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioDecoderConfigurations *trt__GetCompatibleAudioDecoderConfigurations, _trt__GetCompatibleAudioDecoderConfigurationsResponse &trt__GetCompatibleAudioDecoderConfigurationsResponse) { return this->send_GetCompatibleAudioDecoderConfigurations(soap_endpoint_url, soap_action, trt__GetCompatibleAudioDecoderConfigurations) || this->recv_GetCompatibleAudioDecoderConfigurations(trt__GetCompatibleAudioDecoderConfigurationsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetCompatibleAudioDecoderConfigurations' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetCompatibleAudioDecoderConfigurations(const char *soap_endpoint_url, const char *soap_action, _trt__GetCompatibleAudioDecoderConfigurations *trt__GetCompatibleAudioDecoderConfigurations);
/// Web service asynchronous operation 'recv_GetCompatibleAudioDecoderConfigurations' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetCompatibleAudioDecoderConfigurations(_trt__GetCompatibleAudioDecoderConfigurationsResponse &trt__GetCompatibleAudioDecoderConfigurationsResponse);
//
/// Web service synchronous operation 'SetVideoSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoSourceConfiguration(_trt__SetVideoSourceConfiguration *trt__SetVideoSourceConfiguration, _trt__SetVideoSourceConfigurationResponse &trt__SetVideoSourceConfigurationResponse) { return this->SetVideoSourceConfiguration(NULL, NULL, trt__SetVideoSourceConfiguration, trt__SetVideoSourceConfigurationResponse); }
/// Web service synchronous operation 'SetVideoSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoSourceConfiguration *trt__SetVideoSourceConfiguration, _trt__SetVideoSourceConfigurationResponse &trt__SetVideoSourceConfigurationResponse) { return this->send_SetVideoSourceConfiguration(soap_endpoint_url, soap_action, trt__SetVideoSourceConfiguration) || this->recv_SetVideoSourceConfiguration(trt__SetVideoSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetVideoSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetVideoSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoSourceConfiguration *trt__SetVideoSourceConfiguration);
/// Web service asynchronous operation 'recv_SetVideoSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetVideoSourceConfiguration(_trt__SetVideoSourceConfigurationResponse &trt__SetVideoSourceConfigurationResponse);
//
/// Web service synchronous operation 'SetVideoEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoEncoderConfiguration(_trt__SetVideoEncoderConfiguration *trt__SetVideoEncoderConfiguration, _trt__SetVideoEncoderConfigurationResponse &trt__SetVideoEncoderConfigurationResponse) { return this->SetVideoEncoderConfiguration(NULL, NULL, trt__SetVideoEncoderConfiguration, trt__SetVideoEncoderConfigurationResponse); }
/// Web service synchronous operation 'SetVideoEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoEncoderConfiguration *trt__SetVideoEncoderConfiguration, _trt__SetVideoEncoderConfigurationResponse &trt__SetVideoEncoderConfigurationResponse) { return this->send_SetVideoEncoderConfiguration(soap_endpoint_url, soap_action, trt__SetVideoEncoderConfiguration) || this->recv_SetVideoEncoderConfiguration(trt__SetVideoEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetVideoEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetVideoEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoEncoderConfiguration *trt__SetVideoEncoderConfiguration);
/// Web service asynchronous operation 'recv_SetVideoEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetVideoEncoderConfiguration(_trt__SetVideoEncoderConfigurationResponse &trt__SetVideoEncoderConfigurationResponse);
//
/// Web service synchronous operation 'SetAudioSourceConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioSourceConfiguration(_trt__SetAudioSourceConfiguration *trt__SetAudioSourceConfiguration, _trt__SetAudioSourceConfigurationResponse &trt__SetAudioSourceConfigurationResponse) { return this->SetAudioSourceConfiguration(NULL, NULL, trt__SetAudioSourceConfiguration, trt__SetAudioSourceConfigurationResponse); }
/// Web service synchronous operation 'SetAudioSourceConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioSourceConfiguration *trt__SetAudioSourceConfiguration, _trt__SetAudioSourceConfigurationResponse &trt__SetAudioSourceConfigurationResponse) { return this->send_SetAudioSourceConfiguration(soap_endpoint_url, soap_action, trt__SetAudioSourceConfiguration) || this->recv_SetAudioSourceConfiguration(trt__SetAudioSourceConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetAudioSourceConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetAudioSourceConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioSourceConfiguration *trt__SetAudioSourceConfiguration);
/// Web service asynchronous operation 'recv_SetAudioSourceConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetAudioSourceConfiguration(_trt__SetAudioSourceConfigurationResponse &trt__SetAudioSourceConfigurationResponse);
//
/// Web service synchronous operation 'SetAudioEncoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioEncoderConfiguration(_trt__SetAudioEncoderConfiguration *trt__SetAudioEncoderConfiguration, _trt__SetAudioEncoderConfigurationResponse &trt__SetAudioEncoderConfigurationResponse) { return this->SetAudioEncoderConfiguration(NULL, NULL, trt__SetAudioEncoderConfiguration, trt__SetAudioEncoderConfigurationResponse); }
/// Web service synchronous operation 'SetAudioEncoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioEncoderConfiguration *trt__SetAudioEncoderConfiguration, _trt__SetAudioEncoderConfigurationResponse &trt__SetAudioEncoderConfigurationResponse) { return this->send_SetAudioEncoderConfiguration(soap_endpoint_url, soap_action, trt__SetAudioEncoderConfiguration) || this->recv_SetAudioEncoderConfiguration(trt__SetAudioEncoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetAudioEncoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetAudioEncoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioEncoderConfiguration *trt__SetAudioEncoderConfiguration);
/// Web service asynchronous operation 'recv_SetAudioEncoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetAudioEncoderConfiguration(_trt__SetAudioEncoderConfigurationResponse &trt__SetAudioEncoderConfigurationResponse);
//
/// Web service synchronous operation 'SetVideoAnalyticsConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoAnalyticsConfiguration(_trt__SetVideoAnalyticsConfiguration *trt__SetVideoAnalyticsConfiguration, _trt__SetVideoAnalyticsConfigurationResponse &trt__SetVideoAnalyticsConfigurationResponse) { return this->SetVideoAnalyticsConfiguration(NULL, NULL, trt__SetVideoAnalyticsConfiguration, trt__SetVideoAnalyticsConfigurationResponse); }
/// Web service synchronous operation 'SetVideoAnalyticsConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoAnalyticsConfiguration *trt__SetVideoAnalyticsConfiguration, _trt__SetVideoAnalyticsConfigurationResponse &trt__SetVideoAnalyticsConfigurationResponse) { return this->send_SetVideoAnalyticsConfiguration(soap_endpoint_url, soap_action, trt__SetVideoAnalyticsConfiguration) || this->recv_SetVideoAnalyticsConfiguration(trt__SetVideoAnalyticsConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetVideoAnalyticsConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetVideoAnalyticsConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoAnalyticsConfiguration *trt__SetVideoAnalyticsConfiguration);
/// Web service asynchronous operation 'recv_SetVideoAnalyticsConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetVideoAnalyticsConfiguration(_trt__SetVideoAnalyticsConfigurationResponse &trt__SetVideoAnalyticsConfigurationResponse);
//
/// Web service synchronous operation 'SetMetadataConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetMetadataConfiguration(_trt__SetMetadataConfiguration *trt__SetMetadataConfiguration, _trt__SetMetadataConfigurationResponse &trt__SetMetadataConfigurationResponse) { return this->SetMetadataConfiguration(NULL, NULL, trt__SetMetadataConfiguration, trt__SetMetadataConfigurationResponse); }
/// Web service synchronous operation 'SetMetadataConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetMetadataConfiguration *trt__SetMetadataConfiguration, _trt__SetMetadataConfigurationResponse &trt__SetMetadataConfigurationResponse) { return this->send_SetMetadataConfiguration(soap_endpoint_url, soap_action, trt__SetMetadataConfiguration) || this->recv_SetMetadataConfiguration(trt__SetMetadataConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetMetadataConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetMetadataConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetMetadataConfiguration *trt__SetMetadataConfiguration);
/// Web service asynchronous operation 'recv_SetMetadataConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetMetadataConfiguration(_trt__SetMetadataConfigurationResponse &trt__SetMetadataConfigurationResponse);
//
/// Web service synchronous operation 'SetAudioOutputConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioOutputConfiguration(_trt__SetAudioOutputConfiguration *trt__SetAudioOutputConfiguration, _trt__SetAudioOutputConfigurationResponse &trt__SetAudioOutputConfigurationResponse) { return this->SetAudioOutputConfiguration(NULL, NULL, trt__SetAudioOutputConfiguration, trt__SetAudioOutputConfigurationResponse); }
/// Web service synchronous operation 'SetAudioOutputConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioOutputConfiguration *trt__SetAudioOutputConfiguration, _trt__SetAudioOutputConfigurationResponse &trt__SetAudioOutputConfigurationResponse) { return this->send_SetAudioOutputConfiguration(soap_endpoint_url, soap_action, trt__SetAudioOutputConfiguration) || this->recv_SetAudioOutputConfiguration(trt__SetAudioOutputConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetAudioOutputConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetAudioOutputConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioOutputConfiguration *trt__SetAudioOutputConfiguration);
/// Web service asynchronous operation 'recv_SetAudioOutputConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetAudioOutputConfiguration(_trt__SetAudioOutputConfigurationResponse &trt__SetAudioOutputConfigurationResponse);
//
/// Web service synchronous operation 'SetAudioDecoderConfiguration' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioDecoderConfiguration(_trt__SetAudioDecoderConfiguration *trt__SetAudioDecoderConfiguration, _trt__SetAudioDecoderConfigurationResponse &trt__SetAudioDecoderConfigurationResponse) { return this->SetAudioDecoderConfiguration(NULL, NULL, trt__SetAudioDecoderConfiguration, trt__SetAudioDecoderConfigurationResponse); }
/// Web service synchronous operation 'SetAudioDecoderConfiguration' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioDecoderConfiguration *trt__SetAudioDecoderConfiguration, _trt__SetAudioDecoderConfigurationResponse &trt__SetAudioDecoderConfigurationResponse) { return this->send_SetAudioDecoderConfiguration(soap_endpoint_url, soap_action, trt__SetAudioDecoderConfiguration) || this->recv_SetAudioDecoderConfiguration(trt__SetAudioDecoderConfigurationResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetAudioDecoderConfiguration' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetAudioDecoderConfiguration(const char *soap_endpoint_url, const char *soap_action, _trt__SetAudioDecoderConfiguration *trt__SetAudioDecoderConfiguration);
/// Web service asynchronous operation 'recv_SetAudioDecoderConfiguration' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetAudioDecoderConfiguration(_trt__SetAudioDecoderConfigurationResponse &trt__SetAudioDecoderConfigurationResponse);
//
/// Web service synchronous operation 'GetVideoSourceConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfigurationOptions(_trt__GetVideoSourceConfigurationOptions *trt__GetVideoSourceConfigurationOptions, _trt__GetVideoSourceConfigurationOptionsResponse &trt__GetVideoSourceConfigurationOptionsResponse) { return this->GetVideoSourceConfigurationOptions(NULL, NULL, trt__GetVideoSourceConfigurationOptions, trt__GetVideoSourceConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetVideoSourceConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfigurationOptions *trt__GetVideoSourceConfigurationOptions, _trt__GetVideoSourceConfigurationOptionsResponse &trt__GetVideoSourceConfigurationOptionsResponse) { return this->send_GetVideoSourceConfigurationOptions(soap_endpoint_url, soap_action, trt__GetVideoSourceConfigurationOptions) || this->recv_GetVideoSourceConfigurationOptions(trt__GetVideoSourceConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoSourceConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoSourceConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceConfigurationOptions *trt__GetVideoSourceConfigurationOptions);
/// Web service asynchronous operation 'recv_GetVideoSourceConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoSourceConfigurationOptions(_trt__GetVideoSourceConfigurationOptionsResponse &trt__GetVideoSourceConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetVideoEncoderConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfigurationOptions(_trt__GetVideoEncoderConfigurationOptions *trt__GetVideoEncoderConfigurationOptions, _trt__GetVideoEncoderConfigurationOptionsResponse &trt__GetVideoEncoderConfigurationOptionsResponse) { return this->GetVideoEncoderConfigurationOptions(NULL, NULL, trt__GetVideoEncoderConfigurationOptions, trt__GetVideoEncoderConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetVideoEncoderConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoEncoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfigurationOptions *trt__GetVideoEncoderConfigurationOptions, _trt__GetVideoEncoderConfigurationOptionsResponse &trt__GetVideoEncoderConfigurationOptionsResponse) { return this->send_GetVideoEncoderConfigurationOptions(soap_endpoint_url, soap_action, trt__GetVideoEncoderConfigurationOptions) || this->recv_GetVideoEncoderConfigurationOptions(trt__GetVideoEncoderConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoEncoderConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoEncoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoEncoderConfigurationOptions *trt__GetVideoEncoderConfigurationOptions);
/// Web service asynchronous operation 'recv_GetVideoEncoderConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoEncoderConfigurationOptions(_trt__GetVideoEncoderConfigurationOptionsResponse &trt__GetVideoEncoderConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetAudioSourceConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfigurationOptions(_trt__GetAudioSourceConfigurationOptions *trt__GetAudioSourceConfigurationOptions, _trt__GetAudioSourceConfigurationOptionsResponse &trt__GetAudioSourceConfigurationOptionsResponse) { return this->GetAudioSourceConfigurationOptions(NULL, NULL, trt__GetAudioSourceConfigurationOptions, trt__GetAudioSourceConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetAudioSourceConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioSourceConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfigurationOptions *trt__GetAudioSourceConfigurationOptions, _trt__GetAudioSourceConfigurationOptionsResponse &trt__GetAudioSourceConfigurationOptionsResponse) { return this->send_GetAudioSourceConfigurationOptions(soap_endpoint_url, soap_action, trt__GetAudioSourceConfigurationOptions) || this->recv_GetAudioSourceConfigurationOptions(trt__GetAudioSourceConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioSourceConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioSourceConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioSourceConfigurationOptions *trt__GetAudioSourceConfigurationOptions);
/// Web service asynchronous operation 'recv_GetAudioSourceConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioSourceConfigurationOptions(_trt__GetAudioSourceConfigurationOptionsResponse &trt__GetAudioSourceConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetAudioEncoderConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfigurationOptions(_trt__GetAudioEncoderConfigurationOptions *trt__GetAudioEncoderConfigurationOptions, _trt__GetAudioEncoderConfigurationOptionsResponse &trt__GetAudioEncoderConfigurationOptionsResponse) { return this->GetAudioEncoderConfigurationOptions(NULL, NULL, trt__GetAudioEncoderConfigurationOptions, trt__GetAudioEncoderConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetAudioEncoderConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioEncoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfigurationOptions *trt__GetAudioEncoderConfigurationOptions, _trt__GetAudioEncoderConfigurationOptionsResponse &trt__GetAudioEncoderConfigurationOptionsResponse) { return this->send_GetAudioEncoderConfigurationOptions(soap_endpoint_url, soap_action, trt__GetAudioEncoderConfigurationOptions) || this->recv_GetAudioEncoderConfigurationOptions(trt__GetAudioEncoderConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioEncoderConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioEncoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioEncoderConfigurationOptions *trt__GetAudioEncoderConfigurationOptions);
/// Web service asynchronous operation 'recv_GetAudioEncoderConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioEncoderConfigurationOptions(_trt__GetAudioEncoderConfigurationOptionsResponse &trt__GetAudioEncoderConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetMetadataConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfigurationOptions(_trt__GetMetadataConfigurationOptions *trt__GetMetadataConfigurationOptions, _trt__GetMetadataConfigurationOptionsResponse &trt__GetMetadataConfigurationOptionsResponse) { return this->GetMetadataConfigurationOptions(NULL, NULL, trt__GetMetadataConfigurationOptions, trt__GetMetadataConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetMetadataConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetMetadataConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfigurationOptions *trt__GetMetadataConfigurationOptions, _trt__GetMetadataConfigurationOptionsResponse &trt__GetMetadataConfigurationOptionsResponse) { return this->send_GetMetadataConfigurationOptions(soap_endpoint_url, soap_action, trt__GetMetadataConfigurationOptions) || this->recv_GetMetadataConfigurationOptions(trt__GetMetadataConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetMetadataConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetMetadataConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetMetadataConfigurationOptions *trt__GetMetadataConfigurationOptions);
/// Web service asynchronous operation 'recv_GetMetadataConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetMetadataConfigurationOptions(_trt__GetMetadataConfigurationOptionsResponse &trt__GetMetadataConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetAudioOutputConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfigurationOptions(_trt__GetAudioOutputConfigurationOptions *trt__GetAudioOutputConfigurationOptions, _trt__GetAudioOutputConfigurationOptionsResponse &trt__GetAudioOutputConfigurationOptionsResponse) { return this->GetAudioOutputConfigurationOptions(NULL, NULL, trt__GetAudioOutputConfigurationOptions, trt__GetAudioOutputConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetAudioOutputConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioOutputConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfigurationOptions *trt__GetAudioOutputConfigurationOptions, _trt__GetAudioOutputConfigurationOptionsResponse &trt__GetAudioOutputConfigurationOptionsResponse) { return this->send_GetAudioOutputConfigurationOptions(soap_endpoint_url, soap_action, trt__GetAudioOutputConfigurationOptions) || this->recv_GetAudioOutputConfigurationOptions(trt__GetAudioOutputConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioOutputConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioOutputConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioOutputConfigurationOptions *trt__GetAudioOutputConfigurationOptions);
/// Web service asynchronous operation 'recv_GetAudioOutputConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioOutputConfigurationOptions(_trt__GetAudioOutputConfigurationOptionsResponse &trt__GetAudioOutputConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetAudioDecoderConfigurationOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfigurationOptions(_trt__GetAudioDecoderConfigurationOptions *trt__GetAudioDecoderConfigurationOptions, _trt__GetAudioDecoderConfigurationOptionsResponse &trt__GetAudioDecoderConfigurationOptionsResponse) { return this->GetAudioDecoderConfigurationOptions(NULL, NULL, trt__GetAudioDecoderConfigurationOptions, trt__GetAudioDecoderConfigurationOptionsResponse); }
/// Web service synchronous operation 'GetAudioDecoderConfigurationOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetAudioDecoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfigurationOptions *trt__GetAudioDecoderConfigurationOptions, _trt__GetAudioDecoderConfigurationOptionsResponse &trt__GetAudioDecoderConfigurationOptionsResponse) { return this->send_GetAudioDecoderConfigurationOptions(soap_endpoint_url, soap_action, trt__GetAudioDecoderConfigurationOptions) || this->recv_GetAudioDecoderConfigurationOptions(trt__GetAudioDecoderConfigurationOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetAudioDecoderConfigurationOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetAudioDecoderConfigurationOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetAudioDecoderConfigurationOptions *trt__GetAudioDecoderConfigurationOptions);
/// Web service asynchronous operation 'recv_GetAudioDecoderConfigurationOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetAudioDecoderConfigurationOptions(_trt__GetAudioDecoderConfigurationOptionsResponse &trt__GetAudioDecoderConfigurationOptionsResponse);
//
/// Web service synchronous operation 'GetGuaranteedNumberOfVideoEncoderInstances' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetGuaranteedNumberOfVideoEncoderInstances(_trt__GetGuaranteedNumberOfVideoEncoderInstances *trt__GetGuaranteedNumberOfVideoEncoderInstances, _trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse &trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse) { return this->GetGuaranteedNumberOfVideoEncoderInstances(NULL, NULL, trt__GetGuaranteedNumberOfVideoEncoderInstances, trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse); }
/// Web service synchronous operation 'GetGuaranteedNumberOfVideoEncoderInstances' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetGuaranteedNumberOfVideoEncoderInstances(const char *soap_endpoint_url, const char *soap_action, _trt__GetGuaranteedNumberOfVideoEncoderInstances *trt__GetGuaranteedNumberOfVideoEncoderInstances, _trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse &trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse) { return this->send_GetGuaranteedNumberOfVideoEncoderInstances(soap_endpoint_url, soap_action, trt__GetGuaranteedNumberOfVideoEncoderInstances) || this->recv_GetGuaranteedNumberOfVideoEncoderInstances(trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetGuaranteedNumberOfVideoEncoderInstances' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetGuaranteedNumberOfVideoEncoderInstances(const char *soap_endpoint_url, const char *soap_action, _trt__GetGuaranteedNumberOfVideoEncoderInstances *trt__GetGuaranteedNumberOfVideoEncoderInstances);
/// Web service asynchronous operation 'recv_GetGuaranteedNumberOfVideoEncoderInstances' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetGuaranteedNumberOfVideoEncoderInstances(_trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse &trt__GetGuaranteedNumberOfVideoEncoderInstancesResponse);
//
/// Web service synchronous operation 'GetStreamUri' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetStreamUri(_trt__GetStreamUri *trt__GetStreamUri, _trt__GetStreamUriResponse &trt__GetStreamUriResponse) { return this->GetStreamUri(NULL, NULL, trt__GetStreamUri, trt__GetStreamUriResponse); }
/// Web service synchronous operation 'GetStreamUri' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetStreamUri(const char *soap_endpoint_url, const char *soap_action, _trt__GetStreamUri *trt__GetStreamUri, _trt__GetStreamUriResponse &trt__GetStreamUriResponse) { return this->send_GetStreamUri(soap_endpoint_url, soap_action, trt__GetStreamUri) || this->recv_GetStreamUri(trt__GetStreamUriResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetStreamUri' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetStreamUri(const char *soap_endpoint_url, const char *soap_action, _trt__GetStreamUri *trt__GetStreamUri);
/// Web service asynchronous operation 'recv_GetStreamUri' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetStreamUri(_trt__GetStreamUriResponse &trt__GetStreamUriResponse);
//
/// Web service synchronous operation 'StartMulticastStreaming' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int StartMulticastStreaming(_trt__StartMulticastStreaming *trt__StartMulticastStreaming, _trt__StartMulticastStreamingResponse &trt__StartMulticastStreamingResponse) { return this->StartMulticastStreaming(NULL, NULL, trt__StartMulticastStreaming, trt__StartMulticastStreamingResponse); }
/// Web service synchronous operation 'StartMulticastStreaming' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int StartMulticastStreaming(const char *soap_endpoint_url, const char *soap_action, _trt__StartMulticastStreaming *trt__StartMulticastStreaming, _trt__StartMulticastStreamingResponse &trt__StartMulticastStreamingResponse) { return this->send_StartMulticastStreaming(soap_endpoint_url, soap_action, trt__StartMulticastStreaming) || this->recv_StartMulticastStreaming(trt__StartMulticastStreamingResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_StartMulticastStreaming' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_StartMulticastStreaming(const char *soap_endpoint_url, const char *soap_action, _trt__StartMulticastStreaming *trt__StartMulticastStreaming);
/// Web service asynchronous operation 'recv_StartMulticastStreaming' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_StartMulticastStreaming(_trt__StartMulticastStreamingResponse &trt__StartMulticastStreamingResponse);
//
/// Web service synchronous operation 'StopMulticastStreaming' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int StopMulticastStreaming(_trt__StopMulticastStreaming *trt__StopMulticastStreaming, _trt__StopMulticastStreamingResponse &trt__StopMulticastStreamingResponse) { return this->StopMulticastStreaming(NULL, NULL, trt__StopMulticastStreaming, trt__StopMulticastStreamingResponse); }
/// Web service synchronous operation 'StopMulticastStreaming' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int StopMulticastStreaming(const char *soap_endpoint_url, const char *soap_action, _trt__StopMulticastStreaming *trt__StopMulticastStreaming, _trt__StopMulticastStreamingResponse &trt__StopMulticastStreamingResponse) { return this->send_StopMulticastStreaming(soap_endpoint_url, soap_action, trt__StopMulticastStreaming) || this->recv_StopMulticastStreaming(trt__StopMulticastStreamingResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_StopMulticastStreaming' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_StopMulticastStreaming(const char *soap_endpoint_url, const char *soap_action, _trt__StopMulticastStreaming *trt__StopMulticastStreaming);
/// Web service asynchronous operation 'recv_StopMulticastStreaming' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_StopMulticastStreaming(_trt__StopMulticastStreamingResponse &trt__StopMulticastStreamingResponse);
//
/// Web service synchronous operation 'SetSynchronizationPoint' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetSynchronizationPoint(_trt__SetSynchronizationPoint *trt__SetSynchronizationPoint, _trt__SetSynchronizationPointResponse &trt__SetSynchronizationPointResponse) { return this->SetSynchronizationPoint(NULL, NULL, trt__SetSynchronizationPoint, trt__SetSynchronizationPointResponse); }
/// Web service synchronous operation 'SetSynchronizationPoint' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetSynchronizationPoint(const char *soap_endpoint_url, const char *soap_action, _trt__SetSynchronizationPoint *trt__SetSynchronizationPoint, _trt__SetSynchronizationPointResponse &trt__SetSynchronizationPointResponse) { return this->send_SetSynchronizationPoint(soap_endpoint_url, soap_action, trt__SetSynchronizationPoint) || this->recv_SetSynchronizationPoint(trt__SetSynchronizationPointResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetSynchronizationPoint' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetSynchronizationPoint(const char *soap_endpoint_url, const char *soap_action, _trt__SetSynchronizationPoint *trt__SetSynchronizationPoint);
/// Web service asynchronous operation 'recv_SetSynchronizationPoint' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetSynchronizationPoint(_trt__SetSynchronizationPointResponse &trt__SetSynchronizationPointResponse);
//
/// Web service synchronous operation 'GetSnapshotUri' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetSnapshotUri(_trt__GetSnapshotUri *trt__GetSnapshotUri, _trt__GetSnapshotUriResponse &trt__GetSnapshotUriResponse) { return this->GetSnapshotUri(NULL, NULL, trt__GetSnapshotUri, trt__GetSnapshotUriResponse); }
/// Web service synchronous operation 'GetSnapshotUri' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetSnapshotUri(const char *soap_endpoint_url, const char *soap_action, _trt__GetSnapshotUri *trt__GetSnapshotUri, _trt__GetSnapshotUriResponse &trt__GetSnapshotUriResponse) { return this->send_GetSnapshotUri(soap_endpoint_url, soap_action, trt__GetSnapshotUri) || this->recv_GetSnapshotUri(trt__GetSnapshotUriResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetSnapshotUri' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetSnapshotUri(const char *soap_endpoint_url, const char *soap_action, _trt__GetSnapshotUri *trt__GetSnapshotUri);
/// Web service asynchronous operation 'recv_GetSnapshotUri' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetSnapshotUri(_trt__GetSnapshotUriResponse &trt__GetSnapshotUriResponse);
//
/// Web service synchronous operation 'GetVideoSourceModes' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceModes(_trt__GetVideoSourceModes *trt__GetVideoSourceModes, _trt__GetVideoSourceModesResponse &trt__GetVideoSourceModesResponse) { return this->GetVideoSourceModes(NULL, NULL, trt__GetVideoSourceModes, trt__GetVideoSourceModesResponse); }
/// Web service synchronous operation 'GetVideoSourceModes' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetVideoSourceModes(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceModes *trt__GetVideoSourceModes, _trt__GetVideoSourceModesResponse &trt__GetVideoSourceModesResponse) { return this->send_GetVideoSourceModes(soap_endpoint_url, soap_action, trt__GetVideoSourceModes) || this->recv_GetVideoSourceModes(trt__GetVideoSourceModesResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetVideoSourceModes' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetVideoSourceModes(const char *soap_endpoint_url, const char *soap_action, _trt__GetVideoSourceModes *trt__GetVideoSourceModes);
/// Web service asynchronous operation 'recv_GetVideoSourceModes' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetVideoSourceModes(_trt__GetVideoSourceModesResponse &trt__GetVideoSourceModesResponse);
//
/// Web service synchronous operation 'SetVideoSourceMode' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoSourceMode(_trt__SetVideoSourceMode *trt__SetVideoSourceMode, _trt__SetVideoSourceModeResponse &trt__SetVideoSourceModeResponse) { return this->SetVideoSourceMode(NULL, NULL, trt__SetVideoSourceMode, trt__SetVideoSourceModeResponse); }
/// Web service synchronous operation 'SetVideoSourceMode' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetVideoSourceMode(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoSourceMode *trt__SetVideoSourceMode, _trt__SetVideoSourceModeResponse &trt__SetVideoSourceModeResponse) { return this->send_SetVideoSourceMode(soap_endpoint_url, soap_action, trt__SetVideoSourceMode) || this->recv_SetVideoSourceMode(trt__SetVideoSourceModeResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetVideoSourceMode' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetVideoSourceMode(const char *soap_endpoint_url, const char *soap_action, _trt__SetVideoSourceMode *trt__SetVideoSourceMode);
/// Web service asynchronous operation 'recv_SetVideoSourceMode' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetVideoSourceMode(_trt__SetVideoSourceModeResponse &trt__SetVideoSourceModeResponse);
//
/// Web service synchronous operation 'GetOSDs' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetOSDs(_trt__GetOSDs *trt__GetOSDs, _trt__GetOSDsResponse &trt__GetOSDsResponse) { return this->GetOSDs(NULL, NULL, trt__GetOSDs, trt__GetOSDsResponse); }
/// Web service synchronous operation 'GetOSDs' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetOSDs(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSDs *trt__GetOSDs, _trt__GetOSDsResponse &trt__GetOSDsResponse) { return this->send_GetOSDs(soap_endpoint_url, soap_action, trt__GetOSDs) || this->recv_GetOSDs(trt__GetOSDsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetOSDs' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetOSDs(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSDs *trt__GetOSDs);
/// Web service asynchronous operation 'recv_GetOSDs' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetOSDs(_trt__GetOSDsResponse &trt__GetOSDsResponse);
//
/// Web service synchronous operation 'GetOSD' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetOSD(_trt__GetOSD *trt__GetOSD, _trt__GetOSDResponse &trt__GetOSDResponse) { return this->GetOSD(NULL, NULL, trt__GetOSD, trt__GetOSDResponse); }
/// Web service synchronous operation 'GetOSD' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetOSD(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSD *trt__GetOSD, _trt__GetOSDResponse &trt__GetOSDResponse) { return this->send_GetOSD(soap_endpoint_url, soap_action, trt__GetOSD) || this->recv_GetOSD(trt__GetOSDResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetOSD' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetOSD(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSD *trt__GetOSD);
/// Web service asynchronous operation 'recv_GetOSD' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetOSD(_trt__GetOSDResponse &trt__GetOSDResponse);
//
/// Web service synchronous operation 'GetOSDOptions' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int GetOSDOptions(_trt__GetOSDOptions *trt__GetOSDOptions, _trt__GetOSDOptionsResponse &trt__GetOSDOptionsResponse) { return this->GetOSDOptions(NULL, NULL, trt__GetOSDOptions, trt__GetOSDOptionsResponse); }
/// Web service synchronous operation 'GetOSDOptions' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int GetOSDOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSDOptions *trt__GetOSDOptions, _trt__GetOSDOptionsResponse &trt__GetOSDOptionsResponse) { return this->send_GetOSDOptions(soap_endpoint_url, soap_action, trt__GetOSDOptions) || this->recv_GetOSDOptions(trt__GetOSDOptionsResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_GetOSDOptions' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_GetOSDOptions(const char *soap_endpoint_url, const char *soap_action, _trt__GetOSDOptions *trt__GetOSDOptions);
/// Web service asynchronous operation 'recv_GetOSDOptions' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_GetOSDOptions(_trt__GetOSDOptionsResponse &trt__GetOSDOptionsResponse);
//
/// Web service synchronous operation 'SetOSD' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int SetOSD(_trt__SetOSD *trt__SetOSD, _trt__SetOSDResponse &trt__SetOSDResponse) { return this->SetOSD(NULL, NULL, trt__SetOSD, trt__SetOSDResponse); }
/// Web service synchronous operation 'SetOSD' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int SetOSD(const char *soap_endpoint_url, const char *soap_action, _trt__SetOSD *trt__SetOSD, _trt__SetOSDResponse &trt__SetOSDResponse) { return this->send_SetOSD(soap_endpoint_url, soap_action, trt__SetOSD) || this->recv_SetOSD(trt__SetOSDResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_SetOSD' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_SetOSD(const char *soap_endpoint_url, const char *soap_action, _trt__SetOSD *trt__SetOSD);
/// Web service asynchronous operation 'recv_SetOSD' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_SetOSD(_trt__SetOSDResponse &trt__SetOSDResponse);
//
/// Web service synchronous operation 'CreateOSD' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int CreateOSD(_trt__CreateOSD *trt__CreateOSD, _trt__CreateOSDResponse &trt__CreateOSDResponse) { return this->CreateOSD(NULL, NULL, trt__CreateOSD, trt__CreateOSDResponse); }
/// Web service synchronous operation 'CreateOSD' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int CreateOSD(const char *soap_endpoint_url, const char *soap_action, _trt__CreateOSD *trt__CreateOSD, _trt__CreateOSDResponse &trt__CreateOSDResponse) { return this->send_CreateOSD(soap_endpoint_url, soap_action, trt__CreateOSD) || this->recv_CreateOSD(trt__CreateOSDResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_CreateOSD' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_CreateOSD(const char *soap_endpoint_url, const char *soap_action, _trt__CreateOSD *trt__CreateOSD);
/// Web service asynchronous operation 'recv_CreateOSD' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_CreateOSD(_trt__CreateOSDResponse &trt__CreateOSDResponse);
//
/// Web service synchronous operation 'DeleteOSD' with default endpoint and default SOAP Action header, returns SOAP_OK or error code
virtual int DeleteOSD(_trt__DeleteOSD *trt__DeleteOSD, _trt__DeleteOSDResponse &trt__DeleteOSDResponse) { return this->DeleteOSD(NULL, NULL, trt__DeleteOSD, trt__DeleteOSDResponse); }
/// Web service synchronous operation 'DeleteOSD' to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int DeleteOSD(const char *soap_endpoint_url, const char *soap_action, _trt__DeleteOSD *trt__DeleteOSD, _trt__DeleteOSDResponse &trt__DeleteOSDResponse) { return this->send_DeleteOSD(soap_endpoint_url, soap_action, trt__DeleteOSD) || this->recv_DeleteOSD(trt__DeleteOSDResponse) ? this->soap->error : SOAP_OK; }
/// Web service asynchronous operation 'send_DeleteOSD' to send a request message to the specified endpoint and SOAP Action header, returns SOAP_OK or error code
virtual int send_DeleteOSD(const char *soap_endpoint_url, const char *soap_action, _trt__DeleteOSD *trt__DeleteOSD);
/// Web service asynchronous operation 'recv_DeleteOSD' to receive a response message from the connected endpoint, returns SOAP_OK or error code
virtual int recv_DeleteOSD(_trt__DeleteOSDResponse &trt__DeleteOSDResponse);
};
#endif
| [
"arteshchuk@gmail.com"
] | arteshchuk@gmail.com |
168b621a636c9c93f749ae149f7e8d0bad9e1fcd | d0e8caf30912e096a35071c7c550ef59ae410606 | /maxOf3Num.cpp | 27c8556aba2f91293bd97ecc35a71fc81b0835fe | [] | no_license | geekyprawins/towards-cpp | 8db4e5def357a7517107bfc92d2947fd304afa79 | 6662897999afefbd315790d2ed11029693fccdaf | refs/heads/master | 2023-06-21T23:39:43.613881 | 2021-07-21T15:36:53 | 2021-07-21T15:36:53 | 373,852,103 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 497 | cpp | #include <iostream>
using namespace std;
int main()
{
int a, b, c, maxof3;
cin >> a >> b >> c;
if (a > b)
{
if (a > c)
{
maxof3 = a;
}
else
{
maxof3 = c;
}
}
else
{
if (b > c)
{
maxof3 = b;
}
else
{
maxof3 = c;
}
}
cout << "The max of " << a << " ," << b << " ," << c << " is " << maxof3 << endl;
return 0;
}
| [
"swamiraju.varma@learner.manipal.edu"
] | swamiraju.varma@learner.manipal.edu |
b38f3c422ba8e251953e582e40c6964c49181b4b | d9a66840bf09cb926de8ee1749a47acc11bcdd05 | /old2/contest/AtCoder/abc018/A.cpp | 4d1ab4ca288f071b81f7fabf9bcf7586bc321336 | [
"Unlicense"
] | permissive | not522/CompetitiveProgramming | b632603a49d3fec5e0815458bd2c5f355e96a84f | a900a09bf1057d37d08ddc7090a9c8b8f099dc74 | refs/heads/master | 2023-05-12T12:14:57.888297 | 2023-05-07T07:36:29 | 2023-05-07T07:36:29 | 129,512,758 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 149 | cpp | #include "vector.hpp"
int main() {
Vector<int> a(3, in);
for (int i : a) {
cout << a.count_if([i](int n) { return i <= n; }) << endl;
}
}
| [
"mizuno@eps.s.u-tokyo.ac.jp"
] | mizuno@eps.s.u-tokyo.ac.jp |
37026cf3c8da080f3385fcf727c5467e32ba6adf | 1ad310fc8abf44dbcb99add43f6c6b4c97a3767c | /samples_c++/cc/turtlebot/avoid.cc | 17d568c134ae998aa5990b72dc6d43edcc25ebb7 | [] | no_license | Jazzinghen/spamOSEK | fed44979b86149809f0fe70355f2117e9cb954f3 | 7223a2fb78401e1d9fa96ecaa2323564c765c970 | refs/heads/master | 2020-06-01T03:55:48.113095 | 2010-05-19T14:37:30 | 2010-05-19T14:37:30 | 580,640 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 3,299 | cc | //
// avoid.cc
//
// Test of C++ and LEJOS-OSEK with TurtleBot II
//
// Written 20-jan-2008 by rwk
//
// Copyright 2007, 2008 by Takashi Chikamasa and Robert W. Kramer
//
#include <Motor.h>
#include <SonarSensor.h>
//
// To properly interface with LEJOS-OSEK, we need to use C linkage between our
// code and LEJOS-OSEK
//
extern "C" {
#include "ecrobot_interface.h"
// Port configration for Sensor and Motor
Motor leftMotor(NXT_PORT_A);
Motor rightMotor(NXT_PORT_B);
SonarSensor sonar(NXT_PORT_S1);
//
// Main task (thread) declarations
//
// You need one DeclareTask( ) per task/thread
//
DeclareTask(LeftMotorTask);
DeclareTask(RightMotorTask);
DeclareTask(SonarTask);
//
// LEJOS OSEK callback hooks
//
void ecrobot_device_initialize(void)
{
sonar.activate();
}
void ecrobot_device_terminate(void)
{
sonar.passivate();
}
//===========================================================================
// User tasks go here.
//
enum { FORWARD,BACKWARD,LEFT_TURN,RIGHT_TURN,STOP };
int robotAction = FORWARD;
void showMessage(char* msg)
{
display_clear(0);
display_goto_xy(0, 0);
display_string(msg);
display_update();
}
TASK(LeftMotorTask)
{
leftMotor.setPower(75);
if (robotAction == FORWARD || robotAction == RIGHT_TURN)
{
leftMotor.forward();
}
else if (robotAction != STOP)
{
leftMotor.backward();
}
else
{
leftMotor.flt();
}
//
// your task should end like this unless it's a one-shot task
//
TaskType t;
GetTaskID(&t);
ChainTask(t);
}
TASK(RightMotorTask)
{
rightMotor.setPower(75);
if (robotAction == FORWARD || robotAction == LEFT_TURN)
{
rightMotor.forward();
}
else if (robotAction != STOP)
{
rightMotor.backward();
}
else
{
rightMotor.flt();
}
//
// your task should end like this unless it's a one-shot task
//
TaskType t;
GetTaskID(&t);
ChainTask(t);
}
TASK(SonarTask)
{
int d = sonar.getDistance();
if (d < 18)
{
robotAction = STOP;
showMessage("STOP");
sleep(250);
robotAction = BACKWARD;
showMessage("BACKWARD");
sleep(500);
robotAction = STOP;
showMessage("STOP");
sleep(250);
robotAction = LEFT_TURN;
showMessage("LEFT_TURN");
sleep(750);
robotAction = STOP;
showMessage("STOP");
sleep(250);
d = sonar.getDistance();
robotAction = RIGHT_TURN;
showMessage("RIGHT_TURN");
sleep(1500);
robotAction = STOP;
showMessage("STOP");
sleep(250);
if (d > sonar.getDistance())
{
robotAction = LEFT_TURN;
showMessage("LEFT_TURN");
sleep(1500);
robotAction = STOP;
showMessage("STOP");
sleep(250);
}
}
robotAction = FORWARD;
showMessage("FORWARD");
//
// your task should end like this unless it's a one-shot task
//
TaskType t;
GetTaskID(&t);
ChainTask(t);
}
}
| [
"jazzinghen@Jehuty.(none)"
] | jazzinghen@Jehuty.(none) |
030d96942c874aa5e3e97c60e23de8679f6a2445 | b437086cb1c76af82e408ae60119e8119e7d0ddf | /make_stuff/make_3/unary.h | 1f1dde018fb741eea73b5001dd6a797bac1a7e68 | [] | no_license | Zyoto/Demo | ea2eb76a007b8321eefdf30e3ce385be55a36cf5 | 501476aeb0ef2d66b074ccdd54daf3e3cc66a787 | refs/heads/master | 2016-09-03T03:18:06.165419 | 2013-09-27T16:51:35 | 2013-09-27T16:51:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 535 | h | #ifndef _UNARY_H
#define _UNARY_H
#include <ostream>
#include <string>
using namespace std;
struct Expression;
typedef Expression * ExPtr;
enum UnOp {NEGATION, PAREN, BRACES, BRACKETS};
struct UnaryStmt {
UnOp oper;
ExPtr val;
};
#include "expr.h"
ExPtr NewUnExp(UnOp op, ExPtr a);
void Obliterate(UnaryStmt &);
bool Evaluate(const UnaryStmt &);
ostream& operator << (ostream &, const UnaryStmt &);
ostream& operator << (ostream &, const UnOp &);
string to_string(const UnaryStmt &);
string to_string(const UnOp &);
#endif
| [
"BrettSquared@gmail.com"
] | BrettSquared@gmail.com |
526251b42c2f9d09ad30d693f93d1d67958ff1c4 | 45c84e64a486a3c48bd41a78e28252acbc0cc1b0 | /src/net/http/alternative_service.h | 01cf43f19d89afa5bf7d833738844a8e4754e16c | [
"BSD-3-Clause",
"MIT"
] | permissive | stanleywxc/chromium-noupdator | 47f9cccc6256b1e5b0cb22c598b7a86f5453eb42 | 637f32e9bf9079f31430c9aa9c64a75247993a71 | refs/heads/master | 2022-12-03T22:00:20.940455 | 2019-10-04T16:29:31 | 2019-10-04T16:29:31 | 212,851,250 | 1 | 2 | MIT | 2022-11-17T09:51:04 | 2019-10-04T15:49:33 | null | UTF-8 | C++ | false | false | 7,713 | h | // Copyright (c) 2012 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.
#ifndef NET_HTTP_ALTERNATIVE_SERVICE_H_
#define NET_HTTP_ALTERNATIVE_SERVICE_H_
#include <stdint.h>
#include <algorithm>
#include <ostream>
#include <string>
#include "base/time/time.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_export.h"
#include "net/base/port_util.h"
#include "net/quic/quic_http_utils.h"
#include "net/socket/next_proto.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
namespace net {
enum AlternateProtocolUsage {
// Alternate Protocol was used without racing a normal connection.
ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0,
// Alternate Protocol was used by winning a race with a normal connection.
ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1,
// Alternate Protocol was not used by losing a race with a normal connection.
ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2,
// Alternate Protocol was not used because no Alternate-Protocol information
// was available when the request was issued, but an Alternate-Protocol header
// was present in the response.
ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3,
// Alternate Protocol was not used because it was marked broken.
ALTERNATE_PROTOCOL_USAGE_BROKEN = 4,
// Maximum value for the enum.
ALTERNATE_PROTOCOL_USAGE_MAX,
};
// Log a histogram to reflect |usage|.
NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage,
bool proxy_server_used);
enum BrokenAlternateProtocolLocation {
BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB = 0,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_ALT = 2,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_MAIN = 3,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_HTTP_STREAM = 4,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_NETWORK_TRANSACTION = 5,
BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX,
};
// Log a histogram to reflect |location|.
NET_EXPORT void HistogramBrokenAlternateProtocolLocation(
BrokenAlternateProtocolLocation location);
// Returns true if |protocol| is a valid protocol.
NET_EXPORT bool IsAlternateProtocolValid(NextProto protocol);
// Returns true if |protocol| is enabled, based on |is_http2_enabled|
// and |is_quic_enabled|..
NET_EXPORT bool IsProtocolEnabled(NextProto protocol,
bool is_http2_enabled,
bool is_quic_enabled);
// (protocol, host, port) triple as defined in
// https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html
//
// TODO(mmenke): Seems like most of this stuff should be de-inlined.
struct NET_EXPORT AlternativeService {
AlternativeService() : protocol(kProtoUnknown), host(), port(0) {}
AlternativeService(NextProto protocol, const std::string& host, uint16_t port)
: protocol(protocol), host(host), port(port) {}
AlternativeService(NextProto protocol, const HostPortPair& host_port_pair)
: protocol(protocol),
host(host_port_pair.host()),
port(host_port_pair.port()) {}
AlternativeService(const AlternativeService& alternative_service) = default;
AlternativeService& operator=(const AlternativeService& alternative_service) =
default;
HostPortPair host_port_pair() const { return HostPortPair(host, port); }
bool operator==(const AlternativeService& other) const {
return protocol == other.protocol && host == other.host &&
port == other.port;
}
bool operator!=(const AlternativeService& other) const {
return !this->operator==(other);
}
bool operator<(const AlternativeService& other) const {
return std::tie(protocol, host, port) <
std::tie(other.protocol, other.host, other.port);
}
// Output format: "protocol host:port", e.g. "h2 www.google.com:1234".
std::string ToString() const;
NextProto protocol;
std::string host;
uint16_t port;
};
NET_EXPORT_PRIVATE std::ostream& operator<<(
std::ostream& os,
const AlternativeService& alternative_service);
class NET_EXPORT_PRIVATE AlternativeServiceInfo {
public:
static AlternativeServiceInfo CreateHttp2AlternativeServiceInfo(
const AlternativeService& alternative_service,
base::Time expiration);
static AlternativeServiceInfo CreateQuicAlternativeServiceInfo(
const AlternativeService& alternative_service,
base::Time expiration,
const quic::ParsedQuicVersionVector& advertised_versions);
AlternativeServiceInfo();
~AlternativeServiceInfo();
AlternativeServiceInfo(
const AlternativeServiceInfo& alternative_service_info);
AlternativeServiceInfo& operator=(
const AlternativeServiceInfo& alternative_service_info);
bool operator==(const AlternativeServiceInfo& other) const {
return alternative_service_ == other.alternative_service() &&
expiration_ == other.expiration() &&
advertised_versions_ == other.advertised_versions();
}
bool operator!=(const AlternativeServiceInfo& other) const {
return !this->operator==(other);
}
std::string ToString() const;
void set_alternative_service(const AlternativeService& alternative_service) {
alternative_service_ = alternative_service;
}
void set_protocol(const NextProto& protocol) {
alternative_service_.protocol = protocol;
}
void set_host(const std::string& host) { alternative_service_.host = host; }
void set_port(uint16_t port) { alternative_service_.port = port; }
void set_expiration(const base::Time& expiration) {
expiration_ = expiration;
}
void set_advertised_versions(
const quic::ParsedQuicVersionVector& advertised_versions) {
if (alternative_service_.protocol != kProtoQUIC)
return;
advertised_versions_ = advertised_versions;
std::sort(advertised_versions_.begin(), advertised_versions_.end(),
TransportVersionLessThan);
}
const AlternativeService& alternative_service() const {
return alternative_service_;
}
NextProto protocol() const { return alternative_service_.protocol; }
HostPortPair host_port_pair() const {
return alternative_service_.host_port_pair();
}
base::Time expiration() const { return expiration_; }
const quic::ParsedQuicVersionVector& advertised_versions() const {
return advertised_versions_;
}
private:
AlternativeServiceInfo(
const AlternativeService& alternative_service,
base::Time expiration,
const quic::ParsedQuicVersionVector& advertised_versions);
static bool TransportVersionLessThan(const quic::ParsedQuicVersion& lhs,
const quic::ParsedQuicVersion& rhs);
AlternativeService alternative_service_;
base::Time expiration_;
// Lists all the QUIC versions that are advertised by the server and supported
// by Chrome. If empty, defaults to versions used by the current instance of
// the netstack.
// This list MUST be sorted in ascending order.
quic::ParsedQuicVersionVector advertised_versions_;
};
using AlternativeServiceInfoVector = std::vector<AlternativeServiceInfo>;
NET_EXPORT_PRIVATE AlternativeServiceInfoVector ProcessAlternativeServices(
const spdy::SpdyAltSvcWireFormat::AlternativeServiceVector&
alternative_service_vector,
bool is_http2_enabled,
bool is_quic_enabled,
const quic::ParsedQuicVersionVector& supported_quic_versions,
bool support_ietf_format_quic_altsvc);
} // namespace net
#endif // NET_HTTP_ALTERNATIVE_SERVICE_H_
| [
"stanley@moon.lan"
] | stanley@moon.lan |
3e8c30c7f810a70cccd16bc194d2fe34d8b6cbf8 | 1b34eca216ede574a47747a396f8dd9fa37eab8a | /example_01_simple_measurement/example_01_simple_measurement.ino | 88adc4b30d3f062b878c39f8658bc2ed336cf100 | [] | no_license | 14CORE/arduino-liquid-flow-snippets | d77b05ebac9df87285ead6875ec56ee67ef10463 | f7d53683a53613a48fa1822d64454ab98d9abd60 | refs/heads/master | 2021-06-22T05:10:41.480855 | 2017-08-11T20:14:29 | 2017-08-11T20:30:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,963 | ino | /*
* Copyright (c) 2017, Sensirion AG
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Sensirion AG 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.
*/
/*******************************************************************************
* Purpose: Example code for the I2C communication with Sensirion Liquid
* Flow Sensors
*
* Read measurements from the sensor
******************************************************************************/
#include <Wire.h> // Arduino library for I2C
const int ADDRESS = 0x40; // Standard address for Liquid Flow Sensors
// -----------------------------------------------------------------------------
// Arduino setup routine, just runs once:
// -----------------------------------------------------------------------------
void setup() {
int ret;
Serial.begin(9600); // initialize serial communication
Wire.begin(); // join i2c bus (address optional for master)
do {
// Soft reset the sensor
Wire.beginTransmission(ADDRESS);
Wire.write(0xFE);
ret = Wire.endTransmission();
if (ret != 0) {
Serial.println("Error while sending soft reset command, retrying...");
}
} while (ret != 0);
delay(50); // wait long enough for chip reset to complete
}
// -----------------------------------------------------------------------------
// The Arduino loop routine runs over and over again forever:
// -----------------------------------------------------------------------------
void loop() {
int ret;
uint16_t raw_sensor_value;
int16_t signed_sensor_value;
// To perform a measurement, first send 0xF1 to switch to measurement mode,
// then read 2 bytes + 1 CRC byte from the sensor.
Wire.beginTransmission(ADDRESS);
Wire.write(0xF1);
ret = Wire.endTransmission();
if (ret != 0) {
Serial.println("Error during write measurement mode command");
} else {
Wire.requestFrom(ADDRESS, 2); // reading 2 bytes ignores the CRC byte
raw_sensor_value = Wire.read() << 8; // read the MSB from the sensor
raw_sensor_value |= Wire.read(); // read the LSB from the sensor
ret = Wire.endTransmission();
if (ret != 0) {
Serial.println("Error while reading flow measurement");
} else {
Serial.print("raw value from sensor: ");
Serial.print(raw_sensor_value);
signed_sensor_value = (int16_t) raw_sensor_value;
Serial.print(", signed value: ");
Serial.println(signed_sensor_value);
}
}
delay(1000); // milliseconds delay between reads (for demo purposes)
}
| [
"andreas.brauchli@sensirion.com"
] | andreas.brauchli@sensirion.com |
71c19fe4884f4cc021a5e6c9640334cc014946fa | 6c48f80a8b74c01ae1edf93547fded5eba26536a | /common/datastructures/alignment/AlignmentMap.h | 16f521cdc8bcd3494562e4ee708c8e9d28eeea99 | [] | no_license | BioinformaticsArchive/blasr | d291d49ca5985399a387b297dd82901af331110f | 2c124a2b3f15d3b9932dffb97009025cbeaec68d | refs/heads/master | 2020-12-25T09:09:39.176768 | 2013-03-12T15:17:43 | 2013-03-12T15:17:43 | 9,436,305 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 835 | h | #ifndef ALIGNMENT_MAP_H_
#define ALIGNMENT_MAP_H_
#include <vector>
#include <string>
using namespace std;
class AlignmentMap {
public:
int qPos, tPos;
vector<int> alignPos;
};
// Build a map of positions from (unaligned) bases to an aligned sequence
void CreateSequenceToAlignmentMap(const string & alignedSequence,
vector<int> & baseToAlignmentMap) {
baseToAlignmentMap.resize(alignedSequence.size());
int alignedPos, unalignedPos;
for (alignedPos=0, unalignedPos=0;
alignedPos < alignedSequence.size();
alignedPos++) {
if (not (alignedSequence[alignedPos] == ' ' or
alignedSequence[alignedPos] == '-')) {
baseToAlignmentMap[unalignedPos] = alignedPos;
unalignedPos++;
}
}
baseToAlignmentMap.resize(unalignedPos);
}
#endif
| [
"dalexander@pacificbiosciences.com"
] | dalexander@pacificbiosciences.com |
cab40c5b9a3a2517918966efce864ac99c7f6530 | 0c5ea74c89c3281691baf85b4692300698b5f155 | /lw4/GeometricShapes/CRectangle.h | b8f2f9ac9bf171632fc514074be2a18bf6b2a945 | [] | no_license | waslost0/oop | 6a3e3032eb8b1833245414023a9734982ae8c928 | 8676ae57700f5e0001bff680d159ddc0166a7d57 | refs/heads/master | 2023-01-14T03:13:25.547846 | 2020-11-10T12:39:18 | 2020-11-10T12:39:18 | 240,909,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 737 | h | #pragma once
#include "CPoint.h"
#include "Const.h"
#include "ISolidShape.h"
class CRectangle : public ISolidShape
{
public:
CRectangle(CPoint& leftTop, const double width, const double height, const std::string outlineColor, const std::string fillColor);
~CRectangle() = default;
double GetArea() const override;
double GetPerimeter() const override;
void PrintInfo(std::ostream& iss) const override;
std::string GetOutlineColor() const override;
std::string GetFillColor() const override;
CPoint GetLeftTop() const;
CPoint GetRightBottom() const;
double GetWidth() const;
double GetHeight() const;
private:
double m_width;
double m_height;
std::string m_fillColor;
std::string m_outlineColor;
CPoint m_leftTop;
}; | [
"marcus.koh16.01.97@gmail.com"
] | marcus.koh16.01.97@gmail.com |
1437ec94ea5c0607185343995d2095c3861f52d9 | 8dbb27e6253b3912b36755746a277013c2698376 | /main.cpp | 6b3d02b13fbebec50cb9741c7c17248a681b4daf | [] | no_license | BielskiGrzegorz/GraMUD | dbd033dfb83df0ce5119c23374e3d8e7cf8e3556 | 28e53c77063a4d83fc832ed6c55bacbb30720f6c | refs/heads/master | 2021-05-09T20:28:57.470151 | 2018-01-24T00:58:42 | 2018-01-24T00:58:42 | 118,691,286 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,416 | cpp | #include "BazaDanych.h"
#include "GameManager.h"
#include "Klasa.h"
#include<iostream>
#include<string>
#include"Postac.h"
#include<conio.h>
#include <windows.h>
using namespace std;
int main()
{
BazaDanych baza;
Postac postac;
GameManager manager;
Wojownik woj;
Mag mag;
Zlodziej zlo;
Palladyn pal;
Klasa *wsk;
wsk = &mag;
string map = "dane/Mapy/mapa.txt";
manager.wczytajMape(map);
baza.wczytaj("dane/BazaDanych.txt");
char wybor,c='b';
for (;;)
{
system("cls");
cout << "c===|[::::::::> Fallen Kingdom XII <::::::::]|===c\n\n ~~MENU~~ \n\n c=|[::> 1) New Game <::]|=c \n\n c=|[::> 2) Continue <::]|=c \n";
cin >> wybor;
switch (wybor)
{
case '1':
{
baza.rejestracja();
system("cls");
baza.zapisz("dane/BazaDanych.txt");
postac.stworz();
postac.zapisz();
wybor = 's';
}
break;
case '2':
{
system("cls");
baza.zaloguj(&postac.login, &postac.dane);
postac.wczytajGre();
wybor = 's';
}
break;
default:
break;
}
if (wybor == 's') break;
}
system("cls");
////////////////////////////////////////
if (postac.klasa == "Mag") wsk = &mag;
if (postac.klasa == "Wojownik") wsk = &woj;
if (postac.klasa == "Palladyn") wsk = &pal;
if (postac.klasa == "Zlodziej") wsk = &zlo;
manager.poruszanie(&postac.x, &postac.y,&postac);
_getch();
return 0;
} | [
"34401813+HajsSieZgadza@users.noreply.github.com"
] | 34401813+HajsSieZgadza@users.noreply.github.com |
3a0de1491aeb864ba858fdbb3515e41aeedccc14 | 0d755c32fc537b937905ea8534add792d1d72c1a | /main.cpp | c78cad33aa7d39e23b1f6ec24b5ffcfddfa989a6 | [] | no_license | pdrmdrs/hashTable | 4e976cfdb92d9e25279287922f30319e01fd8688 | df58f5c92b8e640ed8415d43490e9ac1aa20aadb | refs/heads/master | 2020-12-24T18:23:17.346338 | 2016-04-29T00:40:38 | 2016-04-29T00:40:38 | 57,164,152 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 868 | cpp | //
// main.cpp
// TabelaHash
//
// Created by Eiji Adachi Medeiros Barbosa on 23/04/16.
// Copyright (c) 2016 Eiji Adachi Medeiros Barbosa. All rights reserved.
//
#include "TesteTabela.h"
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
bool passouTeste = testar_Criar();
if(passouTeste)
{
passouTeste = testar_Inserir();
}
if(passouTeste)
{
passouTeste = testar_Remover();
}
if(passouTeste)
{
passouTeste = testar_Buscar();
}
if(passouTeste)
{
passouTeste = testar_Tudo();
}
if(passouTeste)
{
cout << "\nTodos os testes rodaram sem falhas." << endl;
}
else
{
cout << "\nForam encontradas falhas na implementação da Tabela. Ver mensagens de erro acima." << endl;
}
return 0;
}
| [
"pdr_mdrs@hotmail.com"
] | pdr_mdrs@hotmail.com |
863655e382ccfee1cf6e5ead7da4c00dcf7ac220 | ef0f94420944dda7c5c56229a104670c4e7d9471 | /Flocking/Game.h | f51ee94d2f26896171c1fb09295e9d07a6dadd64 | [] | no_license | Laurareilly/Networked-Boids | b2fc0f752e3455c848ee5c4250fe8977243c5884 | 88a21b4254ba817e802cc5af8d3780c92913456d | refs/heads/master | 2021-07-13T07:53:44.292165 | 2017-10-14T03:47:17 | 2017-10-14T03:47:17 | 105,702,684 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,732 | h | #pragma once
#include "RakNet\WindowsIncludes.h"
#include "Trackable.h"
#include "PerformanceTracker.h"
#include "Defines.h"
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_audio.h>
#include <string>
class GraphicsSystem;
class GraphicsBuffer;
class GraphicsBufferManager;
class SpriteManager;
class KinematicUnit;
class GameMessageManager;
class Timer;
class ComponentManager;
class UnitManager;
class Font;
class InputManager;
class HomeScreen;
class ApplicationState;
class ActiveGameState;
const IDType BACKGROUND_SPRITE_ID = 0;
const IDType PLAYER_ICON_SPRITE_ID = 1;
const IDType AI_ICON_SPRITE_ID = 2;
const IDType TARGET_SPRITE_ID = 3;
const float LOOP_TARGET_TIME = 33.3f;//how long should each frame of execution take? 30fps = 33.3ms/frame
class Game:public Trackable
{
public:
Game();
~Game();
bool init();//returns true if no errors, false otherwise
void cleanup();
//game loop
void beginLoop();
void processLoop();
void processInput();
bool endLoop();
void exitGame();
void updateTime(double time);
void render();
inline GraphicsSystem* getGraphicsSystem() const { return mpGraphicsSystem; };
inline GraphicsBufferManager* getGraphicsBufferManager() const { return mpGraphicsBufferManager; };
inline SpriteManager* getSpriteManager() const { return mpSpriteManager; };
inline GameMessageManager* getMessageManager() { return mpMessageManager; };
inline ComponentManager* getComponentManager() { return mpComponentManager; };
inline UnitManager* getUnitManager() { return mpUnitManager; };
inline Timer* getMasterTimer() const { return mpMasterTimer; };
inline double getCurrentTime() const { return mpMasterTimer->getElapsedTime(); };
inline Font* getFont() const { return mpFont; };
ApplicationState *theState;
HomeScreen *theHomeScreen;
ActiveGameState *theGameState;
InputManager* getInputManager() { return mpInputManager; }
private:
GraphicsSystem* mpGraphicsSystem;
GraphicsBufferManager* mpGraphicsBufferManager;
SpriteManager* mpSpriteManager;
GameMessageManager* mpMessageManager;
ComponentManager* mpComponentManager;
UnitManager* mpUnitManager;
Timer* mpLoopTimer;
Timer* mpMasterTimer;
bool mShouldExit;
//should be somewhere else
Font* mpFont;
InputManager* mpInputManager;
ALLEGRO_SAMPLE* mpSample;
IDType mBackgroundBufferID;
IDType mPlayerIconBufferID;
IDType mEnemyIconBufferID;
double mFrameTime;
double mLastUpdateTime;
};
float genRandomBinomial();//range -1:1 from "Artificial Intelligence for Games", Millington and Funge
float genRandomFloat();//range 0:1 from "Artificial Intelligence for Games", Millington and Funge
extern Game* gpGame;
extern PerformanceTracker* gpPerformanceTracker;
| [
"laura.reilly@mymail.champlain.edu"
] | laura.reilly@mymail.champlain.edu |
5cd135b0893af417dfa510c74eb749208ef28324 | a5f2883a94c38d7b7d837c63002d7927adaf4a6c | /MfcCircCtrl/MfcCircCtrlPropPage.cpp | 2523af94772871ee5d30aacf0831040d81c408e7 | [] | no_license | dmxjMao/MyDemoPrj | 688b2275987c0c63d4f64c25ea5c1d60377c270a | a3ca03ef33fae648480a49ad50648e8310e1d949 | refs/heads/master | 2021-09-01T07:09:52.623778 | 2017-12-25T15:30:31 | 2017-12-25T15:30:31 | 104,610,064 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,314 | cpp | // MfcCircCtrlPropPage.cpp : CMfcCircCtrlPropPage 属性页类的实现。
#include "stdafx.h"
#include "MfcCircCtrl.h"
#include "MfcCircCtrlPropPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE(CMfcCircCtrlPropPage, COlePropertyPage)
// 消息映射
BEGIN_MESSAGE_MAP(CMfcCircCtrlPropPage, COlePropertyPage)
END_MESSAGE_MAP()
// 初始化类工厂和 guid
IMPLEMENT_OLECREATE_EX(CMfcCircCtrlPropPage, "MFCCIRCCTRL.MfcCircCtrlPropPage.1",
0xa5b7caad, 0xc613, 0x4da4, 0x81, 0x91, 0x18, 0xe, 0x20, 0xab, 0x26, 0xad)
// CMfcCircCtrlPropPage::CMfcCircCtrlPropPageFactory::UpdateRegistry -
// 添加或移除 CMfcCircCtrlPropPage 的系统注册表项
BOOL CMfcCircCtrlPropPage::CMfcCircCtrlPropPageFactory::UpdateRegistry(BOOL bRegister)
{
if (bRegister)
return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
m_clsid, IDS_MFCCIRCCTRL_PPG);
else
return AfxOleUnregisterClass(m_clsid, NULL);
}
// CMfcCircCtrlPropPage::CMfcCircCtrlPropPage - 构造函数
CMfcCircCtrlPropPage::CMfcCircCtrlPropPage() :
COlePropertyPage(IDD, IDS_MFCCIRCCTRL_PPG_CAPTION)
{
}
// CMfcCircCtrlPropPage::DoDataExchange - 在页和属性间移动数据
void CMfcCircCtrlPropPage::DoDataExchange(CDataExchange* pDX)
{
DDP_PostProcessing(pDX);
}
// CMfcCircCtrlPropPage 消息处理程序
| [
"920746980@qq.com"
] | 920746980@qq.com |
86225ac069ed01ca68fa288d2477e6c72057b663 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-tizen/generated/src/ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo.cpp | 1831d719d29c4bc71a90fbb3d1a92fb087529e40 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 7,459 | cpp | #include <map>
#include <cstdlib>
#include <glib-object.h>
#include <json-glib/json-glib.h>
#include "Helpers.h"
#include "ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo.h"
using namespace std;
using namespace Tizen::ArtikCloud;
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo()
{
//__init();
}
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::~ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo()
{
//__cleanup();
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::__init()
{
//pid = std::string();
//title = std::string();
//description = std::string();
//properties = new ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties();
//bundle_location = std::string();
//service_location = std::string();
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::__cleanup()
{
//if(pid != NULL) {
//
//delete pid;
//pid = NULL;
//}
//if(title != NULL) {
//
//delete title;
//title = NULL;
//}
//if(description != NULL) {
//
//delete description;
//description = NULL;
//}
//if(properties != NULL) {
//
//delete properties;
//properties = NULL;
//}
//if(bundle_location != NULL) {
//
//delete bundle_location;
//bundle_location = NULL;
//}
//if(service_location != NULL) {
//
//delete service_location;
//service_location = NULL;
//}
//
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::fromJson(char* jsonStr)
{
JsonObject *pJsonObject = json_node_get_object(json_from_string(jsonStr,NULL));
JsonNode *node;
const gchar *pidKey = "pid";
node = json_object_get_member(pJsonObject, pidKey);
if (node !=NULL) {
if (isprimitive("std::string")) {
jsonToValue(&pid, node, "std::string", "");
} else {
}
}
const gchar *titleKey = "title";
node = json_object_get_member(pJsonObject, titleKey);
if (node !=NULL) {
if (isprimitive("std::string")) {
jsonToValue(&title, node, "std::string", "");
} else {
}
}
const gchar *descriptionKey = "description";
node = json_object_get_member(pJsonObject, descriptionKey);
if (node !=NULL) {
if (isprimitive("std::string")) {
jsonToValue(&description, node, "std::string", "");
} else {
}
}
const gchar *propertiesKey = "properties";
node = json_object_get_member(pJsonObject, propertiesKey);
if (node !=NULL) {
if (isprimitive("ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties")) {
jsonToValue(&properties, node, "ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties", "ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties");
} else {
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties* obj = static_cast<ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties*> (&properties);
obj->fromJson(json_to_string(node, false));
}
}
const gchar *bundle_locationKey = "bundle_location";
node = json_object_get_member(pJsonObject, bundle_locationKey);
if (node !=NULL) {
if (isprimitive("std::string")) {
jsonToValue(&bundle_location, node, "std::string", "");
} else {
}
}
const gchar *service_locationKey = "service_location";
node = json_object_get_member(pJsonObject, service_locationKey);
if (node !=NULL) {
if (isprimitive("std::string")) {
jsonToValue(&service_location, node, "std::string", "");
} else {
}
}
}
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo(char* json)
{
this->fromJson(json);
}
char*
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::toJson()
{
JsonObject *pJsonObject = json_object_new();
JsonNode *node;
if (isprimitive("std::string")) {
std::string obj = getPid();
node = converttoJson(&obj, "std::string", "");
}
else {
}
const gchar *pidKey = "pid";
json_object_set_member(pJsonObject, pidKey, node);
if (isprimitive("std::string")) {
std::string obj = getTitle();
node = converttoJson(&obj, "std::string", "");
}
else {
}
const gchar *titleKey = "title";
json_object_set_member(pJsonObject, titleKey, node);
if (isprimitive("std::string")) {
std::string obj = getDescription();
node = converttoJson(&obj, "std::string", "");
}
else {
}
const gchar *descriptionKey = "description";
json_object_set_member(pJsonObject, descriptionKey, node);
if (isprimitive("ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties")) {
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties obj = getProperties();
node = converttoJson(&obj, "ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties", "");
}
else {
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties obj = static_cast<ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties> (getProperties());
GError *mygerror;
mygerror = NULL;
node = json_from_string(obj.toJson(), &mygerror);
}
const gchar *propertiesKey = "properties";
json_object_set_member(pJsonObject, propertiesKey, node);
if (isprimitive("std::string")) {
std::string obj = getBundleLocation();
node = converttoJson(&obj, "std::string", "");
}
else {
}
const gchar *bundle_locationKey = "bundle_location";
json_object_set_member(pJsonObject, bundle_locationKey, node);
if (isprimitive("std::string")) {
std::string obj = getServiceLocation();
node = converttoJson(&obj, "std::string", "");
}
else {
}
const gchar *service_locationKey = "service_location";
json_object_set_member(pJsonObject, service_locationKey, node);
node = json_node_alloc();
json_node_init(node, JSON_NODE_OBJECT);
json_node_take_object(node, pJsonObject);
char * ret = json_to_string(node, false);
json_node_free(node);
return ret;
}
std::string
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getPid()
{
return pid;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setPid(std::string pid)
{
this->pid = pid;
}
std::string
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getTitle()
{
return title;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setTitle(std::string title)
{
this->title = title;
}
std::string
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getDescription()
{
return description;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setDescription(std::string description)
{
this->description = description;
}
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getProperties()
{
return properties;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setProperties(ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerProperties properties)
{
this->properties = properties;
}
std::string
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getBundleLocation()
{
return bundle_location;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setBundleLocation(std::string bundle_location)
{
this->bundle_location = bundle_location;
}
std::string
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::getServiceLocation()
{
return service_location;
}
void
ComAdobeGraniteAuthOauthImplHelperProviderConfigManagerInfo::setServiceLocation(std::string service_location)
{
this->service_location = service_location;
}
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
566a67e1c5aab11f0729b33b9d645df81a2e893e | 4e40762cf9ff6fd3162f71fbbd5883ef5378a9e2 | /ftp_client.cpp | c4a98fdd73a8e065c06e39e5016802c89f28d903 | [] | no_license | wshy1121/FileOpr | e828c0f51567ecfce6d98bce028c838d4d47d4f8 | 917399ed46600222b17ec44293fd532e706c19ce | refs/heads/master | 2021-01-01T04:55:18.832701 | 2016-05-27T06:50:36 | 2016-05-27T06:50:36 | 58,015,816 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 19,750 | cpp | #include <assert.h>
#include <string.h>
#include "ftp_client.h"
static int SplitString( std::string strSrc, std::list<std::string> &strArray , std::string strFlag)
{
int pos = 1;
while((pos = (int)strSrc.find_first_of(strFlag.c_str())) > 0)
{
strArray.insert(strArray.end(), strSrc.substr(0 , pos));
strSrc = strSrc.substr(pos + 1, strSrc.length() - pos - 1);
}
strArray.insert(strArray.end(), strSrc.substr(0, strSrc.length()));
return 0;
}
CFTPManager::CFTPManager(void)
:m_cmdSocket(-1)
,m_bLogin(false)
{
}
CFTPManager::~CFTPManager(void)
{
std::string strCmdLine = parseCommand(FTP_COMMAND_QUIT, "");
Send(m_cmdSocket, strCmdLine.c_str());
close(m_cmdSocket);
m_bLogin = false;
}
FTP_API CFTPManager::login2Server(const std::string &serverIP)
{ trace_worker();
m_cmdSocket = socket(AF_INET, SOCK_STREAM, 0);
std::string strPort;
int pos = serverIP.find_first_of(":");
if (pos > 0)
{
strPort = serverIP.substr(pos + 1, serverIP.length() - pos);
}
else
{
pos = serverIP.length();
strPort = FTP_DEFAULT_PORT;
}
m_strServerIP = serverIP.substr(0, pos);
m_nServerPort = atol(strPort.c_str());
trace("IP: %s port: %d\n", m_strServerIP.c_str(), m_nServerPort);
if (Connect(m_cmdSocket, m_strServerIP, m_nServerPort) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
trace_printf("@@@@Response: %s", m_strResponse.c_str());
trace("@@@@Response: %s", m_strResponse.c_str());
if (m_strResponse.empty())
{ trace_printf("NULL");
return -1;
}
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::inputUserName(const std::string &userName)
{ trace_worker();
std::string strCommandLine = parseCommand(FTP_COMMAND_USERNAME, userName);
m_strUserName = userName;
if (Send(m_cmdSocket, strCommandLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
printf("Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::inputPassWord(const std::string &password)
{ trace_worker();
std::string strCmdLine = parseCommand(FTP_COMMAND_PASSWORD, password);
m_strPassWord = password;
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
else
{
m_bLogin = true;
m_strResponse = serverResponse(m_cmdSocket);
printf("Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
}
FTP_API CFTPManager::quitServer(void)
{ trace_worker();
std::string strCmdLine = parseCommand(FTP_COMMAND_QUIT, "");
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
else
{
m_strResponse = serverResponse(m_cmdSocket);
printf("Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
}
const std::string CFTPManager::PWD()
{
std::string strCmdLine = parseCommand(FTP_COMMAND_CURRENT_PATH, "");
if (Send(m_cmdSocket, strCmdLine.c_str()) < 0)
{
return "";
}
else
{
return serverResponse(m_cmdSocket);
}
}
FTP_API CFTPManager::setTransferMode(type mode)
{
std::string strCmdLine;
switch (mode)
{
case binary:
strCmdLine = parseCommand(FTP_COMMAND_TYPE_MODE, "I");
break;
case ascii:
strCmdLine = parseCommand(FTP_COMMAND_TYPE_MODE, "A");
break;
default:
break;
}
if (Send(m_cmdSocket, strCmdLine.c_str()) < 0)
{
assert(false);
}
else
{
m_strResponse = serverResponse(m_cmdSocket);
printf("@@@@Response: %s", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
}
const std::string CFTPManager::Pasv()
{ trace_worker();
std::string strCmdLine = parseCommand(FTP_COMMAND_PSAV_MODE, "");
if (Send(m_cmdSocket, strCmdLine.c_str()) < 0)
{ trace_printf("NULL");
return "";
}
else
{ trace_printf("NULL");
m_strResponse = serverResponse(m_cmdSocket);
return m_strResponse;
}
}
const std::string CFTPManager::Dir(const std::string &path)
{
int dataSocket = socket(AF_INET, SOCK_STREAM, 0);
if (createDataLink(dataSocket) < 0)
{
return "";
}
// 数据连接成功
std::string strCmdLine = parseCommand(FTP_COMMAND_DIR, path);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
trace("@@@@Response: %s\n", serverResponse(m_cmdSocket).c_str());
close(dataSocket);
return "";
}
else
{
trace("@@@@Response: %s\n", serverResponse(m_cmdSocket).c_str());
m_strResponse = serverResponse(dataSocket);
trace("@@@@Response: \n%s\n", m_strResponse.c_str());
close(dataSocket);
return m_strResponse;
}
}
FTP_API CFTPManager::CD(const std::string &path)
{
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_CHANGE_DIRECTORY, path);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
trace("@@@@Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::DeleteFile(const std::string &strRemoteFile)
{
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_DELETE_FILE, strRemoteFile);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
printf("@@@@Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::DeleteDirectory(const std::string &strRemoteDir)
{
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_DELETE_DIRECTORY, strRemoteDir);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
trace("@@@@Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::CreateDirectory(const std::string &strRemoteDir)
{
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_CREATE_DIRECTORY, strRemoteDir);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
trace("@@@@Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
FTP_API CFTPManager::Rename(const std::string &strRemoteFile, const std::string &strNewFile)
{
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_RENAME_BEGIN, strRemoteFile);
Send(m_cmdSocket, strCmdLine);
trace("@@@@Response: %s\n", serverResponse(m_cmdSocket).c_str());
Send(m_cmdSocket, parseCommand(FTP_COMMAND_RENAME_END, strNewFile));
m_strResponse = serverResponse(m_cmdSocket);
trace("@@@@Response: %s\n", m_strResponse.c_str());
return parseResponse(m_strResponse);
}
long CFTPManager::getFileLength(const std::string &strRemoteFile)
{ trace_worker();
assert(m_cmdSocket != INVALID_SOCKET);
std::string strCmdLine = parseCommand(FTP_COMMAND_FILE_SIZE, strRemoteFile);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
m_strResponse = serverResponse(m_cmdSocket);
trace("@@@@Response: %s\n", m_strResponse.c_str());
std::string strData = m_strResponse.substr(0, 3);
unsigned long val = atol(strData.c_str());
if (val == 213)
{
strData = m_strResponse.substr(4);
trace("strData: %s\n", strData.c_str());
val = atol(strData.c_str());
return val;
}
return -1;
}
void CFTPManager::Close(int sock)
{
shutdown(sock, SHUT_RDWR);
close(sock);
sock = INVALID_SOCKET;
}
FTP_API CFTPManager::Get(const std::string &strRemoteFile, const std::string &strLocalFile)
{
return downLoad(strRemoteFile, strLocalFile);
}
FTP_API CFTPManager::Put(const std::string &strRemoteFile, const std::string &strLocalFile)
{ trace_worker();
trace_printf("strRemoteFile.c_str() %s", strRemoteFile.c_str());
trace_printf("strLocalFile.c_str() %s", strLocalFile.c_str());
std::string strCmdLine;
const unsigned long dataLen = FTP_DEFAULT_BUFFER;
char strBuf[dataLen] = {0};
long nSize = getFileLength(strRemoteFile);
unsigned long nLen = 0;
FILE *pFile = fopen(strLocalFile.c_str(), "rb"); // 以只读方式打开 且文件必须存在
assert(pFile != NULL);
int data_fd = socket(AF_INET, SOCK_STREAM, 0);
assert(data_fd != -1);
if (createDataLink(data_fd) < 0)
{ trace_printf("NULL");
return -1;
}
if (nSize == -1)
{ trace_printf("NULL");
strCmdLine = parseCommand(FTP_COMMAND_UPLOAD_FILE, strRemoteFile);
}
else
{ trace_printf("NULL");
strCmdLine = parseCommand(FTP_COMMAND_APPEND_FILE, strRemoteFile);
}
trace_printf("NULL");
if (Send(m_cmdSocket, strCmdLine) < 0)
{ trace_printf("NULL");
Close(data_fd);
return -1;
}
fseek(pFile, nSize, SEEK_SET);
while (!feof(pFile))
{
nLen = fread(strBuf, 1, dataLen, pFile);
if (nLen < 0)
{
break;
}
if (Send(data_fd, strBuf) < 0)
{
Close(data_fd);
return -1;
}
}
Close(data_fd);
fclose(pFile);
std::string response = serverResponse(m_cmdSocket);
trace_printf("response.c_str() %s", response.c_str());
return 0;
}
const std::string CFTPManager::parseCommand(const unsigned int command, const std::string &strParam)
{
if (command < FTP_COMMAND_BASE || command > FTP_COMMAND_END)
{
return "";
}
std::string strCommandLine;
m_nCurrentCommand = command;
m_commandStr.clear();
switch (command)
{
case FTP_COMMAND_USERNAME:
strCommandLine = "USER ";
break;
case FTP_COMMAND_PASSWORD:
strCommandLine = "PASS ";
break;
case FTP_COMMAND_QUIT:
strCommandLine = "QUIT ";
break;
case FTP_COMMAND_CURRENT_PATH:
strCommandLine = "PWD ";
break;
case FTP_COMMAND_TYPE_MODE:
strCommandLine = "TYPE ";
break;
case FTP_COMMAND_PSAV_MODE:
strCommandLine = "PASV ";
break;
case FTP_COMMAND_DIR:
strCommandLine = "LIST ";
break;
case FTP_COMMAND_CHANGE_DIRECTORY:
strCommandLine = "CWD ";
break;
case FTP_COMMAND_DELETE_FILE:
strCommandLine = "DELE ";
break;
case FTP_COMMAND_DELETE_DIRECTORY:
strCommandLine = "RMD ";
break;
case FTP_COMMAND_CREATE_DIRECTORY:
strCommandLine = "MKD ";
break;
case FTP_COMMAND_RENAME_BEGIN:
strCommandLine = "RNFR ";
break;
case FTP_COMMAND_RENAME_END:
strCommandLine = "RNTO ";
break;
case FTP_COMMAND_FILE_SIZE:
strCommandLine = "SIZE ";
break;
case FTP_COMMAND_DOWNLOAD_FILE:
strCommandLine = "RETR ";
break;
case FTP_COMMAND_DOWNLOAD_POS:
strCommandLine = "REST ";
break;
case FTP_COMMAND_UPLOAD_FILE:
strCommandLine = "STOR ";
break;
case FTP_COMMAND_APPEND_FILE:
strCommandLine = "APPE ";
break;
default :
break;
}
strCommandLine += strParam;
strCommandLine += "\r\n";
m_commandStr = strCommandLine;
trace("parseCommand: %s\n", m_commandStr.c_str());
return m_commandStr;
}
FTP_API CFTPManager::Connect(int socketfd, const std::string &serverIP, unsigned int nPort)
{ trace_worker();
if (socketfd == INVALID_SOCKET)
{ trace_printf("NULL");
return -1;
}
unsigned int argp = 1;
int error = -1;
int len = sizeof(int);
struct sockaddr_in addr;
bool ret = false;
timeval stime;
fd_set set;
ioctl(socketfd, FIONBIO, &argp); //设置为非阻塞模式
memset(&addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_port = htons(nPort);
addr.sin_addr.s_addr = inet_addr(serverIP.c_str());
bzero(&(addr.sin_zero), 8);
trace_printf("Address: %s %d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
trace("Address: %s %d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
if (connect(socketfd, (struct sockaddr*)&addr, sizeof(struct sockaddr)) == -1) //若直接返回 则说明正在进行TCP三次握手
{ trace_printf("NULL");
stime.tv_sec = 20; //设置为1秒超时
stime.tv_usec = 0;
FD_ZERO(&set);
FD_SET(socketfd, &set);
if (select(socketfd + 1, NULL, &set, NULL, &stime) > 0) ///在这边等待 阻塞 返回可以读的描述符 或者超时返回0 或者出错返回-1
{
getsockopt(socketfd, SOL_SOCKET, SO_ERROR, &error, (socklen_t*)&len);
if (error == 0)
{ trace_printf("NULL");
ret = true;
}
else
{ trace_printf("NULL");
ret = false;
perror("connect\n");
}
}
trace_printf("NULL");
}
else
{ trace("Connect Immediately!!!\n");
ret = true;
}
argp = 0;
ioctl(socketfd, FIONBIO, &argp);
if (!ret)
{
close(socketfd);
fprintf(stderr, "cannot connect server!!\n");
return -1;
}
//fprintf(stdout, "Connect!!!\n");
return 0;
}
const std::string CFTPManager::serverResponse(int sockfd)
{ trace_worker();
if (sockfd == INVALID_SOCKET)
{ trace_printf("NULL");
return "";
}
char buf[MAX_PATH] = {0};
trace_printf("NULL");
m_strResponse.clear();
trace_printf("NULL");
if(getData(sockfd, buf, MAX_PATH) > 0)
{
buf[MAX_PATH - 1] = '\0';
m_strResponse += buf;
}
trace_printf("m_strResponse.c_str() %s", m_strResponse.c_str());
return m_strResponse;
}
FTP_API CFTPManager::getData(int fd, char *strBuf, unsigned long length)
{ trace_worker();
assert(strBuf != NULL);
trace_printf("NULL");
if (fd == INVALID_SOCKET)
{ trace_printf("NULL");
return -1;
}
trace_printf("NULL");
memset(strBuf, 0, length);
timeval stime;
int nLen;
stime.tv_sec = 1;
stime.tv_usec = 0;
fd_set readfd;
FD_ZERO( &readfd );
FD_SET(fd, &readfd );
if (select(fd + 1, &readfd, 0, 0, &stime) > 0)
{ trace_printf("NULL");
if ((nLen = recv(fd, strBuf, length, 0)) > 0)
{ trace_printf("NULL");
return nLen;
}
else
{ trace_printf("NULL");
return -2;
}
}
trace_printf("NULL");
return 0;
}
FTP_API CFTPManager::Send(int fd, const std::string &cmd)
{
if (fd == INVALID_SOCKET)
{
return -1;
}
return Send(fd, cmd.c_str(), cmd.length());
}
FTP_API CFTPManager::Send(int fd, const char *cmd, const size_t len)
{
if((FTP_COMMAND_USERNAME != m_nCurrentCommand)
&&(FTP_COMMAND_PASSWORD != m_nCurrentCommand)
&&(!m_bLogin))
{
return -1;
}
timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
fd_set writefd;
FD_ZERO(&writefd);
FD_SET(fd, &writefd);
if(select(fd + 1, 0, &writefd , 0 , &timeout) > 0)
{
size_t nlen = len;
int nSendLen = 0;
while (nlen >0)
{
nSendLen = send(fd, cmd , (int)nlen , 0);
if(nSendLen == -1)
return -2;
nlen = nlen - nSendLen;
cmd += nSendLen;
}
return 0;
}
return -1;
}
FTP_API CFTPManager::createDataLink(int data_fd)
{ trace_worker();
assert(data_fd != INVALID_SOCKET);
std::string strData;
unsigned long nPort = 0 ;
std::string strServerIp ;
std::list<std::string> strArray ;
std::string parseStr = Pasv();
trace_printf("parseStr.c_str() |%s|", parseStr.c_str());
trace_printf("parseStr.size() %d", parseStr.size());
if (parseStr.size() <= 0)
{ trace_printf("NULL");
return -1;
}
//trace("parseInfo: %s\n", parseStr.c_str());
size_t nBegin = parseStr.find_first_of("(");
size_t nEnd = parseStr.find_first_of(")");
strData = parseStr.substr(nBegin + 1, nEnd - nBegin - 1);
//trace("ParseAfter: %s\n", strData.c_str());
if( SplitString( strData , strArray , "," ) <0)
{ trace_printf("NULL");
return -1;
}
if( ParseString( strArray , nPort , strServerIp) < 0)
return -1;
//trace("nPort: %ld IP: %s\n", nPort, strServerIp.c_str());
if (Connect(data_fd, strServerIp, nPort) < 0)
{
return -1;
}
return 0;
}
FTP_API CFTPManager::ParseString(std::list<std::string> strArray, unsigned long & nPort ,std::string & strServerIp)
{
if (strArray.size() < 6 )
return -1 ;
std::list<std::string>::iterator citor;
citor = strArray.begin();
strServerIp = *citor;
strServerIp += ".";
citor ++;
strServerIp += *citor;
strServerIp += ".";
citor ++ ;
strServerIp += *citor;
strServerIp += ".";
citor ++ ;
strServerIp += *citor;
citor = strArray.end();
citor--;
nPort = atol( (*citor).c_str());
citor--;
nPort += atol( (*(citor)).c_str()) * 256 ;
return 0 ;
}
FILE *CFTPManager::createLocalFile(const std::string &strLocalFile)
{
return fopen(strLocalFile.c_str(), "w+b");
}
FTP_API CFTPManager::downLoad(const std::string &strRemoteFile, const std::string &strLocalFile, const int pos, const unsigned int length)
{
assert(length >= 0);
FILE *file = NULL;
unsigned long nDataLen = FTP_DEFAULT_BUFFER;
char strPos[MAX_PATH] = {0};
int data_fd = socket(AF_INET, SOCK_STREAM, 0);
assert(data_fd != -1);
if ((length != 0) && (length < nDataLen))
{
nDataLen = length;
}
char *dataBuf = new char[nDataLen];
assert(dataBuf != NULL);
sprintf(strPos, "%d", pos);
if (createDataLink(data_fd) < 0)
{
trace("@@@@ Create Data Link error!!!\n");
return -1;
}
std::string strCmdLine = parseCommand(FTP_COMMAND_DOWNLOAD_POS, strPos);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
trace("@@@@Response: %s\n", serverResponse(m_cmdSocket).c_str());
strCmdLine = parseCommand(FTP_COMMAND_DOWNLOAD_FILE, strRemoteFile);
if (Send(m_cmdSocket, strCmdLine) < 0)
{
return -1;
}
trace("@@@@Response: %s\n", serverResponse(m_cmdSocket).c_str());
file = createLocalFile(std::string(FTP_DEFAULT_PATH + strLocalFile));
assert(file != NULL);
int len = 0;
int nReceiveLen = 0;
while ((len = getData(data_fd, dataBuf, nDataLen)) > 0)
{
nReceiveLen += len;
int num = fwrite(dataBuf, 1, len, file);
memset(dataBuf, 0, nDataLen);
//trace("%s", dataBuf);
trace("Num:%d\n", num);
if (nReceiveLen == (int)length && length != 0)
break;
if ((nReceiveLen + nDataLen) > length && length != 0)
{
delete []dataBuf;
nDataLen = length - nReceiveLen;
dataBuf = new char[nDataLen];
}
}
Close(data_fd);
fclose(file);
delete []dataBuf;
return 0;
}
FTP_API CFTPManager::parseResponse(const std::string &str)
{
assert(!str.empty());
std::string strData = str.substr(0, 3);
unsigned int val = atoi(strData.c_str());
return val;
}
FTP_API CFTPManager::WriteData(const std::string &strRemoteFile, const char *dataBuffer, int dataBufferLen)
{ trace_worker();
trace_printf("strRemoteFile.c_str() %s", strRemoteFile.c_str());
std::string strCmdLine;
std::string response;
long nSize = getFileLength(strRemoteFile);
int data_fd = socket(AF_INET, SOCK_STREAM, 0);
if (data_fd == -1)
{ trace_printf("NULL");
perror("socket failed\n");
return -1;
}
if (createDataLink(data_fd) < 0)
{ trace_printf("NULL");
return -1;
}
if (nSize == -1)
{ trace_printf("NULL");
strCmdLine = parseCommand(FTP_COMMAND_UPLOAD_FILE, strRemoteFile);
}
else
{ trace_printf("NULL");
strCmdLine = parseCommand(FTP_COMMAND_APPEND_FILE, strRemoteFile);
}
trace_printf("NULL");
if (Send(m_cmdSocket, strCmdLine) < 0)
{ trace_printf("NULL");
Close(data_fd);
return -1;
}
response = serverResponse(m_cmdSocket);
trace_printf("response.c_str() %s", response.c_str());
int sendPos = 0;
int MaxDataLen = 0;
int remainLen = 0;
int sendRet = -1;
while (sendPos < dataBufferLen)
{
MaxDataLen = FTP_DEFAULT_BUFFER;
remainLen = dataBufferLen - sendPos;
if (remainLen < MaxDataLen)
{
MaxDataLen = remainLen;
}
trace_printf("MaxDataLen %d", MaxDataLen);
sendRet = Send(data_fd, dataBuffer + sendPos, MaxDataLen);
if (sendRet < 0)
{ trace_printf("NULL");
Close(data_fd);
return -1;
}
sendPos += MaxDataLen;
}
Close(data_fd);
response = serverResponse(m_cmdSocket);
trace_printf("response.c_str() %s", response.c_str());
return 0;
}
bool CFTPManager::isOnline()
{ trace_worker();
std::string strCmdLine = parseCommand(FTP_COMMAND_CURRENT_PATH, "");
if (Send(m_cmdSocket, strCmdLine.c_str()) < 0)
{ trace_printf("false");
return false;
}
trace_printf("true");
std::string response = serverResponse(m_cmdSocket);
trace_printf("response.c_str() %s", response.c_str());
if (response.empty())
{
return false;
}
return true;
}
| [
"wshy1121@qq.com"
] | wshy1121@qq.com |
3580a2194b7d0779c52e8accb8da571ca308ceb5 | 0370b81e9ec3f1b1d4bf0da224a613ff576e8dd4 | /Not_Classified/uva_11039.cpp | f4e53fc426bcfe1270acf664db55e0d411ccf7a7 | [] | no_license | Rolight/ACM_ICPC | c511bc58ac5038ca521bb500a40fcbdf5468832d | 6208a20ea66a42b4a06249d97494c77f55121847 | refs/heads/master | 2021-01-10T22:08:48.336023 | 2015-07-17T21:46:48 | 2015-07-17T21:46:48 | 27,808,805 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,259 | cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <bitset>
#include <list>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <stack>
#include <sstream>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
#define MP make_pair
#define PB push_back
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> pii;
const int INF = INT_MAX / 3;
const double eps = 1e-8;
const LL LINF = 1e17;
const double DINF = 1e60;
const int maxn = 5e5 + 10;
int num[maxn], n;
bool cmp(int a,int b) {
return abs(a) < abs(b);
}
int main() {
int T; scanf("%d",&T);
while(T--) {
scanf("%d",&n);
for(int i = 0;i < n;i++) {
scanf("%d",&num[i]);
}
sort(num, num + n, cmp);
int ans = 0, last = -num[0];
for(int i = 0;i < n;i++) {
if(last < 0 && num[i] > 0) {
last = 1; ans++;
}
else if(last > 0 && num[i] < 0) {
last = -1; ans++;
}
}
printf("%d\n",ans);
}
return 0;
}
| [
"flsnnx@gmail.com"
] | flsnnx@gmail.com |
8deb308023c3ef7691a5ca49552c2cb7117246bd | b3973b607e776fd40c52434a5bc1609218aa8c2f | /BoltzmannPhysics/xcode/CharacterEngine/Characters/Character.cpp | e9fad6ae96e7d150225761c6cc61bb21e33cb867 | [] | no_license | drewcummins/boltzmann-games | ff0e1adea03334ff5953cab4c4d384144b57041c | d80e3e2c16716cd60dbba2a73570411344f59277 | refs/heads/master | 2022-07-21T15:09:54.653309 | 2017-06-13T00:32:04 | 2017-06-13T00:32:04 | 84,253,672 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,049 | cpp | //
// Character.cpp
// BoltzmannPhysics
//
// Created by Drew on 3/15/17.
//
//
#include "Character.hpp"
#include "Constants.hpp"
using namespace bltz;
shared_ptr<Character> Character::create() {
return shared_ptr<Character>(new Character);
}
void Character::setup(float height, vec3 pelvisX) {
s = M2U(height * 0.3);
auto leg = Box::create(vec3(s/3,s,s/3));
auto foot = bltz::Sphere::create(s/4);
auto pelvisGeom = Box::create(vec3(s*0.75,s/3,s/3));
auto torsoGeom = Box::create(vec3(s/2,s,s/2));
auto torsoLatGeom = bltz::Sphere::create(s/4);
Material animal;
animal.density = 3.f;
animal.friction = 0.96;
animal.bounciness = 0.f;
luleg = RigidBody::create();
llleg = RigidBody::create();
ruleg = RigidBody::create();
rlleg = RigidBody::create();
pelvis = RigidBody::create();
torso = RigidBody::create();
torsoLat = RigidBody::create();
lhipLat = RigidBody::create();
rhipLat = RigidBody::create();
Material lt = {1.f,0.96,0.f};
torso->addElement(torsoGeom, lt);
torsoLat->addElement(torsoLatGeom, lt);
lhipLat->addElement(torsoLatGeom, lt);
rhipLat->addElement(torsoLatGeom, lt);
pelvis->addElement(pelvisGeom, animal);
// pelvis->isGround = true;
// Muscle abs = SineMuscle::create(torso, vec3(0,s/2,0), pelvis, vec3(0,0,0), 30.f);
// muscles.push_back(abs);
luleg->addElement(leg, animal);
ruleg->addElement(leg, animal);
llleg->addElement(leg, animal);
lfootElem = llleg->addElement(foot, animal, vec3(0,-s/2,0));
rlleg->addElement(leg, animal);
rfootElem = rlleg->addElement(foot, animal, vec3(0,-s/2,0));
pelvis->setPosition(pelvisX);
torso->setPosition(pelvisX + vec3(0,s/2 + s/4,0));
torsoLat->setPosition(pelvisX + vec3(0,s/2,0));
luleg->setPosition(pelvisX + vec3(s/2,-s/2,0));
llleg->setPosition(luleg->x + vec3(0,-s,0));
ruleg->setPosition(pelvisX + vec3(-s/2,-s/2,0));
rlleg->setPosition(ruleg->x + vec3(0,-s,0));
rhipLat->setPosition(pelvisX + vec3(-s/2,0,0));
lhipLat->setPosition(pelvisX + vec3(s/2,0,0));
lknee = HingeJoint::create(luleg, vec3(0,-s/2,0), vec3(1,0,0), llleg);
lknee->setLimits(0, glm::pi<float>()*0.75);
rknee = HingeJoint::create(ruleg, vec3(0,-s/2,0), vec3(1,0,0), rlleg);
rknee->setLimits(0, glm::pi<float>()*0.75);
lhipLatJoint = HingeJoint::create(lhipLat, vec3(0,0,0), vec3(0,0,1), pelvis);
lhipLatJoint->setLimits(-glm::pi<float>()*0.2, glm::pi<float>()*0.2);
rhipLatJoint = HingeJoint::create(rhipLat, vec3(), vec3(0,0,1), pelvis);
rhipLatJoint->setLimits(-glm::pi<float>()*0.2, glm::pi<float>()*0.2);
lhip = HingeJoint::create(luleg, vec3(0,s/2,0), vec3(1,0,0), lhipLat);
lhip->setLimits(-glm::pi<float>()*0.25, glm::pi<float>()*0.5);
rhip = HingeJoint::create(ruleg, vec3(0,s/2,0), vec3(-1,0,0), rhipLat);
rhip->setLimits(-glm::pi<float>()*0.5, glm::pi<float>()*0.25);
backLat = HingeJoint::create(torsoLat, vec3(0,0,0), vec3(0,0,1), pelvis);
backLat->setLimits(-glm::pi<float>()*0.1, glm::pi<float>()*0.1);
back = HingeJoint::create(torso, torsoLat->x - torso->x, vec3(1,0,0), torsoLat);
back->setLimits(-glm::pi<float>()*0.35, glm::pi<float>()*0.35);
muscles.resize(8);
auto motor = MotorMuscle::create(rhip);
muscles[RHIP] = motor;
motor = MotorMuscle::create(rknee);
muscles[RKNEE] = motor;
motor = MotorMuscle::create(back);
muscles[BACK] = motor;
motor = MotorMuscle::create(lhip);
muscles[LHIP] = motor;
motor = MotorMuscle::create(lknee);
muscles[LKNEE] = motor;
motor = MotorMuscle::create(lhipLatJoint);
muscles[LHIPLAT] = motor;
motor = MotorMuscle::create(rhipLatJoint);
muscles[RHIPLAT] = motor;
motor = MotorMuscle::create(backLat);
muscles[BACKLAT] = motor;
sy = pelvis->com.z;
ticks = 0;
}
vec3 Character::com() {
vec3 COM = vec3();
float mass = 0.f;
for (auto &bone : getBones()) {
COM += bone->com * bone->m;
mass += bone->m;
}
return COM/mass;
}
vec3 Character::leftAnkle() {
return luleg->com + luleg->R * (lfootElem.x + luleg->xModel);
}
vec3 Character::rightAnkle() {
return ruleg->com + ruleg->R * (rfootElem.x + ruleg->xModel);
}
vector<Body> Character::getBones() {
return {torso, pelvis, luleg, ruleg, llleg, rlleg, torsoLat, lhipLat, rhipLat};
}
vector<Constraint> Character::getJoints() {
return {lhip, rhip, lknee, rknee, back, backLat, lhipLatJoint, rhipLatJoint};
}
void Character::update(float dt) {
if (brain) {
brain->update(dt);
}
// cout << pelvis->com.y << endl;
for (int i = 0; i < muscles.size(); i++) {
muscles[i]->t = Utils::clamp(brain->network[i]->output, 0.0, 1.0);
muscles[i]->update(dt);
}
}
| [
"drew.f.cummins@gmail.com"
] | drew.f.cummins@gmail.com |
753fa09da137b8676576d216550da7fdb67b8bfa | ed836705563ed01174d0c40fd9a2c2582eb81e75 | /Módulo 8 - Imports/node_modules/lmdb/src/lmdb-js.h | 62c0ad01715b49483d596962ee527d69272c13a3 | [
"MIT"
] | permissive | Artsafort/Bootcamp_JS | 6f07e92d5aecdd38ceaa108323c678e93d3346be | 48d7586d1237c4730931267acee96353fd35d809 | refs/heads/master | 2023-08-16T23:09:24.556376 | 2023-08-03T10:55:39 | 2023-08-03T10:55:39 | 287,233,790 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,438 | h | #ifndef NODE_LMDB_H
#define NODE_LMDB_H
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <ctime>
#include <napi.h>
#include <node_api.h>
#include "lmdb.h"
#include "lz4.h"
#ifdef MDB_RPAGE_CACHE
#include "chacha8.h"
#endif
using namespace Napi;
// set the threshold of when to use shared buffers (for uncompressed entries larger than this value)
const size_t SHARED_BUFFER_THRESHOLD = 0x4000;
#ifndef __CPTHREAD_H__
#define __CPTHREAD_H__
#ifdef _WIN32
# include <windows.h>
#else
# include <pthread.h>
#endif
#ifdef _WIN32
typedef CRITICAL_SECTION pthread_mutex_t;
typedef void pthread_mutexattr_t;
typedef void pthread_condattr_t;
typedef HANDLE pthread_t;
typedef CONDITION_VARIABLE pthread_cond_t;
#endif
#ifndef mdb_size_t
typedef size_t mdb_size_t;
#endif
#define NAPI_FUNCTION(name) napi_value name(napi_env env, napi_callback_info info)
#define ARGS(count) napi_value returnValue;\
size_t argc = count;\
napi_value args[count];\
napi_get_cb_info(env, info, &argc, args, NULL, NULL);
#define GET_UINT32_ARG(target, position) napi_get_value_uint32(env, args[position], (uint32_t*) &target)
#define GET_INT32_ARG(target, position) napi_get_value_int32(env, args[position], (int32_t*) &target)
#define GET_INT64_ARG(position)\
int64_t i64;\
napi_get_value_int64(env, args[position], &i64);
#define RETURN_UINT32(value) { napi_create_uint32(env, value, &returnValue); return returnValue; }
#define RETURN_INT32(value) { napi_create_int32(env, value, &returnValue); return returnValue; }
#define RETURN_UNDEFINED { napi_get_undefined(env, &returnValue); return returnValue; }
#define THROW_ERROR(message) { napi_throw_error(env, NULL, message); napi_get_undefined(env, &returnValue); return returnValue; }
#define EXPORT_NAPI_FUNCTION(name, func) { napi_property_descriptor desc = { name, 0, func, 0, 0, 0, (napi_property_attributes) (napi_writable | napi_configurable), 0 };\
napi_define_properties(env, exports, 1, &desc); }
#define EXPORT_FUNCTION_ADDRESS(name, func) { \
napi_value address;\
void* f = (void*) func;\
napi_create_double(env, *((double*) &f), &address);\
napi_property_descriptor desc = { name, 0, 0, 0, 0, address, (napi_property_attributes) (napi_writable | napi_configurable), 0 };\
napi_define_properties(env, exports, 1, &desc); }
#ifdef _WIN32
const uint64_t TICKS_PER_SECOND = 1000;
int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
int pthread_cond_signal(pthread_cond_t *cond);
int pthread_cond_broadcast(pthread_cond_t *cond);
#else
const uint64_t TICKS_PER_SECOND = 1000000000;
#endif
uint64_t get_time64();
int cond_init(pthread_cond_t *cond);
int cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, uint64_t ns);
#endif /* __CPTHREAD_H__ */
class Logging {
public:
static int debugLogging;
static int initLogging();
};
enum class LmdbKeyType {
// Invalid key (used internally by lmdb-js)
InvalidKey = -1,
// Default key (used internally by lmdb-js)
DefaultKey = 0,
// UCS-2/UTF-16 with zero terminator - Appears to V8 as string
StringKey = 1,
// LMDB fixed size integer key with 32 bit keys - Appearts to V8 as an Uint32
Uint32Key = 2,
// LMDB default key format - Appears to V8 as node::Buffer
BinaryKey = 3,
};
enum class KeyCreation {
Reset = 0,
Continue = 1,
InArray = 2,
};
const int THEAD_MEMORY_THRESHOLD = 4000;
class TxnWrap;
class DbiWrap;
class EnvWrap;
class CursorWrap;
class Compression;
// Exports misc stuff to the module
void setupExportMisc(Env env, Object exports);
// Helper callback
typedef void (*argtokey_callback_t)(MDB_val &key);
void consoleLog(Value val);
void consoleLog(const char *msg);
void consoleLogN(int n);
void setFlagFromValue(int *flags, int flag, const char *name, bool defaultValue, Object options);
void writeValueToEntry(const Value &str, MDB_val *val);
LmdbKeyType keyTypeFromOptions(const Value &val, LmdbKeyType defaultKeyType = LmdbKeyType::DefaultKey);
int getVersionAndUncompress(MDB_val &data, DbiWrap* dw);
int compareFast(const MDB_val *a, const MDB_val *b);
napi_value setGlobalBuffer(napi_env env, napi_callback_info info);
napi_value lmdbError(napi_env env, napi_callback_info info);
napi_value createBufferForAddress(napi_env env, napi_callback_info info);
napi_value getBufferAddress(napi_env env, napi_callback_info info);
napi_value getAddress(napi_env env, napi_callback_info info);
napi_value detachBuffer(napi_env env, napi_callback_info info);
napi_value enableThreadSafeCalls(napi_env env, napi_callback_info info);
napi_value startRead(napi_env env, napi_callback_info info);
napi_value setReadCallback(napi_env env, napi_callback_info info);
Value getAddress(const CallbackInfo& info);
Value lmdbNativeFunctions(const CallbackInfo& info);
napi_value enableDirectV8(napi_env env, napi_callback_info info);
#ifndef thread_local
#ifdef __GNUC__
# define thread_local __thread
#elif __STDC_VERSION__ >= 201112L
# define thread_local _Thread_local
#elif defined(_MSC_VER)
# define thread_local __declspec(thread)
#else
# define thread_local
#endif
#endif
bool valToBinaryFast(MDB_val &data, DbiWrap* dw);
Value valToUtf8(Env env, MDB_val &data);
Value valToString(MDB_val &data);
Value valToStringUnsafe(MDB_val &data);
Value valToBinary(MDB_val &data);
Value valToBinaryUnsafe(MDB_val &data, DbiWrap* dw, Env env);
int putWithVersion(MDB_txn* txn,
MDB_dbi dbi,
MDB_val * key,
MDB_val * data,
unsigned int flags, double version);
Napi::Value throwLmdbError(Napi::Env env, int rc);
Napi::Value throwError(Napi::Env env, const char* message);
class TxnWrap;
class DbiWrap;
class EnvWrap;
class CursorWrap;
class SharedEnv {
public:
MDB_env* env;
uint64_t dev;
uint64_t inode;
int count;
bool hasWrites;
};
const int INTERRUPT_BATCH = 9998;
const int WORKER_WAITING = 9997;
const int RESTART_WORKER_TXN = 9999;
const int RESUME_BATCH = 9996;
const int USER_HAS_LOCK = 9995;
const int SEPARATE_FLUSHED = 1;
const int DELETE_ON_CLOSE = 2;
const int OPEN_FAILED = 0x10000;
class WriteWorker {
public:
WriteWorker(MDB_env* env, EnvWrap* envForTxn, uint32_t* instructions);
void Write();
MDB_txn* txn;
MDB_txn* AcquireTxn(int* flags);
void UnlockTxn();
int WaitForCallbacks(MDB_txn** txn, bool allowCommit, uint32_t* target);
virtual void SendUpdate();
int interruptionStatus;
bool finishedProgress;
int resultCode;
bool hasError;
napi_ref callback;
napi_async_work work;
napi_threadsafe_function progress;
EnvWrap* envForTxn;
virtual ~WriteWorker();
uint32_t* instructions;
int progressStatus;
MDB_env* env;
static int DoWrites(MDB_txn* txn, EnvWrap* envForTxn, uint32_t* instruction, WriteWorker* worker);
static bool threadSafeCallsEnabled;
};
class TxnTracked {
public:
TxnTracked(MDB_txn *txn, unsigned int flags);
~TxnTracked();
unsigned int flags;
MDB_txn *txn;
TxnTracked *parent;
};
typedef void* (get_shared_buffers_t)();
/*
`Env`
Represents a database environment.
(Wrapper for `MDB_env`)
*/
typedef struct env_tracking_t {
pthread_mutex_t* envsLock;
std::vector<SharedEnv> envs;
get_shared_buffers_t* getSharedBuffers;
} env_tracking_t;
typedef struct buffer_info_t { // definition of a buffer that is available/used in JS
int32_t id;
bool isSharedMap;
char* end;
MDB_env* env;
napi_ref ref;
} buffer_info_t;
typedef struct js_buffers_t { // there is one instance of this for each JS (worker) thread, holding all the active buffers
std::unordered_map<char*, buffer_info_t> buffers;
int nextId;
pthread_mutex_t modification_lock;
} js_buffers_t;
class EnvWrap : public ObjectWrap<EnvWrap> {
private:
// List of open read transactions
std::vector<TxnWrap*> readTxns;
static env_tracking_t* initTracking();
napi_env napiEnv;
// compression settings and space
Compression *compression;
static thread_local std::vector<EnvWrap*>* openEnvWraps;
// Cleans up stray transactions
void cleanupStrayTxns();
void consolidateTxns();
static void cleanupEnvWraps(void* data);
friend class TxnWrap;
friend class DbiWrap;
public:
EnvWrap(const CallbackInfo&);
~EnvWrap();
// The wrapped object
MDB_env *env;
// Current write transaction
static thread_local js_buffers_t* sharedBuffers;
static env_tracking_t* envTracking;
TxnWrap *currentWriteTxn;
TxnTracked *writeTxn;
pthread_mutex_t* writingLock;
pthread_cond_t* writingCond;
std::vector<AsyncWorker*> workers;
MDB_txn* currentReadTxn;
WriteWorker* writeWorker;
bool readTxnRenewed;
bool hasWrites;
bool trackMetrics;
uint64_t timeTxnWaiting;
unsigned int jsFlags;
char* keyBuffer;
int pageSize;
time_t lastReaderCheck;
MDB_txn* getReadTxn(int64_t tw_address = 0);
// Sets up exports for the Env constructor
static void setupExports(Napi::Env env, Object exports);
void closeEnv(bool hasLock = false);
int openEnv(int flags, int jsFlags, const char* path, char* keyBuffer, Compression* compression, int maxDbs,
int maxReaders, mdb_size_t mapSize, int pageSize, char* encryptionKey);
/*
Gets statistics about the database environment.
*/
Napi::Value stat(const CallbackInfo& info);
/*
Gets statistics about the free space database
*/
Napi::Value freeStat(const CallbackInfo& info);
/*
Gets information about the database environment.
*/
Napi::Value info(const CallbackInfo& info);
/*
Check for stale readers
*/
Napi::Value readerCheck(const CallbackInfo& info);
/*
Print a list of readers
*/
Napi::Value readerList(const CallbackInfo& info);
/*
Opens the database environment with the specified options. The options will be used to configure the environment before opening it.
(Wrapper for `mdb_env_open`)
Parameters:
* Options object that contains possible configuration options.
Possible options are:
* maxDbs: the maximum number of named databases you can have in the environment (default is 1)
* maxReaders: the maximum number of concurrent readers of the environment (default is 126)
* mapSize: maximal size of the memory map (the full environment) in bytes (default is 10485760 bytes)
* path: path to the database environment
*/
Napi::Value open(const CallbackInfo& info);
Napi::Value getMaxKeySize(const CallbackInfo& info);
/*
Copies the database environment to a file.
(Wrapper for `mdb_env_copy2`)
Parameters:
* path - Path to the target file
* compact (optional) - Copy using compact setting
* callback - Callback when finished (this is performed asynchronously)
*/
Napi::Value copy(const CallbackInfo& info);
/*
Closes the database environment.
(Wrapper for `mdb_env_close`)
*/
Napi::Value close(const CallbackInfo& info);
/*
Starts a new transaction in the environment.
(Wrapper for `mdb_txn_begin`)
Parameters:
* Options object that contains possible configuration options.
Possible options are:
* readOnly: if true, the transaction is read-only
*/
Napi::Value beginTxn(const CallbackInfo& info);
Napi::Value commitTxn(const CallbackInfo& info);
Napi::Value abortTxn(const CallbackInfo& info);
/*
Flushes all data to the disk asynchronously.
(Asynchronous wrapper for `mdb_env_sync`)
Parameters:
* Callback to be executed after the sync is complete.
*/
Napi::Value sync(const CallbackInfo& info);
/*
Performs a set of operations asynchronously, automatically wrapping it in its own transaction
Parameters:
* Callback to be executed after the sync is complete.
*/
Napi::Value startWriting(const CallbackInfo& info);
Napi::Value resumeWriting(const CallbackInfo& info);
static napi_value compress(napi_env env, napi_callback_info info);
static napi_value write(napi_env env, napi_callback_info info);
static napi_value onExit(napi_env env, napi_callback_info info);
static int32_t toSharedBuffer(MDB_env* env, uint32_t* keyBuffer, MDB_val data);
};
const int TXN_ABORTABLE = 1;
const int TXN_SYNCHRONOUS_COMMIT = 2;
const int TXN_FROM_WORKER = 4;
/*
`Txn`
Represents a transaction running on a database environment.
(Wrapper for `MDB_txn`)
*/
class TxnWrap : public ObjectWrap<TxnWrap> {
private:
// Reference to the MDB_env of the wrapped MDB_txn
MDB_env *env;
// Environment wrapper of the current transaction
EnvWrap *ew;
// parent TW, if it is exists
TxnWrap *parentTw;
// Flags used with mdb_txn_begin
unsigned int flags;
friend class CursorWrap;
friend class DbiWrap;
friend class EnvWrap;
public:
TxnWrap(const CallbackInfo& info);
~TxnWrap();
// The wrapped object
MDB_txn *txn;
// Remove the current TxnWrap from its EnvWrap
void removeFromEnvWrap();
int begin(EnvWrap *ew, unsigned int flags);
/*
Commits the transaction.
(Wrapper for `mdb_txn_commit`)
*/
Napi::Value commit(const CallbackInfo& info);
/*
Aborts the transaction.
(Wrapper for `mdb_txn_abort`)
*/
Napi::Value abort(const CallbackInfo& info);
/*
Aborts a read-only transaction but makes it renewable with `renew`.
(Wrapper for `mdb_txn_reset`)
*/
void reset();
/*
Renews a read-only transaction after it has been reset.
(Wrapper for `mdb_txn_renew`)
*/
Napi::Value renew(const CallbackInfo& info);
static void setupExports(Napi::Env env, Object exports);
};
const int HAS_VERSIONS = 0x100;
/*
`Dbi`
Represents a database instance in an environment.
(Wrapper for `MDB_dbi`)
*/
class DbiWrap : public ObjectWrap<DbiWrap> {
public:
// Tells how keys should be treated
LmdbKeyType keyType;
// Stores flags set when opened
int flags;
// The wrapped object
MDB_dbi dbi;
// Reference to the MDB_env of the wrapped MDB_dbi
MDB_env *env;
// The EnvWrap object of the current Dbi
EnvWrap *ew;
// Whether the Dbi was opened successfully
bool isOpen;
// compression settings and space
Compression* compression;
// versions stored in data
bool hasVersions;
// current unsafe buffer for this db
bool getFast;
friend class TxnWrap;
friend class CursorWrap;
friend class EnvWrap;
DbiWrap(const CallbackInfo& info);
~DbiWrap();
/*
Closes the database instance.
Wrapper for `mdb_dbi_close`)
*/
Napi::Value close(const CallbackInfo& info);
/*
Drops the database instance, either deleting it completely (default) or just freeing its pages.
Parameters:
* Options object that contains possible configuration options.
Possible options are:
* justFreePages - indicates that the database pages need to be freed but the database shouldn't be deleted
*/
Napi::Value drop(const CallbackInfo& info);
Napi::Value stat(const CallbackInfo& info);
int prefetch(uint32_t* keys);
int open(int flags, char* name, bool hasVersions, LmdbKeyType keyType, Compression* compression);
int32_t doGetByBinary(uint32_t keySize, uint32_t ifNotTxnId, int64_t txnAddress);
static void setupExports(Napi::Env env, Object exports);
};
class Compression : public ObjectWrap<Compression> {
public:
char* dictionary; // dictionary to use to decompress
char* compressDictionary; // separate dictionary to use to compress since the decompression dictionary can move around in the main thread
unsigned int dictionarySize;
char* decompressTarget;
unsigned int decompressSize;
unsigned int compressionThreshold;
// compression acceleration (defaults to 1)
int acceleration;
static thread_local LZ4_stream_t* stream;
void decompress(MDB_val& data, bool &isValid, bool canAllocate);
argtokey_callback_t compress(MDB_val* value, argtokey_callback_t freeValue);
int compressInstruction(EnvWrap* env, double* compressionAddress);
Napi::Value ctor(const CallbackInfo& info);
Napi::Value setBuffer(const CallbackInfo& info);
Compression(const CallbackInfo& info);
friend class EnvWrap;
friend class DbiWrap;
//NAN_METHOD(Compression::startCompressing);
static void setupExports(Napi::Env env, Object exports);
};
/*
`Cursor`
Represents a cursor instance that is assigned to a transaction and a database instance
(Wrapper for `MDB_cursor`)
*/
class CursorWrap : public ObjectWrap<CursorWrap> {
private:
// Key/data pair where the cursor is at, and ending key
MDB_val key, data, endKey;
// Free function for the current key
argtokey_callback_t freeKey;
public:
MDB_cursor_op iteratingOp;
MDB_cursor *cursor;
// Stores how key is represented
LmdbKeyType keyType;
int flags;
DbiWrap *dw;
MDB_txn *txn;
// The wrapped object
CursorWrap(MDB_cursor* cursor);
CursorWrap(const CallbackInfo& info);
~CursorWrap();
// Sets up exports for the Cursor constructor
static void setupExports(Napi::Env env, Object exports);
/*
Closes the cursor.
(Wrapper for `mdb_cursor_close`)
Parameters:
* Transaction object
* Database instance object
*/
Napi::Value close(const CallbackInfo& info);
/*
Deletes the key/data pair to which the cursor refers.
(Wrapper for `mdb_cursor_del`)
*/
Napi::Value del(const CallbackInfo& info);
int returnEntry(int lastRC, MDB_val &key, MDB_val &data);
int32_t doPosition(uint32_t offset, uint32_t keySize, uint64_t endKeyAddress);
//Value getStringByBinary(const CallbackInfo& info);
};
#endif // NODE_LMDB_H
// Portions of this file are from node-lmdb
// Copyright (c) 2013-2017 Timur Kristóf
// Licensed to you under the terms of the MIT license
//
// 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.
| [
"artinsafarian@live.com"
] | artinsafarian@live.com |
b4b214d8d990d3945ba6b17ef69dc04c80c6ae06 | 1d9df1156e49f768ed2633641075f4c307d24ad2 | /base/trace_event/memory_dump_manager.cc | f4ac5be1b8b896b829e312edc05d330853611791 | [
"BSD-3-Clause"
] | permissive | GSIL-Monitor/platform.framework.web.chromium-efl | 8056d94301c67a8524f6106482087fd683c889ce | e156100b0c5cfc84c19de612dbdb0987cddf8867 | refs/heads/master | 2022-10-26T00:23:44.061873 | 2018-10-30T03:41:51 | 2018-10-30T03:41:51 | 161,171,104 | 0 | 1 | BSD-3-Clause | 2022-10-20T23:50:20 | 2018-12-10T12:24:06 | C++ | UTF-8 | C++ | false | false | 37,788 | 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 "base/trace_event/memory_dump_manager.h"
#include <inttypes.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include "base/allocator/features.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/alias.h"
#include "base/debug/stack_trace.h"
#include "base/debug/thread_heap_usage_tracker.h"
#include "base/memory/ptr_util.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/heap_profiler.h"
#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
#include "base/trace_event/heap_profiler_event_filter.h"
#include "base/trace_event/heap_profiler_serialization_state.h"
#include "base/trace_event/heap_profiler_stack_frame_deduplicator.h"
#include "base/trace_event/heap_profiler_type_name_deduplicator.h"
#include "base/trace_event/malloc_dump_provider.h"
#include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/memory_dump_scheduler.h"
#include "base/trace_event/memory_infra_background_whitelist.h"
#include "base/trace_event/memory_peak_detector.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
#include "build/build_config.h"
#if defined(OS_ANDROID)
#include "base/trace_event/java_heap_dump_provider_android.h"
#endif
namespace base {
namespace trace_event {
namespace {
const char* const kTraceEventArgNames[] = {"dumps"};
const unsigned char kTraceEventArgTypes[] = {TRACE_VALUE_TYPE_CONVERTABLE};
MemoryDumpManager* g_instance_for_testing = nullptr;
// Temporary (until peak detector and scheduler are moved outside of here)
// trampoline function to match the |request_dump_function| passed to Initialize
// to the callback expected by MemoryPeakDetector and MemoryDumpScheduler.
// TODO(primiano): remove this.
void DoGlobalDumpWithoutCallback(
MemoryDumpManager::RequestGlobalDumpFunction global_dump_fn,
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail) {
// The actual dump_guid will be set by service. TODO(primiano): remove
// guid from the request args API.
MemoryDumpRequestArgs args{0 /* dump_guid */, dump_type, level_of_detail};
global_dump_fn.Run(args);
}
// Proxy class which wraps a ConvertableToTraceFormat owned by the
// |heap_profiler_serialization_state| into a proxy object that can be added to
// the trace event log. This is to solve the problem that the
// HeapProfilerSerializationState is refcounted but the tracing subsystem wants
// a std::unique_ptr<ConvertableToTraceFormat>.
template <typename T>
struct SessionStateConvertableProxy : public ConvertableToTraceFormat {
using GetterFunctPtr = T* (HeapProfilerSerializationState::*)() const;
SessionStateConvertableProxy(scoped_refptr<HeapProfilerSerializationState>
heap_profiler_serialization_state,
GetterFunctPtr getter_function)
: heap_profiler_serialization_state(heap_profiler_serialization_state),
getter_function(getter_function) {}
void AppendAsTraceFormat(std::string* out) const override {
return (heap_profiler_serialization_state.get()->*getter_function)()
->AppendAsTraceFormat(out);
}
void EstimateTraceMemoryOverhead(
TraceEventMemoryOverhead* overhead) override {
return (heap_profiler_serialization_state.get()->*getter_function)()
->EstimateTraceMemoryOverhead(overhead);
}
scoped_refptr<HeapProfilerSerializationState>
heap_profiler_serialization_state;
GetterFunctPtr const getter_function;
};
void NotifyHeapProfilingEnabledOnMDPThread(
scoped_refptr<MemoryDumpProviderInfo> mdpinfo,
bool profiling_enabled) {
mdpinfo->dump_provider->OnHeapProfilingEnabled(profiling_enabled);
}
inline bool ShouldEnableMDPAllocatorHooks(HeapProfilingMode mode) {
return (mode == kHeapProfilingModePseudo) ||
(mode == kHeapProfilingModeNative) ||
(mode == kHeapProfilingModeBackground);
}
#if BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
inline bool IsHeapProfilingModeEnabled(HeapProfilingMode mode) {
return mode != kHeapProfilingModeDisabled &&
mode != kHeapProfilingModeInvalid;
}
void EnableFilteringForPseudoStackProfiling() {
if (AllocationContextTracker::capture_mode() !=
AllocationContextTracker::CaptureMode::PSEUDO_STACK ||
(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) {
return;
}
// Create trace config with heap profiling filter.
std::string filter_string = JoinString(
{"*", TRACE_DISABLED_BY_DEFAULT("net"), TRACE_DISABLED_BY_DEFAULT("cc"),
MemoryDumpManager::kTraceCategory},
",");
TraceConfigCategoryFilter category_filter;
category_filter.InitializeFromString(filter_string);
TraceConfig::EventFilterConfig heap_profiler_filter_config(
HeapProfilerEventFilter::kName);
heap_profiler_filter_config.SetCategoryFilter(category_filter);
TraceConfig::EventFilters filters;
filters.push_back(heap_profiler_filter_config);
TraceConfig filtering_trace_config;
filtering_trace_config.SetEventFilters(filters);
TraceLog::GetInstance()->SetEnabled(filtering_trace_config,
TraceLog::FILTERING_MODE);
}
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
} // namespace
// static
const char* const MemoryDumpManager::kTraceCategory =
TRACE_DISABLED_BY_DEFAULT("memory-infra");
// static
const int MemoryDumpManager::kMaxConsecutiveFailuresCount = 3;
// static
const uint64_t MemoryDumpManager::kInvalidTracingProcessId = 0;
// static
const char* const MemoryDumpManager::kSystemAllocatorPoolName =
#if defined(MALLOC_MEMORY_TRACING_SUPPORTED)
MallocDumpProvider::kAllocatedObjects;
#else
nullptr;
#endif
// static
MemoryDumpManager* MemoryDumpManager::GetInstance() {
if (g_instance_for_testing)
return g_instance_for_testing;
return Singleton<MemoryDumpManager,
LeakySingletonTraits<MemoryDumpManager>>::get();
}
// static
std::unique_ptr<MemoryDumpManager>
MemoryDumpManager::CreateInstanceForTesting() {
DCHECK(!g_instance_for_testing);
std::unique_ptr<MemoryDumpManager> instance(new MemoryDumpManager());
g_instance_for_testing = instance.get();
return instance;
}
MemoryDumpManager::MemoryDumpManager()
: is_coordinator_(false),
tracing_process_id_(kInvalidTracingProcessId),
dumper_registrations_ignored_for_testing_(false),
heap_profiling_mode_(kHeapProfilingModeDisabled) {}
MemoryDumpManager::~MemoryDumpManager() {
Thread* dump_thread = nullptr;
{
AutoLock lock(lock_);
if (dump_thread_) {
dump_thread = dump_thread_.get();
}
}
if (dump_thread) {
dump_thread->Stop();
}
AutoLock lock(lock_);
dump_thread_.reset();
g_instance_for_testing = nullptr;
}
// static
HeapProfilingMode MemoryDumpManager::GetHeapProfilingModeFromCommandLine() {
if (!CommandLine::InitializedForCurrentProcess() ||
!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableHeapProfiling)) {
return kHeapProfilingModeDisabled;
}
#if BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
std::string profiling_mode =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kEnableHeapProfiling);
if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler)
return kHeapProfilingModeTaskProfiler;
if (profiling_mode == switches::kEnableHeapProfilingModePseudo)
return kHeapProfilingModePseudo;
if (profiling_mode == switches::kEnableHeapProfilingModeNative)
return kHeapProfilingModeNative;
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
return kHeapProfilingModeInvalid;
}
void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
#if BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
HeapProfilingMode profiling_mode = GetHeapProfilingModeFromCommandLine();
if (IsHeapProfilingModeEnabled(profiling_mode)) {
EnableHeapProfiling(profiling_mode);
} else {
if (profiling_mode == kHeapProfilingModeInvalid) {
// Heap profiling is misconfigured, disable it permanently.
EnableHeapProfiling(kHeapProfilingModeDisabled);
}
}
#else
// Heap profiling is unsupported, disable it permanently.
EnableHeapProfiling(kHeapProfilingModeDisabled);
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
}
bool MemoryDumpManager::EnableHeapProfiling(HeapProfilingMode profiling_mode) {
AutoLock lock(lock_);
#if BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
bool notify_mdps = true;
if (heap_profiling_mode_ == kHeapProfilingModeInvalid)
return false; // Disabled permanently.
if (IsHeapProfilingModeEnabled(heap_profiling_mode_) ==
IsHeapProfilingModeEnabled(profiling_mode)) {
if (profiling_mode == kHeapProfilingModeDisabled)
heap_profiling_mode_ = kHeapProfilingModeInvalid; // Disable permanently.
return false;
}
switch (profiling_mode) {
case kHeapProfilingModeTaskProfiler:
if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled())
base::debug::ThreadHeapUsageTracker::EnableHeapTracking();
notify_mdps = false;
break;
case kHeapProfilingModeBackground:
AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::PSEUDO_STACK);
break;
case kHeapProfilingModePseudo:
AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::PSEUDO_STACK);
EnableFilteringForPseudoStackProfiling();
break;
case kHeapProfilingModeNative:
// If we don't have frame pointers then native tracing falls-back to
// using base::debug::StackTrace, which may be slow.
AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::NATIVE_STACK);
break;
case kHeapProfilingModeDisabled:
if (heap_profiling_mode_ == kHeapProfilingModeTaskProfiler) {
LOG(ERROR) << "ThreadHeapUsageTracker cannot be disabled.";
return false;
}
if (heap_profiling_mode_ == kHeapProfilingModePseudo)
TraceLog::GetInstance()->SetDisabled(TraceLog::FILTERING_MODE);
AllocationContextTracker::SetCaptureMode(
AllocationContextTracker::CaptureMode::DISABLED);
heap_profiling_mode_ = kHeapProfilingModeInvalid; // Disable permanently.
break;
default:
NOTREACHED() << "Incorrect heap profiling mode " << profiling_mode;
return false;
}
if (heap_profiling_mode_ != kHeapProfilingModeInvalid)
heap_profiling_mode_ = profiling_mode;
// In case tracing was already enabled, setup the serialization state before
// notifying mdps.
InitializeHeapProfilerStateIfNeededLocked();
if (notify_mdps) {
bool enabled = IsHeapProfilingModeEnabled(heap_profiling_mode_);
for (const auto& mdpinfo : dump_providers_)
NotifyHeapProfilingEnabledLocked(mdpinfo, enabled);
}
return true;
#else
heap_profiling_mode_ = kHeapProfilingModeInvalid;
return false;
#endif // BUILDFLAG(USE_ALLOCATOR_SHIM) && !defined(OS_NACL)
}
HeapProfilingMode MemoryDumpManager::GetHeapProfilingMode() {
AutoLock lock(lock_);
return heap_profiling_mode_;
}
void MemoryDumpManager::Initialize(
RequestGlobalDumpFunction request_dump_function,
bool is_coordinator) {
{
AutoLock lock(lock_);
DCHECK(!request_dump_function.is_null());
DCHECK(!can_request_global_dumps());
request_dump_function_ = request_dump_function;
is_coordinator_ = is_coordinator;
}
EnableHeapProfilingIfNeeded();
// Enable the core dump providers.
#if defined(MALLOC_MEMORY_TRACING_SUPPORTED)
base::trace_event::MemoryDumpProvider::Options options;
options.supports_heap_profiling = true;
RegisterDumpProvider(MallocDumpProvider::GetInstance(), "Malloc", nullptr,
options);
#endif
#if defined(OS_ANDROID)
RegisterDumpProvider(JavaHeapDumpProvider::GetInstance(), "JavaHeap",
nullptr);
#endif
TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory);
}
void MemoryDumpManager::RegisterDumpProvider(
MemoryDumpProvider* mdp,
const char* name,
scoped_refptr<SingleThreadTaskRunner> task_runner,
MemoryDumpProvider::Options options) {
options.dumps_on_single_thread_task_runner = true;
RegisterDumpProviderInternal(mdp, name, std::move(task_runner), options);
}
void MemoryDumpManager::RegisterDumpProvider(
MemoryDumpProvider* mdp,
const char* name,
scoped_refptr<SingleThreadTaskRunner> task_runner) {
// Set |dumps_on_single_thread_task_runner| to true because all providers
// without task runner are run on dump thread.
MemoryDumpProvider::Options options;
options.dumps_on_single_thread_task_runner = true;
RegisterDumpProviderInternal(mdp, name, std::move(task_runner), options);
}
void MemoryDumpManager::RegisterDumpProviderWithSequencedTaskRunner(
MemoryDumpProvider* mdp,
const char* name,
scoped_refptr<SequencedTaskRunner> task_runner,
MemoryDumpProvider::Options options) {
DCHECK(task_runner);
options.dumps_on_single_thread_task_runner = false;
RegisterDumpProviderInternal(mdp, name, std::move(task_runner), options);
}
void MemoryDumpManager::RegisterDumpProviderInternal(
MemoryDumpProvider* mdp,
const char* name,
scoped_refptr<SequencedTaskRunner> task_runner,
const MemoryDumpProvider::Options& options) {
if (dumper_registrations_ignored_for_testing_)
return;
// A handful of MDPs are required to compute the summary struct these are
// 'whitelisted for summary mode'. These MDPs are a subset of those which
// have small enough performance overhead that it is resonable to run them
// in the background while the user is doing other things. Those MDPs are
// 'whitelisted for background mode'.
bool whitelisted_for_background_mode = IsMemoryDumpProviderWhitelisted(name);
bool whitelisted_for_summary_mode =
IsMemoryDumpProviderWhitelistedForSummary(name);
scoped_refptr<MemoryDumpProviderInfo> mdpinfo = new MemoryDumpProviderInfo(
mdp, name, std::move(task_runner), options,
whitelisted_for_background_mode, whitelisted_for_summary_mode);
if (options.is_fast_polling_supported) {
DCHECK(!mdpinfo->task_runner) << "MemoryDumpProviders capable of fast "
"polling must NOT be thread bound.";
}
{
AutoLock lock(lock_);
bool already_registered = !dump_providers_.insert(mdpinfo).second;
// This actually happens in some tests which don't have a clean tear-down
// path for RenderThreadImpl::Init().
if (already_registered)
return;
if (options.is_fast_polling_supported)
MemoryPeakDetector::GetInstance()->NotifyMemoryDumpProvidersChanged();
if (ShouldEnableMDPAllocatorHooks(heap_profiling_mode_))
NotifyHeapProfilingEnabledLocked(mdpinfo, true);
}
}
void MemoryDumpManager::UnregisterDumpProvider(MemoryDumpProvider* mdp) {
UnregisterDumpProviderInternal(mdp, false /* delete_async */);
}
void MemoryDumpManager::UnregisterAndDeleteDumpProviderSoon(
std::unique_ptr<MemoryDumpProvider> mdp) {
UnregisterDumpProviderInternal(mdp.release(), true /* delete_async */);
}
void MemoryDumpManager::UnregisterDumpProviderInternal(
MemoryDumpProvider* mdp,
bool take_mdp_ownership_and_delete_async) {
std::unique_ptr<MemoryDumpProvider> owned_mdp;
if (take_mdp_ownership_and_delete_async)
owned_mdp.reset(mdp);
AutoLock lock(lock_);
auto mdp_iter = dump_providers_.begin();
for (; mdp_iter != dump_providers_.end(); ++mdp_iter) {
if ((*mdp_iter)->dump_provider == mdp)
break;
}
if (mdp_iter == dump_providers_.end())
return; // Not registered / already unregistered.
if (take_mdp_ownership_and_delete_async) {
// The MDP will be deleted whenever the MDPInfo struct will, that is either:
// - At the end of this function, if no dump is in progress.
// - Either in SetupNextMemoryDump() or InvokeOnMemoryDump() when MDPInfo is
// removed from |pending_dump_providers|.
// - When the provider is removed from other clients (MemoryPeakDetector).
DCHECK(!(*mdp_iter)->owned_dump_provider);
(*mdp_iter)->owned_dump_provider = std::move(owned_mdp);
} else {
// If you hit this DCHECK, your dump provider has a bug.
// Unregistration of a MemoryDumpProvider is safe only if:
// - The MDP has specified a sequenced task runner affinity AND the
// unregistration happens on the same task runner. So that the MDP cannot
// unregister and be in the middle of a OnMemoryDump() at the same time.
// - The MDP has NOT specified a task runner affinity and its ownership is
// transferred via UnregisterAndDeleteDumpProviderSoon().
// In all the other cases, it is not possible to guarantee that the
// unregistration will not race with OnMemoryDump() calls.
DCHECK((*mdp_iter)->task_runner &&
(*mdp_iter)->task_runner->RunsTasksInCurrentSequence())
<< "MemoryDumpProvider \"" << (*mdp_iter)->name << "\" attempted to "
<< "unregister itself in a racy way. Please file a crbug.";
}
if ((*mdp_iter)->options.is_fast_polling_supported) {
DCHECK(take_mdp_ownership_and_delete_async);
MemoryPeakDetector::GetInstance()->NotifyMemoryDumpProvidersChanged();
}
// The MDPInfo instance can still be referenced by the
// |ProcessMemoryDumpAsyncState.pending_dump_providers|. For this reason
// the MDPInfo is flagged as disabled. It will cause InvokeOnMemoryDump()
// to just skip it, without actually invoking the |mdp|, which might be
// destroyed by the caller soon after this method returns.
(*mdp_iter)->disabled = true;
dump_providers_.erase(mdp_iter);
}
void MemoryDumpManager::GetDumpProvidersForPolling(
std::vector<scoped_refptr<MemoryDumpProviderInfo>>* providers) {
DCHECK(providers->empty());
AutoLock lock(lock_);
for (const scoped_refptr<MemoryDumpProviderInfo>& mdp : dump_providers_) {
if (mdp->options.is_fast_polling_supported)
providers->push_back(mdp);
}
}
bool MemoryDumpManager::IsDumpProviderRegisteredForTesting(
MemoryDumpProvider* provider) {
AutoLock lock(lock_);
for (const auto& info : dump_providers_) {
if (info->dump_provider == provider)
return true;
}
return false;
}
scoped_refptr<base::SequencedTaskRunner>
MemoryDumpManager::GetOrCreateBgTaskRunnerLocked() {
lock_.AssertAcquired();
if (dump_thread_)
return dump_thread_->task_runner();
dump_thread_ = std::make_unique<Thread>("MemoryInfra");
bool started = dump_thread_->Start();
CHECK(started);
return dump_thread_->task_runner();
}
void MemoryDumpManager::CreateProcessDump(
const MemoryDumpRequestArgs& args,
const ProcessMemoryDumpCallback& callback) {
char guid_str[20];
sprintf(guid_str, "0x%" PRIx64, args.dump_guid);
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(kTraceCategory, "ProcessMemoryDump",
TRACE_ID_LOCAL(args.dump_guid), "dump_guid",
TRACE_STR_COPY(guid_str));
// If argument filter is enabled then only background mode dumps should be
// allowed. In case the trace config passed for background tracing session
// missed the allowed modes argument, it crashes here instead of creating
// unexpected dumps.
if (TraceLog::GetInstance()
->GetCurrentTraceConfig()
.IsArgumentFilterEnabled()) {
CHECK_EQ(MemoryDumpLevelOfDetail::BACKGROUND, args.level_of_detail);
}
std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state;
{
AutoLock lock(lock_);
// MDM could have been disabled by this point destroying
// |heap_profiler_serialization_state|. If heap profiling is enabled we
// require session state so if heap profiling is on and session state is
// absent we fail the dump immediately. If heap profiler is enabled during
// the dump, then the dump succeeds since the dump was requested before, and
// the future process dumps will contain heap dumps.
if (args.dump_type != MemoryDumpType::SUMMARY_ONLY &&
ShouldEnableMDPAllocatorHooks(heap_profiling_mode_) &&
!heap_profiler_serialization_state_) {
callback.Run(false /* success */, args.dump_guid, nullptr);
return;
}
pmd_async_state.reset(new ProcessMemoryDumpAsyncState(
args, dump_providers_, heap_profiler_serialization_state_, callback,
GetOrCreateBgTaskRunnerLocked()));
// If enabled, holds back the peak detector resetting its estimation window.
MemoryPeakDetector::GetInstance()->Throttle();
}
// Start the process dump. This involves task runner hops as specified by the
// MemoryDumpProvider(s) in RegisterDumpProvider()).
SetupNextMemoryDump(std::move(pmd_async_state));
}
// PostTask InvokeOnMemoryDump() to the dump provider's sequenced task runner. A
// PostTask is always required for a generic SequencedTaskRunner to ensure that
// no other task is running on it concurrently. SetupNextMemoryDump() and
// InvokeOnMemoryDump() are called alternatively which linearizes the dump
// provider's OnMemoryDump invocations.
// At most one of either SetupNextMemoryDump() or InvokeOnMemoryDump() can be
// active at any time for a given PMD, regardless of status of the |lock_|.
// |lock_| is used in these functions purely to ensure consistency w.r.t.
// (un)registrations of |dump_providers_|.
void MemoryDumpManager::SetupNextMemoryDump(
std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state) {
HEAP_PROFILER_SCOPED_IGNORE;
// Initalizes the ThreadLocalEventBuffer to guarantee that the TRACE_EVENTs
// in the PostTask below don't end up registering their own dump providers
// (for discounting trace memory overhead) while holding the |lock_|.
TraceLog::GetInstance()->InitializeThreadLocalEventBufferIfSupported();
if (pmd_async_state->pending_dump_providers.empty())
return FinishAsyncProcessDump(std::move(pmd_async_state));
// Read MemoryDumpProviderInfo thread safety considerations in
// memory_dump_manager.h when accessing |mdpinfo| fields.
MemoryDumpProviderInfo* mdpinfo =
pmd_async_state->pending_dump_providers.back().get();
// If we are in background tracing, we should invoke only the whitelisted
// providers. Ignore other providers and continue.
if (pmd_async_state->req_args.level_of_detail ==
MemoryDumpLevelOfDetail::BACKGROUND &&
!mdpinfo->whitelisted_for_background_mode) {
pmd_async_state->pending_dump_providers.pop_back();
return SetupNextMemoryDump(std::move(pmd_async_state));
}
// If we are in summary mode, we only need to invoke the providers
// whitelisted for summary mode.
if (pmd_async_state->req_args.dump_type == MemoryDumpType::SUMMARY_ONLY &&
!mdpinfo->whitelisted_for_summary_mode) {
pmd_async_state->pending_dump_providers.pop_back();
return SetupNextMemoryDump(std::move(pmd_async_state));
}
// If the dump provider did not specify a task runner affinity, dump on
// |dump_thread_|.
scoped_refptr<SequencedTaskRunner> task_runner = mdpinfo->task_runner;
if (!task_runner) {
DCHECK(mdpinfo->options.dumps_on_single_thread_task_runner);
task_runner = pmd_async_state->dump_thread_task_runner;
DCHECK(task_runner);
}
if (mdpinfo->options.dumps_on_single_thread_task_runner &&
task_runner->RunsTasksInCurrentSequence()) {
// If |dumps_on_single_thread_task_runner| is true then no PostTask is
// required if we are on the right thread.
return InvokeOnMemoryDump(pmd_async_state.release());
}
bool did_post_task = task_runner->PostTask(
FROM_HERE, BindOnce(&MemoryDumpManager::InvokeOnMemoryDump,
Unretained(this), Unretained(pmd_async_state.get())));
if (did_post_task) {
// Ownership is tranferred to InvokeOnMemoryDump().
ignore_result(pmd_async_state.release());
return;
}
// PostTask usually fails only if the process or thread is shut down. So, the
// dump provider is disabled here. But, don't disable unbound dump providers.
// The utility thread is normally shutdown when disabling the trace and
// getting here in this case is expected.
if (mdpinfo->task_runner) {
LOG(ERROR) << "Disabling MemoryDumpProvider \"" << mdpinfo->name
<< "\". Failed to post task on the task runner provided.";
// A locked access is required to R/W |disabled| (for the
// UnregisterAndDeleteDumpProviderSoon() case).
AutoLock lock(lock_);
mdpinfo->disabled = true;
}
// PostTask failed. Ignore the dump provider and continue.
pmd_async_state->pending_dump_providers.pop_back();
SetupNextMemoryDump(std::move(pmd_async_state));
}
// This function is called on the right task runner for current MDP. It is
// either the task runner specified by MDP or |dump_thread_task_runner| if the
// MDP did not specify task runner. Invokes the dump provider's OnMemoryDump()
// (unless disabled).
void MemoryDumpManager::InvokeOnMemoryDump(
ProcessMemoryDumpAsyncState* owned_pmd_async_state) {
HEAP_PROFILER_SCOPED_IGNORE;
// In theory |owned_pmd_async_state| should be a scoped_ptr. The only reason
// why it isn't is because of the corner case logic of |did_post_task|
// above, which needs to take back the ownership of the |pmd_async_state| when
// the PostTask() fails.
// Unfortunately, PostTask() destroys the scoped_ptr arguments upon failure
// to prevent accidental leaks. Using a scoped_ptr would prevent us to to
// skip the hop and move on. Hence the manual naked -> scoped ptr juggling.
auto pmd_async_state = WrapUnique(owned_pmd_async_state);
owned_pmd_async_state = nullptr;
// Read MemoryDumpProviderInfo thread safety considerations in
// memory_dump_manager.h when accessing |mdpinfo| fields.
MemoryDumpProviderInfo* mdpinfo =
pmd_async_state->pending_dump_providers.back().get();
DCHECK(!mdpinfo->task_runner ||
mdpinfo->task_runner->RunsTasksInCurrentSequence());
// Limit the scope of the TRACE_EVENT1 below to not include the
// SetupNextMemoryDump(). Don't replace with a BEGIN/END pair or change the
// event name, as the slow-reports pipeline relies on this event.
{
TRACE_EVENT1(kTraceCategory, "MemoryDumpManager::InvokeOnMemoryDump",
"dump_provider.name", mdpinfo->name);
// Do not add any other TRACE_EVENT macro (or function that might have them)
// below this point. Under some rare circunstances, they can re-initialize
// and invalide the current ThreadLocalEventBuffer MDP, making the
// |should_dump| check below susceptible to TOCTTOU bugs (crbug.com/763365).
bool should_dump;
bool is_thread_bound;
{
// A locked access is required to R/W |disabled| (for the
// UnregisterAndDeleteDumpProviderSoon() case).
AutoLock lock(lock_);
// Unregister the dump provider if it failed too many times consecutively.
if (!mdpinfo->disabled &&
mdpinfo->consecutive_failures >= kMaxConsecutiveFailuresCount) {
mdpinfo->disabled = true;
LOG(ERROR) << "Disabling MemoryDumpProvider \"" << mdpinfo->name
<< "\". Dump failed multiple times consecutively.";
}
should_dump = !mdpinfo->disabled;
is_thread_bound = mdpinfo->task_runner != nullptr;
} // AutoLock lock(lock_);
if (should_dump) {
// Invoke the dump provider.
// A stack allocated string with dump provider name is useful to debug
// crashes while invoking dump after a |dump_provider| is not unregistered
// in safe way.
// TODO(ssid): Remove this after fixing crbug.com/643438.
char provider_name_for_debugging[16];
strncpy(provider_name_for_debugging, mdpinfo->name,
sizeof(provider_name_for_debugging) - 1);
provider_name_for_debugging[sizeof(provider_name_for_debugging) - 1] =
'\0';
base::debug::Alias(provider_name_for_debugging);
ProcessMemoryDump* pmd = pmd_async_state->process_memory_dump.get();
ANNOTATE_BENIGN_RACE(&mdpinfo->disabled, "best-effort race detection");
CHECK(!is_thread_bound ||
!*(static_cast<volatile bool*>(&mdpinfo->disabled)));
bool dump_successful =
mdpinfo->dump_provider->OnMemoryDump(pmd->dump_args(), pmd);
mdpinfo->consecutive_failures =
dump_successful ? 0 : mdpinfo->consecutive_failures + 1;
}
}
pmd_async_state->pending_dump_providers.pop_back();
SetupNextMemoryDump(std::move(pmd_async_state));
}
void MemoryDumpManager::FinishAsyncProcessDump(
std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state) {
HEAP_PROFILER_SCOPED_IGNORE;
DCHECK(pmd_async_state->pending_dump_providers.empty());
const uint64_t dump_guid = pmd_async_state->req_args.dump_guid;
if (!pmd_async_state->callback_task_runner->BelongsToCurrentThread()) {
scoped_refptr<SingleThreadTaskRunner> callback_task_runner =
pmd_async_state->callback_task_runner;
callback_task_runner->PostTask(
FROM_HERE, BindOnce(&MemoryDumpManager::FinishAsyncProcessDump,
Unretained(this), Passed(&pmd_async_state)));
return;
}
TRACE_EVENT0(kTraceCategory, "MemoryDumpManager::FinishAsyncProcessDump");
// In the general case (allocators and edges) the serialization into the trace
// buffer is handled by the memory-infra service (see tracing_observer.cc).
// This special case below deals only with serialization of the heap profiler
// and is temporary given the upcoming work on the out-of-process heap
// profiler.
const auto& args = pmd_async_state->req_args;
if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) {
std::unique_ptr<TracedValue> traced_value = base::MakeUnique<TracedValue>();
pmd_async_state->process_memory_dump->SerializeHeapProfilerDumpsInto(
traced_value.get());
traced_value->SetString("level_of_detail",
base::trace_event::MemoryDumpLevelOfDetailToString(
args.level_of_detail));
std::unique_ptr<base::trace_event::ConvertableToTraceFormat> event_value(
std::move(traced_value));
TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
TRACE_EVENT_PHASE_MEMORY_DUMP,
base::trace_event::TraceLog::GetCategoryGroupEnabled(
base::trace_event::MemoryDumpManager::kTraceCategory),
base::trace_event::MemoryDumpTypeToString(args.dump_type),
trace_event_internal::kGlobalScope, args.dump_guid,
base::kNullProcessId, 1 /* num_args */, kTraceEventArgNames,
kTraceEventArgTypes, nullptr /* arg_values */, &event_value,
TRACE_EVENT_FLAG_HAS_ID);
}
if (!pmd_async_state->callback.is_null()) {
pmd_async_state->callback.Run(
true /* success */, dump_guid,
std::move(pmd_async_state->process_memory_dump));
pmd_async_state->callback.Reset();
}
TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump",
TRACE_ID_LOCAL(dump_guid));
}
void MemoryDumpManager::SetupForTracing(
const TraceConfig::MemoryDumpConfig& memory_dump_config) {
AutoLock lock(lock_);
heap_profiler_serialization_state_ = new HeapProfilerSerializationState();
heap_profiler_serialization_state_
->set_heap_profiler_breakdown_threshold_bytes(
memory_dump_config.heap_profiler_options.breakdown_threshold_bytes);
InitializeHeapProfilerStateIfNeededLocked();
// At this point we must have the ability to request global dumps.
DCHECK(can_request_global_dumps());
MemoryDumpScheduler::Config periodic_config;
bool peak_detector_configured = false;
for (const auto& trigger : memory_dump_config.triggers) {
if (trigger.trigger_type == MemoryDumpType::PERIODIC_INTERVAL) {
if (periodic_config.triggers.empty()) {
periodic_config.callback =
BindRepeating(&DoGlobalDumpWithoutCallback, request_dump_function_,
MemoryDumpType::PERIODIC_INTERVAL);
}
periodic_config.triggers.push_back(
{trigger.level_of_detail, trigger.min_time_between_dumps_ms});
} else if (trigger.trigger_type == MemoryDumpType::PEAK_MEMORY_USAGE) {
// At most one peak trigger is allowed.
CHECK(!peak_detector_configured);
peak_detector_configured = true;
MemoryPeakDetector::GetInstance()->Setup(
BindRepeating(&MemoryDumpManager::GetDumpProvidersForPolling,
Unretained(this)),
GetOrCreateBgTaskRunnerLocked(),
BindRepeating(&DoGlobalDumpWithoutCallback, request_dump_function_,
MemoryDumpType::PEAK_MEMORY_USAGE,
trigger.level_of_detail));
MemoryPeakDetector::Config peak_config;
peak_config.polling_interval_ms = 10;
peak_config.min_time_between_peaks_ms = trigger.min_time_between_dumps_ms;
peak_config.enable_verbose_poll_tracing =
trigger.level_of_detail == MemoryDumpLevelOfDetail::DETAILED;
MemoryPeakDetector::GetInstance()->Start(peak_config);
// When peak detection is enabled, trigger a dump straight away as it
// gives a good reference point for analyzing the trace.
if (is_coordinator_) {
GetOrCreateBgTaskRunnerLocked()->PostTask(
FROM_HERE,
BindRepeating(&DoGlobalDumpWithoutCallback, request_dump_function_,
MemoryDumpType::PEAK_MEMORY_USAGE,
trigger.level_of_detail));
}
}
}
// Only coordinator process triggers periodic memory dumps.
if (is_coordinator_ && !periodic_config.triggers.empty()) {
MemoryDumpScheduler::GetInstance()->Start(periodic_config,
GetOrCreateBgTaskRunnerLocked());
}
}
void MemoryDumpManager::TeardownForTracing() {
// There might be a memory dump in progress while this happens. Therefore,
// ensure that the MDM state which depends on the tracing enabled / disabled
// state is always accessed by the dumping methods holding the |lock_|.
AutoLock lock(lock_);
MemoryDumpScheduler::GetInstance()->Stop();
MemoryPeakDetector::GetInstance()->TearDown();
heap_profiler_serialization_state_ = nullptr;
}
void MemoryDumpManager::InitializeHeapProfilerStateIfNeededLocked() {
lock_.AssertAcquired();
if (!ShouldEnableMDPAllocatorHooks(heap_profiling_mode_) ||
!heap_profiler_serialization_state_ ||
heap_profiler_serialization_state_->is_initialized()) {
return;
}
// If heap profiling is enabled, the stack frame deduplicator and type name
// deduplicator will be in use. Add a metadata events to write the frames
// and type IDs.
heap_profiler_serialization_state_->SetStackFrameDeduplicator(
WrapUnique(new StackFrameDeduplicator));
heap_profiler_serialization_state_->SetTypeNameDeduplicator(
WrapUnique(new TypeNameDeduplicator));
TRACE_EVENT_API_ADD_METADATA_EVENT(
TraceLog::GetCategoryGroupEnabled("__metadata"), "stackFrames",
"stackFrames",
std::make_unique<SessionStateConvertableProxy<StackFrameDeduplicator>>(
heap_profiler_serialization_state_,
&HeapProfilerSerializationState::stack_frame_deduplicator));
TRACE_EVENT_API_ADD_METADATA_EVENT(
TraceLog::GetCategoryGroupEnabled("__metadata"), "typeNames", "typeNames",
std::make_unique<SessionStateConvertableProxy<TypeNameDeduplicator>>(
heap_profiler_serialization_state_,
&HeapProfilerSerializationState::type_name_deduplicator));
}
void MemoryDumpManager::NotifyHeapProfilingEnabledLocked(
scoped_refptr<MemoryDumpProviderInfo> mdpinfo,
bool enabled) {
lock_.AssertAcquired();
if (!mdpinfo->options.supports_heap_profiling)
return;
const auto& task_runner = mdpinfo->task_runner
? mdpinfo->task_runner
: GetOrCreateBgTaskRunnerLocked();
// TODO(ssid): Post tasks only for MDPs that support heap profiling.
task_runner->PostTask(
FROM_HERE,
BindOnce(&NotifyHeapProfilingEnabledOnMDPThread, mdpinfo, enabled));
}
MemoryDumpManager::ProcessMemoryDumpAsyncState::ProcessMemoryDumpAsyncState(
MemoryDumpRequestArgs req_args,
const MemoryDumpProviderInfo::OrderedSet& dump_providers,
scoped_refptr<HeapProfilerSerializationState>
heap_profiler_serialization_state_in,
ProcessMemoryDumpCallback callback,
scoped_refptr<SequencedTaskRunner> dump_thread_task_runner)
: req_args(req_args),
heap_profiler_serialization_state(
std::move(heap_profiler_serialization_state_in)),
callback(callback),
callback_task_runner(ThreadTaskRunnerHandle::Get()),
dump_thread_task_runner(std::move(dump_thread_task_runner)) {
pending_dump_providers.reserve(dump_providers.size());
pending_dump_providers.assign(dump_providers.rbegin(), dump_providers.rend());
MemoryDumpArgs args = {req_args.level_of_detail, req_args.dump_guid};
process_memory_dump =
MakeUnique<ProcessMemoryDump>(heap_profiler_serialization_state, args);
}
MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() {
}
} // namespace trace_event
} // namespace base
| [
"RetZero@desktop"
] | RetZero@desktop |
a1626475144f1f81c0d87681db15c9398f560628 | 61b117590efcd83b7afaedda467470700c12b4d0 | /dayso.cpp | a6cf51fab93b822b5d47f253971a0ec1eec5fec4 | [] | no_license | hieuthanh1999/Algorithm_Ex | a8ef2341db76b0178df1c5a46894f52fc0de12a3 | cc5758c76ad6092e5f0fbb68cd1cc06f2d6eb17d | refs/heads/master | 2023-02-23T04:40:39.273254 | 2021-01-26T15:41:02 | 2021-01-26T15:41:02 | 333,130,839 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 388 | cpp | #include<bits/stdc++.h>
using namespace std;
#define N 100001
long n, a[N], b[N], c[N], k=0;
int main()
{
cin>>n;
for(int i=0; i<n; i++)
cin>>a[i];
for(int i=0; i<n; i++)
cin>>b[i];
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
{
c[k] = abs(a[i]+b[j]);
k++;
}
}
int min=c[0];
for(int i=0; i<k; i++)
{
if(min>c[i]) min=c[i];
}
cout<<min;
return 0;
}
| [
"n.hieuhthanhps@gmail.com"
] | n.hieuhthanhps@gmail.com |
2cea3b6de7f28d88e05a4e11e44ce7f022d08d2e | 2e48f035ec01285f4231c3e5959c5b42942abbf7 | /SSheet/CF-A/Nightatthemuseum/main.cpp | d884dee6f23738a64797cec878cd65953fd83780 | [] | no_license | iamsaumya/Competitive-Coding | ec2997023a6cb86cfbd8c0aebd3b83bc50ca2ea3 | 16059bca865b4c5d91c98510e63cd9f7f6f4adfa | refs/heads/master | 2020-04-17T10:29:10.279675 | 2019-12-18T12:05:31 | 2019-12-18T12:05:31 | 166,502,933 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 486 | cpp | #include<bits/stdc++.h>
using namespace std;
#include <iostream>
int main()
{
string str;
int value;
int ptr = 'a';
int moves=0;
cin>>str;
int size = str.length();
for(int i=0;i<size;i++){
value = abs(ptr-str[i]);
if(value<=13){
moves +=value;
ptr = str[i];
}
else {
value = 26 - value;
moves +=value;
ptr = str[i];
}
}
cout<<moves;
return 0;
}
| [
"Sp160899@gmail.com"
] | Sp160899@gmail.com |
c5a8024f647f196950e2b40938e3b9407e6cb461 | 70472ba3a036434603611b78767f1828899967c7 | /MoxFiles/AudioChannelList.h | b0bb708b2b712bd66b1fe5fb8749fab7bdb9a41f | [
"BSD-2-Clause"
] | permissive | MOXfiles/libmox | 1fe4d79b22e492b251c0c5049ef1debba0b19f7a | d0ee0237ac710bd8f8bfc784be03a2c456da2aeb | refs/heads/master | 2021-01-22T12:12:25.202826 | 2017-06-09T17:46:06 | 2017-06-09T17:46:06 | 33,965,989 | 15 | 2 | BSD-2-Clause | 2020-04-24T12:57:19 | 2015-04-15T01:22:52 | C++ | UTF-8 | C++ | false | false | 5,665 | h | /*
* AudioChannelList.h
* MoxFiles
*
* Created by Brendan Bolles on 4/29/15.
* Copyright 2015 fnord. All rights reserved.
*
*/
#ifndef MOXFILES_AUDIOCHANNELLIST_H
#define MOXFILES_AUDIOCHANNELLIST_H
#include <MoxFiles/SampleType.h>
#include <MoxFiles/Types.h>
#include <string>
#include <map>
namespace MoxFiles
{
struct AudioChannel
{
SampleType type;
//------------
// Constructor
//------------
AudioChannel(SampleType type = SIGNED24);
bool operator == (const AudioChannel &other) const;
};
class AudioChannelList
{
public:
size_t size() const;
SampleType type() const;
//--------------
// Add a channel
//--------------
void insert (const char name[],
const AudioChannel &channel);
void insert (const std::string &name,
const AudioChannel &channel);
//--------------
// Remove a channel
//--------------
void erase (const char name[]);
void erase (const std::string &name);
//------------------------------------------------------------------
// Access to existing channels:
//
// [n] Returns a reference to the channel with name n.
// If no channel with name n exists, an IEX_NAMESPACE::ArgExc
// is thrown.
//
// findChannel(n) Returns a pointer to the channel with name n,
// or 0 if no channel with name n exists.
//
//------------------------------------------------------------------
AudioChannel & operator [] (const char name[]);
const AudioChannel & operator [] (const char name[]) const;
AudioChannel & operator [] (const std::string &name);
const AudioChannel & operator [] (const std::string &name) const;
AudioChannel * findChannel (const char name[]);
const AudioChannel * findChannel (const char name[]) const;
AudioChannel * findChannel (const std::string &name);
const AudioChannel * findChannel (const std::string &name) const;
//-------------------------------------------
// Iterator-style access to existing channels
//-------------------------------------------
typedef std::map <Name, AudioChannel> AudioChannelMap;
class Iterator;
class ConstIterator;
Iterator begin ();
ConstIterator begin () const;
Iterator end ();
ConstIterator end () const;
Iterator find (const char name[]);
ConstIterator find (const char name[]) const;
Iterator find (const std::string &name);
ConstIterator find (const std::string &name) const;
//------------
// Operator ==
//------------
bool operator == (const AudioChannelList &other) const;
private:
AudioChannelMap _map;
};
std::vector<Name> StandardAudioChannelList(unsigned int count);
class AudioChannelList::Iterator
{
public:
Iterator ();
Iterator (const AudioChannelList::AudioChannelMap::iterator &i);
Iterator & operator ++ ();
Iterator operator ++ (int);
const char * name () const;
AudioChannel & channel () const;
private:
friend class AudioChannelList::ConstIterator;
AudioChannelList::AudioChannelMap::iterator _i;
};
class AudioChannelList::ConstIterator
{
public:
ConstIterator ();
ConstIterator (const AudioChannelList::AudioChannelMap::const_iterator &i);
ConstIterator (const AudioChannelList::Iterator &other);
ConstIterator & operator ++ ();
ConstIterator operator ++ (int);
const char * name () const;
const AudioChannel &channel () const;
private:
friend bool operator == (const ConstIterator &, const ConstIterator &);
friend bool operator != (const ConstIterator &, const ConstIterator &);
AudioChannelList::AudioChannelMap::const_iterator _i;
};
//-----------------
// Inline Functions
//-----------------
inline
AudioChannelList::Iterator::Iterator (): _i()
{
// empty
}
inline
AudioChannelList::Iterator::Iterator (const AudioChannelList::AudioChannelMap::iterator &i):
_i (i)
{
// empty
}
inline AudioChannelList::Iterator &
AudioChannelList::Iterator::operator ++ ()
{
++_i;
return *this;
}
inline AudioChannelList::Iterator
AudioChannelList::Iterator::operator ++ (int)
{
Iterator tmp = *this;
++_i;
return tmp;
}
inline const char *
AudioChannelList::Iterator::name () const
{
return *_i->first;
}
inline AudioChannel &
AudioChannelList::Iterator::channel () const
{
return _i->second;
}
inline
AudioChannelList::ConstIterator::ConstIterator (): _i()
{
// empty
}
inline
AudioChannelList::ConstIterator::ConstIterator
(const AudioChannelList::AudioChannelMap::const_iterator &i): _i (i)
{
// empty
}
inline
AudioChannelList::ConstIterator::ConstIterator (const AudioChannelList::Iterator &other):
_i (other._i)
{
// empty
}
inline AudioChannelList::ConstIterator &
AudioChannelList::ConstIterator::operator ++ ()
{
++_i;
return *this;
}
inline AudioChannelList::ConstIterator
AudioChannelList::ConstIterator::operator ++ (int)
{
ConstIterator tmp = *this;
++_i;
return tmp;
}
inline const char *
AudioChannelList::ConstIterator::name () const
{
return *_i->first;
}
inline const AudioChannel &
AudioChannelList::ConstIterator::channel () const
{
return _i->second;
}
inline bool
operator == (const AudioChannelList::ConstIterator &x,
const AudioChannelList::ConstIterator &y)
{
return x._i == y._i;
}
inline bool
operator != (const AudioChannelList::ConstIterator &x,
const AudioChannelList::ConstIterator &y)
{
return !(x == y);
}
} // namespace
#endif // MOXFILES_AUDIOCHANNELLIST_H | [
"brendan@fnordware.com"
] | brendan@fnordware.com |
58f1e3fdf51a5763fdc807c7150124b3a0ce6c0f | 6f2b6e9d77fc4dd5e1dae8ba6e5a66eb7c7ae849 | /sstd_boost/sstd/libs/mpl/test/remove_if.cpp | 7083277d5318df5c1a2c6aa4a559268f30a77261 | [
"BSL-1.0"
] | permissive | KqSMea8/sstd_library | 9e4e622e1b01bed5de7322c2682539400d13dd58 | 0fcb815f50d538517e70a788914da7fbbe786ce1 | refs/heads/master | 2020-05-03T21:07:01.650034 | 2019-04-01T00:10:47 | 2019-04-01T00:10:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,478 | cpp |
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <sstd/boost/mpl/remove_if.hpp>
#include <sstd/boost/mpl/list/list10_c.hpp>
#include <sstd/boost/mpl/list/list10.hpp>
#include <sstd/boost/mpl/front_inserter.hpp>
#include <sstd/boost/mpl/greater.hpp>
#include <sstd/boost/mpl/int.hpp>
#include <sstd/boost/mpl/equal.hpp>
#include <sstd/boost/mpl/size.hpp>
#include <sstd/boost/type_traits/is_float.hpp>
#include <sstd/boost/mpl/aux_/test.hpp>
MPL_TEST_CASE()
{
typedef list10_c<int,0,1,2,3,4,5,6,7,8,9> numbers;
typedef list5_c<int,4,3,2,1,0>::type answer;
typedef remove_if<
numbers
, greater<_,int_<4> >
, mpl::front_inserter< list0_c<int> >
>::type result;
MPL_ASSERT_RELATION( size<result>::value, ==, 5 );
MPL_ASSERT(( equal<result,answer> ));
}
MPL_TEST_CASE()
{
typedef list8<int,float,long,float,char,long,double,double> types;
typedef list4<int,long,char,long>::type answer;
typedef reverse_remove_if<
types
, is_float<_>
, mpl::front_inserter< list0<> >
>::type result;
MPL_ASSERT_RELATION( size<result>::value, ==, 4 );
MPL_ASSERT(( equal<result,answer> ));
}
| [
"zhaixueqiang@hotmail.com"
] | zhaixueqiang@hotmail.com |
a6194b2b92d6d9516ddb3c019e6ab3c56ea096bd | 612325535126eaddebc230d8c27af095c8e5cc2f | /src/base/task_scheduler/scheduler_worker_params.h | f5d0d8a524f621f48d447674b387c38a4b89d69c | [
"BSD-3-Clause"
] | permissive | TrellixVulnTeam/proto-quic_1V94 | 1a3a03ac7a08a494b3d4e9857b24bb8f2c2cd673 | feee14d96ee95313f236e0f0e3ff7719246c84f7 | refs/heads/master | 2023-04-01T14:36:53.888576 | 2019-10-17T02:23:04 | 2019-10-17T02:23:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 808 | h | // Copyright 2017 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.
#ifndef BASE_TASK_SCHEDULER_SCHEDULER_WORKER_PARAMS_H_
#define BASE_TASK_SCHEDULER_SCHEDULER_WORKER_PARAMS_H_
namespace base {
enum class SchedulerBackwardCompatibility {
// No backward compatibility.
DISABLED,
// On Windows, initialize COM STA to mimic SequencedWorkerPool and
// BrowserThreadImpl. Behaves like DISABLED on other platforms.
// TODO(fdoray): Get rid of this and force tasks that care about a
// CoInitialized environment to request one explicitly (via an upcoming
// execution mode).
INIT_COM_STA,
};
} // namespace base
#endif // BASE_TASK_SCHEDULER_SCHEDULER_WORKER_PARAMS_H_
| [
"2100639007@qq.com"
] | 2100639007@qq.com |
6adea48e04594795310efa8c626bbe5158e6cc15 | a08e005474521e6b10573aed863a3ff8067c9c13 | /src/qt/qrimagewidget.h | 9ab4965471032896fb11f562e6bad65b8164984f | [
"MIT"
] | permissive | BitcoinClassicDev/BitcoinClassic | c18048431dccd4346865f9c5ee3c079831c8adde | 87f76317eb80c25c54e9104c61bdf570fc7721f3 | refs/heads/master | 2020-09-16T00:57:59.563234 | 2019-12-02T19:18:14 | 2019-12-02T19:18:14 | 223,602,827 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,074 | h | // Copyright (c) 2011-2018 The BitcoinClassic Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_QRIMAGEWIDGET_H
#define BITCOIN_QT_QRIMAGEWIDGET_H
#include <QImage>
#include <QLabel>
/* Maximum allowed URI length */
static const int MAX_URI_LENGTH = 255;
/* Size of exported QR Code image */
static const int QR_IMAGE_SIZE = 300;
QT_BEGIN_NAMESPACE
class QMenu;
QT_END_NAMESPACE
/* Label widget for QR code. This image can be dragged, dropped, copied and saved
* to disk.
*/
class QRImageWidget : public QLabel
{
Q_OBJECT
public:
explicit QRImageWidget(QWidget *parent = nullptr);
bool setQR(const QString& data, const QString& text = "");
QImage exportImage();
public Q_SLOTS:
void saveImage();
void copyImage();
protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void contextMenuEvent(QContextMenuEvent *event);
private:
QMenu *contextMenu;
};
#endif // BITCOIN_QT_QRIMAGEWIDGET_H
| [
"root@DESKTOP-325AAR8.localdomain"
] | root@DESKTOP-325AAR8.localdomain |
930827b5042a361d8529a6b480d38b1ac227f1d9 | e4e1b52596d598247b14c06d466b32851cf596a4 | /Topc++.cpp | 79c15ab03888e991a6cba1df1b62d26027c5ddfc | [] | no_license | ankitlohiya/TopCpp-Codes | caeb685c72f1d09c20d5c89888b42db279a175af | 9df675b369f14d79434c536895ce84536ebf31de | refs/heads/master | 2020-05-22T17:11:12.428820 | 2019-05-13T15:35:56 | 2019-05-13T15:35:56 | 186,448,018 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 798 | cpp | //Are private functions really private? Well...
//Checkout video at: https://youtu.be/TVKsaq7Bohs
#include <bits/stdc++.h>
using namespace std;
class SocialWebsite{
private:
protected:
public:
virtual void secret() {} ;
// void secret() {} ;
};
class Facebook: public SocialWebsite{
private:
string fbPassword;
void secret(){
cout << "The Facebook password is: " << fbPassword << endl;
// cout << "Its risky, but its fine to print here as it's a private function\n";
}
public:
Facebook(string pwd) {
fbPassword = pwd;
cout << "Constructor invoked" << endl;
}
};
int main()
{
Facebook f("ank2it");
// f.secret();
SocialWebsite *ptr = &f;
ptr->secret();
return 0;
} | [
"noreply@github.com"
] | ankitlohiya.noreply@github.com |
b7033129602a35e6d5e8ea864833cbe63f623d41 | 0b7e09b7cb929760bd406295657c8b092f7ead8b | /qtwayland/src/plugins/platforms/wayland_common/qwaylanddataoffer.h | fada683a2297ee6a41ae5b4abb05a5ba9acb7faf | [] | no_license | cxl000/qtwayland | 7eb6c33186d491a2f5049064fe0dad422a9cfd0a | 8abf0823e882df4db9fc07f0cdb8e3d27b99815b | refs/heads/master | 2020-12-11T09:13:29.174268 | 2013-08-15T00:22:09 | 2013-08-15T00:22:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,137 | h | /****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWAYLANDDATAOFFER_H
#define QWAYLANDDATAOFFER_H
#include <QString>
#include <QByteArray>
#include <QMimeData>
#include <QtGui/private/qdnd_p.h>
#include <QtGui/QClipboard>
#include <stdint.h>
struct wl_callback;
QT_BEGIN_NAMESPACE
class QWaylandDisplay;
class QWaylandDataOffer : public QInternalMimeData
{
public:
QWaylandDataOffer(QWaylandDisplay *display, struct wl_data_offer *offer);
~QWaylandDataOffer();
bool hasFormat_sys(const QString &mimeType) const;
QStringList formats_sys() const;
QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const;
struct wl_data_offer *handle() const;
private:
struct wl_data_offer *m_data_offer;
QWaylandDisplay *m_display;
QStringList m_offered_mime_types;
wl_callback *m_receiveSyncCallback;
static void offer(void *data, struct wl_data_offer *wl_data_offer, const char *type);
static const struct wl_data_offer_listener data_offer_listener;
static void offer_sync_callback(void *data, struct wl_callback *wl_callback, uint32_t time);
static const struct wl_callback_listener offer_sync_callback_listener;
};
QT_END_NAMESPACE
#endif
| [
"robin+git@viroteck.net"
] | robin+git@viroteck.net |
9e650517dedabe0136f838ef2f0aa3816279e30b | b51e10ab5c6e4b9da1176a537c8e8064b7e95561 | /include/MyException.hpp | 440b92e24c6cd2a81abc3e86d5c058f6571f1a6a | [] | no_license | summer06/Agenda | 4bf465a7ae455f451107dfd755b167977ee468b1 | 51b0aea3bd0b71de6432a2fcbf8c8d9f124d4f30 | refs/heads/master | 2020-12-31T02:33:25.559452 | 2017-12-10T04:24:21 | 2017-12-10T04:24:21 | 68,387,702 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 231 | hpp | #include <iostream>
#include <exception>
class MyException {
public:
MyException(const std::string error_type) {
error = error_type;
}
~MyException() {}
std::string what() {
return error;
}
private:
std::string error;
}; | [
"864409241@qq.com"
] | 864409241@qq.com |
2ecd205a09f54ac63a49346b9ae3dadeab1f47c7 | 4559502038e2da3d9a2f5cc4edf919af71fc5700 | /ConsoleApplication3/ConsoleApplication3.cpp | 3dbcd100afa7f13c4c6234b4732402cad5f4b074 | [] | no_license | SergeySeydel/ConsoleApplication3 | ac6de1153b0b4e45b8467bdc911fb0e5bec64157 | 0b76908ccc3555392333b171e7e227e1a1177ab6 | refs/heads/master | 2023-02-09T02:04:52.193187 | 2020-12-29T15:42:54 | 2020-12-29T15:42:54 | 325,288,582 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,488 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
template <class Container>
void Divider(const std::string& anotherline, Container& cont)
{
std::istringstream iss(anotherline);
std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(), std::back_inserter(cont));
}
bool Point = true;
void consolewriting(std::vector<std::string>& consoledata) {
std::string line;
do {
std::cout << "---->";
getline(std::cin, line);
if (line.size() > 0) {
if ((line.find("\\q") != std::string::npos) | (line.find("\\quit") != std::string::npos)) {
Point = false;
return;
}
Divider(line, consoledata);
for (auto& Local_variable : consoledata) {
if (Local_variable.find(';') != std::string::npos) {
auto it = std::find(consoledata.begin(), consoledata.end(), Local_variable);
*it = Local_variable.erase(Local_variable.find(';'), 1);
}
else if (Local_variable.find('=') != std::string::npos) {
auto it = std::find(consoledata.begin(), consoledata.end(), Local_variable);
consoledata.erase(it);
if (Local_variable.find(';') != std::string::npos) {
auto it = std::find(consoledata.begin(), consoledata.end(), Local_variable);
*it = Local_variable.erase(Local_variable.find(';'), 1);
}
}
}
}
else {
}
} while (line.size() > 0);
}
void filewritten(std::string& nameoffile, std::vector<std::vector<std::string>>& data_file) {
vector<string> strBuff;
string anotheranotherline;
ifstream f(nameoffile);
if (!f.is_open()) {
std::cout << "Error! Could not find a file: *.csv";
}
else
{
if (f.eof()) {
std::cout << "File - empty";
return;
}
while (!f.eof())
{
getline(f, anotheranotherline);
std::stringstream s_1(anotheranotherline);
vector<string> strBuff;
while (!s_1.eof())
{
getline(s_1, anotheranotherline, ';');
strBuff.push_back(anotheranotherline);
}
data_file.push_back(strBuff);
}
}
}
void Handling(vector<string>& data_console, vector<vector<string>>& data_file) {
for (auto Local_variable : data_console) {
if (Local_variable.find("FROM") != std::string::npos) {
auto it = Local_variable.find("FROM");
auto part = (*(++(std::find(data_console.begin(), data_console.end(), Local_variable))));
filewritten(part, data_file);
for (auto Local_variableN : data_console) {
if (Local_variableN.find('*') != std::string::npos) {
for (int i = 0; i < data_file.size(); i++)
{
for (int j = 0; j < data_file[i].size(); j++)
std::cout << data_file[i][j] << " ";
std::cout << endl;
}
}if (Local_variableN.find("SELECT") != std::string::npos) {
auto it = Local_variableN.find("SELECT");
auto part = (*(++(std::find(data_console.begin(), data_console.end(), Local_variableN))));
int i = 0;
for (auto Local_variableR : data_file[0]) {
++i;
if (Local_variableR == part) {
break;
}
}
for (int j = 0; j <= data_file[i - 1].size(); ++j) {
std::cout << data_file[j][i - 1] << std::endl;
}
}
}
}
}
}
int main()
{
setlocale(LC_ALL, "Russian");
vector<string> dataofcon;
vector<vector<string>> dataoffs;
while (Point) {
consolewriting(dataofcon);
if (dataofcon.size() > 1) {
Handling(dataofcon, dataoffs);
}
}
} | [
"s.filyaev@mail.ru"
] | s.filyaev@mail.ru |
cea0605f64fefc37d7672f36fe379104921f5d4f | d533ea535c8a640278a806f8487a143d691997da | /infoarena edu/evaluare.cpp | c5eb07afe18ba58695d3d078e1510767ccf09736 | [] | no_license | VladCincean/infoarena | 964fd8091e3b9675d39c6844030a5f51d73e2430 | 2753d2e72b77b46f8bc9f46673676e83bbc68279 | refs/heads/master | 2021-01-13T16:57:11.702688 | 2016-12-24T21:14:36 | 2016-12-24T21:14:36 | 77,299,850 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,499 | cpp | #include <stdio.h>
#define MAXN 100001
long long eval_expr_order_0(char **str);
long long eval_expr_order_2(char **str) {
long long result;
char *s;
result = 0;
s = *str;
if (*s == '(') {
s++; // pass '('
result += eval_expr_order_0(&s);
s++; // pass ')'
}
else while ('0' <= *s && *s <= '9') {
result = result * 10 + *s - '0';
s++;
}
*str = s;
return result;
}
long long eval_expr_order_1(char **str) {
long long result;
char *s;
s = *str;
result = eval_expr_order_2(&s);
while (*s == '*' || *s == '/' || *s == '%') {
if (*s == '*') {
s++;
result *= eval_expr_order_2(&s);
}
else if (*s == '/') {
s++;
result /= eval_expr_order_2(&s);
}
else if (*s == '%') {
s++;
result %= eval_expr_order_2(&s);
}
}
*str = s;
return result;
}
long long eval_expr_order_0(char **str) {
long long result;
char *s;
s = *str;
result = eval_expr_order_1(&s);
while (*s == '+' || *s == '-') {
if (*s == '+') {
s++;
result += eval_expr_order_1(&s);
}
else if (*s == '-') {
s++;
result -= eval_expr_order_1(&s);
}
}
*str = s;
return result;
}
long long eval_expr(char *str) {
long long result;
result = eval_expr_order_0(&str);
return result;
}
int main(void) {
char str[MAXN];
long long result;
FILE *f_in = fopen("evaluare.in", "r");
FILE *f_out = fopen("evaluare.out", "w");
fgets(str, MAXN, f_in);
result = eval_expr(str);
fprintf(f_out, "%lld\n", result);
fclose(f_in);
fclose(f_out);
return 0;
} | [
"cvie1883@scs.ubbcluj.ro"
] | cvie1883@scs.ubbcluj.ro |
70ef1103506a8d04e51f31be79ce980c21eadd92 | 7d023c350e2b05c96428d7f5e018a74acecfe1d2 | /my_auv2000_ros/devel/include/std_msgs_stamped/Float64Stamped.h | a137ac1af8627c369bc709bdcb11b52f44e45991 | [] | no_license | thanhhaibk96/VIAM_AUV2000_ROS | 8cbf867e170212e1f1559aa38c36f22d6f5237ad | fe797304fe9283eaf95fe4fa4aaabb1fe1097c92 | refs/heads/main | 2023-06-06T14:15:39.519361 | 2021-06-19T06:01:19 | 2021-06-19T06:01:19 | 376,807,938 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,048 | h | // Generated by gencpp from file std_msgs_stamped/Float64Stamped.msg
// DO NOT EDIT!
#ifndef STD_MSGS_STAMPED_MESSAGE_FLOAT64STAMPED_H
#define STD_MSGS_STAMPED_MESSAGE_FLOAT64STAMPED_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <std_msgs/Header.h>
namespace std_msgs_stamped
{
template <class ContainerAllocator>
struct Float64Stamped_
{
typedef Float64Stamped_<ContainerAllocator> Type;
Float64Stamped_()
: header()
, data(0.0) {
}
Float64Stamped_(const ContainerAllocator& _alloc)
: header(_alloc)
, data(0.0) {
(void)_alloc;
}
typedef ::std_msgs::Header_<ContainerAllocator> _header_type;
_header_type header;
typedef double _data_type;
_data_type data;
typedef boost::shared_ptr< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> const> ConstPtr;
}; // struct Float64Stamped_
typedef ::std_msgs_stamped::Float64Stamped_<std::allocator<void> > Float64Stamped;
typedef boost::shared_ptr< ::std_msgs_stamped::Float64Stamped > Float64StampedPtr;
typedef boost::shared_ptr< ::std_msgs_stamped::Float64Stamped const> Float64StampedConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >::stream(s, "", v);
return s;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator==(const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator1> & lhs, const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator2> & rhs)
{
return lhs.header == rhs.header &&
lhs.data == rhs.data;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator!=(const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator1> & lhs, const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator2> & rhs)
{
return !(lhs == rhs);
}
} // namespace std_msgs_stamped
namespace ros
{
namespace message_traits
{
template <class ContainerAllocator>
struct IsFixedSize< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> const>
: TrueType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
{
static const char* value()
{
return "e6c99c37e6f9fe98e071d524cc164e65";
}
static const char* value(const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0xe6c99c37e6f9fe98ULL;
static const uint64_t static_value2 = 0xe071d524cc164e65ULL;
};
template<class ContainerAllocator>
struct DataType< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
{
static const char* value()
{
return "std_msgs_stamped/Float64Stamped";
}
static const char* value(const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
{
static const char* value()
{
return "Header header\n"
"float64 data\n"
"\n"
"================================================================================\n"
"MSG: std_msgs/Header\n"
"# Standard metadata for higher-level stamped data types.\n"
"# This is generally used to communicate timestamped data \n"
"# in a particular coordinate frame.\n"
"# \n"
"# sequence ID: consecutively increasing ID \n"
"uint32 seq\n"
"#Two-integer timestamp that is expressed as:\n"
"# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n"
"# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n"
"# time-handling sugar is provided by the client library\n"
"time stamp\n"
"#Frame this data is associated with\n"
"string frame_id\n"
;
}
static const char* value(const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.header);
stream.next(m.data);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct Float64Stamped_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::std_msgs_stamped::Float64Stamped_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::std_msgs_stamped::Float64Stamped_<ContainerAllocator>& v)
{
s << indent << "header: ";
s << std::endl;
Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header);
s << indent << "data: ";
Printer<double>::stream(s, indent + " ", v.data);
}
};
} // namespace message_operations
} // namespace ros
#endif // STD_MSGS_STAMPED_MESSAGE_FLOAT64STAMPED_H
| [
"thanhhaipif96@gmail.com"
] | thanhhaipif96@gmail.com |
a2bfa16e91c3eb456599aeb2205046aeb5a3791c | eec43b04a250260727e7d8bded8e923e57d27330 | /Programming Code/uva 260.cpp | bee88461c9e81c1ad22c4984d8e0c91ea08a5b60 | [] | no_license | ShafiqurRohman/Competitive-programming | 82e4c8c33c6e9e6236aca8daf4d6b24ce37089c6 | 84bdbe2abb7a6a927325c4c37ed8d15b1c082f2e | refs/heads/main | 2023-06-25T14:23:18.371879 | 2021-07-25T17:10:04 | 2021-07-25T17:10:04 | 318,260,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,804 | cpp | #include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs v.size()
#define sot(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define ii pair<int, int>
#define int long long
#define ull unsigned long long
#define pb push_back
#define mpp make_pair
#define Okay 0
#define pi 3.14159
const int inf = 1e6;
const int cont = 1e18;
using namespace std;
char Graph[500][500];
bool vis[500][500];
int n;
int dx[6]= {-1, -1, 0, 0, 1, 1};
int dy[6]= {-1, 0, -1, 1, 0, 1};
void bfs(int i, int j){
queue<int>q;
q.push(i);
q.push(j);
vis[i][j] = true;
while(!q.empty()){
int ux = q.front();
q.pop();
int uy = q.front();
q.pop();
for(int i=0; i<6; i++){
int vx = ux+dx[i];
int vy = uy+dy[i];
if((vx>=1 && vx <= n) && (vy >= 1&&vy <= n) && (!vis[vx][vy]) && (Graph[vx][vy] == 'w')){
vis[vx][vy] = true;
q.push(vx);
q.push(vy);
}
}
}
}
void solve(){
// for black
memset(vis, 0, sizeof vis);
bool check = 0;
for(int i=1; i<=n; i++){
if(vis[i][1] == false && Graph[i][1] == 'w'){
bfs(i, 1);
}
}
for(int i=1; i<=n; i++){
if(vis[i][n])check = 1;
}
if(!check)cout<<"B";
else cout<<"W";
}
int32_t main() {
Fast;
int tc = 1;
while(cin>>n && n){
for(int i=1; i<=n; i++){
for(int j =1; j<=n; j++){
cin>>Graph[i][j];
}
}
cout<<tc++<<" ";
solve();
cout<<endl;
}
return Okay;
}
| [
"SHAFIQ@DESKTOP-O8CRK89"
] | SHAFIQ@DESKTOP-O8CRK89 |
152f8aee62a7b9d460bace0e5d074a5fb5589b34 | 6844d0f4aab41d037cd469133b83618dc0707f19 | /newton-4.00/sdk/dCollision/ndShapeChamferCylinder.h | eb6c0dce4acedf651dde32822822528444a6e253 | [
"Zlib"
] | permissive | VB6Hobbyst7/newton-dynamics | 3bb000676987723d2794374e2bddd8ccc66a6d70 | 368507c939004f5663f15410c203e2781a408530 | refs/heads/master | 2023-08-04T17:37:19.074998 | 2021-10-06T18:57:03 | 2021-10-06T18:57:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,942 | h | /* Copyright (c) <2003-2021> <Julio Jerez, Newton Game Dynamics>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _D_SHAPE_CHAMFER_CYLINDER_H__
#define _D_SHAPE_CHAMFER_CYLINDER_H__
#include "ndShapeConvex.h"
#define DG_CHAMFERCYLINDER_SLICES 4
#define DG_CHAMFERCYLINDER_BRAKES 8
#define DG_MAX_CHAMFERCYLINDER_DIR_COUNT 8
class ndShapeChamferCylinder: public ndShapeConvex
{
public:
D_CLASS_REFLECTION(ndShapeChamferCylinder);
D_COLLISION_API ndShapeChamferCylinder(dFloat32 radius, dFloat32 height);
D_COLLISION_API ndShapeChamferCylinder(const dLoadSaveBase::dLoadDescriptor& desc);
D_COLLISION_API virtual ~ndShapeChamferCylinder();
virtual ndShapeChamferCylinder* GetAsShapeChamferCylinder() { return this; }
protected:
D_COLLISION_API void Init(dFloat32 radius, dFloat32 height);
D_COLLISION_API virtual ndShapeInfo GetShapeInfo() const;
D_COLLISION_API virtual void CalculateAabb(const dMatrix& matrix, dVector& p0, dVector& p1) const;
D_COLLISION_API virtual void DebugShape(const dMatrix& matrix, ndShapeDebugCallback& debugCallback) const;
D_COLLISION_API virtual dVector SupportVertexSpecialProjectPoint(const dVector& point, const dVector& dir) const;
D_COLLISION_API virtual dVector SupportVertex(const dVector& dir, dInt32* const vertexIndex) const;
D_COLLISION_API virtual dVector SupportVertexSpecial(const dVector& dir, dFloat32 skinThickness, dInt32* const vertexIndex) const;
D_COLLISION_API virtual dFloat32 RayCast(ndRayCastNotify& callback, const dVector& localP0, const dVector& localP1, dFloat32 maxT, const ndBody* const body, ndContactPoint& contactOut) const;
D_COLLISION_API virtual void Save(const dLoadSaveBase::dSaveDescriptor& desc) const;
virtual dInt32 CalculatePlaneIntersection(const dVector& normal, const dVector& point, dVector* const contactsOut) const;
private:
dFloat32 m_height;
dFloat32 m_radius;
dVector m_vertex[DG_CHAMFERCYLINDER_BRAKES * (DG_CHAMFERCYLINDER_SLICES + 1)];
static dInt32 m_shapeRefCount;
static ndConvexSimplexEdge m_edgeArray[];
static dVector m_shapesDirs[];
static dVector m_yzMask;
friend class dgWorld;
};
#endif
| [
"jerezjulio0@gmail.com"
] | jerezjulio0@gmail.com |
db712b8f6d2f4590d9f1b7b6be4f0cbc774345b1 | 44289ecb892b6f3df043bab40142cf8530ac2ba4 | /Sources/External/node/elastos/external/chromium_org/third_party/WebKit/Source/modules/modules_gyp/bindings/core/v8/V8SVGAnimatedNumberList.h | b9cef7c343ecb82ff3173b90fd896a01a10ef1ba | [
"Apache-2.0"
] | permissive | warrenween/Elastos | a6ef68d8fb699fd67234f376b171c1b57235ed02 | 5618eede26d464bdf739f9244344e3e87118d7fe | refs/heads/master | 2021-01-01T04:07:12.833674 | 2017-06-17T15:34:33 | 2017-06-17T15:34:33 | 97,120,576 | 2 | 1 | null | 2017-07-13T12:33:20 | 2017-07-13T12:33:20 | null | UTF-8 | C++ | false | false | 5,111 | h | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#ifndef V8SVGAnimatedNumberList_h
#define V8SVGAnimatedNumberList_h
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
#include "bindings/v8/WrapperTypeInfo.h"
#include "core/svg/SVGAnimatedNumberList.h"
#include "platform/heap/Handle.h"
namespace WebCore {
class V8SVGAnimatedNumberList {
public:
static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Value>, v8::Isolate*);
static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*);
static SVGAnimatedNumberList* toNative(v8::Handle<v8::Object> object)
{
return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static SVGAnimatedNumberList* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Value>);
static const WrapperTypeInfo wrapperTypeInfo;
static void derefObject(void*);
static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Isolate*);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
static inline void* toInternalPointer(SVGAnimatedNumberList* impl)
{
return impl;
}
static inline SVGAnimatedNumberList* fromInternalPointer(void* object)
{
return static_cast<SVGAnimatedNumberList*>(object);
}
static void installPerContextEnabledProperties(v8::Handle<v8::Object>, SVGAnimatedNumberList*, v8::Isolate*) { }
static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
friend v8::Handle<v8::Object> wrap(SVGAnimatedNumberList*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
static v8::Handle<v8::Object> createWrapper(PassRefPtr<SVGAnimatedNumberList>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
};
v8::Handle<v8::Object> wrap(SVGAnimatedNumberList* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
inline v8::Handle<v8::Value> toV8(SVGAnimatedNumberList* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
if (UNLIKELY(!impl))
return v8::Null(isolate);
v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8SVGAnimatedNumberList>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
}
template<typename CallbackInfo>
inline void v8SetReturnValue(const CallbackInfo& callbackInfo, SVGAnimatedNumberList* impl)
{
if (UNLIKELY(!impl)) {
v8SetReturnValueNull(callbackInfo);
return;
}
if (DOMDataStore::setReturnValueFromWrapper<V8SVGAnimatedNumberList>(callbackInfo.GetReturnValue(), impl))
return;
v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
v8SetReturnValue(callbackInfo, wrapper);
}
template<typename CallbackInfo>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, SVGAnimatedNumberList* impl)
{
ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld());
if (UNLIKELY(!impl)) {
v8SetReturnValueNull(callbackInfo);
return;
}
if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8SVGAnimatedNumberList>(callbackInfo.GetReturnValue(), impl))
return;
v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
v8SetReturnValue(callbackInfo, wrapper);
}
template<class CallbackInfo, class Wrappable>
inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, SVGAnimatedNumberList* impl, Wrappable* wrappable)
{
if (UNLIKELY(!impl)) {
v8SetReturnValueNull(callbackInfo);
return;
}
if (DOMDataStore::setReturnValueFromWrapperFast<V8SVGAnimatedNumberList>(callbackInfo.GetReturnValue(), impl, callbackInfo.Holder(), wrappable))
return;
v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
v8SetReturnValue(callbackInfo, wrapper);
}
inline v8::Handle<v8::Value> toV8(PassRefPtr<SVGAnimatedNumberList> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
return toV8(impl.get(), creationContext, isolate);
}
template<class CallbackInfo>
inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<SVGAnimatedNumberList> impl)
{
v8SetReturnValue(callbackInfo, impl.get());
}
template<class CallbackInfo>
inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassRefPtr<SVGAnimatedNumberList> impl)
{
v8SetReturnValueForMainWorld(callbackInfo, impl.get());
}
template<class CallbackInfo, class Wrappable>
inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<SVGAnimatedNumberList> impl, Wrappable* wrappable)
{
v8SetReturnValueFast(callbackInfo, impl.get(), wrappable);
}
}
#endif // V8SVGAnimatedNumberList_h
| [
"gdsys@126.com"
] | gdsys@126.com |
85934a9cefac41bd65deed01e4a21a2c41ad7b5c | 47145fdb5e9a6eaf99c04012c8480bb8255a4c00 | /Bounce_Back_2/Public/LevelStreamerActor.h | 5feb1f1eec41ac8bd923bf31c22b56c4af79c4b9 | [] | no_license | Ozzyblade/bb2ohp2020 | a7127dae115325955b0019553b41bcc6e1ae7a13 | dc6e914790b5856d9a4ba1b2c155691fd84ba13b | refs/heads/master | 2022-11-17T21:47:04.181857 | 2020-07-13T13:41:15 | 2020-07-13T13:41:15 | 279,311,988 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LevelStreamerActor.generated.h"
UCLASS()
class BOUNCE_BACK_2_API ALevelStreamerActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ALevelStreamerActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
| [
"b6011786@my.shu.ac.uk"
] | b6011786@my.shu.ac.uk |
76df1f7c0fffa35d91654601c645ed165a61a652 | b410ebaf2a74822b387825465625bde72c08f96e | /src/script/interpreter.h | ecda38575a78d73ea2c27b8ab23c827ba719d094 | [
"MIT"
] | permissive | freelancerstudio/PoriunCoin | 925c94558dc03d2f8310bde14ab4768a923fd44b | 7d675d4d163702eb7072cafda52e7a58ef6e169c | refs/heads/master | 2023-04-21T20:56:55.178694 | 2021-05-06T08:46:03 | 2021-05-06T08:46:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,562 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin developers
// Copyright (c) 2018-2019 The Poriun Coin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_SCRIPT_INTERPRETER_H
#define BITCOIN_SCRIPT_INTERPRETER_H
#include "script_error.h"
#include "primitives/transaction.h"
#include <vector>
#include <stdint.h>
#include <string>
class CPubKey;
class CScript;
class CTransaction;
class uint256;
/** Signature hash types/flags */
enum
{
SIGHASH_ALL = 1,
SIGHASH_NONE = 2,
SIGHASH_SINGLE = 3,
SIGHASH_ANYONECANPAY = 0x80,
};
/** Script verification flags */
enum
{
SCRIPT_VERIFY_NONE = 0,
// Evaluate P2SH subscripts (softfork safe, BIP16).
SCRIPT_VERIFY_P2SH = (1U << 0),
// Passing a non-strict-DER signature or one with undefined hashtype to a checksig operation causes script failure.
// Evaluating a pubkey that is not (0x04 + 64 bytes) or (0x02 or 0x03 + 32 bytes) by checksig causes script failure.
// (softfork safe, but not used or intended as a consensus rule).
SCRIPT_VERIFY_STRICTENC = (1U << 1),
// Passing a non-strict-DER signature to a checksig operation causes script failure (softfork safe, BIP62 rule 1)
SCRIPT_VERIFY_DERSIG = (1U << 2),
// Passing a non-strict-DER signature or one with S > order/2 to a checksig operation causes script failure
// (softfork safe, BIP62 rule 5).
SCRIPT_VERIFY_LOW_S = (1U << 3),
// verify dummy stack item consumed by CHECKMULTISIG is of zero-length (softfork safe, BIP62 rule 7).
SCRIPT_VERIFY_NULLDUMMY = (1U << 4),
// Using a non-push operator in the scriptSig causes script failure (softfork safe, BIP62 rule 2).
SCRIPT_VERIFY_SIGPUSHONLY = (1U << 5),
// Require minimal encodings for all push operations (OP_0... OP_16, OP_1NEGATE where possible, direct
// pushes up to 75 bytes, OP_PUSHDATA up to 255 bytes, OP_PUSHDATA2 for anything larger). Evaluating
// any other push causes the script to fail (BIP62 rule 3).
// In addition, whenever a stack element is interpreted as a number, it must be of minimal length (BIP62 rule 4).
// (softfork safe)
SCRIPT_VERIFY_MINIMALDATA = (1U << 6),
// Discourage use of NOPs reserved for upgrades (NOP1-10)
//
// Provided so that nodes can avoid accepting or mining transactions
// containing executed NOP's whose meaning may change after a soft-fork,
// thus rendering the script invalid; with this flag set executing
// discouraged NOPs fails the script. This verification flag will never be
// a mandatory flag applied to scripts in a block. NOPs that are not
// executed, e.g. within an unexecuted IF ENDIF block, are *not* rejected.
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1U << 7),
// Require that only a single stack element remains after evaluation. This changes the success criterion from
// "At least one stack element must remain, and when interpreted as a boolean, it must be true" to
// "Exactly one stack element must remain, and when interpreted as a boolean, it must be true".
// (softfork safe, BIP62 rule 6)
// Note: CLEANSTACK should never be used without P2SH.
SCRIPT_VERIFY_CLEANSTACK = (1U << 8),
// Verify CHECKLOCKTIMEVERIFY
//
// See BIP65 for details.
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9)
};
bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror);
uint256 SignatureHash(const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType);
class BaseSignatureChecker
{
public:
virtual bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const
{
return false;
}
virtual bool CheckLockTime(const CScriptNum& nLockTime) const
{
return false;
}
virtual bool CheckColdStake(const CScript& script) const
{
return false;
}
virtual ~BaseSignatureChecker() {}
};
class TransactionSignatureChecker : public BaseSignatureChecker
{
private:
const CTransaction* txTo;
unsigned int nIn;
protected:
virtual bool VerifySignature(const std::vector<unsigned char>& vchSig, const CPubKey& vchPubKey, const uint256& sighash) const;
public:
TransactionSignatureChecker(const CTransaction* txToIn, unsigned int nInIn) : txTo(txToIn), nIn(nInIn) {}
bool CheckSig(const std::vector<unsigned char>& scriptSig, const std::vector<unsigned char>& vchPubKey, const CScript& scriptCode) const override;
bool CheckLockTime(const CScriptNum& nLockTime) const override;
bool CheckColdStake(const CScript& script) const override {
return txTo->CheckColdStake(script);
}
};
class MutableTransactionSignatureChecker : public TransactionSignatureChecker
{
private:
const CTransaction txTo;
public:
MutableTransactionSignatureChecker(const CMutableTransaction* txToIn, unsigned int nInIn) : TransactionSignatureChecker(&txTo, nInIn), txTo(*txToIn) {}
};
bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* error = NULL);
#endif // BITCOIN_SCRIPT_INTERPRETER_H
| [
"hello@poriun.com"
] | hello@poriun.com |
e65b82be1f05e8a9c45718756b3aeda44807f9e0 | a8d0bb2f9a42320be0aa5e383f1ce67e5e44d2c6 | /Miscellaneous/011 niceWayRotateArray.cpp | cbb3ddce5b136552d223a1c14783e894ba483c76 | [] | no_license | camperjett/DSA_dups | f5728e06f1874bafbaf8561752e8552fee2170fa | f20fb4be1463398f568dbf629a597d8d0ae92e8f | refs/heads/main | 2023-04-19T18:18:55.674116 | 2021-05-15T12:51:21 | 2021-05-15T12:51:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 191 | cpp | vector<int> Solution::rotateArray(vector<int> &A, int B) {
vector<int> ret;
for (int i = 0; i < A.size(); i++) {
ret.push_back(A[(i + B)%(A.size())]);
}
return ret;
}
| [
"vasubansal1998@gmail.com"
] | vasubansal1998@gmail.com |
53a57fb63b34c3835f12af7c0cb0e6385618efa9 | 5d5a214f8433ceeb0a90712bfe8b61116b95267f | /build/linux-build/Sources/include/hxinc/game/Inventory.h | 8afed23d0b4980f7207bae2f06d7e2140db6d918 | [
"MIT"
] | permissive | 5Mixer/GGJ20 | 86cc3f42f29671889dddf6f25bfe641927cfa998 | a12a14d596ab150e8d96dda5a21defcd176f251f | refs/heads/master | 2022-12-09T09:55:03.928292 | 2020-02-02T03:52:50 | 2020-02-02T03:52:50 | 237,372,388 | 0 | 0 | MIT | 2022-12-05T06:26:15 | 2020-01-31T06:19:23 | C++ | UTF-8 | C++ | false | true | 2,211 | h | // Generated by Haxe 4.0.5
#ifndef INCLUDED_game_Inventory
#define INCLUDED_game_Inventory
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
#ifndef INCLUDED_bonsai_entity_Entity
#include <hxinc/bonsai/entity/Entity.h>
#endif
HX_DECLARE_CLASS2(bonsai,entity,Entity)
HX_DECLARE_CLASS1(game,BodyPart)
HX_DECLARE_CLASS1(game,Inventory)
HX_DECLARE_CLASS1(haxe,IMap)
HX_DECLARE_CLASS2(haxe,ds,BalancedTree)
HX_DECLARE_CLASS2(haxe,ds,EnumValueMap)
HX_DECLARE_CLASS2(kha,graphics2,Graphics)
HX_DECLARE_CLASS2(kha,math,Vector2)
namespace game{
class HXCPP_CLASS_ATTRIBUTES Inventory_obj : public ::bonsai::entity::Entity_obj
{
public:
typedef ::bonsai::entity::Entity_obj super;
typedef Inventory_obj OBJ_;
Inventory_obj();
public:
enum { _hx_ClassId = 0x0632590a };
void __construct();
inline void *operator new(size_t inSize, bool inContainer=true,const char *inName="game.Inventory")
{ return hx::Object::operator new(inSize,inContainer,inName); }
inline void *operator new(size_t inSize, int extra)
{ return hx::Object::operator new(inSize+extra,true,"game.Inventory"); }
static hx::ObjectPtr< Inventory_obj > __new();
static hx::ObjectPtr< Inventory_obj > __alloc(hx::Ctx *_hx_ctx);
static void * _hx_vtable;
static Dynamic __CreateEmpty();
static Dynamic __Create(hx::DynamicArray inArgs);
//~Inventory_obj();
HX_DO_RTTI_ALL;
hx::Val __Field(const ::String &inString, hx::PropertyAccess inCallProp);
hx::Val __SetField(const ::String &inString,const hx::Val &inValue, hx::PropertyAccess inCallProp);
void __GetFields(Array< ::String> &outFields);
static void __register();
void __Mark(HX_MARK_PARAMS);
void __Visit(HX_VISIT_PARAMS);
bool _hx_isInstanceOf(int inClassId);
::String __ToString() const { return HX_("Inventory",7c,56,89,ea); }
::haxe::ds::EnumValueMap items;
inline ::haxe::ds::EnumValueMap _hx_set_items(hx::StackContext *_hx_ctx, ::haxe::ds::EnumValueMap _hx_v) { HX_OBJ_WB(this,_hx_v.mPtr) return items=_hx_v; }
::game::BodyPart getItemClicked( ::kha::math::Vector2 position);
::Dynamic getItemClicked_dyn();
void render( ::kha::graphics2::Graphics graphics);
};
} // end namespace game
#endif /* INCLUDED_game_Inventory */
| [
"danielblaker@protonmail.com"
] | danielblaker@protonmail.com |
da573e651ad1c759e5e4a17d34e5ac1f1975cac1 | 055e54711691fa5f998154a38126bf2b5d2fa652 | /lib/extract_mvs.cc | 0455897e4de48a611bf4ae24ff2cecf040e09025 | [] | no_license | piercus/motionVector | a8067f134bc9addb3f3d90ee16e566c349144acd | ce92f38e5ba567988bf64b440c4cc99433de067e | refs/heads/master | 2021-05-04T09:10:02.409587 | 2017-08-29T15:23:53 | 2017-08-29T15:23:53 | 70,420,994 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,208 | cc |
/*
* Copyright (c) 2012 Stefano Sabatini
* Copyright (c) 2014 Clément Bœsch
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <node.h>
#include <v8.h>
#include <iostream>
#include <nan.h>
#include <map>
extern "C" {
#include <libavutil/motion_vector.h>
#include <libavformat/avformat.h>
}
namespace jsscope {
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Array;
using v8::Handle;
using v8::Null;
using v8::Object;
using v8::String;
using v8::Value;
using v8::Number;
using namespace std;
static AVFormatContext *fmt_ctx = NULL;
static AVCodecContext *video_dec_ctx = NULL;
static AVStream *video_stream = NULL;
static const char *src_filename = NULL;
static int video_stream_idx = -1;
static AVFrame *frame = NULL;
static AVPacket pkt;
static int video_frame_count = 0;
typedef std::map<unsigned int, bool> FramesHash;
static int decode_packet(int *got_frame, FramesHash selectedFrames, int cached, v8::Local<v8::Function> cb, Isolate* isolate)
{
int decoded = pkt.size;
*got_frame = 0;
if (pkt.stream_index == video_stream_idx) {
int ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
if (ret < 0) {
//fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
return ret;
}
if (*got_frame) {
int i;
AVFrameSideData *sd;
video_frame_count++;
//fprintf(stderr, "Frame number %i %s\n", video_frame_count, selectedFrames[video_frame_count] ? "true" : "false");
if(selectedFrames[video_frame_count]){
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
if (sd) {
const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
int size = sd->size / sizeof(*mvs);
Handle<Array> array = Array::New(isolate, size);
for (i = 0; i < size; i++) {
const AVMotionVector *mv = &mvs[i];
// "framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n"
Local<Object> objItem = Object::New(isolate);
objItem->Set(String::NewFromUtf8(isolate, "w"), Number::New(isolate, mv->w));
objItem->Set(String::NewFromUtf8(isolate, "h"), Number::New(isolate, mv->h));
objItem->Set(String::NewFromUtf8(isolate, "srcx"), Number::New(isolate, mv->src_x));
objItem->Set(String::NewFromUtf8(isolate, "srcy"), Number::New(isolate, mv->src_y));
objItem->Set(String::NewFromUtf8(isolate, "dstx"), Number::New(isolate, mv->dst_x));
objItem->Set(String::NewFromUtf8(isolate, "dsty"), Number::New(isolate, mv->dst_y));
objItem->Set(String::NewFromUtf8(isolate, "flags"), Number::New(isolate, mv->flags));
array->Set(i, objItem);
//printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
// video_frame_count, mv->source,
// mv->w, mv->h, mv->src_x, mv->src_y,
// mv->dst_x, mv->dst_y, mv->flags);
}
Local<Object> obj = Object::New(isolate);
obj->Set(String::NewFromUtf8(isolate, "framenum"), Number::New(isolate, video_frame_count));
obj->Set(String::NewFromUtf8(isolate, "vectors"), array);
const unsigned argc = 1;
Local<Value> argv[argc] = { obj };
cb->Call(Null(isolate), argc, argv);
} else {
Local<Object> obj = Object::New(isolate);
obj->Set(String::NewFromUtf8(isolate, "framenum"), Number::New(isolate, video_frame_count));
const unsigned argc = 1;
Local<Value> argv[argc] = { obj };
cb->Call(Null(isolate), argc, argv);
}
}
}
}
return decoded;
}
static int open_codec_context(int *stream_idx,
AVFormatContext *fmt_ctx, enum AVMediaType type)
{
int ret;
AVStream *st;
AVCodecContext *dec_ctx = NULL;
AVCodec *dec = NULL;
AVDictionary *opts = NULL;
ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0);
if (ret < 0) {
fprintf(stderr, "Could not find %s stream in input file '%s'\n",
av_get_media_type_string(type), src_filename);
return ret;
} else {
*stream_idx = ret;
st = fmt_ctx->streams[*stream_idx];
/* find decoder for the stream */
dec_ctx = st->codec;
dec = avcodec_find_decoder(dec_ctx->codec_id);
if (!dec) {
fprintf(stderr, "Failed to find %s codec\n",
av_get_media_type_string(type));
return AVERROR(EINVAL);
}
/* Init the video decoder */
av_dict_set(&opts, "flags2", "+export_mvs", 0);
if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) {
fprintf(stderr, "Failed to open %s codec\n",
av_get_media_type_string(type));
return ret;
}
}
return 0;
}
int c_function(v8::Local<v8::String> src_filename_in, FramesHash selectedFrames, v8::Local<v8::Function> cb, Isolate* isolate)
{
int ret = 0, got_frame;
av_register_all();
v8::String::Utf8Value filename2(src_filename_in->ToString());
std::string str(*filename2);
char * cstr = new char [str.length()+1];
std::strcpy (src_filename, str.c_str());
if (avformat_open_input(&fmt_ctx, cstr, NULL, NULL) < 0) {
fprintf(stderr, "filename is %s\n", cstr);
fprintf(stderr, "Could not open source file : %s\n", cstr);
exit(1);
}
if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
fprintf(stderr, "Could not find stream information\n");
exit(1);
}
if (open_codec_context(&video_stream_idx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
video_stream = fmt_ctx->streams[video_stream_idx];
video_dec_ctx = video_stream->codec;
}
av_dump_format(fmt_ctx, 0, src_filename, 0);
if (!video_stream) {
fprintf(stderr, "Could not find video stream in the input, aborting\n");
ret = 1;
avcodec_close(video_dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
return ret < 0;
}
frame = av_frame_alloc();
if (!frame) {
fprintf(stderr, "Could not allocate frame\n");
ret = AVERROR(ENOMEM);
avcodec_close(video_dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
return ret < 0;
}
//printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n");
/* initialize packet, set data to NULL, let the demuxer fill it */
av_init_packet(&pkt);
pkt.data = NULL;
pkt.size = 0;
/* read frames from the file */
while (av_read_frame(fmt_ctx, &pkt) >= 0) {
AVPacket orig_pkt = pkt;
do {
ret = decode_packet(&got_frame, selectedFrames, 0, cb, isolate);
if (ret < 0)
break;
pkt.data += ret;
pkt.size -= ret;
} while (pkt.size > 0);
av_packet_unref(&orig_pkt);
}
/* flush cached frames */
pkt.data = NULL;
pkt.size = 0;
do {
decode_packet(&got_frame, selectedFrames, 1, cb, isolate);
} while (got_frame);
//end:
avcodec_close(video_dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
return ret < 0;
}
void GetVectors(const Nan::FunctionCallbackInfo<v8::Value>& info) {
//Isolate* isolate = args.GetIsolate();
//HandleScope scope(isolate);
Isolate* isolate = info.GetIsolate();
Local<Function> cb = info[2].As<v8::Function>();
Local<String> str = info[0]->ToString();
info[1]->ToObject();
Local<Array> frames = Local<Array>::Cast(info[1]);
unsigned int n = frames->Length();
FramesHash selectedFrames;
for (unsigned int i = 0; i < n; i++) {
int frame = frames->Get(i)->IntegerValue();
selectedFrames.insert(std::make_pair(frame, true));
}
//Local<String> filename = Local<String>::Cast(args[0]);
//NanSymbol(args[0])
//Handle<Value> filename = String::New( args[0].c_str() );
info.GetReturnValue().Set(c_function(str, selectedFrames, cb, isolate));
}
void Init(Local<Object> exports, Local<Object> module) {
//NODE_SET_METHOD(module, "exports", GetVectors);
exports->Set(Nan::New("getVector").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(GetVectors)->GetFunction());
}
NODE_MODULE(binding, Init);
}
| [
"piercus@gmail.com"
] | piercus@gmail.com |
058f6a862c1afedd0efb87b4093494b70e2fa23d | 00c2d1cad4bfc768841380b30ea5de0a363f31a0 | /src/text.hpp | 5cc72dc11213ddc54ecff4012c65d5636a3e4c14 | [] | no_license | everhart/juicer | 4450319e2f0ddfd85372581507c6602fd4344b87 | 785a537399487872f54b1772fabaded97e8e4bf5 | refs/heads/master | 2020-11-23T23:33:47.208253 | 2019-12-13T15:21:20 | 2019-12-13T15:21:20 | 227,865,954 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 625 | hpp | #ifndef TEXT_HPP_
#define TEXT_HPP_
#include <vector>
#include <string>
#include <iostream>
#include "media.hpp"
#include "font.hpp"
namespace s2d {
class Text : public Media {
protected:
std::string message_;
void create_attribute_(const Font& font);
public:
Text(
const Font& font,
const glm::vec2& position,
const std::string& message,
GLfloat z
);
virtual void draw() override;
const Font& font() const noexcept;
const std::string& message() const noexcept;
void font(const Font& font);
void message(const std::string& message);
};
}
#endif
| [
"rpe1618@icloud.com"
] | rpe1618@icloud.com |
0e99bf461909dceef328ceb0e02225f528f82609 | aeec67f03514eff7f7f0301dd220131d5e3421f5 | /dist/roslib/rtthread/components/tiny_ros/ros/service_server.h | 020944f58faf37741f941894d7855f564be3ddfb | [] | no_license | loulansuiye/tiny-ros | cfe910c26bf6e582c929dec6a3d6a0de0152e0b8 | 3b5f787352e01c8be62c08deb08ab5b78873dcac | refs/heads/master | 2022-04-26T02:40:10.035016 | 2020-04-19T06:18:46 | 2020-04-19T06:18:46 | 257,832,808 | 1 | 0 | null | 2020-04-22T08:03:04 | 2020-04-22T08:03:03 | null | UTF-8 | C++ | false | false | 2,595 | h | /*
* File : service_server.h
* This file is part of tiny_ros
*
* Change Logs:
* Date Author Notes
* 2018-04-24 Pinkie.Fu initial version
*/
#ifndef _TINYROS_SERVICE_SERVER_H_
#define _TINYROS_SERVICE_SERVER_H_
#include "tiny_ros/tinyros_msgs/TopicInfo.h"
#include "tiny_ros/ros/publisher.h"
#include "tiny_ros/ros/subscriber.h"
namespace tinyros
{
template<typename MReq , typename MRes, typename ObjT = void>
class ServiceServer : public Subscriber_
{
public:
typedef void(ObjT::*CallbackT)(const MReq&, MRes&);
ServiceServer(const char* topic_name, CallbackT cb, ObjT* obj) :
pub(topic_name, &resp, tinyros_msgs::TopicInfo::ID_SERVICE_SERVER + tinyros_msgs::TopicInfo::ID_PUBLISHER),
obj_(obj)
{
this->negotiated_ = false;
this->srv_flag_ = true;
this->topic_ = topic_name;
this->cb_ = cb;
}
// these refer to the subscriber
virtual void callback(unsigned char *data)
{
MReq treq; MRes tresp;
treq.deserialize(data);
(obj_->*cb_)(treq, tresp);
tresp.setID(treq.getID());
pub.publish(&tresp);
}
virtual const char * getMsgType()
{
return this->req.getType();
}
virtual const char * getMsgMD5()
{
return this->req.getMD5();
}
virtual int getEndpointType()
{
return tinyros_msgs::TopicInfo::ID_SERVICE_SERVER + tinyros_msgs::TopicInfo::ID_SUBSCRIBER;
}
virtual bool negotiated()
{
return (negotiated_ && pub.negotiated_);
}
MReq req;
MRes resp;
Publisher pub;
private:
CallbackT cb_;
ObjT* obj_;
};
template<typename MReq , typename MRes>
class ServiceServer<MReq, MRes, void> : public Subscriber_
{
public:
typedef void(*CallbackT)(const MReq&, MRes&);
ServiceServer(const char* topic_name, CallbackT cb) :
pub(topic_name, &resp, tinyros_msgs::TopicInfo::ID_SERVICE_SERVER + tinyros_msgs::TopicInfo::ID_PUBLISHER)
{
this->negotiated_ = false;
this->srv_flag_ = true;
this->topic_ = topic_name;
this->cb_ = cb;
}
// these refer to the subscriber
virtual void callback(unsigned char *data)
{
MReq treq; MRes tresp;
treq.deserialize(data);
cb_(treq, tresp);
tresp.setID(treq.getID());
pub.publish(&tresp);
}
virtual const char * getMsgType()
{
return this->req.getType();
}
virtual const char * getMsgMD5()
{
return this->req.getMD5();
}
virtual int getEndpointType()
{
return tinyros_msgs::TopicInfo::ID_SERVICE_SERVER + tinyros_msgs::TopicInfo::ID_SUBSCRIBER;
}
MReq req;
MRes resp;
Publisher pub;
private:
CallbackT cb_;
};
}
#endif
| [
"363960870@qq.com"
] | 363960870@qq.com |
684ad32073d75607e9c0ec9314a0d0c64aac44c2 | 2005fe2f9c6a18df170477c8eca5090313e10ac4 | /mainwindow.h | f090f2c5cf5dcc7f6b3e8420a5587d07432eca72 | [] | no_license | m0m0likeyou/Kinect_gesture | c35858318414d05b033bd1d0c6bdd2a0d7489da7 | 3cd426b4d4b3d50533bb7b4098e40403ac835191 | refs/heads/master | 2021-01-22T19:04:12.007913 | 2013-10-01T16:36:59 | 2013-10-01T16:36:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,202 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "kinectreader.h"
#include "GestureRecognizer.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(KinectReader& reader, QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
KinectReader &m_reader;
GestureRecognizer m_recognizer;
//how many skeleton frames to ignore
//1 = capture every frame, 2 = capture every second frame ...
int ignore_frame;
int flipflop; //0 = use this frame, else drop
int buffer_size;
//the minimum number of frames in the buffer before attempting to start matching gestures
int min_frame_size;
int capture_count_down_second;
//whether the recogniser is capturing new gesture
bool capturing;
//used for calculating frames per second
int last_frames;
vector<vector<double> > buffer;
//slots为按钮的处理函数
private slots:
void loadGestures();
void saveGestures();
void read();
void capture();
void listGestures();
public slots:
void handleFrame();
};
#endif // MAINWINDOW_H
| [
"lutianming1005@gmail.com"
] | lutianming1005@gmail.com |
ad9b44a6ea9bb1435e244f99803d51ea9a36a44b | d13d854467ae8e7309e90a35789f7864ba954d76 | /dsadsadsadsada.cpp | 1755c512440313c4dac473985d1da198f6d0f5a3 | [] | no_license | SQP1999/SKT | 8e8f6e14f4436582dbbefaa82a7e3c5a3200f247 | f06cf9787e7c791e86561d851ed0a5b01cb8d1c7 | refs/heads/master | 2020-05-04T04:47:03.111246 | 2019-04-11T02:17:38 | 2019-04-11T02:17:38 | 178,973,817 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 4,943 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#define High 15 // 游戏画面尺寸
#define Width 25
#define EnemyNum 10 // 敌机个数
// 全局变量
int position_x,position_y; // 飞机位置
int enemy_x[EnemyNum],enemy_y[EnemyNum]; // 敌机位置
int canvas[High][Width] = {0}; // 二维数组存储游戏画布中对应的元素
// 0为空格,1为飞机*,2为子弹|,3为敌机@
int score; // 得分
int BulletWidth; // 子弹宽度
int EnemyMoveSpeed; // 敌机移动速度
void gotoxy(int x,int y) //光标移动到(x,y)位置
{
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle,pos);
}
void startup() // 数据初始化
{
position_x = High-1;
position_y = Width/2;
canvas[position_x][position_y] = 1;
int k;
for (k=0;k<EnemyNum;k++)
{
enemy_x[k] = rand()%2;
enemy_y[k] = rand()%Width;
canvas[enemy_x[k]][enemy_y[k]] = 3;
}
score = 0;
BulletWidth = 0;
EnemyMoveSpeed = 20;
}
void show() // 显示画面
{
gotoxy(0,0); // 光标移动到原点位置,以下重画清屏
int i,j;
for (i=0;i<High;i++)
{
for (j=0;j<Width;j++)
{
if (canvas[i][j]==0)
printf(" "); // 输出空格
else if (canvas[i][j]==1)
printf("*"); // 输出飞机*
else if (canvas[i][j]==2)
printf("|"); // 输出子弹|
else if (canvas[i][j]==3)
printf("@"); // 输出飞机@
}
printf("\n");
}
printf("得分:%d\n",score);
Sleep(20);
}
void updateWithoutInput() // 与用户输入无关的更新
{
int i,j,k;
for (i=0;i<High;i++)
{
for (j=0;j<Width;j++)
{
if (canvas[i][j]==2)
{
for (k=0;k<EnemyNum;k++)
{
if ((i==enemy_x[k]) && (j==enemy_y[k])) // 子弹击中敌机
{
score++; // 分数加1
if (score%5==0 && EnemyMoveSpeed>5) // 达到一定积分后,敌机变快
EnemyMoveSpeed--;
if (score==5)
{ printf("子弹+1");
BulletWidth++;
}
if (score==50)
{printf("子弹+2");
BulletWidth++;
}
if(score==200)
{printf("子弹+3");
BulletWidth++;
}
canvas[enemy_x[k]][enemy_y[k]] = 0;
enemy_x[k] = rand()%2; // 产生新的飞机
enemy_y[k] = rand()%Width;
canvas[enemy_x[k]][enemy_y[k]] = 3;
canvas[i][j] = 0; // 子弹消失
}
}
// 子弹向上移动
canvas[i][j] = 0;
if (i>0)
canvas[i-1][j] = 2;
}
}
}
static int speed = 0;
if (speed<EnemyMoveSpeed)
speed++;
for (k=0;k<EnemyNum;k++)
{
if ((position_x==enemy_x[k]) && (position_y==enemy_y[k])) // 敌机撞到我机
{
printf("失败!\n");
Sleep(3000);
system("pause");
exit(0);
}
if (enemy_x[k]>High) // 敌机跑出显示屏幕
{
canvas[enemy_x[k]][enemy_y[k]] = 0;
enemy_x[k] = rand()%2; // 产生新的飞机
enemy_y[k] = rand()%Width;
canvas[enemy_x[k]][enemy_y[k]] = 3;
score--; // 减分
}
if (speed == EnemyMoveSpeed)
{
// 敌机下落
for (k=0;k<EnemyNum;k++)
{
canvas[enemy_x[k]][enemy_y[k]] = 0;
enemy_x[k]++;
speed = 0;
canvas[enemy_x[k]][enemy_y[k]] = 3;
}
}
}
}
void updateWithInput() // 与用户输入有关的更新
{
char input;
if(kbhit()) // 判断是否有输入
{
input = getch();
if (input == 'r')
{
EnemyMoveSpeed = 0;
}
else if (input == 't')
{
EnemyMoveSpeed = 20;
}
if (input == 'a' && position_y>0)
{
canvas[position_x][position_y] = 0;
position_y--; // 位置左移
canvas[position_x][position_y] = 1;
}
else if (input == 'd' && position_y<Width-1)
{
canvas[position_x][position_y] = 0;
position_y++; // 位置右移
canvas[position_x][position_y] = 1;
}
else if (input == 'w')
{
canvas[position_x][position_y] = 0;
position_x--; // 位置上移
canvas[position_x][position_y] = 1;
}
else if (input == 's')
{
canvas[position_x][position_y] = 0;
position_x++; // 位置下移
canvas[position_x][position_y] = 1;
}
else if (input == ' ') // 发射子弹
{
int left = position_y-BulletWidth;
int right = position_y+BulletWidth;
if (left<0)
left = 0;
if (right>Width-1)
right = Width-1;
int k;
for (k=left;k<=right;k++) // 发射闪弹
canvas[position_x-1][k] = 2; // 发射子弹的初始位置在飞机的正上方
}
}
}
int main()
{
startup(); // 数据初始化
while (1) // 游戏循环执行
{
show(); // 显示画面
updateWithoutInput(); // 与用户输入无关的更新
updateWithInput(); // 与用户输入有关的更新
}
return 0;
} | [
"noreply@github.com"
] | SQP1999.noreply@github.com |
1440e93a8673caebfbe1d90eb94b2d97a1fd81bd | 06be945222cda320732d546b51132764d56b06f6 | /webrtc/video_engine/vie_sender.cc | 051c56096d116ef8fec0dccac1ba53693b607d11 | [] | no_license | suxinde2009/native_webrtc | 8018b8fc26c89091a5e2c13f401bfd8a54dcd7ce | f074826790f7e57e44f95ccd0e640aa6c6c349bc | refs/heads/master | 2020-05-09T14:40:31.487502 | 2017-04-06T13:49:16 | 2017-04-06T13:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,979 | cc | /*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/video_engine/vie_sender.h"
#include <assert.h>
#include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
#include "webrtc/modules/utility/interface/rtp_dump.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
ViESender::ViESender(int channel_id)
: channel_id_(channel_id),
critsect_(CriticalSectionWrapper::CreateCriticalSection()),
transport_(NULL),
rtp_dump_(NULL) {
}
ViESender::~ViESender() {
if (rtp_dump_) {
rtp_dump_->Stop();
RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL;
}
}
int ViESender::RegisterSendTransport(Transport* transport) {
CriticalSectionScoped cs(critsect_.get());
if (transport_) {
return -1;
}
transport_ = transport;
return 0;
}
int ViESender::DeregisterSendTransport() {
CriticalSectionScoped cs(critsect_.get());
if (transport_ == NULL) {
return -1;
}
transport_ = NULL;
return 0;
}
int ViESender::StartRTPDump(const char file_nameUTF8[1024]) {
CriticalSectionScoped cs(critsect_.get());
/*if (rtp_dump_) {
// Packet dump is already started, restart it.
rtp_dump_->Stop();
} else {
rtp_dump_ = RtpDump::CreateRtpDump();
if (rtp_dump_ == NULL) {
return -1;
}
}
if (rtp_dump_->Start(file_nameUTF8) != 0) {
RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL;
return -1;
}*/
return 0;
}
int ViESender::StopRTPDump() {
CriticalSectionScoped cs(critsect_.get());
if (rtp_dump_) {
if (rtp_dump_->IsActive()) {
rtp_dump_->Stop();
}
RtpDump::DestroyRtpDump(rtp_dump_);
rtp_dump_ = NULL;
} else {
return -1;
}
return 0;
}
int ViESender::SendPacket(int vie_id, const void* data, int len) {
CriticalSectionScoped cs(critsect_.get());
if (!transport_) {
// No transport
return -1;
}
assert(ChannelId(vie_id) == channel_id_);
if (rtp_dump_) {
rtp_dump_->DumpPacket(static_cast<const uint8_t*>(data),
static_cast<uint16_t>(len));
}
return transport_->SendPacket(channel_id_, data, len);
}
int ViESender::SendRTCPPacket(int vie_id, const void* data, int len) {
CriticalSectionScoped cs(critsect_.get());
if (!transport_) {
return -1;
}
assert(ChannelId(vie_id) == channel_id_);
if (rtp_dump_) {
rtp_dump_->DumpPacket(static_cast<const uint8_t*>(data),
static_cast<uint16_t>(len));
}
return transport_->SendRTCPPacket(channel_id_, data, len);
}
} // namespace webrtc
| [
"dq5070410@126.com"
] | dq5070410@126.com |
ce71f9eb0308e9f072d9296aff70b41adf562f8d | 7ae8ec0dd750effd6c26a89e409095ad6076b3d7 | /src/source_clang.h | 71b09032eb2ecfe308b91b8bd77e8a03eef17f38 | [
"MIT"
] | permissive | AdamRobertHall/jucipp | 41de70274252eacfa076e36dc34a717e984b13f0 | 7516d1d9b0456d0814e0931e71e1b4f97e0369f1 | refs/heads/master | 2021-01-01T20:37:11.028478 | 2017-07-27T11:10:23 | 2017-07-29T10:31:23 | 98,897,821 | 1 | 0 | null | 2017-07-31T14:26:56 | 2017-07-31T14:26:55 | null | UTF-8 | C++ | false | false | 4,291 | h | #ifndef JUCI_SOURCE_CLANG_H_
#define JUCI_SOURCE_CLANG_H_
#include <thread>
#include <atomic>
#include <mutex>
#include <set>
#include "clangmm.h"
#include "source.h"
#include "terminal.h"
#include "dispatcher.h"
#include "autocomplete.h"
namespace Source {
class ClangViewParse : public View {
protected:
enum class ParseState {PROCESSING, RESTARTING, STOP};
enum class ParseProcessState {IDLE, STARTING, PREPROCESSING, PROCESSING, POSTPROCESSING};
public:
ClangViewParse(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
bool save(const std::vector<Source::View*> &views) override;
void configure() override;
void soft_reparse() override;
protected:
Dispatcher dispatcher;
void parse_initialize();
std::unique_ptr<clangmm::TranslationUnit> clang_tu;
std::unique_ptr<clangmm::Tokens> clang_tokens;
sigc::connection delayed_reparse_connection;
std::shared_ptr<Terminal::InProgress> parsing_in_progress;
void remove_include_guard(std::string &buffer);
void show_diagnostic_tooltips(const Gdk::Rectangle &rectangle) override;
void show_type_tooltips(const Gdk::Rectangle &rectangle) override;
std::set<int> diagnostic_offsets;
std::vector<FixIt> fix_its;
std::thread parse_thread;
std::mutex parse_mutex;
std::atomic<ParseState> parse_state;
std::atomic<ParseProcessState> parse_process_state;
private:
Glib::ustring parse_thread_buffer;
void update_syntax();
std::set<std::string> last_syntax_tags;
void update_diagnostics();
std::vector<clangmm::Diagnostic> clang_diagnostics;
static clangmm::Index clang_index;
std::vector<std::string> get_compilation_commands();
};
class ClangViewAutocomplete : public virtual ClangViewParse {
public:
class Suggestion {
public:
explicit Suggestion(std::vector<clangmm::CompletionChunk> &&chunks) :
chunks(chunks) { }
std::vector<clangmm::CompletionChunk> chunks;
std::string brief_comments;
};
ClangViewAutocomplete(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
protected:
Autocomplete<Suggestion> autocomplete;
private:
const std::unordered_map<std::string, std::string> &autocomplete_manipulators_map();
};
class ClangViewRefactor : public virtual ClangViewParse {
class Identifier {
public:
Identifier(const std::string &spelling, const clangmm::Cursor &cursor)
: kind(cursor.get_kind()), spelling(spelling), usr_extended(cursor.get_usr_extended()), cursor(cursor) {}
Identifier() : kind(static_cast<clangmm::Cursor::Kind>(0)) {}
operator bool() const { return static_cast<int>(kind)!=0; }
bool operator==(const Identifier &rhs) const { return spelling==rhs.spelling && usr_extended==rhs.usr_extended; }
bool operator!=(const Identifier &rhs) const { return !(*this==rhs); }
bool operator<(const Identifier &rhs) const { return spelling<rhs.spelling || (spelling==rhs.spelling && usr_extended<rhs.usr_extended); }
clangmm::Cursor::Kind kind;
std::string spelling;
std::string usr_extended;
clangmm::Cursor cursor;
};
public:
ClangViewRefactor(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
protected:
sigc::connection delayed_tag_similar_identifiers_connection;
private:
Identifier get_identifier();
void wait_parsing(const std::vector<Source::View*> &views);
std::list<std::pair<Glib::RefPtr<Gtk::TextMark>, Glib::RefPtr<Gtk::TextMark> > > similar_identifiers_marks;
void tag_similar_identifiers(const Identifier &identifier);
Glib::RefPtr<Gtk::TextTag> similar_identifiers_tag;
Identifier last_tagged_identifier;
};
class ClangView : public ClangViewAutocomplete, public ClangViewRefactor {
public:
ClangView(const boost::filesystem::path &file_path, Glib::RefPtr<Gsv::Language> language);
void full_reparse() override;
void async_delete();
private:
Glib::Dispatcher do_delete_object;
std::thread delete_thread;
std::thread full_reparse_thread;
bool full_reparse_running=false;
};
}
#endif // JUCI_SOURCE_CLANG_H_
| [
"eidheim@gmail.com"
] | eidheim@gmail.com |
226c6ecd55ba66c7610ca941c4cc591d6f5a9793 | 4021cc20733c8ead5c235d1f89e6a95ef1cf7386 | /campion.edu/tessst/main.cpp | 26e8d520e5521d088edbedeb2eed14777b184719 | [] | no_license | MicuEmerson/AlgorithmicProblems | 9462ca439f2c3b8dcf5bfccf5e3f061b3e0ff645 | 918a52853dd219ba315d1cb4a620cf85ed73b4fd | refs/heads/master | 2020-12-24T11:46:37.771635 | 2016-12-23T18:14:30 | 2016-12-23T18:14:30 | 73,013,087 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 368 | cpp | #include <iostream>
#include <vector>
using namespace std;
5 10 14 15 16
n = 20
template<class T>
vector < int > f(int n, vector < int > v)
{
for (int i = 1; i < v.size(); ++i)
{
for (int j = v[i - 1] + 1; j <= v[i] - 1; ++j)
v2.push_back(j);
}
return v2;
}
O(n + v.size())
int main()
{
int n;
cin>>n;
f(n);
}
| [
"micuemerson@gmail.com"
] | micuemerson@gmail.com |
e92766bdca64d4cdc0dc7d3f0b1e863443232c4a | b130cc5918ed507faa7d487cce1868d1e994d5ee | /graph/main.cpp | 06c1302fd8e477160b95d566403df4efac39f1fb | [] | no_license | yaaawner/graph | 8a11c10a36b8d03be1c39ae8bef52ef30a751258 | 034c1518ea74eda1297d3e368a3d11e2a092e873 | refs/heads/master | 2023-01-30T10:57:53.521268 | 2020-12-12T21:06:57 | 2020-12-12T21:06:57 | 313,405,874 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 36,120 | cpp | #define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "Shader.h"
#include "Camera.h"
#include "ShaderSmoke.h"
#include "Load.h"
#include <vector>
#define WIDTH 1600
#define HEIGHT 1200
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
void Do_Movement();
Camera camera(glm::vec3(0.0f, 0.0f, 6.0f));
bool keys[1024];
GLfloat lastX = 400, lastY = 300;
bool firstMouse = false;
GLfloat deltaTime = 0.0f;
GLfloat lastFrame = 0.0f;
GLfloat T = 0.0f;
GLfloat starVertices[] = {
0.0f, 0.5f, 0.0f,
0.0f, 0.0f, 0.5f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f,
0.0f, 0.0f, 0.5f,
-0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f,
0.0f, 0.0f, -0.5f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f,
0.0f, 0.0f, -0.5f,
-0.5f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f,
0.0f, 0.0f, 0.5f,
0.5f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f,
0.0f, 0.0f, 0.5f,
-0.5f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f,
0.0f, 0.0f, -0.5f,
0.5f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f,
0.0f, 0.0f, -0.5f,
-0.5f, 0.0f, 0.0f,
};
GLfloat planeVertices[] = {
// positions // normals // texture
10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 5.0f, 0.0f,
-10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
-10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 5.0f,
10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 5.0f, 0.0f,
-10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 5.0f,
10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 5.0f, 5.0f
};
GLfloat cubeVertices[] = {
// positions // normals // texture
-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,
1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
-1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
-1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
-1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,
1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
-1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,
1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,
-1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f
};
GLfloat skyboxVertices[] = {
// positions
-1.0f, 1.0f, -1.0f,
-1.0f, -1.0f, -1.0f,
1.0f, -1.0f, -1.0f,
1.0f, -1.0f, -1.0f,
1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, -1.0f,
-1.0f, -1.0f, 1.0f,
-1.0f, -1.0f, -1.0f,
-1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, 1.0f,
-1.0f, -1.0f, 1.0f,
1.0f, -1.0f, -1.0f,
1.0f, -1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, -1.0f,
1.0f, -1.0f, -1.0f,
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
1.0f, -1.0f, 1.0f,
-1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, -1.0f,
1.0f, 1.0f, -1.0f,
1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f,
-1.0f, 1.0f, 1.0f,
-1.0f, 1.0f, -1.0f,
-1.0f, -1.0f, -1.0f,
-1.0f, -1.0f, 1.0f,
1.0f, -1.0f, -1.0f,
1.0f, -1.0f, -1.0f,
-1.0f, -1.0f, 1.0f,
1.0f, -1.0f, 1.0f
};
GLfloat billboardVertices[] = {
// position // texture
-1, -1, 0, 0, 1,
1, -1, 0, 1, 1,
-1, 1, 0, 0, 0,
1, -1, 0, 1, 1,
1, 1, 0, 1, 0,
-1, 1, 0, 0, 0
};
GLfloat transparentVertices[] = {
// positions // texture
0.0f, 0.5f, 0.0f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f, 0.0f, 1.0f,
1.0f, -0.5f, 0.0f, 1.0f, 1.0f,
0.0f, 0.5f, 0.0f, 0.0f, 0.0f,
1.0f, -0.5f, 0.0f, 1.0f, 1.0f,
1.0f, 0.5f, 0.0f, 1.0f, 0.0f
};
float borderColor[] = { 1.0, 1.0, 1.0, 1.0 };
static void glfwError(int id, const char* description)
{
std::cout << description << std::endl;
}
class Skybox {
GLuint skyboxVAO, skyboxVBO;
GLuint cubemapTexture;
Shader shader = Shader("shaders/skybox.vs", "shaders/skybox.fs");
std::vector<std::string> faces
{
"textures/IceLake/posx.jpg",
"textures/IceLake/negx.jpg",
"textures/IceLake/posy.jpg",
"textures/IceLake/negy.jpg",
"textures/IceLake/posz.jpg",
"textures/IceLake/negz.jpg"
/*
"textures/wow.jpg",
"textures/wow.jpg",
"textures/wow.jpg",
"textures/wow.jpg",
"textures/wow.jpg",
"textures/wow.jpg"
*/
};
public:
Skybox() {
// skybox VAO
glGenVertexArrays(1, &skyboxVAO);
glGenBuffers(1, &skyboxVBO);
glBindVertexArray(skyboxVAO);
glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
cubemapTexture = loadCubemap(faces);
}
void Draw() {
// depth. we need background
glDepthFunc(GL_LEQUAL);
// texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
glUniform1i(glGetUniformLocation(shader.Program, "ourTexture"), 0);
shader.Use();
glm::mat4 view = glm::mat4(glm::mat3(camera.GetViewMatrix())); // background
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glUniformMatrix4fv(glGetUniformLocation(shader.Program, "view"), 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(glGetUniformLocation(shader.Program, "projection"), 1, GL_FALSE, glm::value_ptr(projection));
// cube
glBindVertexArray(skyboxVAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
glDepthFunc(GL_LESS); // set depth function back to default
}
~Skybox() {
glDeleteVertexArrays(1, &skyboxVAO);
glDeleteBuffers(1, &skyboxVBO);
}
};
class Billboard {
GLuint billboardVAO, billboardVBO;
GLuint billboardTexture;
Shader shader = Shader("shaders/billboard.vs", "shaders/billboard.fs");
std::vector<glm::vec3> billboards = {
glm::vec3(-1.0f, 0.0f, 0.0f),
//glm::vec3(-1.0f, 0.5f, -4.0f),
glm::vec3(-2.0f, 0.0f, 2.0f),
glm::vec3(-3.0f, 0.0f, 0.0f)
};
public:
Billboard() {
glGenVertexArrays(1, &billboardVAO);
glGenBuffers(1, &billboardVBO);
glBindVertexArray(billboardVAO);
glBindBuffer(GL_ARRAY_BUFFER, billboardVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(billboardVertices), &billboardVertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
billboardTexture = loadTexture("textures/amongus_red.png");
}
void Draw() {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glBindTexture(GL_TEXTURE_2D, billboardTexture);
glUniform1i(glGetUniformLocation(shader.Program, "ourTexture"), 1);
shader.Use();
glUniform1f(glGetUniformLocation(shader.Program, "size"), 0.4f);
for (int i = 0, n = billboards.size(); i + 1 < n; i++) {
for (int j = i; j < n; j++) {
glm::vec3 delta1 = billboards[i] - camera.Position;
glm::vec3 delta2 = billboards[j] - camera.Position;
if (dot(delta1, delta1) < dot(delta2, delta2)) {
glm::vec3 tmp = billboards[i];
billboards[i] = billboards[j];
billboards[j] = tmp;
}
}
}
glm::mat4 PV = projection * view;
shader.setMat4("PVM", PV);
shader.setVec3("cameraRight", camera.Right);
shader.setVec3("cameraUp", camera.Up);
glBindVertexArray(billboardVAO);
// draw billboards
for (int i = 0, n = billboards.size(); i < n; i++) {
shader.setVec3("billboardPos", billboards[i]);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
glBindVertexArray(0);
}
~Billboard() {
glDeleteVertexArrays(1, &billboardVAO);
glDeleteBuffers(1, &billboardVBO);
}
};
class Transparent {
GLuint transparentVAO, transparentVBO;
GLuint transparentTexture;
Shader shader = Shader("shaders/glass.vs", "shaders/glass.fs");
std::vector<glm::vec3> windows
{
glm::vec3(-1.5f, 2.0f, -0.48f),
glm::vec3(-0.3f, 2.0f, -2.3f),
glm::vec3(0.5f, 2.0f, -0.6f),
glm::vec3(0.5f, 2.0f, 0.0f),
glm::vec3(-1.0f, 2.0f, -2.0f),
glm::vec3(-2.5f, 2.0f, -1.3f),
glm::vec3(-2.1f, 2.0f, 2.3f),
glm::vec3(-3.5f, 2.0f, 0.6f),
};
public:
Transparent() {
glGenVertexArrays(1, &transparentVAO);
glGenBuffers(1, &transparentVBO);
glBindVertexArray(transparentVAO);
glBindBuffer(GL_ARRAY_BUFFER, transparentVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), transparentVertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
glBindVertexArray(0);
transparentTexture = loadTexture("textures/blue.png");
}
void Draw() {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glm::mat4 model(1.0f);
for (int i = 0, n = windows.size(); i + 1 < n; i++) {
for (int j = i; j < n; j++) {
glm::vec3 delta1 = windows[i] - camera.Position;
glm::vec3 delta2 = windows[j] - camera.Position;
if (dot(delta1, delta1) < dot(delta2, delta2)) {
glm::vec3 tmp = windows[i];
windows[i] = windows[j];
windows[j] = tmp;
}
}
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, transparentTexture);
shader.setInt("texture1", 0);
shader.Use();
shader.setMat4("view", view);
shader.setMat4("projection", projection);
glBindVertexArray(transparentVAO);
for (int i = 0, n = windows.size(); i < n; i++) {
model = glm::mat4(1.0f);
model = glm::translate(model, windows[i]);
shader.setMat4("model", model);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
glBindVertexArray(0);
}
~Transparent() {
glDeleteVertexArrays(1, &transparentVAO);
glDeleteBuffers(1, &transparentVBO);
}
};
class Star {
GLuint starVAO, starVBO;
Shader shader = Shader("shaders/star.vs", "shaders/star.fs");
public:
Star() {
glGenVertexArrays(1, &starVAO);
glGenBuffers(1, &starVBO);
glBindVertexArray(starVAO);
glBindBuffer(GL_ARRAY_BUFFER, starVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(starVertices), starVertices, GL_STATIC_DRAW);
// Position attribute
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
}
void Draw() {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glm::mat4 model(1.0f);
shader.Use();
shader.setMat4("model", model);
shader.setMat4("projection", projection);
shader.setMat4("view", view);
GLfloat greenValue = (sin(glfwGetTime()) / 2) + 0.5f;
GLfloat redValue = (sin(glfwGetTime()) / 2) + 0.5f;
GLint vertexColorLocation = glGetUniformLocation(shader.Program, "ourColor");
glUniform3f(vertexColorLocation, redValue, greenValue, 1.0f);
glBindVertexArray(starVAO);
glm::vec3 cubePositions[] = {
glm::vec3(0.0f, 17.0f, 0.0f),
glm::vec3(6.0f, 17.0f, 0.0f),
glm::vec3(1.0f, 17.0f, -3.0f),
glm::vec3(4.7f, 17.0f, -3.0f),
glm::vec3(-3.0f, 17.0f, 2.0f),
glm::vec3(-6.0f, 17.0f, 4.0f),
glm::vec3(-11.0f, 17.0f, 4.0f),
};
for (GLuint i = 0; i < 7; i++)
{
glm::mat4 model(1.0f);
model = glm::translate(model, cubePositions[i]);
shader.setMat4("model", model);
glDrawArrays(GL_TRIANGLES, 0, 24);
}
glBindVertexArray(0);
}
~Star() {
glDeleteVertexArrays(1, &starVAO);
glDeleteBuffers(1, &starVBO);
}
};
class Smoke {
GLuint posBuf[2], velBuf[2];
GLuint particleArray[2];
GLuint feedback[2], initVel, startTime[2];
GLuint drawBuf = 1;
GLuint renderSub, updateSub;
int nParticles = 500;
GLuint smokeTexture;
ShaderSmoke shader = ShaderSmoke("shaders/smoke.vs", "shaders/smoke.fs");
public:
Smoke() {
glGenBuffers(2, posBuf);
glGenBuffers(2, velBuf);
glGenBuffers(2, startTime);
glGenBuffers(1, &initVel);
int size = nParticles * 3 * sizeof(GLfloat);
glBindBuffer(GL_ARRAY_BUFFER, posBuf[0]);
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, posBuf[1]);
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, velBuf[0]);
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, velBuf[1]);
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, initVel);
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, startTime[0]);
glBufferData(GL_ARRAY_BUFFER, nParticles * sizeof(float), NULL, GL_DYNAMIC_COPY);
glBindBuffer(GL_ARRAY_BUFFER, startTime[1]);
glBufferData(GL_ARRAY_BUFFER, nParticles * sizeof(float), NULL, GL_DYNAMIC_COPY);
// first velocity buffer with random velocities
glm::vec3 v(0.0f);
float velocity, theta, phi;
GLfloat* data = new GLfloat[nParticles * 3];
for (unsigned int i = 0; i < nParticles; i++) {
theta = glm::mix(0.0f, glm::pi<float>() / 3.0f, randFloat());
phi = glm::mix(0.0f, glm::two_pi<float>(), randFloat());
v.x = sinf(theta) * cosf(phi);
v.y = cosf(theta);
v.z = sinf(theta) * sinf(phi);
velocity = glm::mix(0.1f, 0.3f, randFloat());
v = glm::normalize(v) * velocity;
data[3 * i] = v.x;
data[3 * i + 1] = v.y;
data[3 * i + 2] = v.z;
}
glBindBuffer(GL_ARRAY_BUFFER, velBuf[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data);
glBindBuffer(GL_ARRAY_BUFFER, initVel);
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data);
// first start time
GLfloat* tdata = new GLfloat[nParticles];
float ttime = 0.0f;
float rate = 0.1f;
for (int i = 0; i < nParticles; i++) {
tdata[i] = ttime;
ttime += rate;
}
glBindBuffer(GL_ARRAY_BUFFER, startTime[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, nParticles * sizeof(float), tdata);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// create vertex arrays for each set of buffers
glGenVertexArrays(2, particleArray);
// set up particle array 0
glBindVertexArray(particleArray[0]);
glBindBuffer(GL_ARRAY_BUFFER, posBuf[0]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, velBuf[0]);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, startTime[0]);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, initVel);
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(3);
// set up particle array 1
glBindVertexArray(particleArray[1]);
glBindBuffer(GL_ARRAY_BUFFER, posBuf[1]);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, velBuf[1]);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, startTime[1]);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, initVel);
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(3);
glBindVertexArray(0);
// setup the feedback objects
glGenTransformFeedbacks(2, feedback);
// feedback 0
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedback[0]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, posBuf[0]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 1, velBuf[0]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, startTime[0]);
// feedback 1
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedback[1]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, posBuf[1]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 1, velBuf[1]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, startTime[1]);
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
const char* outputNames[] = { "Position", "Velocity", "StartTime" };
glTransformFeedbackVaryings(shader.Program, 3, outputNames, GL_SEPARATE_ATTRIBS);
shader.Link(); // before link we need bind feedback var's name
smokeTexture = loadTexture("textures/smoke.png");
//float T = glfwGetTime();
delete[] data;
delete[] tdata;
}
void Draw() {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glm::mat4 model(1.0f);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, smokeTexture);
shader.Use();
// we call in shader needed function in shader
renderSub = glGetSubroutineIndex(shader.Program, GL_VERTEX_SHADER, "render");
updateSub = glGetSubroutineIndex(shader.Program, GL_VERTEX_SHADER, "update");
glUniformSubroutinesuiv(GL_VERTEX_SHADER, 1, &updateSub); // update
// set uniform
shader.setInt("texture1", 0);
shader.setFloat("ParticleLifetime", 10.0f);
glm::vec3 Accel(0.0f, 0.1f, 0.0f);
shader.setVec3("Accel", Accel);
shader.setFloat("MinParticleSize", 20.0f);
shader.setFloat("MaxParticleSize", 500.0f);
shader.setFloat("Time", glfwGetTime());
shader.setFloat("H", glfwGetTime() - T);
T = glfwGetTime();
// render normal
glEnable(GL_PROGRAM_POINT_SIZE);
glPointSize(10.0);
glEnable(GL_RASTERIZER_DISCARD);
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedback[drawBuf]);
glBeginTransformFeedback(GL_POINTS);
glBindVertexArray(particleArray[1 - drawBuf]);
glDrawArrays(GL_POINTS, 0, nParticles);
glEndTransformFeedback();
glDisable(GL_RASTERIZER_DISCARD);
// render
glUniformSubroutinesuiv(GL_VERTEX_SHADER, 1, &renderSub);
// matrices
model = glm::mat4(1.0f);
glm::vec3 pos(3.0f, -0.5f, 2.0f);
model = glm::translate(model, pos);
glm::mat4 mv = view * model;
shader.setMat4("MVP", projection * mv);
glBindVertexArray(particleArray[drawBuf]);
glDrawTransformFeedback(GL_POINTS, feedback[drawBuf]);
// swap buffers
drawBuf = 1 - drawBuf;
glBindVertexArray(0);
glEnable(GL_DEPTH_TEST);
}
~Smoke() {
glDeleteBuffers(1, &initVel);
glDeleteBuffers(2, posBuf);
glDeleteBuffers(2, velBuf);
glDeleteBuffers(2, startTime);
}
};
class ShadowScene {
Shader object = Shader("shaders/object.vs", "shaders/object.fs");
Shader shadow = Shader("shaders/shadow.vs", "shaders/shadow.fs");
GLuint planeVAO, planeVBO, cubeVAO, cubeVBO;
GLuint iceTexture;
const GLuint SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;
GLuint shadowFBO;
GLuint shadowMap;
glm::vec3 lightPos = glm::vec3(-2.0f, 5.0f, -2.0f);
glm::vec3 cubePositions[6] = {
glm::vec3(0.0f, 1.5f, 0.0),
glm::vec3(1.3f, 0.0f, 1.0),
glm::vec3(-1.0f, 0.0f, 2.0),
glm::vec3(-2.0f, 0.0f, -1.0),
glm::vec3(1.0f, 0.0f, -2.0),
glm::vec3(-1.5f, 1.5f, 1.0),
};
glm::vec3 cubeSizes[6] = {
glm::vec3(0.5f),
glm::vec3(0.3f),
glm::vec3(0.25),
glm::vec3(0.25),
glm::vec3(0.25),
glm::vec3(0.25),
};
GLfloat cubeAngle[6] = {
30.0f,
0.0f,
60.0f,
30.0f,
0.0f,
45.0f,
};
public:
ShadowScene() {
// plane VAO
glGenVertexArrays(1, &planeVAO);
glGenBuffers(1, &planeVBO);
glBindVertexArray(planeVAO);
glBindBuffer(GL_ARRAY_BUFFER, planeVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
glBindVertexArray(0);
// cube VAO
glGenVertexArrays(1, &cubeVAO);
glGenBuffers(1, &cubeVBO);
glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), cubeVertices, GL_STATIC_DRAW);
glBindVertexArray(cubeVAO);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
iceTexture = loadTexture("textures/show.jpg");
// configure map
glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
// configure fbo bind frame buffer to texture
glGenFramebuffers(1, &shadowFBO);
glBindFramebuffer(GL_FRAMEBUFFER, shadowFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// shader configuration
object.Use();
object.setInt("diffuseTexture", 0);
object.setInt("shadowMap", 1);
}
void Draw() {
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// at first we draw shadow map to texture. then we use this texture to draw normal scene
shadow.Use();
// matrices. we draw shadow on texture from light's perspective
glm::mat4 lightProjection, lightView;
glm::mat4 lightPV;
float near_plane = 1.0f, far_plane = 7.5f;
lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));
lightPV = lightProjection * lightView;
shadow.setMat4("lightPV", lightPV);
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
glBindFramebuffer(GL_FRAMEBUFFER, shadowFBO);
glClear(GL_DEPTH_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, iceTexture);
// ----- render ----- shadow shader
// plane
glm::mat4 model = glm::mat4(1.0f);
shadow.setMat4("model", model);
glBindVertexArray(planeVAO);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindVertexArray(0);
// cubes
for (int i = 0; i < 6; i++) {
model = glm::mat4(1.0f);
model = glm::translate(model, cubePositions[i]);
model = glm::scale(model, cubeSizes[i]);
model = glm::rotate(model, glm::radians(cubeAngle[i]), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));
shadow.setMat4("model", model);
glBindVertexArray(cubeVAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// now we draw normal scene and use our texture with shadow (texture map)
glViewport(0, 0, WIDTH, HEIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
object.Use();
// matrices
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glm::mat4 view = camera.GetViewMatrix();
object.setMat4("projection", projection);
object.setMat4("view", view);
// light uniforms
object.setVec3("viewPos", camera.Position);
object.setVec3("lightPos", lightPos);
object.setMat4("lightPV", lightPV);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, iceTexture);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, shadowMap);
// ----- render ----- object shader
// plane
model = glm::mat4(1.0f);
object.setMat4("model", model);
glBindVertexArray(planeVAO);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindVertexArray(0);
// cubes
for (int i = 0; i < 6; i++) {
model = glm::mat4(1.0f);
model = glm::translate(model, cubePositions[i]);
model = glm::scale(model, cubeSizes[i]);
model = glm::rotate(model, glm::radians(cubeAngle[i]), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));
object.setMat4("model", model);
glBindVertexArray(cubeVAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
}
}
~ShadowScene() {
glDeleteVertexArrays(1, &planeVAO);
glDeleteBuffers(1, &planeVBO);
glDeleteVertexArrays(1, &cubeVAO);
glDeleteBuffers(1, &cubeVBO);
glDeleteTextures(1, &shadowMap);
glDeleteFramebuffers(1, &shadowFBO);
}
};
class Cube {
Shader shader = Shader("shaders/refract.vs", "shaders/refract.fs");
GLuint cubeVAO, cubeVBO;
GLuint cubemapTexture;
std::vector<std::string> faces
{
"textures/IceLake/posx.jpg",
"textures/IceLake/negx.jpg",
"textures/IceLake/posy.jpg",
"textures/IceLake/negy.jpg",
"textures/IceLake/posz.jpg",
"textures/IceLake/negz.jpg"
};
public:
Cube() {
glGenVertexArrays(1, &cubeVAO);
glGenBuffers(1, &cubeVBO);
glBindVertexArray(cubeVAO);
glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
cubemapTexture = loadCubemap(faces);
}
void Draw() {
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(camera.Zoom, (float)WIDTH / (float)HEIGHT, 0.1f, 1000.0f);
glm::mat4 model(1.0f);
shader.Use();
shader.setInt("skybox", 0);
shader.setMat4("model", model);
shader.setMat4("view", view);
shader.setMat4("projection", projection);
shader.setVec3("camPos", camera.Position);
glBindVertexArray(cubeVAO);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
}
~Cube() {
glDeleteVertexArrays(1, &cubeVAO);
glDeleteBuffers(1, &cubeVBO);
}
};
float keyTime = 0.0f;
bool refractMode = false;
int main()
{
int width = 1600;
int height = 1200;
glfwSetErrorCallback(&glfwError);
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
GLFWwindow* window = glfwCreateWindow(width, height, "kek", NULL, NULL);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, key_callback);
glfwSetCursorPosCallback(window, mouse_callback);
// Options
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);
Cube refractCube;
Skybox skybox;
Star bear;
Billboard AmongUs;
Transparent Window;
Smoke cloud;
ShadowScene planeAndCubes;
// play cycle
while (!glfwWindowShouldClose(window))
{
// check events
glfwPollEvents();
GLfloat currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// Check and call events
glfwPollEvents();
Do_Movement();
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
// draw here
if (refractMode) {
if (keys[32] && (glfwGetTime() - keyTime) > 1.0) {
keyTime = glfwGetTime();
refractMode = false;
}
refractCube.Draw();
skybox.Draw();
}
else {
if (keys[32] && (glfwGetTime() - keyTime) > 1.0) {
keyTime = glfwGetTime();
refractMode = true;
}
planeAndCubes.Draw();
bear.Draw();
//refractCube.Draw();
skybox.Draw();
AmongUs.Draw();
Window.Draw();
cloud.Draw();
}
// we have 2 buffers (front back). we see front buffer when back buffer has been drowing
// then swap buffers
glfwSwapBuffers(window);
}
glfwTerminate();
return 0;
}
void Do_Movement()
{
// Camera controls
if (keys[GLFW_KEY_W])
camera.ProcessKeyboard(FORWARD, deltaTime);
if (keys[GLFW_KEY_S])
camera.ProcessKeyboard(BACKWARD, deltaTime);
if (keys[GLFW_KEY_A])
camera.ProcessKeyboard(LEFT, deltaTime);
if (keys[GLFW_KEY_D])
camera.ProcessKeyboard(RIGHT, deltaTime);
}
// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
//cout << key << endl;
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
if (key >= 0 && key < 1024)
{
if (action == GLFW_PRESS)
keys[key] = true;
else if (action == GLFW_RELEASE)
keys[key] = false;
}
}
void mouse_callback(GLFWwindow* window, double xpos, double ypos)
{
if (firstMouse)
{
lastX = xpos;
lastY = ypos;
firstMouse = false;
}
GLfloat xoffset = xpos - lastX;
GLfloat yoffset = lastY - ypos; // Reversed since y-coordinates go from bottom to left
lastX = xpos;
lastY = ypos;
camera.ProcessMouseMovement(xoffset, yoffset);
}
| [
"belyaevaolga881@gmail.com"
] | belyaevaolga881@gmail.com |
45bdee070110b9e42b9dfb311d47797962757bf4 | 0f19568208d224b6b094542cdc7078002ecf5c3a | /ivp/src/lib_ipfview/QuadSet.h | 06c6fdd5446dc5378df2c774fbafaf0098cc5809 | [] | no_license | scottsideleau/MOOS-IvP-releases | 5e875d506f123d793e2c1568de3f3733791f7062 | bda2fc46bb7e886f05ab487f72b747521420ce86 | refs/heads/master | 2021-01-11T04:05:38.824239 | 2016-10-21T02:16:11 | 2016-10-21T02:16:11 | 71,249,151 | 1 | 1 | null | 2016-10-18T13:06:30 | 2016-10-18T13:06:29 | null | UTF-8 | C++ | false | false | 4,568 | h | /*****************************************************************/
/* NAME: Michael Benjamin, Henrik Schmidt, and John Leonard */
/* ORGN: Dept of Mechanical Eng / CSAIL, MIT Cambridge MA */
/* FILE: QuadSet.h */
/* DATE: July 4th 2006 */
/* */
/* This file is part of MOOS-IvP */
/* */
/* MOOS-IvP 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. */
/* */
/* MOOS-IvP 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 MOOS-IvP. If not, see */
/* <http://www.gnu.org/licenses/>. */
/*****************************************************************/
#ifndef QUAD_SET_HEADER
#define QUAD_SET_HEADER
#include <vector>
#include <string>
#include "Quad3D.h"
#include "IvPFunction.h"
#include "IvPDomain.h"
#include "FColorMap.h"
class QuadSet
{
public:
QuadSet();
~QuadSet() {}
// Set/Apply Information
bool applyIPF(IvPFunction *ipf, std::string src="");
bool applyIPF1D(IvPFunction *ipf, std::string src);
bool applyIPF2D(IvPFunction *ipf);
void applyColorMap(const FColorMap&);
void applyColorMap(const FColorMap&, double low, double hgh);
void addQuadSet(const QuadSet&);
void normalize(double, double);
// Get Information
bool isEmpty1D() const {return(size1D()==0);}
bool isEmpty2D() const {return(size2D()==0);}
bool isEmptyND() const;
unsigned int getQuadSetDim() const {return(m_quadset_dim);}
Quad3D getQuad(unsigned int i) const {return(m_quads[i]);}
double getMaxVal() const {return(m_maxpt_val);}
double getMinVal() const {return(m_minpt_val);}
double getPriorityWt() const {return(m_ipf_priority_wt);}
IvPDomain getDomain() const {return(m_ivp_domain);}
unsigned int size2D() const {return(m_quads.size());}
unsigned int size1D() const;
unsigned int size1DFs() const {return(m_domain_pts.size());}
double getMaxPoint(std::string) const;
unsigned int getMaxPointQIX(std::string) const;
void print() const;
void resetMinMaxVals();
std::vector<double> getDomainPts(unsigned int=0) const;
std::vector<double> getRangeVals(unsigned int=0) const;
std::vector<bool> getDomainPtsX(unsigned int=0) const;
double getRangeValMax(unsigned int=0) const;
unsigned int getDomainIXMax(unsigned int=0) const;
std::string getSource(unsigned int=0) const;
protected:
std::vector<Quad3D> m_quads;
IvPDomain m_ivp_domain;
double m_ipf_priority_wt;
unsigned int m_quadset_dim;
// Cache Min/Max Utility values (high/low of the function)
double m_maxpt_val;
double m_minpt_val;
// Cache the location of the high/low of the function
double m_max_crs;
double m_max_spd;
// Cache the location of the high/low of the function in units of
// the IvP domain, or quadset index.
double m_max_crs_qix;
double m_max_spd_qix;
// Values of the objecive function can be made to snap to
// intervals. Can be used to alter the rendering.
double m_snap_val;
// Values for representing 1D IPFs
// Each outer index below is for one source, typically:
// [0] Collective [1] Source#1 [2] Source#2 ...
std::vector<std::vector<double> > m_domain_pts;
std::vector<std::vector<bool> > m_domain_ptsx; // true if pt piece edge
std::vector<std::vector<double> > m_range_vals;
std::vector<double> m_range_val_max;
std::vector<unsigned int> m_domain_ix_max;
std::vector<std::string> m_sources;
};
#endif
| [
"msis@mit.edu"
] | msis@mit.edu |
fa43ce4e2092d08b2ae5719a12cc2aba8c17afa5 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/httpd/gumtree/httpd_old_hunk_3218.cpp | 7c56abd951cf80ab1f2dfe61e1dae697bb640348 | [] | 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 | 1,422 | cpp | }
int ssl_stapling_init_cert(server_rec *s, modssl_ctx_t *mctx, X509 *x)
{
certinfo *cinf;
X509 *issuer = NULL;
STACK_OF(STRING) *aia = NULL;
if (x == NULL)
return 0;
cinf = X509_get_ex_data(x, stapling_ex_idx);
if (cinf) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"ssl_stapling_init_cert: certificate already initialized!");
return 0;
}
cinf = OPENSSL_malloc(sizeof(certinfo));
if (!cinf) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"ssl_stapling_init_cert: error allocating memory!");
return 0;
}
cinf->cid = NULL;
cinf->uri = NULL;
X509_set_ex_data(x, stapling_ex_idx, cinf);
issuer = stapling_get_issuer(mctx, x);
if (issuer == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"ssl_stapling_init_cert: Can't retrieve issuer certificate!");
return 0;
}
cinf->cid = OCSP_cert_to_id(NULL, x, issuer);
X509_free(issuer);
if (!cinf->cid)
return 0;
X509_digest(x, EVP_sha1(), cinf->idx, NULL);
aia = X509_get1_ocsp(x);
if (aia)
cinf->uri = sk_STRING_pop(aia);
if (!cinf->uri && !mctx->stapling_force_url) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
"ssl_stapling_init_cert: no responder URL");
}
if (aia)
X509_email_free(aia);
return 1;
}
| [
"993273596@qq.com"
] | 993273596@qq.com |
d4f67bc905bb817a55045bde3500d5e6954f7f9a | 9fd0b6465570129c86f4892e54da27d0e9842f9b | /src/runtime/libc++/test/localization/locales/locale.convenience/classification/iscntrl.pass.cpp | 0bd45ac6bc4a49442c62a551d52a93e9072d6723 | [
"BSL-1.0"
] | permissive | metta-systems/metta | cdbdcda872c5b13ae4047a7ceec6c34fc6184cbf | 170dd91b5653626fb3b9bfab01547612efe531c5 | refs/heads/develop | 2022-04-06T07:25:16.069905 | 2020-02-17T08:22:10 | 2020-02-17T08:22:10 | 6,562,050 | 39 | 11 | BSL-1.0 | 2019-02-22T08:53:20 | 2012-11-06T12:54:03 | C++ | UTF-8 | C++ | false | false | 899 | cpp | //===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <locale>
// template <class charT> bool iscntrl (charT c, const locale& loc);
#include <locale>
#include <cassert>
int main()
{
std::locale l;
assert(!std::iscntrl(' ', l));
assert(!std::iscntrl('<', l));
assert( std::iscntrl('\x8', l));
assert(!std::iscntrl('A', l));
assert(!std::iscntrl('a', l));
assert(!std::iscntrl('z', l));
assert(!std::iscntrl('3', l));
assert(!std::iscntrl('.', l));
assert(!std::iscntrl('f', l));
assert(!std::iscntrl('9', l));
assert(!std::iscntrl('+', l));
}
| [
"berkus@exquance.com"
] | berkus@exquance.com |
ab5ba755a6e073c6996abccb811c132dfca56c83 | b02cc4f2655bbcb9dbb2d6b55ae5014ce3d2b425 | /RotaryEncoder.cpp | bf87d423fba090770fb95760334be39f1c7a6658 | [] | no_license | plskeggs/RotaryEncoder | 020986698a4a2791957f782180498c4646641b45 | 00a3a6972891ff8dce25fb3ce3384f54155e1977 | refs/heads/master | 2020-05-31T16:24:16.241259 | 2012-10-04T04:36:32 | 2012-10-04T04:36:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,812 | cpp | /******************************************************************************
* RotaryEncoder.cpp - Arduino library for reading RotaryEncoder encoders.
* Version 0.90
******************************************************************************/
#include "RotaryEncoder.h"
extern "C" {
#include <inttypes.h>
#include <avr/interrupt.h>
//#include "WConstants.h" //all things wiring / arduino
}
#include "Arduino.h"
const int _quadrature [4][4] = {
{ 0, 0, 0, 0 }, // 00 -> 10 is silent CW
{ 1, 0, 0, 0 }, // 01 -> 00 is CW
{ -1, 0, 0, 0 }, // 10 -> 11 is CW
{ 0, 0, 0, 0 } // 11 -> 01 is silent CW
};
RotaryEncoder * RotaryEncoder::_instance;
RotaryEncoder::RotaryEncoder(int encoderPin1, int encoderPin2, int buttonPin)
: _encoderPin1(encoderPin1), _encoderPin2(encoderPin2), _buttonPin(buttonPin), _position(0), _min(0), _max(0), _usingmin(0), _usingmax(0), _buttonState(0), _buttonPrevious(0), _time(0) // constructor initializer list
{
pinMode(encoderPin1, INPUT);
pinMode(encoderPin2, INPUT);
pinMode(buttonPin, INPUT);
digitalWrite(encoderPin1, HIGH); // activate internal pullups
digitalWrite(encoderPin2, HIGH);
digitalWrite(buttonPin, HIGH);
_previous = _readEncoderPins(); // read initial position
TIMSK2 |= (1 << TOIE2); // enable timer 2 overflow interrupt
_instance = this;
}
inline int RotaryEncoder::_readEncoderPins(void)
{
return digitalRead(_encoderPin2) << 1 | digitalRead(_encoderPin1);
}
inline int RotaryEncoder::_readButtonPin(void)
{
return digitalRead(_buttonPin) == HIGH ? 0 : 1;
}
inline void RotaryEncoder::isr(void)
{
//____________________________________________
// Read Encoder
int quadbits = _instance->_readEncoderPins();
if (quadbits != _instance->_previous)
{
int position = _instance->_position + _quadrature[_instance->_previous][quadbits];
// limit to minimum if assigned
position = _instance->_usingmin ? max(_instance->_min, position) : position;
// limit to maximum if assigned
_instance->_position = _instance->_usingmax ? min(_instance->_max, position) : position;
_instance->_previous = quadbits;
}
//____________________________________________
// Read Button
int reading = _instance->_readButtonPin();
// if we just pressed the button (i.e. the input went from LOW to HIGH),
// and we've waited long enough since the last press to ignore any noise...
if (reading != _instance->_buttonPrevious)// && millis() - _instance->_time > 100)
{
_instance->_buttonState = reading;
// ... and remember when the last button press was
//_instance->_time = millis();
}
_instance->_buttonPrevious = reading;
}
ISR(TIMER2_OVF_vect)
{
RotaryEncoder::isr();
}
| [
"peters@Ganymede.(none)"
] | peters@Ganymede.(none) |
b4b19595f91bad8bee74ac51d00ae39377e54348 | 1d83a78e2223caf62d7ac2db26cb3816e7f31ac4 | /creek/Sink/WinKeySeqBundleSink.cpp | 6f60a3cc888648e3e4b18db31edd76e138448f00 | [] | no_license | EdgeFlow-dev/EdgeFlow | 6833c1a8da7310130cfbee457221ad9f67caadbb | 49e2b32cbeef9795abdd660c04b4a96551478ef5 | refs/heads/master | 2021-05-01T20:07:16.173012 | 2018-02-10T02:00:42 | 2018-02-10T02:00:42 | 120,829,710 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 798 | cpp | //
// Created by xzl on 8/25/17.
//
#define K2_NO_DEBUG 1
#include "WinKeySeqBundleSink.h"
#include "WinKeySeqBundleSinkEval.h"
//void WinKeySeqBundleSink<creek::kvpair>::ExecEvaluator
// (int nodeid, EvaluationBundleContext *c, shared_ptr<BundleBase> bundle_ptr)
//{
// if(this->get_side_info() == SIDE_INFO_JD) {
//#ifdef WORKAROUND_JOIN_JDD
// WinKeySeqBundleSinkEval eval(nodeid); /* construct a normal eval */
//#else
// WinKeySeqBundleSinkEvalJD eval(nodeid); /* side info JD -- the right way. TBD */
//#endif
// eval.evaluate(this, c, bundle_ptr);
// } else {
// xzl_assert(this->get_side_info() == SIDE_INFO_JDD
// || this->get_side_info() == SIDE_INFO_NONE);
// WinKeySeqBundleSinkEval eval(nodeid); /* default side info */
// eval.evaluate(this, c, bundle_ptr);
// }
//}
| [
"hj.bakhi@gmail.com"
] | hj.bakhi@gmail.com |
8d0fd74f2217db640b6ae91c0518c9bc0731ab88 | 7ab8c9a56051e8f7eded0e843c18ec2fa858d476 | /new/src/drobot/device/vestibular/channel/vestibularmagneticfieldchannelfactory.cpp | 2c66d0a9847e41f0a401e953cedd38b80ea98122 | [] | no_license | imanoid/drobot | ee031d0464e01d59604fabb2112dba01805b2722 | e8822555714f45fe5f8288320ccc8bea6f5c5b33 | refs/heads/master | 2020-04-09T07:34:56.942403 | 2013-12-02T13:37:57 | 2013-12-02T13:37:57 | 10,108,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,510 | cpp | #include "vestibularmagneticfieldchannelfactory.h"
#include "vestibularmagneticfieldchannel.h"
#include "../../channel/linearnormalizer.h"
#include <boost/lexical_cast.hpp>
#include "../vestibular.h"
namespace drobot {
namespace device {
namespace vestibular {
namespace channel {
VestibularMagneticFieldChannelFactory::VestibularMagneticFieldChannelFactory() : ChannelFactory("channel:magneticField") {
}
void VestibularMagneticFieldChannelFactory::createFromDomElement(QDomElement element, Device *device) {
std::string name = element.attribute("name", "magneticField").append(QString(".")).append(element.attribute("type").toLower()).toStdString();
device::channel::ChannelType type = device::channel::channelTypeFromString(element.attribute("type").toStdString());
for (int dimension = 0; dimension < 3; dimension++) {
std::stringstream channelName;
channelName << name << "." << dimension;
double min = element.attribute("min", boost::lexical_cast<std::string>(device->toVestibular()->getMagneticFieldMin()[dimension]).c_str()).toDouble();
double max = element.attribute("max", boost::lexical_cast<std::string>(device->toVestibular()->getMagneticFieldMax()[dimension]).c_str()).toDouble();
device->getChannels()->add(new VestibularMagneticFieldChannel(channelName.str(), type, dimension, new device::channel::LinearNormalizer(min, max), device));
}
}
} // namespace channel
} // namespace vestibular
} // namespace device
} // namespace drobot
| [
"imanol.studer@gmail.com"
] | imanol.studer@gmail.com |
b13011622cb1731354cad3ba421a9ce1ed84347e | 1c77a3a504aa67b67b8b01ee7fa311816906472b | /4INFIX.CPP | c342c56e9dce8af1068bb199393c824296758506 | [] | no_license | Ritvik07Mahajan/DS | 26b4d012db628997f18e0283ab0b72e97ea57d3d | 30fe6375f5f7a38133143e28cb321240a5e6d10c | refs/heads/master | 2022-11-22T04:40:33.620483 | 2020-07-26T18:35:00 | 2020-07-26T18:35:00 | 282,710,274 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,550 | cpp | // conversion of infix to postfix expression
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
char opstk[100];
int top=-1;
int arr[100];
int i=0;
void push(char a)
{
top++;
opstk[top]=a;
}
char pop(){
return opstk[top--];
}
int priority(char a)
{
if(a=='$'&& opstk[top]=='$')
return 1;
if(a=='*'&&(opstk[top]=='*'||opstk[top]=='/'||opstk[top]=='$'))
return 1;
//else if(a=='*'&&(opstk[top]=='+'||opstk[top]=='-'))
if(a=='/'&&(opstk[top]=='*'||opstk[top]=='/'||opstk[top]=='$'))
return 1;
//else if(a=='/'&&(opstk[top]=='+'||opstk[top]=='-'))
//push(a);
else if(a=='+'&&(opstk[top]=='*'||opstk[top]=='/'||opstk[top]=='$'||opstk[top]=='+'||opstk[top]=='-'))
return 1;
else if(a=='-'&&(opstk[top]=='*'||opstk[top]=='/'||opstk[top]=='$'||opstk[top]=='+'||opstk[top]=='-'))
return 1;
else return 0;
}
void insert(char a)
{
arr[i]=a;
i++;
}
void show()
{ int j;
for(j=0;j<i;j++)
printf("%s",&arr[j]);
}
void fun(char a[100])
{ int i=0; char s;
while(a[i]!='\0')
{
s=a[i];
if(isalnum(s))
//printf("%c",s);
insert(s);
else if(s=='(')
push(s);
else if(s==')')
{
while(opstk[top]!='(')
{
//printf("%c",pop());
insert(pop());
}
pop();
}
else
{
while(priority(s))
{
// printf("%c",pop());
insert(pop());
}
push(s);
}
i++;
}}
int main()
{ char a[100];
printf("enter the infix expression");
scanf("%s",&a);
fun(a);
while(top>=0)
{
// printf("%c",pop());
insert(pop());
}
show();
return 0;
}
| [
"noreply@github.com"
] | Ritvik07Mahajan.noreply@github.com |
3ce3e2c4f106699940afc0391d2081e225eed983 | 4fc10b326682128ff6a92a927c8ec44d71d08824 | /src/ui/input/drivers/usb-hid/function/two-endpoint-hid-function.cc | 43d9f8cd0cf2cc0ad00880547f5c871417cf4163 | [
"BSD-2-Clause"
] | permissive | dahliaOS/fuchsia-pi4 | f93dc1e0da5ed34018653c72ceab0c50e1d0c1e4 | 5b534fccefd918b5f03205393c1fe5fddf8031d0 | refs/heads/main | 2023-05-01T22:57:08.443538 | 2021-05-20T23:53:40 | 2021-05-20T23:53:40 | 367,988,554 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 9,865 | cc | // Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "two-endpoint-hid-function.h"
#include <assert.h>
#include <lib/ddk/debug.h>
#include <lib/ddk/driver.h>
#include <lib/ddk/metadata.h>
#include <lib/ddk/platform-defs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <zircon/device/usb-peripheral.h>
#include <zircon/process.h>
#include <zircon/syscalls.h>
#include <memory>
#include <fbl/algorithm.h>
#include <usb/usb-request.h>
#include "src/ui/input/drivers/usb-hid/function/two_endpoint_hid-bind.h"
constexpr int BULK_MAX_PACKET = 512;
namespace two_endpoint_hid_function {
static const uint8_t boot_mouse_r_desc[50] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (0x01)
0x29, 0x03, // Usage Maximum (0x03)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,No Null Position)
0x95, 0x01, // Report Count (1)
0x75, 0x05, // Report Size (5)
0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,No Null Position)
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8)
0x95, 0x02, // Report Count (2)
0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,No Null Position)
0xC0, // End Collection
0xC0, // End Collection
};
size_t FakeUsbHidFunction::UsbFunctionInterfaceGetDescriptorsSize(void* ctx) {
FakeUsbHidFunction* func = static_cast<FakeUsbHidFunction*>(ctx);
return func->descriptor_size_;
}
void FakeUsbHidFunction::UsbFunctionInterfaceGetDescriptors(void* ctx,
uint8_t* out_descriptors_buffer,
size_t descriptors_size,
size_t* out_descriptors_actual) {
FakeUsbHidFunction* func = static_cast<FakeUsbHidFunction*>(ctx);
memcpy(out_descriptors_buffer, func->descriptor_.get(),
std::min(descriptors_size, func->descriptor_size_));
*out_descriptors_actual = func->descriptor_size_;
}
zx_status_t FakeUsbHidFunction::UsbFunctionInterfaceControl(
void* ctx, const usb_setup_t* setup, const uint8_t* write_buffer, size_t write_size,
uint8_t* out_read_buffer, size_t read_size, size_t* out_read_actual) {
FakeUsbHidFunction* func = static_cast<FakeUsbHidFunction*>(ctx);
fbl::AutoLock lock(&func->mtx_);
if (setup->bm_request_type == (USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)) {
if (setup->b_request == USB_REQ_GET_DESCRIPTOR) {
memcpy(out_read_buffer, func->report_desc_.data(), func->report_desc_.size());
*out_read_actual = func->report_desc_.size();
return ZX_OK;
}
}
if (setup->bm_request_type == (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) {
if (setup->b_request == USB_HID_GET_REPORT) {
memcpy(out_read_buffer, func->report_.data(), func->report_.size());
*out_read_actual = func->report_.size();
return ZX_OK;
}
if (setup->b_request == USB_HID_GET_PROTOCOL) {
memcpy(out_read_buffer, &func->hid_protocol_, sizeof(func->hid_protocol_));
*out_read_actual = sizeof(func->hid_protocol_);
return ZX_OK;
}
}
if (setup->bm_request_type == (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)) {
if (setup->b_request == USB_HID_SET_REPORT) {
memcpy(func->report_.data(), write_buffer, func->report_.size());
return ZX_OK;
}
if (setup->b_request == USB_HID_SET_PROTOCOL) {
func->hid_protocol_ = static_cast<uint8_t>(setup->w_value);
return ZX_OK;
}
}
return ZX_ERR_IO_REFUSED;
}
zx_status_t FakeUsbHidFunction::UsbFunctionInterfaceSetConfigured(void* ctx, bool configured,
usb_speed_t speed) {
return ZX_OK;
}
zx_status_t FakeUsbHidFunction::UsbFunctionInterfaceSetInterface(void* ctx, uint8_t interface,
uint8_t alt_setting) {
return ZX_OK;
}
int FakeUsbHidFunction::Thread() {
while (1) {
fbl::AutoLock lock(&mtx_);
if (!data_out_req_complete_) {
event_.Wait(&mtx_);
}
if (!active_) {
return 0;
}
data_out_req_complete_ = false;
// Release the lock before queueing, as the callback acquires the lock and is sometimes run in
// the same thread.
lock.release();
usb_request_complete_callback_t complete = {
.callback =
[](void* ctx, usb_request_t* req) {
return static_cast<FakeUsbHidFunction*>(ctx)->UsbEndpointOutCallback(req);
},
.ctx = this,
};
function_.RequestQueue(data_out_req_->request(), &complete);
}
return 0;
}
zx_status_t FakeUsbHidFunction::Bind() {
fbl::AutoLock lock(&mtx_);
report_desc_.resize(sizeof(boot_mouse_r_desc));
memcpy(report_desc_.data(), &boot_mouse_r_desc, sizeof(boot_mouse_r_desc));
report_.resize(3);
descriptor_size_ = sizeof(fake_usb_hid_descriptor_t) + sizeof(usb_hid_descriptor_entry_t);
descriptor_.reset(static_cast<fake_usb_hid_descriptor_t*>(calloc(1, descriptor_size_)));
descriptor_->interface = {
.b_length = sizeof(usb_interface_descriptor_t),
.b_descriptor_type = USB_DT_INTERFACE,
.b_interface_number = 0,
.b_alternate_setting = 0,
.b_num_endpoints = 1,
.b_interface_class = USB_CLASS_HID,
.b_interface_sub_class = USB_HID_SUBCLASS_BOOT,
.b_interface_protocol = USB_HID_PROTOCOL_MOUSE,
.i_interface = 0,
};
descriptor_->interrupt_in = {
.b_length = sizeof(usb_endpoint_descriptor_t),
.b_descriptor_type = USB_DT_ENDPOINT,
.b_endpoint_address = USB_ENDPOINT_IN, // set later
.bm_attributes = USB_ENDPOINT_INTERRUPT,
.w_max_packet_size = htole16(BULK_MAX_PACKET),
.b_interval = 8,
};
descriptor_->interrupt_out = {
.b_length = sizeof(usb_endpoint_descriptor_t),
.b_descriptor_type = USB_DT_ENDPOINT,
.b_endpoint_address = USB_ENDPOINT_OUT, // set later
.bm_attributes = USB_ENDPOINT_INTERRUPT,
.w_max_packet_size = htole16(BULK_MAX_PACKET),
.b_interval = 8,
};
descriptor_->hid_descriptor = {
.bLength = sizeof(usb_hid_descriptor_t) + sizeof(usb_hid_descriptor_entry_t),
.bDescriptorType = USB_DT_HID,
.bcdHID = 0,
.bCountryCode = 0,
.bNumDescriptors = 1,
};
descriptor_->hid_descriptor.descriptors[0] = {
.bDescriptorType = 0x22, // HID TYPE REPORT
.wDescriptorLength = static_cast<uint16_t>(report_desc_.size()),
};
zx_status_t status = function_.AllocInterface(&descriptor_->interface.b_interface_number);
if (status != ZX_OK) {
zxlogf(ERROR, "FakeUsbHidFunction: usb_function_alloc_interface failed");
return status;
}
status = function_.AllocEp(USB_DIR_IN, &descriptor_->interrupt_in.b_endpoint_address);
if (status != ZX_OK) {
zxlogf(ERROR, "FakeUsbHidFunction: usb_function_alloc_ep for endpoint in failed");
return status;
}
status = function_.AllocEp(USB_DIR_OUT, &descriptor_->interrupt_out.b_endpoint_address);
if (status != ZX_OK) {
zxlogf(ERROR, "FakeUsbHidFunction: usb_function_alloc_ep for endpoint out failed");
return status;
}
status = usb::Request<>::Alloc(&data_out_req_, BULK_MAX_PACKET,
descriptor_->interrupt_out.b_endpoint_address,
function_.GetRequestSize());
if (status != ZX_OK) {
return status;
}
active_ = true;
thrd_create(
&thread_, [](void* ctx) { return static_cast<FakeUsbHidFunction*>(ctx)->Thread(); }, this);
status = DdkAdd("usb-hid-function");
if (status != ZX_OK) {
return status;
}
function_.SetInterface(this, &function_interface_ops_);
return ZX_OK;
}
void FakeUsbHidFunction::DdkUnbind(ddk::UnbindTxn txn) {
{
fbl::AutoLock lock(&mtx_);
active_ = false;
event_.Signal();
}
int retval;
thrd_join(thread_, &retval);
txn.Reply();
}
void FakeUsbHidFunction::DdkRelease() { delete this; }
zx_status_t bind(void* ctx, zx_device_t* parent) {
auto dev = std::make_unique<FakeUsbHidFunction>(parent);
zx_status_t status = dev->Bind();
if (status == ZX_OK) {
// devmgr is now in charge of the memory for dev
dev.release();
}
return ZX_OK;
}
void FakeUsbHidFunction::UsbEndpointOutCallback(usb_request_t* request) {
fbl::AutoLock lock(&mtx_);
if (request->response.status == ZX_OK) {
report_.resize(request->response.actual);
size_t result = usb_request_copy_from(request, report_.data(), report_.size(), 0);
ZX_ASSERT(result == request->response.actual);
} else {
zxlogf(ERROR, "request status: %d", request->response.status);
active_ = false;
}
data_out_req_complete_ = true;
event_.Signal();
}
static constexpr zx_driver_ops_t two_endpoint_hid_driver_ops = []() {
zx_driver_ops_t ops = {};
ops.version = DRIVER_OPS_VERSION;
ops.bind = bind;
return ops;
}();
} // namespace two_endpoint_hid_function
ZIRCON_DRIVER(two_endpoint_hid_function, two_endpoint_hid_function::two_endpoint_hid_driver_ops,
"zircon", "0.1");
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
4832d2ddb1b470a97881c544790276f0dbec50a1 | 0613f729dbd955075eae473908e27a2d564af393 | /EPALIN(z-algo).cpp | 25586f7ebddb8dc8bd1bdc4a6c057aca00928999 | [] | no_license | Masud-Parves/SPOJ-Solutions | f38adb6ccc4b46438240e289eedd8f85b4e21274 | 64c6e2f3813a42ffcb1a6ea3b5c5e9307812125d | refs/heads/master | 2022-05-10T06:33:18.948776 | 2022-05-08T04:44:26 | 2022-05-08T04:44:26 | 159,447,037 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,462 | cpp | #include<bits/stdc++.h>
using namespace std;
/*
Bismillahir Rahmanir Rahim
SPOJ EPALIN - Extend to Palindrome
Problem Link :
Topics : Z- Algorithm
Solver : Masud Parves
I Love Code More than Sharks Love Blood <3
*/
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define sf(a) scanf("%d",&a)
#define sff(a,b) scanf("%d%d",&a,&b)
#define sfff(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define SIZE 200005
#define TEST_CASE(t) for(int z=1 ; z<=t ; z++)
#define PRINT_CASE printf("Case %d: ",z)
#define NOT_VISITED 0
#define IS_VISITED 1
int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;
int z[SIZE];
int z_function(string s, int x)
{
memset(z, 0, sizeof z);
int n = (int) s.length(),maxNum=0;
z[0] = 0;
for (int i = 1, l = 0, r = 0; i < n; ++i)
{
if (i <= r)
z[i] = min (r - i + 1, z[i - l]);
else
z[i] = 0;
while (i + z[i] < n && s[z[i]] == s[i + z[i]])
++z[i];
if (i + z[i] - 1 > r)
l = i, r = i + z[i] - 1;
}
vector< int > store;
for(int i=x+1; i<n ; i++)
{
if(z[i]+i==n)
{
store.pb(z[i]);
}
}
int re=0;
for(int i=0 ; i<store.size() ; i++)
{
re=max(re,store[i]);
}
return re;
}
string palindromeFinder(string s)
{
string orginal=s;
string rev=string(s.rbegin(), s.rend());
int n = (int) s.length();
int number=orginal.length()-z_function(rev + "#" +orginal,n);
for(int i=number-1 ; i>=0 ; i--)
{
orginal.append(1,orginal[i]);
}
return orginal;
}
int main()
{
CIN
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
string s;
while(cin>>s)
{
cout<<palindromeFinder(s)<<endl;
}
return 0;
} | [
"pervej.cse1011@gmail.com"
] | pervej.cse1011@gmail.com |
e10532ad2428c1a6c4e9786849817c3f7ba137d0 | e781b0e159e237b6c9c5e7cf3901a53b76daf071 | /GameControl.cpp | 993957984cc0b4c0beeb1a557dc16f8e019239e0 | [] | no_license | BoffinZhang/Gomoku_AI | f78e303348011353ccc6ec5542e145efa4b78639 | b9666605278db05b5a206d19880dd3c4c2e01d7e | refs/heads/master | 2022-10-10T12:38:01.345843 | 2020-06-09T07:25:27 | 2020-06-09T07:25:27 | 270,932,336 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,966 | cpp | #include "GameControl.h"
// 游戏主循环
void GameControl::mainloop()
{
// 对局设定:
// 1. 人机模式or人人模式or机机对战模式
// 2. 玩家先手or玩家后手
int game_mode;
int is_human_first;
Player *player1, *player2;
cout << "选择游戏模式:人机对弈-0,人人对弈-1,机机对弈" << endl;
cin >> game_mode;
if (game_mode == 3) {
player1 = new AIPlayer(black_chess, board);
player2 = new AIPlayer(white_chess, board);
}
else {
cout << "选择先手:人类先手-0,AI先手-1" << endl;
cin >> is_human_first;
is_human_first = 1 - is_human_first;
if (game_mode == 1) {
cout << "人人模式尚在开发中" << endl;
return;
}
// 人机模式初始化
if (is_human_first) {
player1 = new HumanPlayer(black_chess, board);
player2 = new AIPlayer(white_chess, board);
}
else {
player1 = new AIPlayer(black_chess, board);
player2 = new HumanPlayer(white_chess, board);
}
}
// 游戏状态
// 1为玩家1回合,2为玩家2回合
int game_state = 1;
board_display();
while (game_state >= 0) {
// 玩家1回合
if (game_state == 1) {
Pos p = player1->get_position();
last_pos = p;
if (steps.empty()) {
steps.push_back(Step(1, 1, p));
}
else {
steps.push_back(Step(1, steps.back().hand + 1, p));
}
if (p.r < 0 && p.c < 0) {
// 悔棋
backward();
continue;
}
board_display();
int result = win_detect(p);
if (result == 1) {
cout << "玩家1胜利!!" << endl << "Game Over" << endl;
game_state = -1;
}
else if (result == 2) {
cout << "玩家2胜利!!" << endl << "Game Over" << endl;
game_state = -2;
}
else {
// 切换回玩家2
game_state = 2;
continue;
}
}
// 玩家2回合
if (game_state == 2) {
Pos p = player2->get_position();
last_pos = p;
if (p.r < 0 && p.c < 0) {
// 悔棋
backward();
continue;
}
if (steps.empty()) {
steps.push_back(Step(1, 1, p));
}
else {
steps.push_back(Step(1, steps.back().hand + 1, p));
}
board_display();
int result = win_detect(p);
if (result == 1) {
cout << "玩家1胜利" << endl;
game_state = -1;
}
else if (result == 2) {
cout << "玩家2胜利" << endl;
game_state = -2;
}
// 切换回玩家1
else game_state = 1;
continue;
}
}
save_steps();
system("pause");
}
// 棋盘显示
void GameControl::board_display()
{
/**********特殊符号**********
┏┳┓
┣╋┫
┗┻┛
○●☆★
****************************/
system("cls");
// 打印第一行
cout << " ";
for (int i = 0; i < BOARDSIZE; i++) {
cout << char('A' + i) << " ";
}
cout << endl;
for (int i = 0; i < BOARDSIZE; i++) {
for (int j = 0; j < BOARDSIZE; j++) {
if (j == 0) {
printf("%*d", 3, 13 - i);
// printf("%*d", 3, i+1);
}
if (board[i][j]>0) {
if (i == last_pos.r && j == last_pos.c && board[i][j] == black_chess) cout << "☆";
else if (i == last_pos.r && j == last_pos.c && board[i][j] == white_chess) cout << "★";
else if (board[i][j] == black_chess) cout << "○";
else if (board[i][j] == white_chess) cout << "●";
if (j == BOARDSIZE - 1)cout << endl;
}
else {
if (i == 0 && j == 0) cout << "┏-";
else if (i == 0 && j == BOARDSIZE - 1) cout << "┓" << endl;
else if (i == 0) cout << "┳-";
else if (i == BOARDSIZE - 1 && j == 0) cout << "┗-";
else if (i == BOARDSIZE - 1 && j == BOARDSIZE - 1) cout << "┛" << endl;
else if (j == 0) cout << "┣-";
else if (i == BOARDSIZE - 1) cout << "┻-";
else if (j == BOARDSIZE - 1) cout << "┫" << endl;
else cout << "╋-";
}
}
}
// 为了方便,打印AI的最后一步
if (!steps.empty()) {
Pos p = steps.back().p;
cout << "最后一步" << pos_transform(p) << endl;
}
}
// 五连检测
bool GameControl::five_con(Pos p0, Pos dir) {
Pos p1 = p0 + dir;
Pos p2 = p1 + dir;
Pos p3 = p2 + dir;
Pos p4 = p3 + dir;
if (is_in(p0) && is_in(p1) && is_in(p2) && is_in(p3) && is_in(p4) &&
board[p1.r][p1.c] == board[p0.r][p0.c] && board[p2.r][p2.c] == board[p0.r][p0.c] &&
board[p3.r][p3.c] == board[p0.r][p0.c] && board[p4.r][p4.c] == board[p0.r][p0.c]) {
return true;
}
return false;
}
// 六连检测
bool GameControl::six_con(Pos p0, Pos dir) {
Pos p1 = p0 + dir;
Pos p2 = p1 + dir;
Pos p3 = p2 + dir;
Pos p4 = p3 + dir;
Pos p5 = p4 + dir;
if (is_in(p0) && is_in(p1) && is_in(p2) && is_in(p3) && is_in(p4) && is_in(p5) &&
board[p1.r][p1.c] == board[p0.r][p0.c] && board[p2.r][p2.c] == board[p0.r][p0.c] &&
board[p3.r][p3.c] == board[p0.r][p0.c] && board[p4.r][p4.c] == board[p0.r][p0.c] &&
board[p5.r][p5.c] == board[p0.r][p0.c])
{
return true;
}
return false;
}
// 返回与棋子相连的、某个方向上的边缘棋子
Pos GameControl::find_edge(Pos p0, Pos dir) {
Pos p1 = p0 + dir;
while (is_in(p1) && board[p1.r][p1.c] == board[p0.r][p0.c]) {
p0 = p1;
p1 = p1 + dir;
}
return p0;
}
// 胜利检测
int GameControl::win_detect(Pos p)
{
// 从p开始的检测五连
char chess = board[p.r][p.c];
// 找到最左、上、左上、左下端
Pos p_left = find_edge(p, Pos(0, -1));
Pos p_up = find_edge(p, Pos(-1, 0));
Pos p_upleft = find_edge(p, Pos(-1, -1));
Pos p_downleft = find_edge(p, Pos(1, -1));
// p位置的棋子胜利标志
bool win_flag = five_con(p_left, Pos(0, 1)) || five_con(p_up, Pos(1, 0)) ||
five_con(p_upleft, Pos(1, 1)) || five_con(p_downleft, Pos(-1, 1));
if (chess == this->black_chess) {
// 如果玩家1胜利,返回1
if (win_flag) return 1;
}
else {
// 如果玩家2胜利,返回2
if (win_flag) return 2;
}
return 0;
}
// 悔棋
// 因为只有在玩家回合时才能悔棋,所以要撤销两步操作
void GameControl::backward()
{
Pos pos1 = steps.back().p;
steps.pop_back();
Pos pos2 = steps.back().p;
steps.pop_back();
board[pos1.r][pos1.c] = 0;
board[pos2.r][pos2.c] = 0;
}
// 前进
// 撤销悔棋
void GameControl::forward() {
}
string GameControl::save_steps()
{
time_t t = time(0);
char ch[64];
strftime(ch, sizeof(ch), "%Y-%m-%d %H-%M-%S", localtime(&t)); //年-月-日 时-分-秒
cout << ch << endl;
ofstream location_out;
string ss(ch);
ss = "record/" + ss;
ss += ".txt";
location_out.open(ss, std::ios::out | std::ios::app); //以写入和在文件末尾添加的方式打开.txt文件,没有的话就创建该文件。
if (!location_out.is_open())
return 0;
for (int i = 0; i < steps.size(); i++) {
location_out << pos_transform(steps[i].p);
}
cout << "棋谱保存为" << ss << endl;
return string();
}
| [
"noreply@github.com"
] | BoffinZhang.noreply@github.com |
cc173b8f48c5ae75dd8956a6c475a94e886a2363 | 234efff5291e2ab5e87ef71eb8ad80ec3b1854a2 | /TestingHexThrombus/processor13/0.0025/s | fea12d543db3e3364aca53f2dab3f2b3ebf9d90c | [] | no_license | tomwpeach/thrombus-code | 5c6f86f0436177d9bbacae70d43f645d70be1a97 | 8cd3182c333452543f3feaecde08282bebdc00ed | refs/heads/master | 2021-05-01T12:25:22.036621 | 2018-04-10T21:45:28 | 2018-04-10T21:45:28 | 121,060,409 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,615 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.0025";
object s;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0.75;
boundaryField
{
INLET
{
type fixedValue;
value nonuniform 0();
}
OUTLET
{
type zeroGradient;
}
WALL
{
type fixedValue;
value uniform 0.75;
}
PATCH
{
type fixedValue;
value nonuniform 0();
}
procBoundary13to9
{
type processor;
value uniform 0.75;
}
procBoundary13to12
{
type processor;
value uniform 0.75;
}
procBoundary13to15
{
type processor;
value uniform 0.75;
}
}
// ************************************************************************* //
| [
"tom@tom-VirtualBox.(none)"
] | tom@tom-VirtualBox.(none) | |
086e9e17557d8ae16b72d39c50ea83480cd92ac3 | c2fc4673b511b347b47158be96e6bf1f01e3f167 | /extras/jbcoin-libpp/extras/jbcoind/src/test/rpc/OwnerInfo_test.cpp | 413bc5141e1b190a267b0c7d318141e3426a9830 | [
"MIT-Wu",
"MIT",
"ISC",
"BSL-1.0"
] | permissive | trongnmchainos/validator-keys-tool | 037c7d69149cc9581ddfca3dc93892ebc1e031f1 | cae131d6ab46051c0f47509b79b6efc47a70eec0 | refs/heads/master | 2020-04-07T19:42:10.838318 | 2018-11-22T07:33:26 | 2018-11-22T07:33:26 | 158,658,994 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,747 | cpp | //------------------------------------------------------------------------------
/*
This file is part of jbcoind: https://github.com/jbcoin/jbcoind
Copyright (c) 2017 Jbcoin Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <test/jtx.h>
#include <jbcoin/beast/unit_test.h>
#include <jbcoin/protocol/AccountID.h>
#include <jbcoin/protocol/JsonFields.h>
#include <jbcoin/protocol/STAmount.h>
namespace jbcoin {
class OwnerInfo_test : public beast::unit_test::suite
{
void
testBadInput ()
{
testcase ("Bad input to owner_info");
using namespace test::jtx;
Env env {*this};
auto const alice = Account {"alice"};
env.fund (XRP(10000), alice);
env.close ();
{ // missing account field
auto const result =
env.rpc ("json", "owner_info", "{}") [jss::result];
BEAST_EXPECT (result[jss::error] == "invalidParams");
BEAST_EXPECT (result[jss::error_message] ==
"Missing field 'account'.");
}
{ // ask for empty account
Json::Value params;
params[jss::account] = "";
auto const result = env.rpc ("json", "owner_info",
to_string(params)) [jss::result];
if (BEAST_EXPECT (
result.isMember(jss::accepted) &&
result.isMember(jss::current)))
{
BEAST_EXPECT (result[jss::accepted][jss::error] == "badSeed");
BEAST_EXPECT (result[jss::accepted][jss::error_message] ==
"Disallowed seed.");
BEAST_EXPECT (result[jss::current][jss::error] == "badSeed");
BEAST_EXPECT (result[jss::current][jss::error_message] ==
"Disallowed seed.");
}
}
{ // ask for nonexistent account
// this seems like it should be an error, but current impl
// (deprecated) does not return an error, just empty fields.
Json::Value params;
params[jss::account] = Account{"bob"}.human();
auto const result = env.rpc ("json", "owner_info",
to_string(params)) [jss::result];
BEAST_EXPECT (result[jss::accepted] == Json::objectValue);
BEAST_EXPECT (result[jss::current] == Json::objectValue);
BEAST_EXPECT (result[jss::status] == "success");
}
}
void
testBasic ()
{
testcase ("Basic request for owner_info");
using namespace test::jtx;
Env env {*this};
auto const alice = Account {"alice"};
auto const gw = Account {"gateway"};
env.fund (XRP(10000), alice, gw);
auto const USD = gw["USD"];
auto const CNY = gw["CNY"];
env(trust(alice, USD(1000)));
env(trust(alice, CNY(1000)));
env(offer(alice, USD(1), XRP(1000)));
env.close();
env(pay(gw, alice, USD(50)));
env(pay(gw, alice, CNY(50)));
env(offer(alice, CNY(2), XRP(1000)));
Json::Value params;
params[jss::account] = alice.human();
auto const result = env.rpc ("json", "owner_info",
to_string(params)) [jss::result];
if (! BEAST_EXPECT (
result.isMember(jss::accepted) &&
result.isMember(jss::current)))
{
return;
}
// accepted ledger entry
if (! BEAST_EXPECT (result[jss::accepted].isMember(jss::jbcoin_lines)))
return;
auto lines = result[jss::accepted][jss::jbcoin_lines];
if (! BEAST_EXPECT (lines.isArray() && lines.size() == 2))
return;
BEAST_EXPECT (
lines[0u][sfBalance.fieldName] ==
(STAmount{Issue{to_currency("CNY"), noAccount()}, 0}
.value().getJson(0)));
BEAST_EXPECT (
lines[0u][sfHighLimit.fieldName] ==
alice["CNY"](1000).value().getJson(0));
BEAST_EXPECT (
lines[0u][sfLowLimit.fieldName] ==
gw["CNY"](0).value().getJson(0));
BEAST_EXPECT (
lines[1u][sfBalance.fieldName] ==
(STAmount{Issue{to_currency("USD"), noAccount()}, 0}
.value().getJson(0)));
BEAST_EXPECT (
lines[1u][sfHighLimit.fieldName] ==
alice["USD"](1000).value().getJson(0));
BEAST_EXPECT (
lines[1u][sfLowLimit.fieldName] ==
USD(0).value().getJson(0));
if (! BEAST_EXPECT (result[jss::accepted].isMember(jss::offers)))
return;
auto offers = result[jss::accepted][jss::offers];
if (! BEAST_EXPECT (offers.isArray() && offers.size() == 1))
return;
BEAST_EXPECT (
offers[0u][jss::Account] == alice.human());
BEAST_EXPECT (
offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(0));
BEAST_EXPECT (
offers[0u][sfTakerPays.fieldName] == USD(1).value().getJson(0));
// current ledger entry
if (! BEAST_EXPECT (result[jss::current].isMember(jss::jbcoin_lines)))
return;
lines = result[jss::current][jss::jbcoin_lines];
if (! BEAST_EXPECT (lines.isArray() && lines.size() == 2))
return;
BEAST_EXPECT (
lines[0u][sfBalance.fieldName] ==
(STAmount{Issue{to_currency("CNY"), noAccount()}, -50}
.value().getJson(0)));
BEAST_EXPECT (
lines[0u][sfHighLimit.fieldName] ==
alice["CNY"](1000).value().getJson(0));
BEAST_EXPECT (
lines[0u][sfLowLimit.fieldName] ==
gw["CNY"](0).value().getJson(0));
BEAST_EXPECT (
lines[1u][sfBalance.fieldName] ==
(STAmount{Issue{to_currency("USD"), noAccount()}, -50}
.value().getJson(0)));
BEAST_EXPECT (
lines[1u][sfHighLimit.fieldName] ==
alice["USD"](1000).value().getJson(0));
BEAST_EXPECT (
lines[1u][sfLowLimit.fieldName] ==
gw["USD"](0).value().getJson(0));
if (! BEAST_EXPECT (result[jss::current].isMember(jss::offers)))
return;
offers = result[jss::current][jss::offers];
// 1 additional offer in current, (2 total)
if (! BEAST_EXPECT (offers.isArray() && offers.size() == 2))
return;
BEAST_EXPECT (
offers[1u] == result[jss::accepted][jss::offers][0u]);
BEAST_EXPECT (
offers[0u][jss::Account] == alice.human());
BEAST_EXPECT (
offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(0));
BEAST_EXPECT (
offers[0u][sfTakerPays.fieldName] == CNY(2).value().getJson(0));
}
public:
void run ()
{
testBadInput ();
testBasic ();
}
};
BEAST_DEFINE_TESTSUITE(OwnerInfo,app,jbcoin);
} // jbcoin
| [
"trongnm@chainos.vn"
] | trongnm@chainos.vn |
89f589d5ba95f1a1ae06025cd636ac86f7f998df | 2d6f4d27707c9f2b42dee909a95f5f0ba35852d0 | /arduino_run_main_wo_calibration/ir_read_fuc.ino | 7a8ab2ed12e00cf13ba9f0736126f09bbf29938a | [] | no_license | taeyoulee/taeyoulee_arduino | 76c5fa982ac23cd4f0731e04ad883f6a3a8b91d7 | 858b95c0d6f70c0ec2e9462c61031b5da900ddca | refs/heads/master | 2021-01-18T14:13:52.664161 | 2015-04-01T08:58:27 | 2015-04-01T08:58:27 | 32,367,047 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,333 | ino | #include <Motors.h>
#include "DualVNH5019MotorShield.h"
#include "SingleWheelEncoders.h"
#include "PID_v1.h"
#include "PinChangeInt.h"
#include <cstring.h>
#include <Servo.h> // Include Servo library
Servo myservo; // create servo object to control a servo
int pos=0; // variable to store the servo position
int URPWM=3; // PWM Output 0-25000us,every 50us represent 1cm
int URTRIG=5; // PWM trigger pin
boolean up=true; // create a boolean variable
unsigned long time; // create a time variable
unsigned long urmTimer = 0; // timer for managing the sensor reading flash rate
unsigned int Distance=0;
uint8_t EnPwmCmd[4]={0x44,0x22,0xbb,0x01}; // distance measure command
const char LEFT_SENSOR = 2;//2
const char MID_SENSOR = 1;
const char RIGHT_SENSOR = 0;//0
const char LEFTSIDE_SENSOR = 3;
const char RIGHTSIDE_SENSOR = 4;//0
const double P_FAST = 0.01;
const double I_FAST = 0.045;
double adjustment;
Motors motors;
SingleWheelEncoders swe;
const int NUM_SENSOR_READINGS = 5;
String content=""; //read serial input
char character; //store the serial input one by one
char done=true;
void setup() {
Serial.begin(115200);
//Serial.println("Dual VNH5019 Motor Shield");
motors.init(13,11);
myservo.attach(9); // Pin 9 to control servo
}
void loop() {
int distLeft = readLeftIR()/10;
if(distLeft>9)
{
distLeft=-1;
}
int distMid = readMidIR()/10;
if(distMid>9)
{
distMid=-1;
}
int distRight = readRightIR()/10;
if(distRight>9)
{
distRight=-1;
}
int distRightSide = readRightSideIR()/10;
if(distRightSide>9)
{
distRightSide=-1;
}
int distLeftSide = readLeftSideIR()/10;
if(distLeftSide>9)
{
distLeftSide=-1;
}
if(done==true)
{
Serial.print(distLeft);
Serial.print(",");
Serial.print(distMid);
Serial.print(",");
Serial.print(distRight);
Serial.print(",");
Serial.print(distLeftSide);
Serial.print(",");
Serial.print(distRightSide);
Serial.print(",");
Serial.println();
Serial.flush();
done=false;
}
else
{
delay(10);
}
while(Serial.available()) {
character = Serial.read();
if (character == '/'){
break;
}
else if (character >= 48 && character <= 122){ //ascii 0-z
content.concat(character);
}
delay(30);
}
if (content.length() >=4) {
int blocks;
switch (content[0]) {
case 'f':
case 'F': //forward
blocks = content.substring(1,3).toInt();
motors.moveForward(blocks);
done=true;
Serial.println("OK");
break;
case 'l':
case 'L': //turn left
if (content.charAt(3) == '1'){
motors.turnLeftFast();
done=true;
Serial.println("OK");
}
else{
motors.turnLeft();
done=true;
Serial.println("OK");
}
break;
case 'r':
case 'R': //turn right
if (content.charAt(3) == '1'){
motors.turnRightFast();
done=true;
Serial.println("OK");
}else{
motors.turnRight();
done=true;
Serial.println("OK");
}
break;
case 'b':
case 'B':
blocks = content.substring(1,3).toInt();
motors.moveBackward(blocks);
done=true;
Serial.println("OK");
break;
// case 'a':
// case 'A':
// adjustCorner();
// break;
break;
default:
break;
}
if (content.charAt(3) == '1'){
Serial.println("SP");
}
else {
//readSensor();
}
content = "";
Serial.flush();
}
}
//Method to read various sensor, each read is about 39ms
//which will take 390ms, will investigate further to lower this delay
float readLeftIR() {
int adcValue = readSensor(LEFT_SENSOR);
//error condition or undetectable range
if(adcValue == -1)
return -1;
//return ((-2.0718*pow(10,-6)*pow(adcValue,3))+(0.00226234*pow(adcValue,2))-(0.808266*adcValue)+114.864);
//return(12343.85 * pow(adcValue,-1.15));
return (pow(3027.4 / adcValue, 1.2134));
//return (10106*pow(adcValue, -1.12))-5.7;//dist;//left
}
int readMidIR() {
int adcValue = readSensor(MID_SENSOR);
//error condition or undetectable range
if(adcValue == -1)
return -1;
//return 9462/(adcValue - 16.92);
//return ((-2.0718*pow(10,-6)*pow(adcValue,3))+(0.00226234*pow(adcValue,2))-(0.808266*adcValue)+114.864);
//return(12343.85 * pow(adcValue,-1.15));
return (pow(3027.4 / adcValue, 1.2134));
//return (10106*pow(adcValue, -1.12));//56
}
int readRightSideIR() {
int adcValue = readSensor(RIGHTSIDE_SENSOR);
//error condition or undetectable range
if(adcValue == -1)
return -1;
//return ((-2.0718*pow(10,-6)*pow(adcValue,3))+(0.00226234*pow(adcValue,2))-(0.808266*adcValue)+114.864);
//return(12343.85 * pow(adcValue,-1.15));
return (pow(3027.4 / adcValue, 1.2134));
//return (10106*pow(adcValue, -1.12));//56
}
int readLeftSideIR() {
int adcValue = readSensor(LEFTSIDE_SENSOR);
//error condition or undetectable range
if(adcValue == -1)
return -1;
//return ((-2.0718*pow(10,-6)*pow(adcValue,3))+(0.00226234*pow(adcValue,2))-(0.808266*adcValue)+114.864);
//return(12343.85 * pow(adcValue,-1.15));
return (pow(3027.4 / adcValue, 1.2134));
//return (10106*pow(adcValue, -1.12));//56
}
int readRightIR() {
int adcValue = readSensor(RIGHT_SENSOR);
//error condition or undetectable range
if(adcValue == -1)
return -1;
//return ((-2.0718*pow(10,-6)*pow(adcValue,3))+(0.00226234*pow(adcValue,2))-(0.808266*adcValue)+114.864);
//return(12343.85 * pow(adcValue,-1.15));
return (pow(3027.4 / adcValue, 1.2134));
//return (10106*pow(adcValue, -1.12));
//return 1/((0.0003*adcValue) - 0.0236);
}
int readSensor(char sensorPin) {
char i;
long sensorReadings = 0;
int adcValues[10];
for(i=0; i<10; i++) {
sensorReadings = analogRead(sensorPin);
adcValues[i] = sensorReadings;//analogRead(sensorPin);
delay(35);
}
return filterNoise(adcValues);
}
int filterNoise(int adcValues[10]) {
//apply bubblesort and then take the median value
int c, d, swap, _average = 4, _threshold = 3, i, _size = 10;
int sum = 0;
for (c = 0 ; c < (_size - 1); c++) {
for (d = 0 ; d < _size - c - 1; d++) {
if (adcValues[d] > adcValues[d+1]) {
swap = adcValues[d];
adcValues[d] = adcValues[d+1];
adcValues[d+1] = swap;
}
}
}
for(i=_threshold; i<_size-_threshold; i++) {
sum += adcValues[i];
//Serial.println(adcValues[i]);
}
return sum/_average;
}
| [
"taeyoulee@gmail.com"
] | taeyoulee@gmail.com |
e702d49c2042d2ee9e7c98ebc628675c4000c948 | 08cf73a95743dc3036af0f31a00c7786a030d7c0 | /Editor source/OtE/Edgewalker/Terrain/TiledTerrain.h | 443930a2367f0b6c8eaeef8ba1666a4310180cdc | [
"MIT"
] | permissive | errantti/ontheedge-editor | a0779777492b47f4425d6155e831df549f83d4c9 | 678d2886d068351d7fdd68927b272e75da687484 | refs/heads/main | 2023-03-04T02:52:36.538407 | 2021-01-23T19:42:22 | 2021-01-23T19:42:22 | 332,293,357 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 6,966 | h | // On the Edge Editor
//
// Copyright © 2004-2021 Jukka Tykkyläinen
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __CTILEDTERRAIN_H__
#define __CTILEDTERRAIN_H__
#include "TileQuadTreeNode.h"
class CTiledTerrain : public CTileQuadTreeNode
{
public:
CTiledTerrain(ISceneNode *parent, ISceneManager *manager, DWORD id = -1);
virtual ~CTiledTerrain();
virtual void OnPreRender(bool isShadowPass);
virtual void Render(bool isShadowPass);
virtual void Update(float frameTime) {}
// Create
// Creates a tiled terrain object from input
// /param tiles - tiles of the map as a STile-array
bool Create(STile *tiles, POINT dimensions);
vector<CTile*> *GetTileArray() {return &m_tiles;}
void Release();
inline CTile *GetTile(unsigned int x, unsigned int y);
CTile *GetTileByIndex(int x, int y);
CTile *GetTile(float x, float z);
/**
* Iterates through the given tile and all eight tiles
* surrounding it and changes their type and rotation
* to fit together
* /param randomize - if true then instead of choosing
* the first tile that fits the requirements the
* algorithm goes through all fitting tiles and chooses
* one of the at random resulting in more varied but
* still valid ground formations
*/
void TrimTiles(CTile *center, bool randomize = false);
STile *GetTileInfoArray(POINT &dimensions);
POINT GetMapSize() {return m_size;}
inline float GetWidth() {return m_width;}
inline float GetDepth() {return m_depth;}
bool GetMapLoaded() {return m_bMapLoaded;}
virtual void CheckForCollision(IGeometricObject *object, vector<SCollision> &collisions);
virtual void CheckCollisionsQuadtree(IGeometricObject *object, vector<SCollision> &collisions);
virtual void CheckCollisionsSimple(IGeometricObject *object, vector<SCollision> &collisions);
/**
* Checks whether given objects collides with terrain and reports
* the collision to the object. Doesn't calculate collision vector
* or send collision notification to physics engine
*/
void CheckIfCollides(IGeometricObject *object);
float GetTerrainHeight(float x, float z);
CTile *GetTileByRay(D3DXVECTOR3 &pos, D3DXVECTOR3 &dir);
bool GetRayIntersectLocation(D3DXVECTOR3 &pos, D3DXVECTOR3 &dir, D3DXVECTOR3 &outIntersection);
/**
* Finds the shortest path from location start to location target. If the path doesn't exist or it is longer
* than the maximum length specified by maxPathLength the method fails. If this happens then if acceptIncomplete
* is true, outPath is set to include the path that comes closest to the target location. Otherwise outPath
* will include the complete path from start to target. The path is also optimized to remove waypoints which are
* in line and thus useless or even performance hogs.
* The algorithm used is A* which uses the m_terrainNodes vector which is pregenerated when the tile map is
* loaded. Thus dynamic tree generation is not required which makes the algorithm rather efficient.
*/
bool FindPath(D3DXVECTOR3 start, D3DXVECTOR3 target, bool acceptIncomplete, vector<D3DXVECTOR3> &outPath, int iterationLimit = 50);
/**
* Finds out whether the way between locations start and target is clear of terrain obstacles or drops and can be
* walked safely. This is not a path find method, this simply checks the straight line between the two given points.
*
* source - coordinates of the start location
* target - coordinates of the target location
* outIsPit - if the method fails, this value is set to true if the reason was a pit on the
* way and false if it was a wall
* outLastGoodTile - if the method fails, this is coordinates to the last 'good' location (the last tile before wall or pit)
*/
bool IsWayClear(D3DXVECTOR3 start, D3DXVECTOR3 target, bool &outIsPit, D3DXVECTOR3 &outLastGoodTile);
protected:
struct STerrainPointNode
{
// static terrain variables
union {
struct {
int north,
south,
east,
west;
int northeast,
northwest,
southwest,
southeast;
};
int neighbors[8];
};
int height;
int x,z;
// variables to be used by the route finding algorithm
int pathFindIndex; // an ascending number which is set when this node is used. One path index per path search
float pathCost; // Cost of the shortest path to this node
float costEstimate; // Estimation of the remaining path length
int prevIndex; // Index of the previous node in the current path
bool bRamp; // Tells whether this node is a ramp node
void FillDefaults()
{
north = south = east = west = -1;
northeast = northwest = southeast = southwest = -1;
height = 0;
pathCost = 10000;
pathFindIndex = -1;
prevIndex = -1;
costEstimate = 0;
bRamp = false;
}
};
struct SNodeIndex
{
int index;
float cost;
SNodeIndex() : index(-1), cost(10000) {}
SNodeIndex(int index, float cost) : cost(cost), index(index) {}
bool operator<( const SNodeIndex &a ) const {
return cost > a.cost;
}
};
void CheckVCTile(int x, int y);
void CheckVCTile(int i);
void TrimTile(CTile *tile, bool randomize);
void ConstructNodeTable(POINT dimensions);
bool CheckAccessFromTile(int x1, int y1, int x2, int y2);
bool IsTileHigherThanOrRamp(int height, int x, int y);
bool GetTileCoordAt(float x, float z, int &outx, int &outz);
D3DXVECTOR3 GetCenterOfTile(int x, int z, float defaultY = -10000.f);
D3DXVECTOR3 GetCenterOfTile(int index, float defaultY = -10000.f);
bool FillNode(STerrainPointNode &node, int targetX, int targetZ, float parentCost, float costAdd, int prevIndex);
CTileManager *m_tileMgr;
// Array containing all the tiles of the map in
// a centered storage
vector<CTile*> m_tiles;
vector<STerrainPointNode> m_terrainNodes;
bool m_bNodeTableGenerated;
int m_lastPathSearchIndex;
float m_width, m_depth;
// Size of the tile map (in tiles)
POINT m_size;
bool m_bMapLoaded;
};
#endif // #ifndef __CTILEDTERRAIN_H__
| [
"jukka.tykkylainen@gmail.com"
] | jukka.tykkylainen@gmail.com |
8464040960b737f5d400c47e53cf5f1fcd1ea181 | c93cf31d7c358fa15f447da0144448e61078470c | /src/bookmarksmodel.h | e6fa591e755abe01d97c66ce9c03e56d47ee6612 | [
"MIT"
] | permissive | drgogeta86/LinksBag | 75165e0d2d2404568bea30b941ce863fa406a54b | d72372d28ec5a5636396d83976dac9582cffa6ab | refs/heads/master | 2021-01-18T04:59:25.775586 | 2015-01-16T12:18:42 | 2015-01-16T12:18:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,245 | h | #pragma once
#include <QAbstractListModel>
#include "bookmark.h"
namespace LinksBag
{
class BookmarksModel : public QAbstractListModel
{
Q_OBJECT
Bookmarks_t Bookmarks_;
public:
enum BookmarkRoles
{
BRID = Qt::UserRole + 1,
BRUrl,
BRTitle,
BRDescription,
BRImageUrl,
BRFavorite,
BRRead,
BRTags,
BRAddTime,
BRUpdateTime,
BRStatus
};
explicit BookmarksModel (QObject *parent = 0);
virtual ~BookmarksModel ();
virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
virtual int rowCount (const QModelIndex& parent = QModelIndex ()) const;
virtual QHash<int, QByteArray> roleNames () const;
void Clear ();
void AddBookmarks (const Bookmarks_t& bookmarks);
void RemoveBookmark (const QString& id);
void MarkBookmarkAsFavorite (const QString& id, bool favorite);
void MarkBookmarkAsRead (const QString& id, bool read);
Bookmarks_t GetBookmarks () const;
Bookmark* GetBookmark (const QString& id) const;
};
} // namespace LinksBag
| [
"MaledictusDeMagog@gmail.com"
] | MaledictusDeMagog@gmail.com |
32e4ed056139b9570e23a37d4c4d493b6eb594c6 | a12a5400c9459ba4634165c4f389b36f4a520f8a | /examples/RTDB/DataFilter/DataFilter.ino | f9a7878045ae369a55210934b3af3ddc2c4a462e | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | MarcoGrimaldo/Firebase-ESP-Client | 354d0816456a7d70376a6112409a8d624d5025f7 | fa587b5a2cb1da0737220457312230d4c4fbf532 | refs/heads/main | 2023-05-02T06:12:40.972709 | 2021-05-22T14:22:48 | 2021-05-22T14:22:48 | 369,896,578 | 1 | 0 | MIT | 2021-05-22T20:06:20 | 2021-05-22T20:06:20 | null | UTF-8 | C++ | false | false | 3,864 | ino | /**
* Created by K. Suwatchai (Mobizt)
*
* Email: k_suwatchai@hotmail.com
*
* Github: https://github.com/mobizt
*
* Copyright (c) 2021 mobizt
*
*/
//This example shows how to construct queries to filter data.
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
/* 1. Define the WiFi credentials */
#define WIFI_SSID "WIFI_AP"
#define WIFI_PASSWORD "WIFI_PASSWORD"
/* 2. Define the API Key */
#define API_KEY "API_KEY"
/* 3. Define the RTDB URL */
#define DATABASE_URL "URL" //<databaseName>.firebaseio.com or <databaseName>.<region>.firebasedatabase.app
/* 4. Define the user Email and password that alreadey registerd or added in your project */
#define USER_EMAIL "USER_EMAIL"
#define USER_PASSWORD "USER_PASSWORD"
/* This database secret required in this example to get the righs access to database rules */
#define DATABASE_SECRET "DATABASE_SECRET"
//Define Firebase Data object
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
bool taskCompleted = false;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
/* Assign the api key (required) */
config.api_key = API_KEY;
/* Assign the user sign in credentials */
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
/* Assign the RTDB URL (required) */
config.database_url = DATABASE_URL;
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
//Or use legacy authenticate method
//config.database_url = DATABASE_URL;
//config.signer.tokens.legacy_token = "<database secret>";
Firebase.begin(&config, &auth);
//Or use legacy authenticate method
//Firebase.begin(DATABASE_URL, DATABASE_SECRET);
Firebase.reconnectWiFi(true);
}
void loop()
{
if (Firebase.ready() && !taskCompleted)
{
taskCompleted = true;
FirebaseJson json;
for (uint8_t i = 0; i < 30; i++)
{
json.set("Data1", i + 1);
json.set("Data2", i + 100);
Serial.printf("Push json... %s\n", Firebase.RTDB.pushAsync(&fbdo, "/test/push", &json) ? "ok" : fbdo.errorReason().c_str());
}
Serial.println();
//Add an index to the node that being query.
//Update the existing database rules by adding key "test/push/.indexOn" and value "Data2"
//Check your database rules changes after running this function.
/** If the authentication type is OAuth2.0 which allows the admin right access,
* the database secret is not necessary by set this parameter with empty string "".
*/
Firebase.RTDB.setQueryIndex(&fbdo, "/test/push", "Data2", DATABASE_SECRET);
QueryFilter query;
query.orderBy("Data2");
query.startAt(105);
query.endAt(120);
//get only last 8 results
query.limitToLast(8);
//Get filtered data
Serial.printf("Get json... %s\n", Firebase.RTDB.getJSON(&fbdo, "/test/push", &query) ? "ok" : fbdo.errorReason().c_str());
if (fbdo.httpCode() == FIREBASE_ERROR_HTTP_CODE_OK)
printResult(fbdo); //see addons/RTDBHelper.h
//Clear all query parameters
query.clear();
}
} | [
"k_suwatchai@hotmail.com"
] | k_suwatchai@hotmail.com |
c30826d34af8e295dbe5038cac1b146d88e54d3f | e0d1818aa1f29bca77621b151a1b8c55f3143844 | /h/Event.h | 3949b9df27435a446fa9a99f6f8d08738397a26e | [] | no_license | IgorKaric/Custom-operating-system | c7e54373098ad487fff66521b178499f78649dc0 | 1e92f8ab1586ad22eeda6343e4f5bdc971937ec0 | refs/heads/main | 2023-06-13T04:18:10.530647 | 2021-07-09T15:05:57 | 2021-07-09T15:05:57 | 384,472,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 590 | h | #ifndef _event_h_
#define _event_h_
#include "IVTEntry.h"
#define PREPAREENTRY(numEntry, callOld)\
void interrupt inter##numEntry(...); \
IVTEntry newEntry##numEntry(numEntry, inter##numEntry); \
void interrupt inter##numEntry(...) {\
newEntry##numEntry.signal();\
if (callOld == 1)\
newEntry##numEntry.pozoviStaru();\
}
typedef unsigned char IVTNo;
class KernelEv;
class Event {
public:
Event (IVTNo ivtNo);
~Event ();
void wait ();
protected:
friend class KernelEv;
void signal(); // can call KernelEv
private:
KernelEv* myImpl;
};
#endif
| [
"noreply@github.com"
] | IgorKaric.noreply@github.com |
7e1a83925180ccc5123aa7c77128260b70a5866d | c882031ebb661fb255da613c8d5d1e200590dd2e | /src/ppl/nn/engines/x86/impls/src/ppl/kernel/x86/fp32/conv2d/direct_ndarray/avx512/conv2d_n16cx_direct_ndarray_kernel_fp32_avx512.h | 7c03a6dded4e1edb69d4f49dcb8e3a4a4a511020 | [
"Apache-2.0"
] | permissive | zhen8838/ppl.nn | 2064342b9986e061c3ac3e32fba9a7059894f4fe | 5d56662bf5a288898f0dd5b90f763459cc86f47a | refs/heads/master | 2023-06-11T04:19:01.913872 | 2021-07-09T04:26:11 | 2021-07-09T04:27:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,778 | h | // Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#ifndef __ST_PPL_KERNEL_X86_FP32_CONV2D_DIRECT_NDARRAY_AVX512_CONV2D_N16CX_DIRECT_NDARRAY_KERNEL_FP32_AVX512_H_
#define __ST_PPL_KERNEL_X86_FP32_CONV2D_DIRECT_NDARRAY_AVX512_CONV2D_N16CX_DIRECT_NDARRAY_KERNEL_FP32_AVX512_H_
#include "ppl/kernel/x86/common/internal_include.h"
#include "ppl/kernel/x86/fp32/conv2d.h"
#define KERNEL_FLAG_LD_BIAS() (1 << 0)
#define KERNEL_FLAG_AD_BIAS() (1 << 1)
#define KERNEL_FLAG_RELU() (1 << 2)
#define KERNEL_FLAG_RELU6() (1 << 3)
#define PICK_PARAM(T, PARAM, IDX) *(T*)(PARAM + IDX)
#define PRIV_PARAM_LEN() 10
#define SRC_IDX() 0
#define HIS_IDX() 1
#define DST_IDX() 2
#define FLT_IDX() 3
#define BIAS_IDX() 4
#define OW_IDX() 5
#define KH_START_IDX() 6
#define KH_END_IDX() 7
#define KW_START_IDX() 8
#define KW_END_IDX() 9
#define SHAR_PARAM_LEN() 10
#define CHANNELS_IDX() 0
#define SRC_C_STRIDE_IDX() 1
#define SRC_H_STRIDE_IDX() 2
#define HIS_OCB_STRIDE_IDX() 3
#define DST_OCB_STRIDE_IDX() 4
#define FLT_OCB_STRIDE_IDX() 5
#define FLAGS_IDX() 6
#define SW_IDX() 7
#define KH_IDX() 8
#define KW_IDX() 9
#define OC_DT_BLK() 16
#define NT_STORE_OPT() 2
#define MAX_OC_RF() 2
#define MAX_OW_RF() 7
#define BLK1X14_OC_RF() 2
#define BLK1X14_OW_RF() 14
namespace ppl { namespace kernel { namespace x86 {
typedef void (*conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_func_t)(const int64_t*, const int64_t*);
extern conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_func_t
conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_pad_table[NT_STORE_OPT()][MAX_OC_RF()];
extern conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_func_t
conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_o16_table[NT_STORE_OPT()][MAX_OW_RF()];
extern conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_func_t
conv2d_n16cx_direct_ndarray_kernel_fp32_avx512_o32_table[NT_STORE_OPT()][MAX_OW_RF()];
}}}; // namespace ppl::kernel::x86
#endif
| [
"openppl.ai@hotmail.com"
] | openppl.ai@hotmail.com |
4b1f428b547d416a6f531e8412becc9341f448b0 | 10bb2b73c33e1f2a944d884f65e8a503db3e0657 | /src/timedata.cpp | 9f5dd24375c266e5ddb60700251a3c2a34a09434 | [
"MIT"
] | permissive | SapphireCoreCoin/SAPP | 057a7d45d26fd671682e83856be0a0144382c455 | 468ee15a9bb2019de0fa6a2870d3282215093ac7 | refs/heads/master | 2020-05-25T21:35:59.979712 | 2020-01-12T19:02:34 | 2020-01-12T19:02:34 | 188,001,103 | 6 | 12 | MIT | 2020-01-18T16:29:17 | 2019-05-22T08:57:08 | C++ | UTF-8 | C++ | false | false | 3,672 | cpp | // Copyright (c) 2014-2017 The Bitcoin developers
// Copyright (c) 2017-2018 The PIVX developers
// Copyright (c) 2019 The SapphireCore developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "timedata.h"
#include "netbase.h"
#include "sync.h"
#include "ui_interface.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/foreach.hpp>
using namespace std;
static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset = 0;
/**
* "Never go to sea with two chronometers; take one or three."
* Our three time sources are:
* - System clock
* - Median of other nodes clocks
* - The user (asking the user to fix the system clock if the first two disagree)
*/
int64_t GetTimeOffset()
{
LOCK(cs_nTimeOffset);
return nTimeOffset;
}
int64_t GetAdjustedTime()
{
return GetTime() + GetTimeOffset();
}
static int64_t abs64(int64_t n)
{
return (n >= 0 ? n : -n);
}
void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
{
LOCK(cs_nTimeOffset);
// Ignore duplicates
static set<CNetAddr> setKnown;
if (!setKnown.insert(ip).second)
return;
// Add data
static CMedianFilter<int64_t> vTimeOffsets(200, 0);
vTimeOffsets.input(nOffsetSample);
LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample / 60);
// There is a known issue here (see issue #4521):
//
// - The structure vTimeOffsets contains up to 200 elements, after which
// any new element added to it will not increase its size, replacing the
// oldest element.
//
// - The condition to update nTimeOffset includes checking whether the
// number of elements in vTimeOffsets is odd, which will never happen after
// there are 200 elements.
//
// But in this case the 'bug' is protective against some attacks, and may
// actually explain why we've never seen attacks which manipulate the
// clock offset.
//
// So we should hold off on fixing this and clean it up as part of
// a timing cleanup that strengthens it in a number of other ways.
//
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1) {
int64_t nMedian = vTimeOffsets.median();
std::vector<int64_t> vSorted = vTimeOffsets.sorted();
// Only let other nodes change our time by so much
if (abs64(nMedian) < 70 * 60) {
nTimeOffset = nMedian;
} else {
nTimeOffset = 0;
static bool fDone;
if (!fDone) {
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
bool fMatch = false;
BOOST_FOREACH (int64_t nOffset, vSorted)
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
fMatch = true;
if (!fMatch) {
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Sapphire Core will not work properly.");
strMiscWarning = strMessage;
LogPrintf("*** %s\n", strMessage);
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
}
}
}
if (fDebug) {
BOOST_FOREACH (int64_t n, vSorted)
LogPrintf("%+d ", n);
LogPrintf("| ");
}
LogPrintf("nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset / 60);
}
}
| [
"49686299+SapphireCoreCoin@users.noreply.github.com"
] | 49686299+SapphireCoreCoin@users.noreply.github.com |
200bcc6b295d10bdb34207d63a5671bbfca3d511 | 95b9e9dce6c37c318211e2da17baeb6ebfe4e78f | /03-FEA-1D-IsoparametricElements/C-Code/UserDefinedFunctions.h | 07e7308ed86b4edc860b9815f368bcebb36f92b5 | [] | no_license | ming91915/FiniteElementAnalysis | b1425840feaa98ad635e4fa149d36eec7638516c | cc228422b1d991fe561dbd7e4021a30d6f09e0e2 | refs/heads/master | 2020-03-23T03:03:45.111832 | 2018-06-10T01:39:12 | 2018-06-10T01:39:12 | 141,007,099 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 498 | h | #include <iostream>
using namespace std;
double UMAT(double x);
double DLODA(double x);
double UAREA(double x);
//Define E function
double UMAT(double x){
double eval;
if(x<=3.0){
eval = 20 * x;
}else if(x<=6.0){
eval = 10 * x + 20;
}else{cout << "x is out of range" << endl;}
return(eval);
}
double DLOAD(double x){
double bval;
if(x<=2.0){
bval = x * x;
}else if(x<=4.0){
bval = x;
}else if(x<=6.0){
bval = 10;
}else{cout << "x is out of range!" << endl;}
return(bval);
} | [
"dxzhu@DXZhus-MacBook-Air.local"
] | dxzhu@DXZhus-MacBook-Air.local |
638c8ef5ff131bd42705b825dc4317f46870cdd1 | 21b5b3116ba4bc1ade58cb80d63e3beb25127590 | /gearoenix/render/graph/node/rnd-gr-nd-shadow-mapper.cpp | 7131bd58c82c5bb7ec46237c400ed7f7bbd048fc | [] | no_license | bmjoy/gearoenix | 54ac24d088627af16208e7e98f6d3c317b9b5ca0 | 0b6c0c3c19899d99272a2b5168197c7880fa0fc3 | refs/heads/master | 2022-04-17T15:31:42.942367 | 2020-04-21T02:19:08 | 2020-04-21T02:19:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,149 | cpp | #include "rnd-gr-nd-shadow-mapper.hpp"
#include "../../../core/asset/cr-asset-manager.hpp"
#include "../../../core/sync/cr-sync-kernel-workers.hpp"
#include "../../buffer/rnd-buf-framed-uniform.hpp"
#include "../../buffer/rnd-buf-manager.hpp"
#include "../../buffer/rnd-buf-uniform.hpp"
#include "../../command/rnd-cmd-buffer.hpp"
#include "../../command/rnd-cmd-manager.hpp"
#include "../../material/rnd-mat-pbr.hpp"
#include "../../material/rnd-mat-unlit.hpp"
#include "../../mesh/rnd-msh-mesh.hpp"
#include "../../model/rnd-mdl-mesh.hpp"
#include "../../model/rnd-mdl-model.hpp"
#include "../../pipeline/rnd-pip-shadow-mapper-resource-set.hpp"
#include "../../pipeline/rnd-pip-shadow-mapper.hpp"
#include "../../sync/rnd-sy-semaphore.hpp"
#include "../../texture/rnd-txt-target.hpp"
gearoenix::render::graph::node::ShadowMapperRenderData::ShadowMapperRenderData(engine::Engine* const e, pipeline::Pipeline* const pip) noexcept
: r(reinterpret_cast<pipeline::ShadowMapperResourceSet*>(pip->create_resource_set()))
, u(e->get_buffer_manager()->create_uniform(sizeof(ShadowMapperUniform)))
{
r->set_node_uniform_buffer(u.get());
}
gearoenix::render::graph::node::ShadowMapperRenderData::~ShadowMapperRenderData() noexcept
{
r = nullptr;
u = nullptr;
}
gearoenix::render::graph::node::ShadowMapperKernel::ShadowMapperKernel(
engine::Engine* const e,
const unsigned int kernel_index) noexcept
: secondary_cmd(e->get_command_manager()->create_secondary_command_buffer(kernel_index))
{
}
gearoenix::render::graph::node::ShadowMapperKernel::~ShadowMapperKernel() noexcept
{
secondary_cmd = nullptr;
}
gearoenix::render::graph::node::ShadowMapperFrame::ShadowMapperFrame(engine::Engine* const e) noexcept
{
const unsigned int kernels_count = e->get_kernels()->get_threads_count();
kernels.resize(kernels_count);
for (unsigned int i = 0; i < kernels_count; ++i) {
kernels[i] = std::make_unique<ShadowMapperKernel>(e, i);
}
}
gearoenix::render::graph::node::ShadowMapperFrame::~ShadowMapperFrame() noexcept
{
kernels.clear();
}
gearoenix::render::graph::node::ShadowMapper::ShadowMapper(
engine::Engine* e,
const core::sync::EndCaller<gearoenix::core::sync::EndCallerIgnore>& call) noexcept
: Node(Type::ShadowMapper, e, pipeline::Type::ShadowMapper, 0, 1, { "start" }, { "depth" }, call)
{
frames.resize(e->get_frames_count());
for (unsigned int i = 0; i < e->get_frames_count(); ++i) {
frames[i] = std::make_unique<ShadowMapperFrame>(e);
}
const bool week_hwr = e->get_engine_type() == engine::Type::OPENGL_ES2;
shadow_map_render_target = e->create_render_target(
core::asset::Manager::create_id(),
{ texture::AttachmentInfo {
.texture_info = texture::TextureInfo {
.format = week_hwr ? texture::TextureFormat::D16 : texture::TextureFormat::D32,
.sample_info = texture::SampleInfo {
.min_filter = texture::Filter::Nearest,
.mag_filter = texture::Filter::Nearest,
.wrap_s = texture::Wrap::ClampToEdge,
.wrap_t = texture::Wrap::ClampToEdge,
.wrap_r = texture::Wrap::ClampToEdge,
},
.texture_type = texture::Type::Texture2D,
.has_mipmap = false,
},
.img_width = static_cast<unsigned int>(week_hwr ? 1024 : 2048),
.img_height = static_cast<unsigned int>(week_hwr ? 1024 : 2048),
.usage = texture::UsageFlag::Depth,
} },
call);
render_target = shadow_map_render_target.get();
output_textures[0] = shadow_map_render_target->get_texture(0);
}
gearoenix::render::graph::node::ShadowMapper::~ShadowMapper() noexcept
{
frames.clear();
frame = nullptr;
}
void gearoenix::render::graph::node::ShadowMapper::update() noexcept
{
Node::update();
const unsigned int frame_number = e->get_frame_number();
frame = frames[frame_number].get();
for (const auto& kernel : frame->kernels) {
kernel->render_data_pool.refresh();
kernel->secondary_cmd->begin();
}
}
void gearoenix::render::graph::node::ShadowMapper::record_shadow(const math::Mat4x4<double>& mvp, const model::Model* const m, const std::size_t kernel_index) noexcept
{
const auto& kernel = frame->kernels[kernel_index];
const std::map<core::Id, std::shared_ptr<model::Mesh>>& meshes = m->get_meshes();
for (const std::pair<const core::Id, std::shared_ptr<model::Mesh>>& id_mesh : meshes) {
const auto* const mat = id_mesh.second->get_mat().get();
const auto* const mat_buff = mat->get_uniform_buffers()->get_buffer();
ShadowMapperUniform u;
u.mvp = math::Mat4x4<float>(mvp);
switch (mat->get_material_type()) {
case material::Type::Unlit: {
const auto* const ptr = mat_buff->get_ptr<material::Unlit::Uniform>();
u.alpha = ptr->alpha;
u.alpha_cutoff = ptr->alpha_cutoff;
break;
}
case material::Type::Pbr: {
const auto* const ptr = mat_buff->get_ptr<material::Pbr::Uniform>();
u.alpha = ptr->alpha;
u.alpha_cutoff = ptr->alpha_cutoff;
break;
}
default:
GXUNEXPECTED
}
const auto* const msh = id_mesh.second->get_msh().get();
auto* const rd = kernel->render_data_pool.get_next([this] {
return new ShadowMapperRenderData(e, render_pipeline.get());
});
const auto& ub = rd->u;
ub->set_data(u);
const auto& prs = rd->r;
prs->set_mesh(msh);
prs->set_material(mat);
const auto& cmd = kernel->secondary_cmd;
cmd->bind(prs.get());
}
}
void gearoenix::render::graph::node::ShadowMapper::submit() noexcept
{
const unsigned int frame_number = e->get_frame_number();
command::Buffer* cmd = frames_primary_cmd[frame_number].get();
cmd->bind(render_target);
for (const auto& k : frame->kernels) {
cmd->record(k->secondary_cmd.get());
}
Node::submit();
}
| [
"hossein.noroozpour@gmail.com"
] | hossein.noroozpour@gmail.com |
814b9039e8f782741c17697b131c3494d4719ba9 | cdfe20d2672ff2f0f85c8622b9e3d44942773782 | /scopeIsForWimps.cpp | 4f5d60833cdc695010a4c180544e3b7f721c8463 | [] | no_license | paullua/scopeIsForWimps | 175a9a27707af47a13fbbe245a882f2a2f4f5304 | 3876ff546199efa5a1c3df57a4a612cb7a50b1ea | refs/heads/master | 2020-04-27T14:51:11.014851 | 2019-03-06T23:53:54 | 2019-03-06T23:53:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,931 | cpp | /***********************************************************************
* Program:
* Scope is for Wimps - Calendar Application
* Author:
* Adam Kahmann
* Summary:
* A simple application that will display the calendar month of a given
* month and day. However, I must abide by these rules:
*
* 1. Can't pass parameters into any functions
* 2. Must use multiple functions
* 3. Can't use globabl variables
* 4. Can't use classes
*************************************************************************/
#include <cassert>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <iomanip>
/*************************************************
* THIS IS THE PSUEDOCODE OF THE TECHNIQUE I USED
* TO FIND THE LOCATIONS OF ITEMS ON THE STACK:
*
* SET index -4 (use an already existing variable
* such as year or month)
* LOOP until BREAK
* DISPLAY index
* IF stack location's value IS EQUAL hard coded value
* BREAK
* INCREMENT index
*
* The actual code I used is down below
*************************************************/
// while(true)
// {
// std::cout << index << std::endl;
// if (*(&search + index) == 777)
// break;
// index++;
// }
/*************************************************
* Prompt user for month and return it to main
*************************************************/
int getMonth()
{
int month;
std::cout << "Enter Month: ";
std::cin >> month;
assert(month > 0);
assert(month < 13);
return month;
}
/*************************************************
* Prompt user for year and return it to main
*************************************************/
int getYear()
{
int year;
std::cout << "Enter Year: ";
std::cin >> year;
assert(year > 0);
return year;
}
/*************************************************
* Use Zeller's Congruence to find the offset and
* return it
*************************************************/
int getOffset()
{
int search = 9999;
int year;
int month;
//I found the month and year in these locations on the stack
month = *(&search + 15);
year = *(&search + 14);
//Here we will use Zeller's Congruence to find the first calendar day
if (month == 1)
{
month = 13;
year--;
}
if (month == 2)
{
month = 14;
year--;
}
int d = 1; //We want to find the first day of the month
int m = month;
int k = year % 100;
int j = year / 100;
int offset = d + 13*(m+1)/5 + k + k/4 + j/4 + 5*j;
return offset % 7;
}
/*************************************************
* Displays the name of the month number
*************************************************/
void displayMonthName()
{
int search = 9999;
int month = -4;
//I found the month in this location on the stack
month = *(&search + 37);
switch (month)
{
case 1 :
std::cout << "January";
break;
case 2 :
std::cout << "February";
break;
case 3 :
std::cout << "March";
break;
case 4 :
std::cout << "April";
break;
case 5 :
std::cout << "May";
break;
case 6 :
std::cout << "June";
break;
case 7 :
std::cout << "July";
break;
case 8 :
std::cout << "August";
break;
case 9 :
std::cout << "September";
break;
case 10 :
std::cout << "October";
break;
case 11 :
std::cout << "November";
break;
case 12 :
std::cout << "December";
break;
}
}
/*************************************************
* Returns whether the year was a leap year or
* not
*************************************************/
bool isLeapYear()
{
int search = 9999;
int year;
year = *(&search + 23);
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}
/*************************************************
* Returns the number of days in a month
*************************************************/
int getMonthDays()
{
int search = 9999;
int month;
//I found the month on this location on the stack
month = *(&search + 37);
switch (month)
{
case 1 :
return 31;
case 2 :
if (isLeapYear())
return 29;
else
return 28;
case 3 :
return 31;
case 4 :
return 30;
case 5 :
return 31;
case 6 :
return 30;
case 7 :
return 31;
case 8 :
return 31;
case 9 :
return 30;
case 10 :
return 31;
case 11 :
return 30;
case 12 :
return 31;
}
}
/*************************************************
* Displays the calendar
*************************************************/
void display()
{
int search = 9999;
int year = -4;
int offset;
int monthDays;
//I found the offset and year in these locations on the stack
offset = *(&search + 23);
year = *(&search + 24);
//DISPLAY HEADER
std::cout << std::endl;
displayMonthName();
std::cout << ", " << year << std::endl;
std::cout << std::setw(4) << "Su" << std::setw(4) << "Mo" << std::setw(4) << "Tu"
<< std::setw(4) << "We" << std::setw(4) << "Th" << std::setw(4) << "Fr"
<< std::setw(4) << "Sa" << std::endl;
//DISPLAY CALENDAR MONTH
int numDays = getMonthDays();
for (int i = 0; i < (offset + 6) % 7; i++)
std::cout << " ";
for (int day = 1; day <= numDays; day++)
{
std::cout << std::setw(4) << day;
if ((offset + 6 + day) % 7 == 0)
std::cout << std::endl;
else if (day == numDays)
std::cout << std::endl;
}
}
int main()
{
int month = getMonth();
int year = getYear();
int offset = getOffset();
display();
return 0;
} | [
"akahmann93@gmail.com"
] | akahmann93@gmail.com |
4fa6d1268e04aa029c7c65596e998df53dbae233 | 4ad0dddd7a6e29b31d5780bf6dec6ebad776cf73 | /Fireworks/Core/src/FWTTreeCache.cc | addeafb54ad1080a9acd146b98f8453c65e83498 | [
"Apache-2.0"
] | permissive | llechner/cmssw | 95dcd6ae0ced5546853778c6ebdf0dd224030215 | 419d33be023f9f2a4c56ef4b851552d2d228600a | refs/heads/master | 2020-08-26T20:20:28.940065 | 2018-10-18T09:24:51 | 2018-10-18T09:24:51 | 131,112,577 | 0 | 0 | Apache-2.0 | 2019-10-23T17:59:17 | 2018-04-26T06:51:19 | C++ | UTF-8 | C++ | false | false | 3,577 | cc | #include "FWTTreeCache.h"
#include "TChain.h"
#include "TTree.h"
#include "TEventList.h"
#include <climits>
FWTTreeCache::FWTTreeCache() :
TTreeCache()
{}
FWTTreeCache::FWTTreeCache(TTree *tree, Int_t buffersize) :
TTreeCache(tree, buffersize)
{}
FWTTreeCache::~FWTTreeCache()
{}
//==============================================================================
bool FWTTreeCache::s_logging = false;
int FWTTreeCache::s_default_size = 50 * 1024 * 1024;
void FWTTreeCache::LoggingOn() { s_logging = true; }
void FWTTreeCache::LoggingOff() { s_logging = false; }
bool FWTTreeCache::IsLogging() { return s_logging; }
void FWTTreeCache::SetDefaultCacheSize(int def_size) { s_default_size = def_size; }
int FWTTreeCache::GetDefaultCacheSize() { return s_default_size; }
//==============================================================================
Int_t FWTTreeCache::AddBranchTopLevel (const char* bname)
{
if (bname == nullptr || bname[0] == 0)
{
printf("FWTTreeCache::AddBranchTopLevel Invalid branch name <%s>\n",
bname == nullptr ? "nullptr" : "empty string");
return -1;
}
Int_t ret = 0;
if ( ! is_branch_in_cache(bname))
{
if (s_logging)
printf("FWTTreeCache::AddBranchTopLevel '%s' -- adding\n", bname);
{ LearnGuard _lg(this);
ret = AddBranch(bname, true);
}
if (ret == 0)
m_branch_set.insert(bname);
}
else
{
if (s_logging)
printf("FWTTreeCache::AddBranchTopLevel '%s' -- already in cache\n", bname);
}
return ret;
}
Int_t FWTTreeCache::DropBranchTopLevel(const char* bname)
{
if (bname == nullptr || bname[0] == 0)
{
printf("FWTTreeCache::AddBranchTopLevel Invalid branch name");
return -1;
}
Int_t ret = 0;
if (is_branch_in_cache(bname))
{
if (s_logging)
printf("FWTTreeCache::DropBranchTopLevel '%s' -- dropping\n", bname);
m_branch_set.erase(bname);
LearnGuard _lg(this);
ret = DropBranch(bname, true);
}
else
{
if (s_logging)
printf("FWTTreeCache::DropBranchTopLevel '%s' -- not in cache\n", bname);
}
return ret;
}
void FWTTreeCache::BranchAccessCallIn(const TBranch *b)
{
if (s_logging)
printf("FWTTreeCache::BranchAccessCallIn '%s'\n", b->GetName());
AddBranchTopLevel(b->GetName());
}
//==============================================================================
Int_t FWTTreeCache::AddBranch(TBranch *b, Bool_t subbranches)
{
if (s_logging && ! m_silent_low_level)
printf("FWTTreeCache::AddBranch by ptr '%s', subbp=%d\n", b->GetName(), subbranches);
return TTreeCache::AddBranch(b, subbranches);
}
Int_t FWTTreeCache::AddBranch(const char *branch, Bool_t subbranches)
{
if (s_logging)
printf("FWTTreeCache::AddBranch by name '%s', subbp=%d\n", branch, subbranches);
if (strcmp(branch,"*") == 0)
m_silent_low_level = true;
return TTreeCache::AddBranch(branch, subbranches);
}
Int_t FWTTreeCache::DropBranch(TBranch *b, Bool_t subbranches)
{
if (s_logging && ! m_silent_low_level)
printf("FWTTreeCache::DropBranch by ptr '%s', subbp=%d\n", b->GetName(), subbranches);
return TTreeCache::DropBranch(b, subbranches);
}
Int_t FWTTreeCache::DropBranch(const char *branch, Bool_t subbranches)
{
if (s_logging)
printf("FWTTreeCache::DropBranch by name '%s', subbp=%d\n", branch, subbranches);
Int_t ret = TTreeCache::DropBranch(branch, subbranches);
if (strcmp(branch,"*") == 0)
m_silent_low_level = false;
return ret;
}
| [
"mtadel@ucsd.edu"
] | mtadel@ucsd.edu |
5f9cccd3e1ed4ee50e0c5f9163b4d2b6a1f67be6 | 4cc3b4aa2b7d9f5467d88785bb42653e98bc302a | /menghitung nilai mahasiswa.cpp | f521253621ff30b0e8c490706494aaf16661a24a | [] | no_license | khafid-gionino/C- | 275a3938ea8a2625a47c30604ff3c3bbac804b8c | 544da8afa581783f729c79beb688dcb22c82151b | refs/heads/master | 2021-08-23T17:25:32.441057 | 2017-12-05T21:47:34 | 2017-12-05T21:47:34 | 113,182,443 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 614 | cpp | #include <iostream>
using namespace std;
int main()
{
float tugas, quis, uts, uas;
float nilai_total;
float bobot_tugas, bobot_quis, bobot_uts, bobot_uas;
cout<<"input nilai tugas = ";
cin>>tugas;
cout<<"input nilai quis =";
cin>>quis;
cout<<"input nilai uts =";
cin>>uts;
cout<<"input nilai uas =";
cin>>uas;
bobot_tugas=0.3; bobot_quis=0.3; bobot_uts=0.2; bobot_uas=0.2;
nilai_total=(tugas*bobot_tugas) + (quis*bobot_quis) + (uts*bobot_uts) + (uas*bobot_uas);
cout<<"nilai total pemrograman terstruktur adalah ="<<nilai_total;
}
| [
"noreply@github.com"
] | khafid-gionino.noreply@github.com |
42fac7c722d0500a3bd95a74de04725748b03609 | e662e1cb067dccd8a0a3babb1bb72d45f1f82e7e | /src/qt/rpcconsole.h | 3cfab835de647133129289a6f6c8c359bda55b4d | [
"MIT"
] | permissive | mhannigan/nitrous | 98cd91e606cc7db5367e007fd1669281639f25de | da7aac717b5c51fdbe2229e2546f0ffbff47a4d3 | refs/heads/master | 2020-03-19T00:38:18.311951 | 2018-07-02T23:35:57 | 2018-07-02T23:35:57 | 135,494,454 | 0 | 3 | MIT | 2018-05-31T04:46:52 | 2018-05-30T20:31:13 | C++ | UTF-8 | C++ | false | false | 3,808 | h | // Copyright (c) 2011-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_RPCCONSOLE_H
#define BITCOIN_QT_RPCCONSOLE_H
#include "guiutil.h"
#include "peertablemodel.h"
#include "net.h"
#include <QDialog>
class ClientModel;
namespace Ui
{
class RPCConsole;
}
QT_BEGIN_NAMESPACE
class QItemSelection;
QT_END_NAMESPACE
/** Local Bitcoin RPC console. */
class RPCConsole : public QDialog
{
Q_OBJECT
public:
explicit RPCConsole(QWidget* parent);
~RPCConsole();
void setClientModel(ClientModel* model);
enum MessageClass {
MC_ERROR,
MC_DEBUG,
CMD_REQUEST,
CMD_REPLY,
CMD_ERROR
};
protected:
virtual bool eventFilter(QObject* obj, QEvent* event);
private slots:
void on_lineEdit_returnPressed();
void on_tabWidget_currentChanged(int index);
/** open the debug.log from the current datadir */
void on_openDebugLogfileButton_clicked();
/** change the time range of the network traffic graph */
void on_sldGraphRange_valueChanged(int value);
/** update traffic statistics */
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
void resizeEvent(QResizeEvent* event);
void showEvent(QShowEvent* event);
void hideEvent(QHideEvent* event);
public slots:
void clear();
/** Wallet repair options */
void walletSalvage();
void walletRescan();
void walletZaptxes1();
void walletZaptxes2();
void walletUpgrade();
void walletReindex();
void reject();
void message(int category, const QString& message, bool html = false);
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks shown in the UI */
void setNumBlocks(int count);
/** Set number of masternodes shown in the UI */
void setMasternodeCount(const QString& strMasternodes);
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */
void scrollToEnd();
/** Switch to info tab and show */
void showInfo();
/** Switch to console tab and show */
void showConsole();
/** Switch to network tab and show */
void showNetwork();
/** Switch to peers tab and show */
void showPeers();
/** Switch to wallet-repair tab and show */
void showRepair();
/** Open external (default) editor with nitrous.conf */
void showConfEditor();
/** Open external (default) editor with masternode.conf */
void showMNConfEditor();
/** Handle selection of peer in peers list */
void peerSelected(const QItemSelection& selected, const QItemSelection& deselected);
/** Handle updated peer information */
void peerLayoutChanged();
/** Show folder with wallet backups in default browser */
void showBackups();
signals:
// For RPC command executor
void stopExecutor();
void cmdRequest(const QString& command);
/** Get restart command-line parameters and handle restart */
void handleRestart(QStringList args);
private:
static QString FormatBytes(quint64 bytes);
void startExecutor();
void setTrafficGraphRange(int mins);
/** Build parameter list for restart */
void buildParameterlist(QString arg);
/** show detailed information on ui about selected node */
void updateNodeDetail(const CNodeCombinedStats* stats);
enum ColumnWidths {
ADDRESS_COLUMN_WIDTH = 170,
SUBVERSION_COLUMN_WIDTH = 140,
PING_COLUMN_WIDTH = 80
};
Ui::RPCConsole* ui;
ClientModel* clientModel;
QStringList history;
int historyPtr;
NodeId cachedNodeid;
};
#endif // BITCOIN_QT_RPCCONSOLE_H
| [
"root@ip-172-31-87-157.ec2.internal"
] | root@ip-172-31-87-157.ec2.internal |
27fbb4248659b67f7570f032a720f34eddb58d84 | a26b987add5a3ef9a4e85ef18b837fcad5618b4c | /CheesyPoofCode/Autonomous/AutoModeSelector.h | 00123c0da8f4517a98b6bd7ca60d7f52657af53d | [] | no_license | wildstang/2010_software | 74044b0200ba9e41ee2a8dc5f61aa23c54b1e12c | ec8fe9f25230fe0d162550cb98e4c41b0b2b097e | refs/heads/master | 2021-08-11T21:23:42.229962 | 2013-04-24T00:06:45 | 2013-04-24T00:06:45 | 67,354,986 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 873 | h | #ifndef _AUTO_SELECTOR_H
#define _AUTO_SELECTOR_H
#include <string>
#include "../Controllers/AutoModeController.h"
// Note:
// This all sucks.
// I want to change it
class AutoModeSelector{
public:
enum AutoModes{
amFirst = 0,
amFarZoneBounce,
amFarZoneNoBounce,
amMiddleZone,
amMiddleZoneFromAngle,
amNearZone,
amDoNothing,
amDoNothingMiddle,
amLast
};
enum AutoModesSecondary{
amsFirst,
amsCrossBumpAndWait,
amsCrossBump,
amsCrossBumpAndPlow,
amsCrossTwoBumps,
amsTurnToOpp,
amsBlockTunnel,
amsDoNothing,
amsLast
};
void increment();
void incrementSecondary();
// Get a description of this auto mode
string description();
string descriptionSecondary();
void writeToAutoModeController(AutoModeController * ac);
private:
int index;
int secIndex;
};
#endif
| [
"slider6791@gmail.com"
] | slider6791@gmail.com |
4258f78704c1e20bdcba5df29bc55139b7f95118 | 4f2b6eeff4edef9e9fc36574a4377bf6b2cafe31 | /HihoCoder/old/state_dp.cpp | d3dc21d3af62805a0a67d920d7017d499a464c8d | [] | no_license | LimitW/ACM-repo | 9f00ae4dc88cb9b7576347914916b47dd854a40a | f7c01bf1a0f2c7e039fa8c932d9565789bdd268b | refs/heads/master | 2021-01-24T15:06:51.379270 | 2016-06-30T14:55:32 | 2016-06-30T14:55:32 | 36,651,487 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,149 | cpp | /************************************************
* Title:
* Author:LimitW
* Date:2014.8.25
* Source:Hihocoder week 8
* Note:状态压缩dp
*************************************************/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
int dp[1010][(1<<10)+10];
int n,m,q;
int w[1010];
int get_state(int x){
int countx = 0;
for(countx = 0; x; x >>= 1)
countx += x & 1;
return countx;
}
int main(){
cin >> n >> m >> q;
for(int i = 1; i <= n; i++)
cin >> w[i];
for(int i = 1; i <= n; i++)
for(int j = (1 << m) - 1; j >= 0; j--){
if(get_state(j>>1) <= q)
dp[i][j>>1] = max(dp[i][j>>1],dp[i-1][j]);
if(get_state(j>>1) < q)
dp[i][(j>>1)|(1<<(m-1))] = max(dp[i][(j>>1)|(1<<(m-1))],dp[i-1][j]+w[i]);
}
int ans = 0;
for(int i = 0; i < (1 << m); i++)
ans = max(ans,dp[n][i]);
printf("%d\n",ans);
return 0;
} | [
"hbdgwb13@gmail.com"
] | hbdgwb13@gmail.com |
fb076ab656e0a2f84b65a30b94b1e6a884e87edb | a59150b3ac9d43e59e590e13d4cb03e08d5a387f | /testing/testing_cpotrf_msub.cpp | 6c3ae43f50ede0d98818e6ca95995d2057ad7e38 | [] | no_license | schevalier/clmagma | 5856f78140fcd6f66aac32734bba759a15627567 | 05972282d055c36c55cfd5d4d2beed39ce48485f | refs/heads/master | 2021-01-18T09:57:21.319855 | 2014-08-12T17:54:32 | 2014-08-12T17:54:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,784 | cpp | /*
* -- clMAGMA (version 1.1.0) --
* Univ. of Tennessee, Knoxville
* Univ. of California, Berkeley
* Univ. of Colorado, Denver
* @date January 2014
*
* @generated from testing_zpotrf_msub.cpp normal z -> c, Fri Jan 10 15:51:19 2014
*
**/
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
// includes, project
#include "flops.h"
#include "magma.h"
#include "magma_lapack.h"
#include "testings.h"
//#define USE_PINNED_CLMEMORY
#ifdef USE_PINNED_CLMEMORY
extern cl_context gContext;
#endif
#define h_A(i,j) h_A[ i + j*lda ]
void init_matrix( int N, magmaFloatComplex *h_A, magma_int_t lda )
{
magma_int_t ione = 1, n2 = N*lda;
magma_int_t ISEED[4] = {0,0,0,1};
lapackf77_clarnv( &ione, ISEED, &n2, h_A );
/* Symmetrize and increase the diagonal */
for (int i = 0; i < N; ++i) {
MAGMA_C_SET2REAL( h_A(i,i), MAGMA_C_REAL(h_A(i,i)) + N );
for (int j = 0; j < i; ++j) h_A(i, j) = MAGMA_C_CNJG( h_A(j, i) );
}
}
/* ////////////////////////////////////////////////////////////////////////////
-- Testing cpotrf_msub
*/
int main( int argc, char** argv)
{
real_Double_t gflops, gpu_perf, cpu_perf, gpu_time, cpu_time;
magmaFloatComplex *h_R = NULL, *h_P = NULL;
magmaFloatComplex_ptr d_lA[MagmaMaxSubs * MagmaMaxGPUs];
magma_int_t N = 0, n2, lda, ldda;
magma_int_t size[10] =
{ 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000 };
magma_int_t i, j, k, check = 0, info;
magmaFloatComplex mz_one = MAGMA_C_NEG_ONE;
magma_int_t ione = 1;
magma_int_t num_gpus0 = 1, num_gpus, num_subs0 = 1, num_subs, tot_subs, flag = 0;
int nb, n_local, nk;
magma_uplo_t uplo = MagmaLower;
if (argc != 1){
for(i = 1; i<argc; i++){
if (strcmp("-N", argv[i]) == 0){
N = atoi(argv[++i]);
if (N > 0) {
size[0] = size[9] = N;
flag = 1;
}
}
if(strcmp("-NGPU", argv[i]) == 0)
num_gpus0 = atoi(argv[++i]);
if(strcmp("-NSUB", argv[i]) == 0)
num_subs0 = atoi(argv[++i]);
if(strcmp("-UPLO", argv[i]) == 0)
uplo = (strcmp("L", argv[++i]) == 0 ? MagmaLower : MagmaUpper);
if(strcmp("-check", argv[i]) == 0)
check = 1;
}
}
/* Initialize */
magma_queue_t queues[2*MagmaMaxGPUs];
magma_device_t devices[ MagmaMaxGPUs ];
int num = 0;
magma_err_t err;
magma_init();
err = magma_get_devices( devices, MagmaMaxGPUs, &num );
if ( err != 0 || num < 1 ) {
fprintf( stderr, "magma_get_devices failed: %d\n", err );
exit(-1);
}
for(i=0;i<num_gpus0;i++){
err = magma_queue_create( devices[i], &queues[2*i] );
if ( err != 0 ) {
fprintf( stderr, "magma_queue_create failed: %d\n", err );
exit(-1);
}
err = magma_queue_create( devices[i], &queues[2*i+1] );
if ( err != 0 ) {
fprintf( stderr, "magma_queue_create failed: %d\n", err );
exit(-1);
}
}
printf("\nUsing %d GPUs:\n", num_gpus0);
printf(" testing_cpotrf_msub -N %d -NGPU %d -NSUB %d -UPLO %c %s\n\n", size[0], num_gpus0,num_subs0,
(uplo == MagmaLower ? 'L' : 'U'),(check == 1 ? "-check" : " "));
printf(" N CPU GFlop/s (sec) GPU GFlop/s (sec) ||R_magma-R_lapack||_F / ||R_lapack||_F\n");
printf("========================================================================================\n");
for(i=0; i<10; i++){
N = size[i];
lda = N;
n2 = lda*N;
gflops = FLOPS_CPOTRF( N ) / 1e9;;
nb = magma_get_cpotrf_nb(N);
if (num_subs0*num_gpus0 > N/nb) {
num_gpus = N/nb;
num_subs = 1;
if(N%nb != 0) num_gpus ++;
printf("too many GPUs for the matrix size, using %d GPUs\n", (int)num_gpus);
} else {
num_gpus = num_gpus0;
num_subs = num_subs0;
}
tot_subs = num_subs * num_gpus;
/* Allocate host memory for the matrix */
#ifdef USE_PINNED_CLMEMORY
cl_mem buffer1 = clCreateBuffer(gContext, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, n2*sizeof(magmaFloatComplex), NULL, NULL);
cl_mem buffer2 = clCreateBuffer(gContext, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, lda*nb*sizeof(magmaFloatComplex), NULL, NULL);
for (k=0; k<num_gpus; k++) {
h_R = (magmaFloatComplex*)clEnqueueMapBuffer(queues[2*k], buffer1, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, 0,
n2*sizeof(magmaFloatComplex), 0, NULL, NULL, NULL);
h_P = (magmaFloatComplex*)clEnqueueMapBuffer(queues[2*k], buffer2, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, 0,
lda*nb*sizeof(magmaFloatComplex), 0, NULL, NULL, NULL);
}
#else
TESTING_MALLOC_PIN( h_P, magmaFloatComplex, lda*nb );
TESTING_MALLOC_PIN( h_R, magmaFloatComplex, n2 );
#endif
/* Initialize the matrix */
init_matrix( N, h_R, lda );
/* Allocate GPU memory */
if (uplo == MagmaUpper) {
ldda = ((N+nb-1)/nb)*nb;
n_local = ((N+nb*tot_subs-1)/(nb*tot_subs))*nb;
} else {
ldda = ((N+nb*tot_subs-1)/(nb*tot_subs))*nb;
n_local = ((N+nb-1)/nb)*nb;
}
for (j=0; j<tot_subs; j++) {
TESTING_MALLOC_DEV( d_lA[j], magmaFloatComplex, n_local*ldda );
}
/* Warm up to measure the performance */
/* distribute matrix to gpus */
if (uplo == MagmaUpper) {
for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_csetmatrix(j+nk, nk,
&h_R[j*lda], 0, lda,
d_lA[k], j/(nb*tot_subs)*nb*ldda, ldda,
queues[2*(k%num_gpus)]);
}
} else {
for (j=0; j<N; j+=nb) {
nk = min(nb, N-j);
for (int kk = 0; kk<tot_subs; kk++) {
int mk = 0;
for (int ii=j+kk*nb; ii<N; ii+=nb*tot_subs) {
int mii = min(nb, N-ii);
lapackf77_clacpy( MagmaFullStr, &mii, &nk, &h_R[ii+j*lda], &lda, &h_P[mk], &lda );
mk += mii;
}
k = ((j+kk*nb)/nb)%tot_subs;
if (mk > 0 && nk > 0) {
magma_csetmatrix(mk, nk,
h_P, 0, lda,
d_lA[k], j*ldda+(j+kk*nb)/(nb*tot_subs)*nb, ldda,
queues[2*(k%num_gpus)]);
}
}
}
/*for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_csetmatrix(nk, j+nk, &h_R[j], 0, lda,
d_lA[k], j/(nb*tot_subs)*nb, ldda,
queues[2*(k%num_gpus)]);
}*/
}
magma_cpotrf_msub( num_subs, num_gpus, uplo, N, d_lA, 0, ldda, &info, queues );
/* ====================================================================
Performs operation using MAGMA
=================================================================== */
/* distribute matrix to gpus */
if (uplo == MagmaUpper) {
for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_csetmatrix(j+nk, nk,
&h_R[j*lda], 0, lda,
d_lA[k], j/(nb*tot_subs)*nb*ldda, ldda,
queues[2*(k%num_gpus)]);
}
} else {
for (j=0; j<N; j+=nb) {
nk = min(nb, N-j);
for (int kk = 0; kk<tot_subs; kk++) {
int mk = 0;
for (int ii=j+kk*nb; ii<N; ii+=nb*tot_subs) {
int mii = min(nb, N-ii);
lapackf77_clacpy( MagmaFullStr, &mii, &nk, &h_R[ii+j*lda], &lda, &h_P[mk], &lda );
mk += mii;
}
k = ((j+kk*nb)/nb)%tot_subs;
if (mk > 0 && nk > 0) {
magma_csetmatrix(mk, nk,
h_P, 0, lda,
d_lA[k], j*ldda+(j+kk*nb)/(nb*tot_subs)*nb, ldda,
queues[2*(k%num_gpus)]);
}
}
}
/*for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_csetmatrix(nk, j+nk, &h_R[j], 0, lda,
d_lA[k], (j/(nb*tot_subs)*nb), ldda,
queues[2*(k%num_gpus)]);
}*/
}
gpu_time = magma_wtime();
magma_cpotrf_msub( num_subs, num_gpus, uplo, N, d_lA, 0, ldda, &info, queues );
gpu_time = magma_wtime() - gpu_time;
gpu_perf = gflops / gpu_time;
if (info != 0)
printf( "magma_cpotrf had error %d.\n", info );
/* gather matrix from gpus */
if (uplo==MagmaUpper) {
for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_cgetmatrix(j+nk, nk,
d_lA[k], j/(nb*tot_subs)*nb*ldda, ldda,
&h_R[j*lda], 0, lda, queues[2*(k%num_gpus)]);
}
} else {
for (j=0; j<N; j+=nb) {
nk = min(nb, N-j);
for (int kk = 0; kk<tot_subs; kk++) {
k = ((j+kk*nb)/nb)%tot_subs;
int mk = 0;
mk = 0;
for (int ii=j+kk*nb; ii<N; ii+=nb*tot_subs) {
mk += min(nb, N-ii);
}
if (mk > 0 && nk > 0) {
magma_cgetmatrix(mk, nk,
d_lA[k], j*ldda+(j+kk*nb)/(nb*tot_subs)*nb, ldda,
h_P, 0, lda,
queues[2*(k%num_gpus)]);
}
mk = 0;
for (int ii=j+kk*nb; ii<N; ii+=nb*tot_subs) {
int mii = min(nb, N-ii);
lapackf77_clacpy( MagmaFullStr, &mii, &nk, &h_P[mk], &lda, &h_R[ii+j*lda], &lda );
mk += mii;
}
}
}
/*for (j=0; j<N; j+=nb) {
k = (j/nb)%tot_subs;
nk = min(nb, N-j);
magma_cgetmatrix( nk, j+nk,
d_lA[k], (j/(nb*tot_subs)*nb), ldda,
&h_R[j], 0, lda, queues[2*(k%num_gpus)] );
}*/
}
/* =====================================================================
Performs operation using LAPACK
=================================================================== */
if (check == 1) {
float work[1], matnorm, diffnorm;
magmaFloatComplex *h_A;
TESTING_MALLOC_PIN( h_A, magmaFloatComplex, n2 );
init_matrix( N, h_A, lda );
cpu_time = magma_wtime();
if (uplo == MagmaLower) {
lapackf77_cpotrf( MagmaLowerStr, &N, h_A, &lda, &info );
} else {
lapackf77_cpotrf( MagmaUpperStr, &N, h_A, &lda, &info );
}
cpu_time = magma_wtime() - cpu_time;
cpu_perf = gflops / cpu_time;
if (info != 0)
printf( "lapackf77_cpotrf had error %d.\n", info );
/* =====================================================================
Check the result compared to LAPACK
|R_magma - R_lapack| / |R_lapack|
=================================================================== */
matnorm = lapackf77_clange("f", &N, &N, h_A, &lda, work);
blasf77_caxpy(&n2, &mz_one, h_A, &ione, h_R, &ione);
diffnorm = lapackf77_clange("f", &N, &N, h_R, &lda, work);
printf( "%5d %6.2f (%6.2f) %6.2f (%6.2f) %e\n",
N, cpu_perf, cpu_time, gpu_perf, gpu_time, diffnorm / matnorm );
TESTING_FREE_PIN( h_A );
} else {
printf( "%5d - - (- -) %6.2f (%6.2f) - -\n",
N, gpu_perf, gpu_time );
}
// free memory
#ifdef USE_PINNED_CLMEMORY
for (k=0; k<num_gpus; k++) {
clEnqueueUnmapMemObject(queues[2*k], buffer1, h_R, 0, NULL, NULL);
clEnqueueUnmapMemObject(queues[2*k], buffer2, h_P, 0, NULL, NULL);
}
clReleaseMemObject(buffer1);
clReleaseMemObject(buffer2);
#else
TESTING_FREE_PIN( h_P );
TESTING_FREE_PIN( h_R );
#endif
for (j=0; j<tot_subs; j++) {
TESTING_FREE_DEV( d_lA[j] );
}
if (flag != 0)
break;
}
/* clean up */
for (i=0; i<num_gpus; i++) {
magma_queue_destroy( queues[2*i] );
magma_queue_destroy( queues[2*i+1] );
}
magma_finalize();
return 0;
}
| [
"lecaran@gmail.com"
] | lecaran@gmail.com |
e3c96ee5938486cdad40b8a19be255e049cda7f6 | 75bd815c782d58c808b0257855bc1e8c7655035b | /Arrays/Sum_of_two_arrays.cpp | 1d236c7e493596e0cf5cd74ed66204457db2cba6 | [] | no_license | divyanshudob/CodingBlocks-HackerBlocks_Solutions | 6fbb77c5d7181b52927a9e30da38043e3c9d74f1 | dab9e0058d18c8e0ca337a4537bdabb4d5d6bc4c | refs/heads/main | 2023-07-17T22:44:39.668693 | 2021-08-12T03:02:43 | 2021-08-12T03:02:43 | 380,254,907 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 885 | cpp | #include <iostream>
using namespace std;
void calculate(int a[], int b[], int n, int m)
{
int sum[n];
int i = n - 1, j = m - 1, k = n - 1;
int carry = 0, s = 0;
while (j >= 0) {
s = a[i] + b[j] + carry;
sum[k] = (s % 10);
carry = s / 10;
k--;
i--;
j--;
}
while (i >= 0) {
s = a[i] + carry;
sum[k] = (s % 10);
carry = s / 10;
i--;
k--;
}
int ans = 0;
if (carry)
cout<<carry<<", ";
for (int i = 0; i <= n - 1; i++) {
cout<<sum[i]<<", ";
}
cout<<"END";
}
void compare(int a[], int b[], int n, int m)
{
if (n >= m)
calculate(a, b, n, m);
else
calculate(b, a, m, n);
}
int main()
{
int a[10001],b[10001];
int n,m;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
cin>>m;
for(int i=0;i<m;i++){
cin>>b[i];
}
compare(a, b, n, m);
return 0;
} | [
"noreply@github.com"
] | divyanshudob.noreply@github.com |
479620782c77cf005ffeb899d8a96834f558c3e0 | 3c44b829bae4b1ccbcb6acdb29f979e5609af7c7 | /cppfile.cpp | 495bd643f5f39fe4a68ce5cfd6ca92f6502a8eaa | [] | no_license | AhmadQasim/network_lab3 | 481980f94cf3e1c0254b6738ffd85bb240aafe9d | 8d603e00ebf4cf3438260338224fdd492063170e | refs/heads/master | 2021-01-20T02:53:26.080112 | 2015-03-05T14:38:42 | 2015-03-05T14:38:42 | 31,673,159 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,927 | cpp | #include <pthread.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
#include <fcntl.h>
void *client(void *port)
{
//local variables
int sockfd = 0;
int bytesReceived = 0;
unsigned char recvBuff[256];
struct sockaddr_in serv_addr;
char temp[256];
int i = 1;
//creating a TCP socket
if((sockfd = socket(AF_INET, SOCK_STREAM, 0))< 0){
printf("C: Could not create socket \n");
return 0;
}
uint16_t *portnum=(uint16_t *)port;
//obtaining server information
serv_addr.sin_family = AF_INET; //IP family
serv_addr.sin_port = htons(*portnum); // port
serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1"); //server IP
//attempting a connection with server
if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr))<0) {
printf("C: Connection Failed \n");
printf("%s\n", strerror(errno));
return 0;
}
//read first message from server
read(sockfd, temp, sizeof(temp));
printf("%s", temp);
//sending file name to server
memset(recvBuff, '\0', sizeof(recvBuff)); //sanitizing buffer
write(sockfd, "file.txt", sizeof(temp));
FILE *fp;
fp = fopen("file(client-copy).txt", "wb");
if(NULL == fp){
printf("C: Error opening file.\n");
close(sockfd);
return 0;
}
printf("client : Receiving file.\n"); //start receiving
//receive file line by line
while((bytesReceived = read(sockfd, recvBuff, sizeof(recvBuff))) > 0){
for (i = 0; i < bytesReceived; i++)
recvBuff[i] ^= 12; //encrypt file data for security
fwrite(recvBuff, 1,bytesReceived,fp);
}
printf("client : file received. Going offline.\n");
fflush(fp); //sanitize file handler
fclose(fp); //close file handler
close(sockfd); //close connection
}
void *server (void *port){
char *paths[100];
int filesize[100];
int pathcount=0;
int listenfd = 0;
int connfd = 0;
int i, j =0;
int bytesread;
printf("Server : First run, starting thread.\n");
//binding socket to a port
uint16_t *portnum=(uint16_t *)port;
struct sockaddr_in serv_addr;
listenfd = socket(AF_INET, SOCK_STREAM, 0); //open a listen() on a certain port
serv_addr.sin_family = AF_INET; //IP addr family
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(*portnum); //port
bind(listenfd, (struct sockaddr*)&serv_addr,sizeof(serv_addr)); //bind port
//main loop
while(1){
char temp[256];
unsigned char buff[256];
printf("Server : Waiting for new connection.\n");
if(listen(listenfd, 10) == -1){
printf("S: Failed to listen\n");
}
//accept connections from clients
connfd = accept(listenfd, (struct sockaddr*)NULL ,NULL);
pathcount = 0;
//send first message to client
printf("Server : Connection established.\n");
strcpy(temp, "Server : Welcome to C++ sever. Enter filename.\n");
write(connfd, temp, sizeof(temp));
//read file name
read(connfd, temp, sizeof(temp));
printf("client : filename = %s", temp);
int fp = open(temp, O_RDWR , S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
memset(buff, 0, sizeof(buff));
j = 0;
//start reading file data and send it to client
printf("Server : Sending file.\n");
while(bytesread = read(fp,buff, sizeof(buff))){
for(i = 0; i < bytesread; i++)
buff[i] ^= 12; //encrypt file data for security
j = j + bytesread;
fflush(stdout);
write(connfd, buff, bytesread);
}
printf("Server : file sent, going to idle state.\n");
close(connfd); //close connection
}
//close socket
close(listenfd);
return 0;
}
int main ()
{
char temp[256];
pthread_t t1;
int serv = pthread_create(&t1, NULL, server, (void *)55556);
while(1){
printf("Start client ? type JAVA for java server and C++ for c++ server\n");
scanf("%s", temp);
if (strcmp(temp, "JAVA")){
pthread_t t2;
int *port;
*port = 55546;
int cl= pthread_create(&t2, NULL, client, (void *)55555);
}
else{
pthread_t t3;
int *port;
*port = 55546;
int cl= pthread_create(&t3, NULL, client, (void *)55556);
}
}
}
| [
"Ahmad.live.1@gmail.com"
] | Ahmad.live.1@gmail.com |
2e6f8e088c1a50039d83dabb94d792e45a4c325c | 94e964d7228c38100f49eaa44117f22853f4eaad | /D01/ex09/Logger.cpp | e4d332b29c6239d7964391a32b8fd879a0a22fcb | [] | no_license | nyhu/PCPP | 5231a532c5e7d399ba9cdf38e7f7ef69ee09ac71 | 02671aed1d0914095ae4ef77b44442b97fb470d2 | refs/heads/master | 2020-03-06T17:57:40.577445 | 2018-04-10T10:49:53 | 2018-04-10T10:49:53 | 126,997,571 | 1 | 0 | null | 2018-04-01T19:38:19 | 2018-03-27T14:16:31 | C++ | UTF-8 | C++ | false | false | 1,234 | cpp | #include "Logger.hpp"
Logger::Logger(std::string nameFile)
{
this->nameFile = nameFile;
}
Logger::~Logger()
{
}
void Logger::logToConsole(std::string const &input)
{
std::cout << input << std::endl;
}
void Logger::logToFile(std::string const &input)
{
std::ofstream out(this->nameFile.c_str(), std::ios::app);
out << input << std::endl;
out.close();
}
std::string Logger::makeLogEntry(std::string const &input)
{
std::string str = _displayTimestamp() + " | " + input;
return str;
}
void Logger::log(std::string const &dest, std::string const &message)
{
typedef void (Logger::*func)(std::string const &);
std::map<std::string, func> funcMap;
std::string str = this->makeLogEntry(message);
funcMap.insert(std::make_pair("logToFile", &Logger::logToFile));
funcMap.insert(std::make_pair("logToConsole", &Logger::logToConsole));
if (funcMap.count(dest) > 0)
{
func chose = funcMap[dest];
(this->*chose)(str);
} else {
logToConsole(str);
}
}
std::string Logger::_displayTimestamp(void)
{
char str[100];
std::time_t t;
std::time(&t);
std::strftime(str, sizeof(str), "%Y/%m/%d %H:%M:%S", std::localtime(&t));
return str;
}
| [
"toussaint.boos@gmail.com"
] | toussaint.boos@gmail.com |
0f0536474653970415a979a0cd5bb41fac8f0cfb | 76e33c5c200d1672a282dc719c3bc369c59befdb | /greedy/reduce-array-size-to-the-half.cpp | 076d909a9b7f052e5988746871d69916165df784 | [] | no_license | sankalpkotewar/algorithms-1 | cdc851a4695e0dd6d9aee360923c7af06dea837f | 22a8a2e1d29d60ee6b5070f32d5d9c30cd5f9780 | refs/heads/master | 2022-11-11T17:48:19.366022 | 2020-07-09T10:31:20 | 2020-07-09T10:31:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,055 | cpp | #include "greedy.h"
/*
* Given an array arr. You can choose a set of integers and remove all the occurrences of these integers in the array.
Return the minimum size of the set so that at least half of the integers of the array are removed.
Example 1:
Input: arr = [3,3,3,3,5,5,5,2,2,7]
Output: 2
Explanation: Choosing {3,7} will make the new array [5,5,5,2,2] which has size 5 (i.e equal to half of the size of the old array).
Possible sets of size 2 are {3,5},{3,2},{5,2}.
Choosing set {2,7} is not possible as it will make the new array [3,3,3,3,5,5,5] which has size greater than half of
the size of the old array.
Example 2:
Input: arr = [7,7,7,7,7,7]
Output: 1
Explanation: The only possible set you can choose is {7}. This will make the new array empty.
Example 3:
Input: arr = [1,9]
Output: 1
Example 4:
Input: arr = [1000,1000,3,7]
Output: 1
Example 5:
Input: arr = [1,2,3,4,5,6,7,8,9,10]
Output: 5
Constraints:
1 <= arr.length <= 10^5
arr.length is even.
1 <= arr[i] <= 10^5
*/
int minSetSize(vector<int>& arr) {
return 0;
} | [
"ozcanay@itu.edu.tr"
] | ozcanay@itu.edu.tr |
b787acad5d7065906e58766663ccf93e6121ec59 | 670e20d60e321ab81674666ff2ec1acf7ccd96fd | /src/ofApp.h | 52b4f8924b69ac17118ca3ad21431b960221d350 | [] | no_license | davidh8011/Galaga-Project | 6e1783283647584d8be45fda69599f12167ea653 | 1b806ed2bb48508e3793b1c47bc8bb918d593e26 | refs/heads/master | 2020-04-01T08:40:41.216380 | 2018-10-15T02:49:59 | 2018-10-15T02:49:59 | 153,042,003 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,674 | h | #pragma once
#include "ofMain.h"
#include "Ship.h"
#include "Shot.h"
#include "ArrayList2.h"
#include "Fighter.h"
#include "Enemy1.h"
#include "ArrayListEnemy.h"
#include "ArrayListShot.h"
#include "Powerup.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class ofApp : public ofBaseApp {
Fighter fighter{ ofGetWidth() / 2 - 25, ofGetHeight() - 50, 5, 5 };
bool instructionScreen;
bool gameOver;
bool pause;
bool moveLeft;
bool moveRight;
bool spread;
bool newGame;
int moveKey;
int level;
int timer;
bool power;
Powerup pow;
string sc;
int score;
string hScore;
int highScore;
int movement;
ofImage en1;
ArrayList shotX;
ArrayList shotY;
ArrayList shotXLeft;
ArrayList shotYLeft;
//ArrayList shotXRight;
//ArrayList shotYRight;
ArrayList bombX;
ArrayList bombY;
ArrayList bombDir;
//ArrayList enemyX;
//ArrayList enemyY;
ArrayListEnemy enemies;
//ArrayListShot shotList;
//ArrayListShot bombs;
int shotCycle{ 0 };
ofImage background;
ofTrueTypeFont font;
//Enemy1* enemy1;
//int numEnemy1;
int enemyLeft;
public:
void setup();
void update();
void draw();
void spreadShot();
void levelSetUp();
void playLevel();
void pauseScreen();
void resetGame();
//~ofApp();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
};
| [
"davidh80@verizon.net"
] | davidh80@verizon.net |
91dd60e09d0abf3599c5069b8285f13cad72a478 | 8bf393044c4a389e19fad72bd4d19a8c4c715762 | /src/estd/port/chrono.hpp | 58ca3e81d1bc6551f1244c205b5c5d5706ddae99 | [
"Apache-2.0"
] | permissive | malachi-iot/estdlib | 0f873e1801e88dc7311777bc51c65daa4fc60ea0 | d2d47302a778c6859959c97910b73101395b7f9f | refs/heads/master | 2023-09-01T01:30:39.963167 | 2023-08-17T04:16:10 | 2023-08-17T04:16:10 | 128,429,105 | 38 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 211 | hpp | #pragma once
#include "../internal/fwd/chrono.h"
#include "../internal/chrono/duration.hpp"
#include "../internal/chrono/operators.hpp"
#include "../internal/chrono/ratio.h"
#include "../internal/chrono/math.h" | [
"malachi.burke@gmail.com"
] | malachi.burke@gmail.com |
6a29a7e4102acedd9f67c51ffe258648709dfbcb | 424f5e905916541a8a4b1ff916dec93bd06e0d63 | /sdenv2/project/framebuffer.h | 2d9abd9a5da0b5dbe0ef8073b7293009d11d9c70 | [] | no_license | sidneydijkstra/SDENV2 | 33bd4df24fad6bf64fe2763d5fa8cc6090885283 | af08f5cdce760dda867839c460635e03f4d8bd2a | refs/heads/master | 2021-01-25T09:31:39.953453 | 2019-05-18T13:27:35 | 2019-05-18T13:27:35 | 93,844,018 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,576 | h | /**
* @file framebuffer.h
*
* @brief The FrameBuffer header file.
*
* This file is part of SDENV2, a 2D/3D OpenGL framework.
*
*/
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "shader.h"
#include "color.h"
#include "sdenv2config.h"
#include "entity.h"
/**
* @brief The FrameBuffer class
*/
class FrameBuffer
{
public:
FrameBuffer(); ///< @brief Constructor of the FrameBuffer
~FrameBuffer(); ///< @brief Destructor of the FrameBuffer
/// @brief create the FrameBuffer
/// @return void
void createFrameBuffer();
/// @brief create the normal texture for the FrameBuffer
/// @param the width of the texture
/// @param the height of the texture
/// @return void
void createNormalTexture(int _width, int _height);
/// @brief create the depth texture for the FrameBuffer
/// @param the width of the texture
/// @param the height of the texture
/// @return void
void createDepthTexture(int _width, int _height);
/// @brief bind the FrameBuffer
/// @return void
void bind();
/// @brief unbind the FrameBuffer
/// @return void
void unbind();
/// @brief get the normal texture of the FrameBuffer
/// @return int
int getFrameBufferNormalTexture() { return _normalTexture; };
/// @brief get the depth texture of the FrameBuffer
/// @return int
int getFrameBufferDepthTexture() { return _depthTexture; };
/// @brief add a costum shader to the framebuffer
/// @param the location of the vertex shader
/// @param the location of the fragment shader
/// @return void
void addCostumShader(const char* vertLocation, const char* fragLocation);
/// @brief get the shader of the FrameBuffer
/// @return Shader*
Shader* shader() { return _shader; };
/// @brief add costum entitys the framebuffer whil render, remember he whil only render the entitys you give him
/// @param the entity list
/// @return void
void addRenderEntity(std::vector<Entity*> e);
/// @brief remove the costum entitys and go back to scene rendering
/// @return void
void removeRenderEntitys();
/// @brief get if this framebuffer is going to render entitys
/// @return bool
bool isRenderEntitysOnly() { return _renderEntitys; };
/// @brief get the entitys the framebuffer is going to render
/// @return std::vector<Entity*>
std::vector<Entity*> getRenderEntitys() { return _entitysToRender; };
glm::vec3 position; ///< @brief the position of the FrameBuffer
glm::vec3 rotation; ///< @brief the rotation of the FrameBuffer
glm::vec3 size; ///< @brief the size of the FrameBuffer
Color background; ///< @brief the background color of the FrameBuffer
private:
// frame buffer
unsigned int _framebuffer; ///< @brief the Framebuffer id
unsigned int _rbo; ///< @brief the Framebuffer rbo
// textures
unsigned int _normalTexture; ///< @brief the normal texture of the framebuffer
unsigned int _depthTexture; ///< @brief the depth texture of the framebuffer
// shaders
Shader* _shader; ///< @brief the shader of the framebuffer
const GLchar* _vertShader; ///< @brief the vertex shader of the framebuffer
const GLchar* _fragShader; ///< @brief the fragment shader of the framebuffer
std::vector<Entity*> _entitysToRender; ///< @brief the list of costum render entitys of the framebuffer
bool _renderEntitys; ///< @brief the bool that stores if this framebuffer uses costum entitys
};
#endif /* end framebuffer */ | [
"sidney dijkstra"
] | sidney dijkstra |
0a5aa51f453409be1fcf9c304a56a3f977fbb602 | 966c55ba7cd0928019bd64dc31c8f3213ca2d7b5 | /c++_primer_4th/chapter05_expressions/bitwise_operators.cpp | 84f01e1f771093e0971cbbfb4d6f8aa2f34dfdef | [] | no_license | unkown571/learning | 851c458756202596d28c2703898f315f338ee75a | 3a8d6defbf41e9763a6ca41c339c8bdaf12051b3 | refs/heads/master | 2021-05-26T17:22:38.531723 | 2012-09-09T07:59:07 | 2012-09-09T07:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,795 | cpp | /*
* =====================================================================================
*
* Filename: bitwise_operators.cpp
*
* Description: bitwise operators in c++
*
* Version: 1.0
* Created: 02/10/2012 03:40:03 PM
* Revision: none
* Compiler: gcc
*
* Author: zhangliancheng (zlc), zlc@bupt.edu.cn
* Company: IPOC of BUPT http://zhangliancheng.com
*
* =====================================================================================
*/
#include <iostream>
#include <bitset>
using std::cout;
using std::endl;
using std::bitset;
size_t get_size()
{
return 0;
}
int main()
{
/*
* The bitwise operators take operands of integral type, these
* operators can also be applied to bitset operands with the
* behaviour as described for integral operands.
*
* operation function usage
* ~ bitwise NOT ~expr
* << left shift expr1 << expr2
* >> right shift expr1 >> expr2
* & bitwise AND expr1 & expr2
* ^ bitwise XOR expr1 ^ expr2
* | bitwise OR expr1 | expr2
*
* The type of an integer manipulated by the bitwise operators can
* be either signed or unsigned.
*/
// If the operand is signed and its value is negative, how the sign
// bit is handled is machine-dependent. Therefore, we strongly reco
// mmend using an unsigned type when using an integral value with
// the bitwise operators.
/*
* It is a common error to confuse the bitwise AND operator (&) with
* the logical AND operator (&&), similarly, it is common to confuse
* the bitwise OR operator (|) and the logical OR operator (||).
*/
unsigned char bits = 0227;
bitset<8> bs(bits);
cout << "bits: " << bs << endl;
bits = ~bits;
bs = bits;
cout << "~bits: " << bs << endl;
bits = 1;
bs = bits << 1;
cout << "bits << 1: " << bs << endl;
bs = bits << 2;
cout << "bits << 2: " << bs << endl;
bs = bits >> 3;
cout << "bits >> 3: " << bs << endl;
/*
* In general, the library bitset operations are more direct,
* easier to read, easier to write, and more likely to be used
* correctly. Moreover, the size of a bitset is not limited by
* the number of bist in unsigned. Ordinarily, bitset should be
* used in preferce to lower-level direct bit manipulation of
* integral values.
*/
bitset<30> bitset_quiz1; // bitset solution
unsigned long int_quiz1 = 0; // simulated collection of bits
bitset_quiz1.set(27); // indicate student number 27 passed
int_quiz1 |= 1UL << 27; // indicate student number 27 passed
bitset_quiz1.reset(27); // student number 27 failed
int_quiz1 &= ~(1UL << 27); // student number 27 failed
bool status;
status = bitset_quiz1[27]; // how did student 27 do ?
status = int_quiz1 & (1UL << 27); // how did student 27 do ?
return 0;
}
| [
"me@zhangliancheng.com"
] | me@zhangliancheng.com |
2e90c41bc25137083c9697a6937dd86a34238184 | 1f5406714cfd2ebaa91578247e5bd27375738bf4 | /src/Shader.h | dd2cf1b77c2f88357380002f0851537dac14fe5b | [] | no_license | stransky/opengl_test | 09dc31e885c4d87a364868d08ae382dc5127466c | 5d5184159d2e2b6a4faa7a3150bad9514ae763e7 | refs/heads/master | 2020-08-06T13:17:09.839550 | 2019-10-04T22:28:19 | 2019-10-04T22:28:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 851 | h | #pragma once
#include <string>
#include <unordered_map>
struct ShaderProgramSource {
std::string VertexSource;
std::string FragmentSource;
};
class Shader
{
private:
unsigned int m_RendererID;
std::unordered_map<std::string, int> m_UniformLocationCache;
public:
Shader (const std::string &filepath);
~Shader();
void Bind() const;
void Unbind() const;
void SetUniform1i(const std::string &name, int value);
void SetUniform4f(const std::string &name, float v0, float v1, float v2, float v3);
private:
ShaderProgramSource ParseShader(const std::string &filepath);
unsigned int CompileShader(unsigned int type, const std::string& shader_source);
unsigned int CreateShader(const std::string &vertexShader, const std::string &fragmentShader);
int GetUniformLocation(const std::string &name);
}; | [
"tomask@dhcp-233-238.eduroam.muni.cz"
] | tomask@dhcp-233-238.eduroam.muni.cz |
5cbef22a41ddd8321a1066a1237efc8eea2ae55b | 41189993d1389dabc3d1d8a563c8f9327f31e008 | /C-LinkedLists-Worksheet/twodigitLinkedList.cpp | d5ebe01ded6d83b0ef5d245cd4bd28c2297ebc41 | [] | no_license | RaviTejaKomma/learn-c-programming | d445e6f015b823781f833464f6b22e717d832d3c | 1793213a89a04f6fee459d2fe5c688571ab7d9fe | refs/heads/master | 2023-03-23T08:59:21.500253 | 2021-03-06T15:59:21 | 2021-03-06T15:59:21 | 345,133,585 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | cpp | /*
OVERVIEW: Given a single linked list (two digits as a node).Convert that to number
INPUTS: SLL head pointer
OUTPUT: Create a number from the linked list given ,In each node there are two numbers ,digit1 and digit1 ,
So if the nodes are 12->34->56->78 , Final number would be 12345678 ( Integer)
ERROR CASES:
NOTES: Only Postive Numbers
*/
#include <stdio.h>
#include <malloc.h>
struct node {
int digit1;
int digit2;
struct node *next;
};
int convert_sll_2digit_to_int(struct node *head)
{
int result = 0;
while (head != NULL)
{
if (head->digit1 < 0 || head->digit2 < 0)
{
return NULL;
}
result = result * 10 + head->digit1;
result = result * 10 + head->digit2;
head = head->next;
}
return result;
}
| [
"ravieee929374s@gmail.com"
] | ravieee929374s@gmail.com |
8bd6dc6951345102887780245629a9c066eadf22 | cbc5f24153176f61203f103ece75f1db40a6fe5d | /ST.cpp | 3aa1822f19e01bba5241ee6f24b566489bc7a25b | [] | no_license | nwant/cs4280 | ccb8e7314aae0c93b73ddce335fc3b3893895bca | 1de0cadd6f6d0b7badff0d600ace3b88c478eeba | refs/heads/master | 2021-06-17T11:06:54.159490 | 2017-06-18T16:05:46 | 2017-06-18T16:05:46 | 94,697,898 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,063 | cpp | /* Nathaniel Want (nwqk6)
* CS4280-E02
* P4
* 5/9/2017
* -----------
* ST.cpp
* --------
* Contains the implementation for the symbol table
*/
#include <string>
#include <vector>
#include "ST.h"
#include "token.h"
using namespace std;
ST::ST() { }
/**ST::insert
*------------
* insert a token into the symbol table
*
* inputs:
* tk......the token to insert
*/
void ST::insert(token_t tk) {
this->table.push_back(tk);
}
/**ST::verify
*------------
* verify a token is in the symbol table
*
* inputs:
* tk......the token to verify
*
* returns true when the token is in the symbol table, else false
*/
bool ST::verify(token_t tk) {
for (int i=0; i < this->table.size(); i++)
if (this->table.at(i).tokenID == tk.tokenID && this->table.at(i).tokenInstance == tk.tokenInstance)
return true;
return false;
}
/**ST::getTokens
*------------
* get all of the tokens in the symbol table
*
* returns all of the tokens in the symbol table
*/
vector<token_t> ST::getTokens() {
vector<token_t> tokens(this->table);
return tokens;
}
| [
"nathan@DeLorean.localdomain"
] | nathan@DeLorean.localdomain |
13796198c87f6768bdc1f3b3230ed4e027add0eb | a270d3263768ef1735d9fff9d8b9df4a13b09751 | /wireless_charger/wireless_charger.cpp | 6fccc17dc6aa76d0b61a6d3c9beab5df568757b0 | [] | no_license | mcdaniel13/samsung_programming_mock_test | c0750fe0a94b52c5078a9ab372443f75bed05a04 | 9df1d1234c579c9e53189478f87905463adde242 | refs/heads/master | 2020-04-27T02:01:41.157372 | 2019-04-11T07:36:18 | 2019-04-11T07:36:18 | 173,982,032 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,011 | cpp | /*
* https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWXRDL1aeugDFAUo
*/
#include <iostream>
using namespace std;
const int NMAX = 10;
const int MMAX = 101;
const int AMAX = 9;
int m, a;
int moving[5][2] = {{0, 0}, {0, -1}, {1, 0}, {0, 1}, {-1, 0}};
int arr[NMAX][NMAX][2];
int isOccupied[AMAX];
int charger[AMAX];
int userA[MMAX];
int userB[MMAX];
int chargerX;
int chargerY;
int chargerRange;
int aTotalCount;
int bTotalCount;
void print() {
cout << " ==== first ==== " << endl;
for(int i = 0; i < NMAX; i++) {
for(int j = 0; j < NMAX; j++) {
cout << arr[i][j][0] << " ";
}
cout << endl;
}
cout << " ==== second ==== " << endl;
for(int i = 0; i < NMAX; i++) {
for(int j = 0; j < NMAX; j++) {
cout << arr[i][j][1] << " ";
}
cout << endl;
}
}
int solve() {
aTotalCount = 0;
bTotalCount = 0;
int aCurX = 0; // inner
int aCurY = 0; // outer
int bCurX = 9; // inner
int bCurY = 9; // outer
int aCurCount;
int bCurCount;
for(int i = 0; i <= m; i++) {
// cout << " ===== round " << i << " ===== " << endl;
aCurX += moving[userA[i]][0];
aCurY += moving[userA[i]][1];
bCurX += moving[userB[i]][0];
bCurY += moving[userB[i]][1];
// cout << "[A] (" << aCurX << ", " << aCurY << ")" << endl;
// cout << "[B] (" << bCurX << ", " << bCurY << ")" << endl;
if(arr[aCurY][aCurX][0] != 0) {
isOccupied[arr[aCurY][aCurX][0]] = true;
}
aCurCount = charger[arr[aCurY][aCurX][0]];
if(isOccupied[arr[bCurY][bCurX][0]]) {
/* 주의: if(arr[bCurY][bCurX][1] == 0) 이 아니라 충전기 값 비교 해야함 */
if(charger[arr[bCurY][bCurX][1]] < charger[arr[aCurY][aCurX][1]]) {
aCurCount = charger[arr[aCurY][aCurX][1]];
bCurCount = charger[arr[bCurY][bCurX][0]];
} else {
bCurCount = charger[arr[bCurY][bCurX][1]];
}
} else {
bCurCount = charger[arr[bCurY][bCurX][0]];
}
// cout << "[A] charger = " << aCurCount << endl;
// cout << "[B] charger = " << bCurCount << endl;
aTotalCount += aCurCount;
bTotalCount += bCurCount;
isOccupied[arr[aCurY][aCurX][0]] = false;
}
return aTotalCount + bTotalCount;
}
void setRange(int start, int end, int curY, int chargerNum) {
if(start > end || curY < 0 || curY >= NMAX)
return;
for(int i = start; i <= end; i++) {
if(i >= 0 && i < NMAX) {
if(charger[arr[curY][i][0]] < charger[chargerNum]) {
arr[curY][i][1] = arr[curY][i][0];
arr[curY][i][0] = chargerNum;
} else if (charger[arr[curY][i][1]] < charger[chargerNum]) {
arr[curY][i][1] = chargerNum;
}
}
}
if(curY >= chargerY - 1) {
setRange(start + 1, end - 1, curY + 1, chargerNum);
}
if(curY <= chargerY - 1) {
setRange(start + 1, end - 1, curY - 1, chargerNum);
}
}
int main() {
int t;
cin >> t;
for(int i = 0; i < t; i++) {
for(int j = 0; j < NMAX; j++) {
for(int k = 0; k < NMAX; k++) {
arr[j][k][0] = 0;
arr[j][k][1] = 0;
}
}
cin >> m >> a;
userA[0] = 0;
for(int j = 1; j <= m; j++) {
cin >> userA[j];
}
userB[0] = 0;
for(int j = 1; j <= m; j++) {
cin >> userB[j];
}
isOccupied[0] = false;
charger[0] = 0;
for(int j = 1; j <= a; j++) {
cin >> chargerX >> chargerY >> chargerRange >> charger[j];
setRange(chargerX - 1 - chargerRange, chargerX - 1 + chargerRange, chargerY - 1, j);
isOccupied[j] = false;
}
//print();
cout << "#" << i + 1 << " " << solve() << endl;
}
} | [
"whansrl92@gmail.com"
] | whansrl92@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.