blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
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 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a502b3f55fb813e2adc4101111f45d5411ea1e42 | 5af910371e4763fe4d1d9519fec12c0e2ad14188 | /class/herramientas_proyecto/tabla_sprites.cpp | d6297624cc1094db1a208d48f555ef1d545a0bd8 | [
"Unlicense"
] | permissive | TheMarlboroMan/recomposed-platformer | c329c2b7ab04939c89b9c2d9a1851a29f0f099a9 | 2b2e2a7a659e1571dedbadf981fc1707be72b4b2 | refs/heads/master | 2022-10-04T09:38:33.400114 | 2022-09-13T07:27:28 | 2022-09-13T07:27:28 | 119,906,270 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,387 | cpp | #include "tabla_sprites.h"
#include <class/lector_txt.h>
#include <source/string_utilidades.h>
Tabla_sprites::Tabla_sprites(const std::string& ruta)
{
cargar(ruta);
}
Tabla_sprites::Tabla_sprites()
{
}
const Frame_sprites& Tabla_sprites::obtener(unsigned int indice) const
{
return mapa.at(indice);
}
Frame_sprites Tabla_sprites::obtener(unsigned int indice)
{
if(mapa.count(indice)) return mapa[indice];
else return Frame_sprites();
}
void Tabla_sprites::cargar(const std::string& ruta)
{
Herramientas_proyecto::Lector_txt L(ruta, '#');
if(!L)
{
LOG<<"ERROR: Para Tabla_sprites no se ha podido abrir el archivo "<<ruta<<std::endl;
}
else
{
std::string linea;
const char separador='\t';
while(true)
{
linea=L.leer_linea();
if(!L) break;
std::vector<std::string> valores=Herramientas_proyecto::explotar(linea, separador);
if(valores.size()==7)
{
Frame_sprites f;
unsigned int indice=std::atoi(valores[0].c_str());
f.x=std::atoi(valores[1].c_str());
f.y=std::atoi(valores[2].c_str());
f.w=std::atoi(valores[3].c_str());
f.h=std::atoi(valores[4].c_str());
f.desp_x=std::atoi(valores[5].c_str());
f.desp_y=std::atoi(valores[6].c_str());
mapa[indice]=f;
}
else
{
LOG<<"ERROR: En tabla sprites, la línea "<<L.obtener_numero_linea()<<" no está bien formada. Ignorando"<<std::endl;
}
}
}
}
| [
"[email protected]"
] | |
45bc42cf40087e23e86ecb976d4190b9e551397b | b951d03be7c20bd4d9d923bbf6cc551e8a074f37 | /display/concrete/DataIndexWrapperDisplay.h | 81e4c56d1da263ba2eb755a8ba2b0dff46aef45e | [
"BSD-3-Clause"
] | permissive | michaelmurphybrown/MinVR2 | 1cefd97fa014ed6a1f81d6200cc637b3aa64758e | 517c8a345efebb068f298cba02b6b799634135a8 | refs/heads/master | 2021-01-15T16:04:30.870858 | 2016-03-01T23:12:29 | 2016-03-01T23:12:29 | 51,666,198 | 0 | 0 | null | 2016-03-01T23:12:50 | 2016-02-13T21:15:27 | C++ | UTF-8 | C++ | false | false | 857 | h | /*
* Copyright Regents of the University of Minnesota, 2016. This software is released under the following license: http://opensource.org/licenses/GPL-2.0
* Source code originally developed at the University of Minnesota Interactive Visualization Lab (http://ivlab.cs.umn.edu).
*
* Code author(s):
* Dan Orban (dtorban)
*/
#ifndef DATAINDEXWRAPPERDISPLAY_H_
#define DATAINDEXWRAPPERDISPLAY_H_
#include "display/concrete/BaseDisplayDevice.h"
namespace MinVR {
class DataIndexWrapperDisplay : public BaseDisplayDevice {
public:
DataIndexWrapperDisplay(VRDisplayDevice* device, VRDataIndex* index);
virtual ~DataIndexWrapperDisplay();
void finishRendering();
protected:
void startRendering(const VRRenderer& renderer, VRRenderState& state);
private:
VRDataIndex* index;
};
} /* namespace MinVR */
#endif /* DATAINDEXWRAPPERDISPLAY_H_ */
| [
"[email protected]"
] | |
0b1f4ff8b872db93f5c0bc97a85a61ac35f6a430 | c629cdda40748f35341e9da53faa210c90b21f89 | /src/batteries/seq/inner_reduce.hpp | fc8c7988cd61ecf5cea7cbbd15e9b667599abd02 | [
"Apache-2.0"
] | permissive | tonyastolfi/batteries | e2c9b590e620b78e03449893206ac79900d340a1 | acea1f4e10e9f7fbf97c3ab3cf30766b19130ece | refs/heads/main | 2023-08-20T01:56:24.076281 | 2023-02-06T19:32:33 | 2023-02-06T19:32:33 | 228,197,783 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,216 | hpp | //######=###=##=#=#=#=#=#==#==#====#+==#+==============+==+==+==+=+==+=+=+=+=+=+=+
// Copyright 2022 Anthony Paul Astolfi
//
#pragma once
#ifndef BATTERIES_SEQ_INNER_REDUCE_HPP
#define BATTERIES_SEQ_INNER_REDUCE_HPP
#include <batteries/config.hpp>
//
#include <batteries/optional.hpp>
#include <batteries/seq/reduce.hpp>
#include <batteries/seq/seq_item.hpp>
#include <batteries/utility.hpp>
#include <type_traits>
#include <utility>
namespace batt {
namespace seq {
//==#==========+==+=+=++=+++++++++++-+-+--+----- --- -- - - - -
// inner_reduce
//
template <typename ReduceFn>
struct InnerReduceBinder {
ReduceFn reduce_fn;
};
template <typename ReduceFn>
InnerReduceBinder<ReduceFn> inner_reduce(ReduceFn&& reduce_fn)
{
return {BATT_FORWARD(reduce_fn)};
}
template <typename Seq, typename ReduceFn>
[[nodiscard]] Optional<std::decay_t<SeqItem<Seq>>> operator|(Seq&& seq, InnerReduceBinder<ReduceFn> binder)
{
Optional<std::decay_t<SeqItem<Seq>>> state = seq.next();
if (!state) {
return state;
}
return BATT_FORWARD(seq) | reduce(std::move(*state), BATT_FORWARD(binder.reduce_fn));
}
} // namespace seq
} // namespace batt
#endif // BATTERIES_SEQ_INNER_REDUCE_HPP
| [
"[email protected]"
] | |
c07cd4c2c9892bd063008cf87358bb9169c44474 | 794cc446d2e70c6bcdc64309fe65dd8714c9f53b | /agent.cpp | 634a41dbe2f0c5d2e0476f7d330dde5336e7a69b | [] | no_license | mlebre/Boids-Project | b144878356550c409e3cfa93ff05c8825816e59a | eea6bfaccb7ccc5253cb23eddcbc1b4bfe9f245a | refs/heads/master | 2021-01-23T09:28:02.324661 | 2015-01-16T12:06:34 | 2015-01-16T12:06:34 | 28,633,564 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,177 | cpp | //*******************************************************************
// Agent
//*******************************************************************
//===================================================================
// Librairies & Project Files
//===================================================================
#include "agent.h"
//-------------------------------------------------------------------
// Definiton of static attributes
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Constructors
//-------------------------------------------------------------------
agent::agent(void)
{
speed=NULL;
xposition=0;
yposition=0;
r=0;
nb_agents=0;
}
agent::agent(double W, double H, unsigned int size)
{
srandom(time(NULL));
unsigned int i;
speed=new double [8*size];
for(i=0; i<4*size; i++)
{
speed[i]=0;
}
new_speed= new double [2*size];
for(i=0; i<4*size; i++)
{
new_speed[i]=0;
}
xposition=W*(random()/(RAND_MAX + 1.0));
yposition=H*(random()/(RAND_MAX + 1.0));
r=10;
nb_agents=size;
}
//-------------------------------------------------------------------
// Destructors
//-------------------------------------------------------------------
agent::~agent(void)
{
}
//-------------------------------------------------------------------
// Public methods
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Protected methods
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Private methods
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Non inline accesors
//-------------------------------------------------------------------
| [
"[email protected]"
] | |
ddbd53f3ea1c54ba6738df6969de6571c11c15b1 | 8d3232994e1b26a78159dd979c0dbd1379bfd3f9 | /source/extensions/filters/network/zookeeper_proxy/zookeeper_utils.h | 559ef0f63093d0aed714f27f9c86f093a4c67a06 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | theopenlab/envoy | f18f492634da9996e870d28774546e43d49982ca | 3f4e4722aaaa0dd9ad43a058da9ccad9019f988a | refs/heads/master | 2020-05-07T17:24:33.002380 | 2019-07-01T08:57:15 | 2019-07-01T08:57:15 | 180,726,774 | 0 | 0 | Apache-2.0 | 2019-07-03T01:50:56 | 2019-04-11T06:15:27 | C++ | UTF-8 | C++ | false | false | 1,300 | h | #pragma once
#include <cstdint>
#include "envoy/common/platform.h"
#include "common/buffer/buffer_impl.h"
#include "common/common/byte_order.h"
#include "common/common/logger.h"
namespace Envoy {
namespace Extensions {
namespace NetworkFilters {
namespace ZooKeeperProxy {
/**
* Helper for extracting ZooKeeper data from a buffer.
*
* If at any point a peek is tried beyond max_len, an EnvoyException
* will be thrown. This is important to protect Envoy against malformed
* requests (e.g.: when the declared and actual length don't match).
*
* Note: ZooKeeper's protocol uses network byte ordering (big-endian).
*/
class BufferHelper : public Logger::Loggable<Logger::Id::filter> {
public:
BufferHelper(uint32_t max_len) : max_len_(max_len) {}
int32_t peekInt32(Buffer::Instance& buffer, uint64_t& offset);
int64_t peekInt64(Buffer::Instance& buffer, uint64_t& offset);
std::string peekString(Buffer::Instance& buffer, uint64_t& offset);
bool peekBool(Buffer::Instance& buffer, uint64_t& offset);
void skip(uint32_t len, uint64_t& offset);
void reset() { current_ = 0; }
private:
void ensureMaxLen(uint32_t size);
uint32_t max_len_;
uint32_t current_{};
};
} // namespace ZooKeeperProxy
} // namespace NetworkFilters
} // namespace Extensions
} // namespace Envoy
| [
"[email protected]"
] | |
06424472a9ebe958df3a1a176cf5d4a168b3d4ac | df79ac6d682789aa9042b58981559e032fe17ad0 | /CF(Code Forces)/cf7.cpp | 415017025f45b26cdb2c693ad33689dbd5bf1e2c | [] | no_license | abnsl0014/Coding-Questions | 834516e25312fb170b4b4fcf7ff83a4a2df7dd9f | 45973b56698d40612956b95ad10498850fe9aaa8 | refs/heads/master | 2020-05-15T01:56:00.299033 | 2020-05-07T10:36:02 | 2020-05-07T10:36:02 | 182,039,113 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 684 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int ch=0,ce=0,cl=0,cll=0,co=0;
cin>>s;
for(int i=0;i<s.size();i++)
{
if(s[i]=='h'&& ch==0)
{
ch++;
}
else if(s[i]=='e'&&ch!=0&&ce==0)
{
ce++;
}
else if(s[i]=='l'&&cl==0&&ce!=0&&ch!=0)
{
cl++;
}
else if(s[i]=='l'&&cll==0&&ce!=0&&ch!=0&&cl!=0)
{
cll++;
}
else if(s[i]=='o'&&co==0&&ce!=0&&ch!=0&&cl!=0&&cll!=0)
{
co++;
}
}
if(ch==1&&ce==1&&cl==1&&cll==1&&co==1)
{
cout<<"YES\n";
}
else{
cout<<"NO\n";
}
}
| [
"[email protected]"
] | |
909b4559ac9796d88a1f75cedc016111ac22ed2a | 5ef9c03f47708bd0dc95d76a53369e51c5617944 | /lib-h3/lib-spiflashstore/src/spiflashstore.cpp | 31e4dc36644243aecfc15fd179936607980a2628 | [
"MIT"
] | permissive | hermixy/allwinner-bare-metal | 87dcc033884b990609669559428d7e35e191afa6 | ea55715ac31942d7af3a6babba29514c8a2f0d49 | refs/heads/master | 2023-09-02T08:21:25.074808 | 2021-10-12T09:57:52 | 2021-10-12T09:57:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,490 | cpp | /**
* @file spiflashstore.cpp
*
*/
/* Copyright (C) 2018-2020 by Arjan van Vught mailto:[email protected]
*
* 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 <stdint.h>
#include <stdio.h>
#include <cassert>
#include "spiflashstore.h"
#include "spi_flash.h"
#ifndef NDEBUG
# include "hardware.h"
#endif
#include "debug.h"
using namespace spiflashstore;
static constexpr uint8_t s_aSignature[] = {'A', 'v', 'V', 0x10};
static constexpr auto OFFSET_STORES = ((((sizeof(s_aSignature) + 15) / 16) * 16) + 16); // +16 is reserved for UUID
static constexpr uint32_t s_aStorSize[static_cast<uint32_t>(Store::LAST)] = {96, 144, 32, 64, 96, 64, 32, 32, 480, 64, 32, 96, 48, 32, 944, 48, 64, 32, 96, 32, 1024, 32, 32, 64, 96, 32, 32};
#ifndef NDEBUG
static constexpr char s_aStoreName[static_cast<uint32_t>(Store::LAST)][16] = {"Network", "Art-Net3", "DMX", "WS28xx", "E1.31", "LTC", "MIDI", "Art-Net4", "OSC Server", "TLC59711", "USB Pro", "RDM Device", "RConfig", "TCNet", "OSC Client", "Display", "LTC Display", "Monitor", "SparkFun", "Slush", "Motors", "Show", "Serial", "RDM Sensors", "RDM SubDevices", "GPS", "RGB Panel"};
#endif
SpiFlashStore *SpiFlashStore::s_pThis = nullptr;
SpiFlashStore::SpiFlashStore() {
DEBUG_ENTRY
assert(s_pThis == nullptr);
s_pThis = this;
if (spi_flash_probe(0, 0, 0) < 0) {
DEBUG_PUTS("No SPI flash chip");
} else {
printf("Detected %s with sector size %d total %d bytes\n", spi_flash_get_name(), spi_flash_get_sector_size(), spi_flash_get_size());
m_bHaveFlashChip = Init();
}
if (m_bHaveFlashChip) {
m_nSpiFlashStoreSize = OFFSET_STORES;
for (uint32_t j = 0; j < static_cast<uint32_t>(Store::LAST); j++) {
m_nSpiFlashStoreSize += s_aStorSize[j];
}
DEBUG_PRINTF("OFFSET_STORES=%d", static_cast<int>(OFFSET_STORES));
DEBUG_PRINTF("m_nSpiFlashStoreSize=%d", m_nSpiFlashStoreSize);
assert(m_nSpiFlashStoreSize <= FlashStore::SIZE);
Dump();
}
DEBUG_EXIT
}
SpiFlashStore::~SpiFlashStore() {
DEBUG_ENTRY
while (Flash())
;
DEBUG_EXIT
}
bool SpiFlashStore::Init() {
const uint32_t nEraseSize = spi_flash_get_sector_size();
assert(FlashStore::SIZE == nEraseSize);
if (FlashStore::SIZE != nEraseSize) {
return false;
}
m_nStartAddress = spi_flash_get_size() - nEraseSize;
assert(!(m_nStartAddress % nEraseSize));
if (m_nStartAddress % nEraseSize) {
return false;
}
spi_flash_cmd_read_fast(m_nStartAddress, FlashStore::SIZE, &m_aSpiFlashData);
bool bSignatureOK = true;
for (uint32_t i = 0; i < sizeof(s_aSignature); i++) {
if (s_aSignature[i] != m_aSpiFlashData[i]) {
m_aSpiFlashData[i] = s_aSignature[i];
bSignatureOK = false;
}
}
if (__builtin_expect(!bSignatureOK, 0)) {
DEBUG_PUTS("No signature");
m_bIsNew = true;
// Clear nSetList
for (uint32_t j = 0; j < static_cast<uint32_t>(Store::LAST); j++) {
const uint32_t nOffset = GetStoreOffset(static_cast<Store>(j));
uint32_t k = nOffset;
m_aSpiFlashData[k++] = 0x00;
m_aSpiFlashData[k++] = 0x00;
m_aSpiFlashData[k++] = 0x00;
m_aSpiFlashData[k++] = 0x00;
// Clear rest of data
for (; k < nOffset + s_aStorSize[j]; k++) {
m_aSpiFlashData[k] = 0xFF;
}
}
m_tState = State::CHANGED;
return true;
}
for (uint32_t j = 0; j < static_cast<uint32_t>(Store::LAST); j++) {
auto *pbSetList = &m_aSpiFlashData[GetStoreOffset(static_cast<Store>(j))];
if ((pbSetList[0] == 0xFF) && (pbSetList[1] == 0xFF) && (pbSetList[2] == 0xFF) && (pbSetList[3] == 0xFF)) {
DEBUG_PRINTF("[%s]: nSetList \'FF...FF\'", s_aStoreName[j]);
// Clear bSetList
*pbSetList++ = 0x00;
*pbSetList++ = 0x00;
*pbSetList++ = 0x00;
*pbSetList = 0x00;
m_tState = State::CHANGED;
}
}
return true;
}
uint32_t SpiFlashStore::GetStoreOffset(Store tStore) {
assert(tStore < Store::LAST);
uint32_t nOffset = OFFSET_STORES;
for (uint32_t i = 0; i < static_cast<uint32_t>(tStore); i++) {
nOffset += s_aStorSize[i];
}
DEBUG_PRINTF("nOffset=%d", nOffset);
return nOffset;
}
void SpiFlashStore::ResetSetList(Store tStore) {
assert(tStore < Store::LAST);
uint8_t *pbSetList = &m_aSpiFlashData[GetStoreOffset(tStore)];
// Clear bSetList
*pbSetList++ = 0x00;
*pbSetList++ = 0x00;
*pbSetList++ = 0x00;
*pbSetList = 0x00;
m_tState = State::CHANGED;
}
void SpiFlashStore::Update(Store tStore, uint32_t nOffset, const void *pData, uint32_t nDataLength, uint32_t nSetList, uint32_t nOffsetSetList) {
DEBUG1_ENTRY
if (__builtin_expect((!m_bHaveFlashChip),0)) {
return;
}
DEBUG_PRINTF("[%s]:%u:%p, nOffset=%d, nDataLength=%d-%u, bSetList=0x%x, nOffsetSetList=%d", s_aStoreName[static_cast<uint32_t>(tStore)], static_cast<uint32_t>(tStore), pData, nOffset, nDataLength, static_cast<uint32_t>(m_tState), nSetList, nOffsetSetList);
assert(tStore < Store::LAST);
assert(pData != nullptr);
assert((nOffset + nDataLength) <= s_aStorSize[static_cast<uint32_t>(tStore)]);
debug_dump(const_cast<void*>(pData), nDataLength);
bool bIsChanged = false;
const uint32_t nBase = nOffset + GetStoreOffset(tStore);
const auto *pSrc = static_cast<const uint8_t*>(pData);
auto *pDst = &m_aSpiFlashData[nBase];
for (uint32_t i = 0; i < nDataLength; i++) {
if (*pSrc != *pDst) {
bIsChanged = true;
*pDst = *pSrc;
}
pDst++;
pSrc++;
}
if (bIsChanged && (m_tState != State::ERASED)) {
m_tState = State::CHANGED;
}
if ((0 != nOffset) && (bIsChanged) && (nSetList != 0)) {
auto *pSet = reinterpret_cast<uint32_t*>((&m_aSpiFlashData[GetStoreOffset(tStore)] + nOffsetSetList));
*pSet |= nSetList;
}
DEBUG_PRINTF("m_tState=%u", static_cast<uint32_t>(m_tState));
DEBUG1_EXIT
}
void SpiFlashStore::Copy(Store tStore, void *pData, uint32_t nDataLength, uint32_t nOffset) {
DEBUG1_ENTRY
if (__builtin_expect((!m_bHaveFlashChip), 0)) {
DEBUG1_EXIT
return;
}
assert(tStore < Store::LAST);
assert(pData != nullptr);
assert((nDataLength + nOffset) <= s_aStorSize[static_cast<uint32_t>(tStore)]);
const auto *pSet = reinterpret_cast<uint32_t*>((&m_aSpiFlashData[GetStoreOffset(tStore)] + nOffset));
DEBUG_PRINTF("*pSet=0x%x", reinterpret_cast<uint32_t>(*pSet));
if ((__builtin_expect((m_bIsNew), 0)) || (__builtin_expect((*pSet == 0), 0))) {
Update(tStore, nOffset, pData, nDataLength);
DEBUG1_EXIT
return;
}
const auto *pSrc = const_cast<const uint8_t*>(&m_aSpiFlashData[GetStoreOffset(tStore)]) + nOffset;
auto *pDst = static_cast<uint8_t*>(pData);
for (uint32_t i = 0; i < nDataLength; i++) {
*pDst++ = *pSrc++;
}
DEBUG1_EXIT
}
void SpiFlashStore::CopyTo(Store tStore, void* pData, uint32_t& nDataLength) {
DEBUG1_ENTRY
if (__builtin_expect((tStore >= Store::LAST), 0)) {
nDataLength = 0;
return;
}
nDataLength = s_aStorSize[static_cast<uint32_t>(tStore)];
const auto *pSrc = const_cast<const uint8_t*>(&m_aSpiFlashData[GetStoreOffset(tStore)]);
auto *pDst = static_cast<uint8_t*>(pData);
for (uint32_t i = 0; i < nDataLength; i++) {
*pDst++ = *pSrc++;
}
DEBUG1_EXIT
}
bool SpiFlashStore::Flash() {
if (__builtin_expect((m_tState == State::IDLE), 1)) {
return false;
}
DEBUG_PRINTF("m_tState=%d", static_cast<uint32_t>(m_tState));
assert(m_nStartAddress != 0);
if (m_nStartAddress == 0) {
printf("!*! m_nStartAddress == 0 !*!\n");
return false;
}
switch (m_tState) {
case State::CHANGED:
spi_flash_cmd_erase(m_nStartAddress, FlashStore::SIZE);
m_tState = State::ERASED;
return true;
break;
case State::ERASED:
spi_flash_cmd_write_multi(m_nStartAddress, m_nSpiFlashStoreSize, &m_aSpiFlashData);
m_tState = State::IDLE;
break;
default:
break;
}
#ifndef NDEBUG
Dump();
#endif
return false;
}
void SpiFlashStore::Dump() {
#ifndef NDEBUG
if (__builtin_expect((!m_bHaveFlashChip), 0)) {
return;
}
const auto IsWatchDog = Hardware::Get()->IsWatchdog();
if (IsWatchDog) {
Hardware::Get()->WatchdogStop();
}
debug_dump(m_aSpiFlashData, OFFSET_STORES);
printf("\n");
for (uint32_t j = 0; j < static_cast<uint32_t>(Store::LAST); j++) {
printf("Store [%s]:%d\n", s_aStoreName[j], j);
auto *p = &m_aSpiFlashData[GetStoreOffset(static_cast<Store>(j))];
debug_dump(p, s_aStorSize[j]);
printf("\n");
}
if (IsWatchDog) {
Hardware::Get()->WatchdogInit();
}
printf("m_tState=%d\n", static_cast<uint32_t>(m_tState));
#endif
}
| [
"[email protected]"
] | |
bf5874f6bcd66d6c0fce37988bbf33da5b0700f0 | 9ead5fcc5efaf7a73c4c585d813c1cddcb89666d | /m5/src/base/fifo_buffer.hh | f6205330bd6179a862fcf72d5817cbe90f8def0a | [
"BSD-3-Clause"
] | permissive | x10an14/tdt4260Group | b539b6271c8f01f80a9f75249779fb277fa521a4 | 1c4dc24acac3fe6df749e0f41f4d7ab69f443514 | refs/heads/master | 2016-09-06T02:48:04.929661 | 2014-04-08T10:40:22 | 2014-04-08T10:40:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,707 | hh | /*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Steve Raasch
* Nathan Binkert
*/
#ifndef __FIFO_BUFFER_HH__
#define __FIFO_BUFFER_HH__
#include "base/res_list.hh"
//
// The FifoBuffer requires only that the objects to be used have a default
// constructor and a dump() method
//
template<class T>
class FifoBuffer
{
public:
typedef typename res_list<T>::iterator iterator;
private:
res_list<T> *buffer;
unsigned size;
public:
FifoBuffer(unsigned sz)
{
buffer = new res_list<T>(sz, true, 0);
size = sz;
}
void add(T &item)
{
assert(buffer->num_free() > 0);
buffer->add_head(item);
}
iterator head() { return buffer->head(); }
iterator tail() { return buffer->tail(); }
unsigned count() {return buffer->count();}
unsigned free_slots() {return buffer->num_free();}
T *peek() { return (count() > 0) ? tail().data_ptr() : 0; }
T remove()
{
assert(buffer->count() > 0);
T rval = *buffer->tail();
buffer->remove_tail();
return rval;
}
void dump();
~FifoBuffer() { delete buffer; }
};
#endif
| [
"[email protected]"
] | |
4acbaa2dc3badb44d91279e715c55f0dc4e8199b | afdc82729b1ae1e1a11fc0d63d4990a7972a9fd6 | /mace/ops/arm/base/deconv_2d_2x2.cc | faa06666fb70976b5cdb604ff16cbcd5234bdc39 | [
"Apache-2.0"
] | permissive | gasgallo/mace | 79e759ceb9548fa69d577dd28ca983f87a302a5e | 96b4089e2323d9af119f9f2eda51976ac19ae6c4 | refs/heads/master | 2021-06-23T19:09:24.230126 | 2021-03-02T12:23:05 | 2021-03-02T12:23:05 | 205,080,233 | 1 | 0 | Apache-2.0 | 2019-08-29T04:27:36 | 2019-08-29T04:27:35 | null | UTF-8 | C++ | false | false | 1,268 | cc | // Copyright 2020 The MACE Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "mace/ops/arm/base/deconv_2d_2x2.h"
namespace mace {
namespace ops {
namespace arm {
void RegisterDeconv2dK2x2Delegator(OpDelegatorRegistry *registry) {
MACE_REGISTER_DELEGATOR(
registry, Deconv2dK2x2S1<float>, delegator::Deconv2dParam,
MACE_DELEGATOR_KEY_EX(Deconv2d, RuntimeType::RT_CPU,
float, ImplType::NEON, K2x2S1));
MACE_REGISTER_DELEGATOR(
registry, Deconv2dK2x2S2<float>, delegator::Deconv2dParam,
MACE_DELEGATOR_KEY_EX(Deconv2d, RuntimeType::RT_CPU,
float, ImplType::NEON, K2x2S2));
}
} // namespace arm
} // namespace ops
} // namespace mace
| [
"[email protected]"
] | |
ae7d97958bbe1798a425f9f00b34d0dca4820e3b | 7df8ea3fe9e430b0f3e39afc402763edf9382c0f | /Source/ConnectFour/SelectorTile.cpp | 0a9e30ee011b7dd3dfbc74617f3f246f1fc6e30d | [
"MIT"
] | permissive | StevenCaoZRC/ConnectFour | 694bb5c9635c36dd9e0f5f815372047e9b6ea30c | 8df8bdf366d7c684736be474af130346aabfb27d | refs/heads/master | 2022-12-26T11:27:27.150038 | 2020-10-05T00:49:27 | 2020-10-05T00:49:27 | 299,800,996 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 377 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "SelectorTile.h"
ASelectorTile::ASelectorTile()
{
//Establish the Tile type for Selector tiles. This will determine its mesh
TileType = ETileTypes::SELECTOR;
}
void ASelectorTile::BeginPlay()
{
Super::BeginPlay();
//bool Initialise(_CanInteract, _Occupied);
Initialise(true);
}
| [
"[email protected]"
] | |
534c6160d88f37fd72bf0146c6f8314cc0df33d0 | aab3ae5bb8ce591d29599f51f5fb4cd9c5b05f38 | /SourceCode/Physics/Support/BSP.cpp | 822eae925e40c35e22938cf5767679aefb7527d7 | [] | no_license | S-V/Lollipop | b720ef749e599deaf3fbf48b1e883338dcb573c3 | eca4bfe6115437dc87f638af54a69de09956cbfb | refs/heads/master | 2022-02-09T04:59:17.474909 | 2022-01-25T20:20:20 | 2022-01-25T20:20:20 | 43,964,835 | 11 | 1 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 19,342 | cpp | /*
=============================================================================
File: BSP.cpp
Desc:
=============================================================================
*/
#include <Physics_PCH.h>
#pragma hdrstop
#include <Physics.h>
#include <Physics/Collide/Shape/pxShape_Convex.h>
#include <Physics/Collide/Shape/pxShape_Sphere.h>
#include <Physics/Support/BSP.h>
#include <Physics/Support/pxUtilities.h>
enum { MAX_TRACE_PLANES = 32 };
typedef TStaticList<Plane3D,MAX_TRACE_PLANES> PlaneStack;
// keep 1/8 unit away to keep the position valid before network snapping
// and to avoid various numeric issues
//#define SURFACE_CLIP_EPSILON (0.125)
#define SURFACE_CLIP_EPSILON (1/32.0f)
FORCEINLINE
F4 CalcAabbEffectiveRadius( const Vec3D& boxHalfSize, const Plane3D& plane )
{
return
mxFabs( boxHalfSize[0] * plane.Normal()[0] ) +
mxFabs( boxHalfSize[1] * plane.Normal()[1] ) +
mxFabs( boxHalfSize[2] * plane.Normal()[2] );
}
/*
-----------------------------------------------------------------------------
BSP_Tree
-----------------------------------------------------------------------------
*/
BSP_Tree::BSP_Tree()
: m_nodes(EMemHeap::HeapPhysics)
, m_planes(EMemHeap::HeapPhysics)
{
}
#if MX_EDITOR
typedef TList< idFixedWinding > PolygonList;
/*
-----------------------------------------------------------------------------
SBspStats
-----------------------------------------------------------------------------
*/
SBspStats::SBspStats()
{
this->Reset();
}
void SBspStats::Reset()
{
ZERO_OUT( *this );
m_beginTimeMS = mxGetMilliseconds();
}
void SBspStats::Stop()
{
m_elapsedTimeMS = mxGetMilliseconds() - m_beginTimeMS;
}
void SBspStats::Print()
{
DBGOUT( "\n=== BSP statistics ========\n" );
DBGOUT( "Num. Polys(Begin): %d\n", m_numOrigPolygons );
//DBGOUT( "Num. Polys(End): %d\n", m_numPolygons );
DBGOUT( "Num. Splits: %d\n", m_numSplits );
DBGOUT( "Num. Inner Nodes: %d\n", m_numInternalNodes );
DBGOUT( "Num. Solid Leaves: %d\n", m_numSolidLeaves );
DBGOUT( "Num. Empty Leaves: %d\n", m_numEmptyLeaves );
//DBGOUT( "Tree Depth: %d\n", depth );
DBGOUT( "Time elapsed: %d msec\n", m_elapsedTimeMS );
DBGOUT( "==== End ====================\n" );
}
static
EPolyStatus F_ClassifyPolygon(
const Plane3D& plane,
const Vec3D* verts, const UINT numVerts,
const FLOAT epsilon = 0.013f )
{
UINT numPointsInFront = 0;
UINT numPointsInBack = 0;
UINT numPointsOnPlane = 0;
for( UINT iVertex = 0; iVertex < numVerts; iVertex++ )
{
const Vec3D& point = verts[ iVertex ];
const EPlaneSide ePlaneSide = plane.Side( point, epsilon );
if( ePlaneSide == EPlaneSide::PLANESIDE_FRONT )
{
numPointsInFront++;
}
if( ePlaneSide == EPlaneSide::PLANESIDE_BACK )
{
numPointsInBack++;
}
if( ePlaneSide == EPlaneSide::PLANESIDE_ON )
{
numPointsOnPlane++;
}
}
if( numVerts == numPointsInFront ) {
return Poly_Front;
}
if( numVerts == numPointsInBack ) {
return Poly_Back;
}
if( numVerts == numPointsOnPlane ) {
return Poly_Coplanar;
}
return Poly_Split;
}
/*
The selection of the base polygon and the partitioning plane
is the crucial part of the BSP-tree construction. Depend-
ing on criteria for the base polygon selection different BSP-
trees can be obtained. In our work we use two different ap-
proaches: "naive" selection, where the polygon is randomly
selected from the polygon list, and "optimized" selection.
The optimization means using selection criteria that allow
for obtaining a tree with the following properties:
• Minimization of polygon splitting operations to reduce
the total number of nodes and the number of operations
in the function evaluation
• Minimization of computational errors during the function
evaluation and BSP-tree construction;
• Balancing the BSP tree, i.e., minimization of difference
between positive and negative list for the minimization of
the depth of the tree.
*/
// function for picking an optimal partitioning plane.
// we have two conflicting goals:
// 1) keep the tree balanced
// 2) avoid splitting the polygons
// and avoid introducing new partitioning planes
//
static
UINT F_FindBestSplitterIndex( const PolygonList& polygons
, const SBuildBspArgs& options = SBuildBspArgs() )
{
INT numFrontFaces = 0;
INT numBackFaces = 0;
INT numSplitFaces = 0;
INT numCoplanarFaces = 0;
UINT bestSplitter = 0;
FLOAT bestScore = 1e6f; // the less value the better
for(UINT iPolyA = 0;
iPolyA < polygons.Num();
iPolyA++)
{
// select potential splitter
const idFixedWinding& polyA = polygons[ iPolyA ];
// potential splitting plane
Plane3D planeA;
polyA.GetPlane( planeA );
// test other polygons against the potential splitter
for(UINT iPolyB = 0;
iPolyB < polygons.Num();
iPolyB++)
{
if( iPolyA == iPolyB ) {
continue;
}
const idFixedWinding& polyB = polygons[ iPolyB ];
// evaluate heuristic cost and select the best candidate
const int planeSide = polyB.PlaneSide( planeA, options.planeEpsilon );
switch( planeSide )
{
case PLANESIDE_FRONT : numFrontFaces++; break;
case PLANESIDE_BACK : numBackFaces++; break;
case PLANESIDE_ON : numCoplanarFaces++; break;
case PLANESIDE_CROSS : numSplitFaces++; break;
default: Unreachable;
}
// diff == 0 => tree is perfectly balanced
const UINT diff = Abs<INT>( numFrontFaces - numBackFaces );
F4 score = (diff * options.balanceVsCuts)
+ (numSplitFaces * options.splitCost) * (1.0f - options.balanceVsCuts)
;
if( planeA.Type() < PLANETYPE_TRUEAXIAL )
{
score *= 0.8f; // axial is better
}
// A smaller score will yield a better tree.
if( score < bestScore )
{
bestScore = score;
bestSplitter = iPolyA;
}
}//for all tested polygons
}//for all potential splitters
return bestSplitter;
}
#define NORMAL_EPSILON 0.00001f
#define DIST_EPSILON 0.01f
static
UINT GetPlaneIndex(
BSP_Tree & tree, const Plane3D& plane,
const float normalEps = NORMAL_EPSILON,
const float distEps = DIST_EPSILON
)
{
Plane3D normalizedPlane = plane;
normalizedPlane.FixDegeneracies( distEps );
Assert( distEps <= 0.125f );
const UINT numExistingPlanes = tree.m_planes.Num();
for( UINT iPlane = 0; iPlane < numExistingPlanes; iPlane++ )
{
const Plane3D existingPlane = tree.m_planes[ iPlane ];
if( existingPlane.Compare( normalizedPlane, normalEps, distEps ) )
{
return iPlane;
}
}
const UINT newPlaneIndex = numExistingPlanes;
Assert( newPlaneIndex <= BSP_MAX_PLANES );
tree.m_planes.Add( normalizedPlane );
return newPlaneIndex;
}
// returns index of the splitting plane
//
static
UINT PartitionPolygons(
BSP_Tree & tree,
PolygonList & polygons,
PolygonList & frontPolys,
PolygonList & backPolys,
const FLOAT epsilon = 0.13f
)
{
// select the best partitioner
SBuildBspArgs settings;
// we don't need polygons for collision detection
settings.splitCost = 0;
settings.balanceVsCuts = 1;
settings.planeEpsilon = 0.1f;
const UINT bestSplitter = F_FindBestSplitterIndex( polygons, settings );
Plane3D partitioner;
polygons[ bestSplitter ].GetPlane( partitioner );
//polygons.RemoveAt_Fast( bestSplitter );
// partition the list
for( UINT iPoly = 0; iPoly < polygons.Num(); iPoly++ )
{
if( iPoly == bestSplitter ) {
continue;
}
idFixedWinding & polygon = polygons[ iPoly ];
idFixedWinding backPoly;
const int planeSide = polygon.Split( &backPoly, partitioner, epsilon );
if( planeSide == PLANESIDE_FRONT )
{
frontPolys.Add( polygon );
continue;
}
if( planeSide == PLANESIDE_BACK )
{
backPolys.Add( polygon );
continue;
}
if( planeSide == PLANESIDE_CROSS )
{
frontPolys.Add( polygon );
backPolys.Add( backPoly );
tree.m_stats.m_numSplits++;
continue;
}
Assert( planeSide == PLANESIDE_ON );
// continue
}
return GetPlaneIndex( tree, partitioner );
}
#if 0
static
void Dbg_ValidateNode_R( BSP_Tree & tree, UINT nodeIndex )
{
const BspNode& node = tree.m_nodes[ nodeIndex ];
if( node.IsInternal() )
{
Assert( tree.m_planes.IsValidIndex( node.node.plane ) );
Assert( tree.m_nodes.IsValidIndex( node.node.pos ) );
Assert( tree.m_nodes.IsValidIndex( node.node.neg ) );
Dbg_ValidateNode_R( tree, node.node.pos );
Dbg_ValidateNode_R( tree, node.node.neg );
}
}
static
void Dbg_DumpNode_R( BSP_Tree & tree, UINT nodeIndex, UINT depth = 0 )
{
const BspNode& node = tree.m_nodes[ nodeIndex ];
for(UINT i=0; i<depth; i++)
{
DBGOUT(" ");
}
if( node.IsInternal() )
{
DBGOUT("Inner node@%u: plane=%u, neg=%u, pos=%u\n"
,nodeIndex,(UINT)node.node.plane,(UINT)node.node.neg,(UINT)node.node.pos
);
Dbg_DumpNode_R( tree, node.node.pos, depth+1 );
Dbg_DumpNode_R( tree, node.node.neg, depth+1 );
}
else
{
DBGOUT("%s leaf@%u\n",
node.type==BN_Solid ? "Solid" : "Empty", nodeIndex);
}
}
#endif
static
inline
UINT F_AllocateNode( BSP_Tree & tree )
{
const UINT newNodeIndex = tree.m_nodes.Num();
Assert( newNodeIndex <= BSP_MAX_NODES );
BspNode & newNode = tree.m_nodes.Add();
#if MX_DEBUG
MemSet(&newNode,-1,sizeof BspNode);
//DBGOUT("! creating node %u\n",newNodeIndex);
#endif //MX_DEBUG
return newNodeIndex;
}
static
FORCEINLINE
BspNode* GetNodeByIndex( BSP_Tree & tree, UINT nodeIndex )
{
return &tree.m_nodes[ nodeIndex ];
}
static
inline
UINT F_NewInternalNode( BSP_Tree & tree )
{
const UINT newNodeIndex = F_AllocateNode( tree );
BspNode & newNode = tree.m_nodes[ newNodeIndex ];
{
(void)newNode;
//newNode.type = BN_Polys;
}
tree.m_stats.m_numInternalNodes++;
return newNodeIndex;
}
// returns index of new node
//
static
inline
UINT F_NewEmptyLeaf( BSP_Tree & tree )
{
tree.m_stats.m_numEmptyLeaves++;
#if 0
const UINT newNodeIndex = F_AllocateNode( tree );
BspNode & newNode = tree.m_nodes[ newNodeIndex ];
{
newNode.type = BN_Empty;
}
#else
const UINT newNodeIndex = BSP_EMPTY_LEAF;
#endif
return newNodeIndex;
}
// returns index of new node
//
static
inline
UINT F_NewSolidLeaf( BSP_Tree & tree )
{
tree.m_stats.m_numSolidLeaves++;
#if 0
const UINT newNodeIndex = F_AllocateNode( tree );
BspNode & newNode = tree.m_nodes[ newNodeIndex ];
{
newNode.type = BN_Solid;
}
#else
const UINT newNodeIndex = BSP_SOLID_LEAF;
#endif
return newNodeIndex;
}
// returns index of new node
//
static
UINT BuildTree_R( BSP_Tree & tree, PolygonList & polygons )
{
Assert( polygons.NonEmpty() );
// allocate a new internal node
const UINT newNodeIndex = F_NewInternalNode( tree );
// partition the list
PolygonList frontPolys(EMemHeap::HeapTemp);
PolygonList backPolys(EMemHeap::HeapTemp);
const UINT splitPlane = PartitionPolygons( tree, polygons, frontPolys, backPolys );
GetNodeByIndex( tree, newNodeIndex )->node.plane = splitPlane;
// recursively process children
if( frontPolys.Num() )
{
GetNodeByIndex( tree, newNodeIndex )->node.pos = BuildTree_R( tree, frontPolys );
}
else
{
GetNodeByIndex( tree, newNodeIndex )->node.pos = F_NewEmptyLeaf( tree );
}
if( backPolys.Num() )
{
GetNodeByIndex( tree, newNodeIndex )->node.neg = BuildTree_R( tree, backPolys );
}
else
{
GetNodeByIndex( tree, newNodeIndex )->node.neg = F_NewSolidLeaf( tree );
}
return newNodeIndex;
}
struct pxPolygonCollector : pxTriangleIndexCallback
{
PolygonList & m_polygons;
pxPolygonCollector( PolygonList & polygons )
: m_polygons( polygons )
{
}
virtual void ProcessTriangle( const Vec3D& p0, const Vec3D& p1, const Vec3D& p2 ) override
{
idFixedWinding & newPolygon = m_polygons.Add();
// need to reverse winding (different culling in D3D11 renderer and id's winding)
#if 0
newPolygon.AddPoint( p0 );
newPolygon.AddPoint( p1 );
newPolygon.AddPoint( p2 );
#else
newPolygon.AddPoint( p2 );
newPolygon.AddPoint( p1 );
newPolygon.AddPoint( p0 );
#endif
}
};
void BSP_Tree::Build( pxTriangleMeshInterface* triangleMesh )
{
PolygonList polygons(EMemHeap::HeapTemp);
pxPolygonCollector collectPolys( polygons );
triangleMesh->ProcessAllTriangles( &collectPolys );
m_stats.Reset();
m_stats.m_numOrigPolygons = polygons.Num();
BuildTree_R( *this, polygons );
//Dbg_ValidateNode_R( *this, BSP_ROOT_NODE );
m_nodes.Shrink();
m_planes.Shrink();
m_stats.Stop();
m_stats.Print();
DBGOUT("BSP tree: memory used = %u (%u planes)\n",
(UINT)this->GetMemoryUsed(),m_planes.Num());
}
#endif // MX_EDITOR
struct SOverlapArgs
{
UINT prevNode; // index of parent (internal) BSP node
UINT currNode; // index of current BSP node
pxVec3 closestPt;
F4 minDist; // distance from the convex to the previous node's plane
public:
SOverlapArgs()
{
currNode = BSP_ROOT_NODE;
prevNode = INDEX_NONE;
closestPt.SetAll(PX_LARGE_FLOAT);
minDist = PX_LARGE_FLOAT;
}
};
bool BSP_Tree::PointInSolid( const Vec3D& point ) const
{
TStaticList<UINT,BSP_MAX_DEPTH> nodeStack;
nodeStack.Add( BSP_ROOT_NODE );
while( true )
{
const UINT nodeId = nodeStack.GetLast();
nodeStack.PopBack();
if( nodeId == BSP_EMPTY_LEAF ) {
return false;
}
if( nodeId == BSP_SOLID_LEAF ) {
return true;
}
const BspNode& node = m_nodes[ nodeId ];
const Plane3D& plane = m_planes[ node.node.plane ];
const F4 dist = plane.Distance( point );
if( dist >= 0.0f )
{
nodeStack.Add( node.node.pos );
continue;
}
else//if( dist < 0 )
{
nodeStack.Add( node.node.neg );
continue;
}
}
}
F4 BSP_Tree::DistanceToPoint( const Vec3D& point ) const
{
TStaticList<UINT,BSP_MAX_DEPTH> nodeStack;
nodeStack.Add( BSP_ROOT_NODE );
TStaticList<F4,BSP_MAX_DEPTH> distStack;
while( true )
{
const UINT nodeId = nodeStack.GetLast();
nodeStack.PopBack();
MX_UNDONE("this is incorrect, find distance to convex hull");
// if point is outside the brush
if( nodeId == BSP_EMPTY_LEAF ) {
// we need to find the closest point
// on the convex hull formed by intersection of planes
Unimplemented;
return 0.0f;
}
// if point is inside the brush
if( nodeId == BSP_SOLID_LEAF ) {
// take minimum distance from point to planes
F4 minDist = -PX_LARGE_FLOAT;
for( UINT i = 0; i < distStack.Num(); i++ )
{
// take maximum because the point is behind all planes
minDist = maxf( minDist, distStack[i] );
}
return minDist;
}
const BspNode& node = m_nodes[ nodeId ];
const Plane3D& plane = m_planes[ node.node.plane ];
const F4 dist = plane.Distance( point );
distStack.Add( dist );
if( dist >= 0.0f )
{
nodeStack.Add( node.node.pos );
continue;
}
else//if( dist < 0 )
{
nodeStack.Add( node.node.neg );
continue;
}
}
Unreachable;
return PX_LARGE_FLOAT;
}
struct STraceIn
{
Vec3D start;
Vec3D end;
F4 radius;
UINT currNode;
};
struct STraceOut
{
F4 fraction;
};
struct STraceWorks
{
//Vec3D start;
//Vec3D end;
//F4 radius;
AABB boxsize;// size of the box being swept through the model
Vec3D extents;// half size of the box
Vec3D normal;// surface normal at impact, transformed to world space
F4 planeDist;
F4 fraction; // time completed, 1.0 = didn't hit anything
bool startsolid;
bool allsolid;
public:
STraceWorks()
{
// fill in a default trace
//radius = 0;
boxsize.SetZero();
extents.SetZero();
normal.SetZero();
planeDist = 0.0f;
// assume it goes the entire distance until shown otherwise
fraction = 1;
startsolid = false;
allsolid = false;
}
};
enum ETraceResult
{
Trace_Empty,
Trace_Solid,
Trace_Done,
};
enum {
PlaneSide_Front = 0,
PlaneSide_Back = 1,
};
// NOTE: portions of code taken and modified from quake/darkplaces engine sources
// this is not 100% correct (esp. edge collisions) (should use beveling planes)
//
static
ETraceResult TraceBox_R( STraceWorks & tw, const BSP_Tree& t, /*const*/ UINT nodeId, const Vec3D& start, const Vec3D& end, const F4 f1, const F4 f2 )
{
L_Start:
// check if this is a leaf node
if( BSP_EMPTY_LEAF == nodeId )
{
return Trace_Empty;
}
if( BSP_SOLID_LEAF == nodeId )
{
return Trace_Solid;
}
const BspNode& node = t.m_nodes[ nodeId ];
Plane3D plane = t.m_planes[ node.node.plane ];
// calculate offset for the size of the box and
// adjust the plane distance appropriately for mins/maxs
plane.d -= CalcAabbEffectiveRadius( tw.extents, plane );
// distance from plane for trace start and end
const F4 d1 = plane.Distance( start );
const F4 d2 = plane.Distance( end );
// see which sides we need to consider
int planeSide; // 0 - check front side first, 1 - check back side first
// if start point in air
if( d1 >= 0.0f )
{
if( d2 >= 0.0f )// endpoint in air
{
// completely in front of plane
nodeId = node.node.pos;
goto L_Start;
}
// d1 >= 0 && d2 < 0
planeSide = PlaneSide_Front;
}
else // d1 < 0
{
// start point in solid
if( d2 < 0.0f )// endpoint in solid
{
// completely behind plane
nodeId = node.node.neg;
goto L_Start;
}
// endpoint in air
// d1 < 0 && d2 >= 0
planeSide = PlaneSide_Back;
}
// intersecting the plane, split the line segment into two
// and check both sides, starting from 'planeSide'
const F4 midf = clampf( d1 / (d1 - d2), f1, f2 );
Assert( midf >= 0.0f && midf <= 1.0f );
const Vec3D midp = start + (end - start) * midf;
// we're interested in case where 'start' is in empty space
// and 'end' is in solid region.
//
ETraceResult ret;
// check the nearest side first
ret = TraceBox_R( tw, t, node.node.kids[planeSide], start, midp, f1, midf );
// if this side is not empty, return what it is (solid or done)
if( ret != Trace_Empty ) {
return ret;
}
// good, 'start' point is in empty space
ret = TraceBox_R( tw, t, node.node.kids[planeSide^1], midp, end, midf, f2 );
// if other side is not solid, return what it is (empty or done)
if( ret != Trace_Solid ) {
return ret;
}
// now 'end' point is in solid space
// front is air and back is solid, this is the impact point
#if 0
tw.normal = plane.Normal();
tw.planeDist = plane.d;
tw.fraction = midf;
#else
// calculate the return fraction which is nudged off the surface a bit
const float real_midf = clampf( (d1 - DIST_EPSILON) / (d1 - d2), 0.0f, 1.0f );
tw.normal = plane.Normal();
tw.planeDist = plane.d;
tw.fraction = real_midf;
#endif
return Trace_Done;
}
void BSP_Tree::TraceAABB(
const AABB& boxsize, const Vec3D& start, const Vec3D& end,
FLOAT & fraction, Vec3D & normal
) const
{
STraceWorks tw;
tw.boxsize = boxsize;
tw.extents = boxsize.GetHalfSize();
TraceBox_R( tw, *this, BSP_ROOT_NODE, start, end, 0, 1 );
fraction = tw.fraction;
normal = tw.normal;
}
pxVec3 BSP_Tree::CalcSupportingVertex( const pxVec3& dir ) const
{
UNDONE;
return pxVec3();
}
SizeT BSP_Tree::GetMemoryUsed() const
{
return m_nodes.GetAllocatedMemory()
+ m_planes.GetAllocatedMemory()
+ sizeof(*this)
;
}
void BSP_Tree::Serialize( mxArchive& archive )
{
archive && m_nodes;
archive && m_planes;
//@todo: optimize the tree during saving/loading?
if( archive.IsReading() )
{
//
}
}
// @todo:
// weld coplanar polygon faces
//
NO_EMPTY_FILE
//--------------------------------------------------------------//
// End Of File. //
//--------------------------------------------------------------//
| [
"[email protected]"
] | |
a79efa12aca5db87c0a0278b4987eba0b4da2468 | eeb8f1df33baeb1b8454df8080ac07e7fab58da8 | /Graph/levelOrder.cpp | c1f6696bc077e7597c90c58597cb07227968f14e | [] | no_license | Nirav1510/Interviewbit-solution | 02ae5c3c0101793cc7088f4cc188fdfb34719da1 | 004a0fd3b10fac4d7347ef543df40657f2dafee0 | refs/heads/main | 2023-08-16T07:50:24.688145 | 2021-09-27T07:25:21 | 2021-09-27T07:25:21 | 365,322,719 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 659 | cpp | vector<vector<int>> ans;
void solve(TreeNode *root)
{
if (!root)
return;
queue<TreeNode *> q;
q.push(root);
while (!q.empty())
{
int n = q.size();
vector<int> temp;
while (n--)
{
auto t = q.front();
q.pop();
temp.push_back(t->val);
if (t->left)
{
q.push(t->left);
}
if (t->right)
{
q.push(t->right);
}
}
ans.push_back(temp);
}
}
vector<vector<int>> Solution::levelOrder(TreeNode *A)
{
ans.clear();
solve(A);
return ans;
}
| [
"[email protected]"
] | |
67d22e00252008eec695916738f51e3af35b237e | 8356073845231d63c578818b3043c0d3e0973c80 | /Lightoj/1316 - A Wedding Party.cpp | 4d1944b440e06d3a4ad61267f82011721bff28c2 | [] | no_license | anis028/Problem-solving | cce12d0273afbb1573c9a1eec2659f0fc363c71b | 3bc50ed9ff4d0ed1d80423a2ed1fdb1788d776b4 | refs/heads/master | 2020-07-06T19:57:54.889585 | 2019-08-21T10:20:12 | 2019-08-21T10:20:12 | 203,124,065 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,614 | cpp | #include<bits/stdc++.h>
#define db(x) printf("**%d\n",x)
#define pb push_back
#define pii pair<int,int>
#define pip pair<int,pair<int,int> >
#define mod 1000000007
#define mm(x,y) memset(x,y,sizeof(x))
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef double dbl;
const int INF = 0x3f3f3f3f;
vector< pii > G[505], RG[20];
int best, best_cost, shoploc[20], shopid[505], d[505], cost[17][1<<15], pops[1<<15];
void dijkstra(int s) {
int u, v, w, e, i, sz;
priority_queue< pii, vector< pii >, greater< pii > > Q;
memset(d, 0x3f, sizeof d);
Q.push(pii(0, s));
d[s] = 0;
while(!Q.empty()) {
u = Q.top().second;
w = Q.top().first;
Q.pop();
if(d[u] < w) continue;
sz = G[u].size();
for(i = 0; i < sz; i++) {
v = G[u][i].first;
e = G[u][i].second;
if(d[v] > d[u] + e) {
d[v] = d[u] + e;
Q.push(pii(d[v], v));
}
}
}
}
void dijkstra2(int s, int t, int ns) {
int mask, u, w, sz, i, v, e, nmask, nb;
priority_queue< pip, vector< pip >, greater< pip > > Q;
memset(cost, 0x3f, sizeof cost);
if(s >= ns) mask = 0; else mask = 1 << s;
Q.push(pip(0, pii(s, mask)));
cost[s][mask] = 0;
while(!Q.empty()) {
u = Q.top().second.first;
mask = Q.top().second.second;
w = Q.top().first;
Q.pop();
if(cost[u][mask] < w) continue;
sz = RG[u].size();
for(i = 0; i < sz; i++) {
v = RG[u][i].first;
e = RG[u][i].second;
nmask = mask;
if(v < ns) nmask |= (1 << v);
if(cost[v][nmask] > e + cost[u][mask]) {
cost[v][nmask] = e + cost[u][mask];
Q.push(pip(cost[v][nmask], pii(v, nmask)));
}
}
}
best = 0, best_cost = INF;
for(i = 0; i < (1 << ns); i++) {
if(cost[t][i] < INF) {
nb = pops[i];
if(nb > best) {
best = nb;
best_cost = cost[t][i];
}
else if(nb == best) {
best_cost = min(best_cost, cost[t][i]);
}
}
}
}
int main() {
int test, cs, n, rn, e, s, i, u, v, w;
scanf("%d", &test);
for(i = 0; i < (1 << 15); i++) pops[i] = __builtin_popcount(i);
for(cs = 1; cs <= test; cs++) {
scanf("%d %d %d", &n, &e, &s);
memset(shopid, -1, sizeof(shopid));
for(i = 0; i < s; i++) {
scanf("%d", &u);
shoploc[i] = u;
shopid[u] = i;
}
if(shopid[0] == -1) {
shopid[0] = i;
shoploc[i++] = 0;
}
if(shopid[n-1] == -1) {
shopid[n-1] = i;
shoploc[i++] = n-1;
}
rn = i;
for(i = 0; i < n; i++) G[i].clear();
for(i = 0; i < e; i++) {
scanf("%d %d %d", &u, &v, &w);
G[u].push_back(pii(v, w));
}
for(i = 0; i < rn; i++) {
RG[i].clear();
dijkstra(shoploc[i]);
for(u = 0; u < n; u++) {
if(u != shoploc[i] && shopid[u] != -1 && d[u] < INF) {
RG[i].push_back(pii(shopid[u], d[u]));
}
}
}
dijkstra2(shopid[0], shopid[n-1], s);
if(best_cost < INF) printf("Case %d: %d %d\n", cs, best, best_cost);
else printf("Case %d: Impossible\n", cs);
}
return 0;
}
/*sample
*/
| [
"[email protected]"
] | |
95fb10a90355e705b11e66918dbbaa10c362c719 | e1700081b3e9fa1c74e6dd903da767a3fdeca7f5 | /libs/geodata/polygon/private/geodatapolygonproxy_displaysetting.h | aa7fa3cba41ee89cae5b94a46a1ef9858e2a0961 | [
"MIT"
] | permissive | i-RIC/prepost-gui | 2fdd727625751e624245c3b9c88ca5aa496674c0 | 8de8a3ef8366adc7d489edcd500a691a44d6fdad | refs/heads/develop_v4 | 2023-08-31T09:10:21.010343 | 2023-08-31T06:54:26 | 2023-08-31T06:54:26 | 67,224,522 | 8 | 12 | MIT | 2023-08-29T23:04:45 | 2016-09-02T13:24:00 | C++ | UTF-8 | C++ | false | false | 633 | h | #ifndef GEODATAPOLYGONPROXY_DISPLAYSETTING_H
#define GEODATAPOLYGONPROXY_DISPLAYSETTING_H
#include "geodatapolygon_displaysetting.h"
#include "../geodatapolygonproxy.h"
#include <misc/boolcontainer.h>
#include <misc/compositecontainer.h>
class GeoDataPolygonProxy::DisplaySetting : public CompositeContainer
{
public:
DisplaySetting();
DisplaySetting(const DisplaySetting& s);
DisplaySetting& operator=(const DisplaySetting& s);
XmlAttributeContainer& operator=(const XmlAttributeContainer& s);
BoolContainer usePreSetting;
GeoDataPolygon::DisplaySetting displaySetting;
};
#endif // GEODATAPOLYGONPROXY_DISPLAYSETTING_H
| [
"[email protected]"
] | |
500ff0fe9435846d9cb2d8e015e0348749d49654 | 86f9dd1176a3aa6f7a9b472d91de97791c19ae2d | /Domains/RoverPOIDomain/RoverPOIDomain.cpp | 812c1a6132a73c299f144cf24635ae1c861304b6 | [] | no_license | MorS25/libraries | 6139f3e6856cdad836930fa51c4790a896ed8dc0 | d595819ab2aabbe7b34e0c33898b4682b40532d3 | refs/heads/master | 2021-05-31T05:36:47.396330 | 2015-09-19T00:53:52 | 2015-09-19T00:53:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,000 | cpp | #include "RoverPOIDomain.h"
/*
RoverPOIDomain::RoverPOIDomain(void):nPOIs(10),teleportation(false)
{
}
RoverPOIDomain::~RoverPOIDomain(void)
{
}
void RoverPOIDomain::initializeRoverDomain(bool usingTypesSet, bool teleportationSet, std::string rewardSet, bool firstInitialization){
//printf("Deprecated functions removed, needs rewrite.");
// Initialize run constants
usingTypes = usingTypesSet;
teleportation = teleportationSet;
rewardType = rewardSet;
nStateElements = NSECTORS*NDISTANCES*(2+FAILTYPECOUNT*int(usingTypes)); // first two are COUNTS of ALL POIs/rovers, failtypecount/sector for rest
// Place the POIs in the world
if (firstInitialization){
generatePOIs(); // generate POIs
generateStaticPOIPositions(); // Place POIs uniquely+save positions
}
// Place the rovers in the world
generateRovers(); // generate Rovers
generateStaticRoverPositions(); // Place rovers in graph, store original places
// initializeNeuralNetPopulation(); // initialize Neural Net (NOTE, HARDCODING IN THIS FUNCTION) // deprecated
}
std::vector<double> RoverPOIDomain::getDifferenceReward(){
//If more than two robots visit a POI, only the observations of the closest two are considered,
// and their visit distances are averaged in the computation of the system evaluation
std::vector<double> D(rovers.size(),0.0); // D for all of the rovers
typedef std::pair<double,int> P;
for (int i=0; i<POIs.size(); i++){
POI p = POIs[i];
// Get all distances to POI
PairQueueAscending q = sortedRoverDists(p.x,p.y);
// Get top 3 closest (dij, dik, dil) in order closest to farthest
double dij = q.top().first;
double j = q.top().second;
q.pop();
double dik = q.top().first;
double k = q.top().second;
q.pop();
double dil = q.top().first;
double l = q.top().second;
// BEGIN MODIFICATION
double gatheredValjk, gatheredValjl,gatheredValkl; // modification
double multiplej, multiplek,multiplel; // modification
// average the multiples based on type...
if (rovers[j].type==0){
multiplej=0.25;
} else if (rovers[j].type==2){
multiplej=0.5;
} else if (rovers[j].type==3){
multiplej=0.75;
}
if (rovers[k].type==0){
multiplek=0.25;
} else if (rovers[k].type==2){
multiplek=0.5;
} else if (rovers[k].type==3){
multiplek=0.75;
}
if (rovers[l].type==0){
multiplel=0.25;
} else if (rovers[l].type==2){
multiplel=0.5;
} else if (rovers[l].type==3){
multiplel=0.75;
}
gatheredValjk = p.val*(multiplej+multiplek);
gatheredValjl = p.val*(multiplej+multiplel);
gatheredValkl = p.val*(multiplek+multiplel);
// END MODIFICATION
if (dil<deltaO){
//D[unsigned(j)]+=2.0*p.val*(1.0/(dik+dij+2.0)-1.0/(dik+dil+2.0)); // original
//D[unsigned(k)]+=2.0*p.val*(1.0/(dik+dij+2.0)-1.0/(dij+dil+2.0)); // original
D[unsigned(j)]+=gatheredValjk/(dik+dij+2.0)-gatheredValkl/(dik+dil+2.0); // modified
} else if ((dij<deltaO) && (dik<deltaO)){
D[unsigned(j)]+=2.0*gatheredValjk/(dik+dij+2.0); // reduces to original
D[unsigned(k)]+=2.0*gatheredValjk/(dik+dij+2.0);
}
}
return D;
}
double RoverPOIDomain::getLocalReward(int me){
// Returns Pj(z)
double L = 0.0;
for (int i=0; i<POIs.size(); i++){
double deltaMe = gridDistance(POIs[i].x,POIs[i].y,rovers[me].x,rovers[me].y);
if (deltaMe<deltaO){
double gatheredVal = POIs[i].val/deltaMe;
// BEGIN VALUE MODIFICATION*********
if (rovers[me].type==0){
gatheredVal*=0.25;
} else if (rovers[me].type==2){
gatheredVal*=0.5;
} else if (rovers[me].type==3){
gatheredVal*=0.75;
}
// END VALUE MODIFICATION************
L+=gatheredVal;
}
}
return L;
}
void RoverPOIDomain::simulateRunRoverDomain(){
// Performs |maxSteps| number of epochs, consisting of some number of steps, for the rover domain.
// Randomizes starting positions between the rovers. These are reset to be the same during a single epoch though.
int maxEpochs = 1000;
for (int T=0; T<maxEpochs; T++){
//printf("T=%i\n",T);
simulateEpochRoverDomain();
generateStaticRoverPositions();
}
}
double RoverPOIDomain::getGlobalReward(){
//If more than two robots visit a POI, only the observations of the closest two are considered,
// and their visit distances are averaged in the computation of the system evaluation
rovers;
double G=0.0;
for (int i=0; i<POIs.size(); i++){
POI p = POIs[i];
// Get all distances to POI
PairQueueAscending q = sortedRoverDists(p.x,p.y);
double dij = q.top().first; // closest, DISTANCE
int jID = q.top().second; // closest, ID
q.pop();
double dik = q.top().first; // second closest, DISTANCE
int kID = q.top().second; // second closest, ID
double Nij = 0.0;
double Nik = 0.0;
if (dij<deltaO){
Nij=1.0;
}
if (dik<deltaO){
Nik=1.0;
}
// BEGIN MODIFICATION
double gatheredVal; // modification
double multiplej, multiplek; // modification
// average the multiples based on type...
if (rovers[jID].type==0){
multiplej=0.25;
} else if (rovers[jID].type==2){
multiplej=0.5;
} else if (rovers[jID].type==3){
multiplej=0.75;
} else {
multiplej=1.0;
}
if (rovers[kID].type==0){
multiplek=0.25;
} else if (rovers[kID].type==2){
multiplek=0.5;
} else if (rovers[kID].type==3){
multiplek=0.75;
} else {
multiplek = 1.0;
}
// END MODIFICATION
gatheredVal = POIs[i].val*(multiplej+multiplek);
G += 2.0*(gatheredVal*Nij*Nik)/(dij+dik+2.0);
}
return G;
}
void RoverPOIDomain::simulateEpochRoverDomain(){
if (!rovers.size()){
printf("No rovers! Aborting.");
exit(1);
}
double gAvg = 0;
int gCount = 0;
int steps;
if(teleportation) steps=1;
else steps = 10;
double travelScale;
if (teleportation) travelScale = TRAVELBOUND; // MOVE TO INITIALIZATION
else travelScale = 1.0; // MOVE TO INITIALIZATION
logRoverPositions(); // logs the starting position
for (int i=0; i<rovers.size(); i++){
rovers[i].evo.generateNewMembers();
}
while(true){
for (int i=0; i<steps; i++){
std::vector<std::vector<double> > xyActions(rovers.size()); // list of xy coordinates to move to
for (int j=0; j<rovers.size(); j++){
// select xy-coordinates here... scale selection as percent of POSSIBLE distance
xyActions[j] = rovers[j].selectNNActionMultiple(getState(j));
// scale to domain
xyActions[j][0]*=travelScale; // this is the DX ACTION
xyActions[j][1]*=travelScale; // this is the DY ACTION
}
for (int j=0; j<rovers.size(); j++){
rovers[j].walk(xyActions[j][0],xyActions[j][1],percentFail);
}
logRoverPositions();
}
// Calculate reward and update NOTE: THIS IS ONLY GLOBAL REWARD
double epG = getGlobalReward();
gAvg += epG;
gCount++;
std::vector<double> rewards(rovers.size(),0);
if (!strcmp(rewardType.c_str(),"global")){
rewards = std::vector<double>(rovers.size(),epG);
} else if (!strcmp(rewardType.c_str(),"difference")){
rewards = getDifferenceReward();
} else if (!strcmp(rewardType.c_str(),"local")){
for (int i=0; i<rovers.size(); i++){
rewards[i] = getLocalReward(i);
}
}
bool epochDone = false;
for (int i=0; i<rovers.size(); i++){
rovers[i].evo.updateMember(epG);
if (!rovers[i].evo.selectNewMember()) epochDone = true;
}
if (epochDone){
break;
gAvg /= double(gCount);
}
resetForEpoch(); // reset the domain for the next epoch, as it was before
}
for (int i=0; i<rovers.size(); i++){
rovers[i].evo.selectSurvivors();
}
performanceVals.push_back(gAvg);
}
void RoverPOIDomain::resetForEpoch(){
// Replace rovers
resetStaticRovers(); // later; make sure static positions are changed between epochs...
}
void RoverPOIDomain::generateStaticPOIPositions(){
for (int i=0; i<POIs.size(); i++){
staticPOIPositions.push_back(std::vector<double>(2,0.0));
double randX = bounds.size('x')*double(rand())/double(RAND_MAX);
double randY = bounds.size('y')*double(rand())/double(RAND_MAX);
POIs[i].x = randX;
POIs[i].y = randY;
staticPOIPositions[i][0] = randX;
staticPOIPositions[i][1] = randY;
}
}
GridWorld::PairQueueAscending RoverPOIDomain::sortedPOIDists(double xref, double yref){
typedef std::pair<double,int> P;
std::vector<P> dists(POIs.size(),std::make_pair<double,int>(0.0,0));
for (int j=0; j<POIs.size(); j++){
dists[j]=P(gridDistance(xref,yref,POIs[j].x,POIs[j].y),j);
}
PairQueueAscending q(dists.begin(),dists.end());
return q;
}
State RoverPOIDomain::getState(int me)
{
// NEW sonar state... go by quadrant AND distance...
// note here only quadrant is implemented
// State elements/init
std::vector<std::vector<double> > poisByQuadrantAndDistance(NSECTORS); // count POIs for each sector
std::vector<std::vector<double> > roversByQuadrantAndDistance(NSECTORS); // count POIs for each sector
std::vector<std::vector<std::vector<double> > > roverTypeCountByQuadrantAndDistance; // used if using types [QUADRANT][DIST][TYPE]
std::vector<double> stateInputs;
// Reserve space
for (int i=0; i<NSECTORS;i++){
poisByQuadrantAndDistance[i] = std::vector<double>(NDISTANCES,0.0);
roversByQuadrantAndDistance[i] = std::vector<double>(NDISTANCES,0.0);
}
// Counting rovers by quadrant
for (int i=0; i<POIs.size(); i++){
std::pair<Direction,DistanceDivision> quadAndDist = relativePosition(rovers[me].x,rovers[me].y,POIs[i].x,POIs[i].y);
int quadrant = int(quadAndDist.first);
int dist = int(quadAndDist.second);
poisByQuadrantAndDistance[quadrant][dist]++;
}
// Normalization
for (int i=0; i<poisByQuadrantAndDistance.size(); i++){
for (int j=0; j<poisByQuadrantAndDistance[i].size(); j++){
poisByQuadrantAndDistance[i][j] /= POIs.size();
}
}
for (int i=0; i<roversByQuadrantAndDistance.size(); i++){
for (int j=0; j<roversByQuadrantAndDistance[i].size(); j++){
roversByQuadrantAndDistance[i][j] /= rovers.size();
}
}
// Stitch this together to form state...
for (int i=0; i<poisByQuadrantAndDistance.size(); i++){
stateInputs.insert(stateInputs.end(),poisByQuadrantAndDistance[i].begin(),poisByQuadrantAndDistance[i].end());
}
for (int i=0; i<roversByQuadrantAndDistance.size(); i++){
stateInputs.insert(stateInputs.end(),roversByQuadrantAndDistance[i].begin(),roversByQuadrantAndDistance[i].end());
}
if (usingTypes){
// Collect and add type information if necessary
roverTypeCountByQuadrantAndDistance = std::vector<std::vector<std::vector<double> > >(NSECTORS);
for (int i=0; i<NSECTORS; i++){
roverTypeCountByQuadrantAndDistance[i] = std::vector<std::vector<double> >(NDISTANCES);
for (int j=0; j<NDISTANCES; j++){
roverTypeCountByQuadrantAndDistance[i][j] = std::vector<double>(FAILTYPECOUNT);
}
}
// Type count
for (int i=0; i<rovers.size(); i++){
std::pair<Direction,DistanceDivision> quadAndDist = relativePosition(rovers[me].x,rovers[me].y,rovers[i].x,rovers[i].y);
int quadrant = int(quadAndDist.first);
int dist = int(quadAndDist.second);
roversByQuadrantAndDistance[quadrant][dist]++;
roverTypeCountByQuadrantAndDistance[quadrant][dist][rovers[i].type]++;
}
// Normalization
for (int i=0; i<roverTypeCountByQuadrantAndDistance.size(); i++){
for (int j=0; j<roverTypeCountByQuadrantAndDistance[i].size(); j++){
if (roversByQuadrantAndDistance[i][j]==0) continue;
else {
for (int k=0; k<roverTypeCountByQuadrantAndDistance[i][j].size(); k++){
roverTypeCountByQuadrantAndDistance[i][j][k] /= roversByQuadrantAndDistance[i][j];
}
}
}
}
// Stitching
for (int i=0; i<roverTypeCountByQuadrantAndDistance.size(); i++){
for (int j=0; j<roverTypeCountByQuadrantAndDistance[i].size(); j++){
stateInputs.insert(stateInputs.end(), roverTypeCountByQuadrantAndDistance[i][j].begin(), roverTypeCountByQuadrantAndDistance[i][j].end());
}
}
}
// Generate state from stitched inputs
return State(stateInputs);
}
void RoverPOIDomain::generatePOIs(){
// randomly generates POIs
POIs.clear(); // clears out previous POIs
for (int i=0; i<nPOIs; i++){
POIs.push_back(POI());
}
}
*/ | [
"[email protected]"
] | |
a0c05ad6bd3465845b55a41c38c0614e5f43c2f2 | 451ff5a40071578341ca195908276992bd5396fa | /AtCoder/Educational DP/A - Frog 1.cpp | eabd2c432230555bb130bbf242acf7bddca8211b | [] | no_license | Tanjim131/Problem-Solving | ba31d31601798ba585a3f284bb169d67794af6c0 | 6dc9c0023058655ead7da7da08eed11bf48a0dfa | refs/heads/master | 2023-05-02T06:38:34.014689 | 2021-05-14T18:26:15 | 2021-05-14T18:26:15 | 267,421,671 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 828 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
int solve(const vector <int> &heights, vector <int> &dp, int current){
if(current == 0){
return 0;
}
if(dp[current] != -1){
return dp[current];
}
int cost1 = solve(heights, dp, current - 1) + abs(heights[current] - heights[current - 1]);
int cost2 = numeric_limits <int>::max();
if(current > 1) cost2 = solve(heights, dp, current - 2) + abs(heights[current] - heights[current - 2]);
return dp[current] = min(cost1, cost2);
}
int main(int argc, char const *argv[])
{
int N;
cin >> N;
vector <int> heights(N);
for(int i = 0 ; i < N ; ++i){
cin >> heights[i];
}
vector <int> dp(N, -1);
cout << solve(heights, dp, N - 1) << '\n';
return 0;
}
| [
"[email protected]"
] | |
86bc20288809bb8f1215dbee660172d12e66ae8d | fa59c8294096f9019a1a10e556a1d4ba6f19eed0 | /include/eagine/memory/buffer.hpp | 1ef13377544e257d311f15cb0f09ec10e1defb58 | [
"BSL-1.0"
] | permissive | flajann2/oglplu2 | 35312df54eda8f90039127893acccc200c6f0ea3 | 5c964d52ae3fa53cbd7b8a18f735c25d166092cb | refs/heads/master | 2020-04-23T08:15:11.733546 | 2019-02-02T18:40:19 | 2019-02-02T18:40:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,129 | hpp | /**
* @file eagine/memory/buffer.hpp
*
* Copyright Matus Chochlik.
* Distributed under the Boost Software License, Version 1.0.
* See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt
*/
#ifndef EAGINE_MEMORY_BUFFER_HPP
#define EAGINE_MEMORY_BUFFER_HPP
#include "block.hpp"
#include "default_alloc.hpp"
#include "shared_alloc.hpp"
namespace eagine {
namespace memory {
class buffer {
public:
using size_type = typename block::size_type;
using pointer = typename block::pointer;
private:
span_size_t _size;
span_size_t _align;
owned_block _storage;
shared_byte_allocator _alloc;
bool _is_ok() const noexcept {
return bool(_alloc) && size() <= capacity();
}
void _reallocate(span_size_t new_size) {
_alloc.do_reallocate(_storage, new_size, _align);
}
public:
explicit buffer(span_size_t align)
: _size(0)
, _align(align)
, _alloc(default_byte_allocator()) {
}
buffer()
: buffer(alignof(long double)) {
}
buffer(const buffer&) = delete;
~buffer() noexcept {
free();
}
auto addr() const noexcept {
return _storage.addr();
}
pointer data() const noexcept {
return _storage.data();
}
span_size_t size() const noexcept {
return _size;
}
span_size_t capacity() const noexcept {
return _storage.size();
}
void reserve(span_size_t new_size) {
if(capacity() < new_size) {
_reallocate(new_size);
}
assert(_is_ok());
}
void resize(span_size_t new_size) {
reserve(new_size);
_size = new_size;
assert(_is_ok());
}
void free() {
_alloc.deallocate(std::move(_storage), _align);
_size = 0;
}
operator block() noexcept {
assert(_is_ok());
return {_storage.begin(), _size};
}
operator const_block() const noexcept {
assert(_is_ok());
return {_storage.begin(), _size};
}
};
} // namespace memory
} // namespace eagine
#endif // EAGINE_MEMORY_BUFFER_HPP
| [
"[email protected]"
] | |
cf8b207f38f2d7fb68faf8bf5479cabbb2cd9be0 | 696e35ccdf167c3f6b1a7f5458406d3bb81987c9 | /chrome/browser/extensions/api/management/chrome_management_api_delegate.cc | 6a9ab04ba5f45f02534f00d68b40b00cba949cda | [
"BSD-3-Clause"
] | permissive | mgh3326/iridium-browser | 064e91a5e37f4e8501ea971483bd1c76297261c3 | e7de6a434d2659f02e94917be364a904a442d2d0 | refs/heads/master | 2023-03-30T16:18:27.391772 | 2019-04-24T02:14:32 | 2019-04-24T02:14:32 | 183,128,065 | 0 | 0 | BSD-3-Clause | 2019-11-30T06:06:02 | 2019-04-24T02:04:51 | null | UTF-8 | C++ | false | false | 14,279 | cc | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/management/chrome_management_api_delegate.h"
#include <memory>
#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/bookmark_app_helper.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/extensions/extension_metrics.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/web_application_info.h"
#include "components/favicon/core/favicon_service.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/service_manager_connection.h"
#include "extensions/browser/api/management/management_api.h"
#include "extensions/browser/api/management/management_api_constants.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "services/data_decoder/public/cpp/safe_json_parser.h"
namespace {
class ManagementSetEnabledFunctionInstallPromptDelegate
: public extensions::InstallPromptDelegate {
public:
ManagementSetEnabledFunctionInstallPromptDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback)
: install_prompt_(new ExtensionInstallPrompt(web_contents)),
callback_(callback),
weak_factory_(this) {
ExtensionInstallPrompt::PromptType type =
ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(
browser_context, extension);
install_prompt_->ShowDialog(
base::Bind(&ManagementSetEnabledFunctionInstallPromptDelegate::
OnInstallPromptDone,
weak_factory_.GetWeakPtr()),
extension, nullptr,
std::make_unique<ExtensionInstallPrompt::Prompt>(type),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}
~ManagementSetEnabledFunctionInstallPromptDelegate() override {}
private:
void OnInstallPromptDone(ExtensionInstallPrompt::Result result) {
base::ResetAndReturn(&callback_).Run(
result == ExtensionInstallPrompt::Result::ACCEPTED);
}
// Used for prompting to re-enable items with permissions escalation updates.
std::unique_ptr<ExtensionInstallPrompt> install_prompt_;
base::Callback<void(bool)> callback_;
base::WeakPtrFactory<ManagementSetEnabledFunctionInstallPromptDelegate>
weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ManagementSetEnabledFunctionInstallPromptDelegate);
};
class ManagementUninstallFunctionUninstallDialogDelegate
: public extensions::ExtensionUninstallDialog::Delegate,
public extensions::UninstallDialogDelegate {
public:
ManagementUninstallFunctionUninstallDialogDelegate(
extensions::ManagementUninstallFunctionBase* function,
const extensions::Extension* target_extension,
bool show_programmatic_uninstall_ui)
: function_(function) {
ChromeExtensionFunctionDetails details(function);
extension_uninstall_dialog_ = extensions::ExtensionUninstallDialog::Create(
details.GetProfile(), details.GetNativeWindowForUI(), this);
bool uninstall_from_webstore =
function->extension() &&
function->extension()->id() == extensions::kWebStoreAppId;
extensions::UninstallSource source;
extensions::UninstallReason reason;
if (uninstall_from_webstore) {
source = extensions::UNINSTALL_SOURCE_CHROME_WEBSTORE;
reason = extensions::UNINSTALL_REASON_CHROME_WEBSTORE;
} else if (function->source_context_type() ==
extensions::Feature::WEBUI_CONTEXT) {
source = extensions::UNINSTALL_SOURCE_CHROME_EXTENSIONS_PAGE;
// TODO: Update this to a new reason; it shouldn't be lumped in with
// other uninstalls if it's from the chrome://extensions page.
reason = extensions::UNINSTALL_REASON_MANAGEMENT_API;
} else {
source = extensions::UNINSTALL_SOURCE_EXTENSION;
reason = extensions::UNINSTALL_REASON_MANAGEMENT_API;
}
if (show_programmatic_uninstall_ui) {
extension_uninstall_dialog_->ConfirmUninstallByExtension(
target_extension, function->extension(), reason, source);
} else {
extension_uninstall_dialog_->ConfirmUninstall(target_extension, reason,
source);
}
}
~ManagementUninstallFunctionUninstallDialogDelegate() override {}
// ExtensionUninstallDialog::Delegate implementation.
void OnExtensionUninstallDialogClosed(bool did_start_uninstall,
const base::string16& error) override {
function_->OnExtensionUninstallDialogClosed(did_start_uninstall, error);
}
private:
extensions::ManagementUninstallFunctionBase* function_;
std::unique_ptr<extensions::ExtensionUninstallDialog>
extension_uninstall_dialog_;
DISALLOW_COPY_AND_ASSIGN(ManagementUninstallFunctionUninstallDialogDelegate);
};
class ChromeAppForLinkDelegate : public extensions::AppForLinkDelegate {
public:
ChromeAppForLinkDelegate() {}
~ChromeAppForLinkDelegate() override {}
void OnFaviconForApp(
extensions::ManagementGenerateAppForLinkFunction* function,
content::BrowserContext* context,
const std::string& title,
const GURL& launch_url,
const favicon_base::FaviconImageResult& image_result) {
WebApplicationInfo web_app;
web_app.title = base::UTF8ToUTF16(title);
web_app.app_url = launch_url;
if (!image_result.image.IsEmpty()) {
WebApplicationInfo::IconInfo icon;
icon.data = image_result.image.AsBitmap();
icon.width = icon.data.width();
icon.height = icon.data.height();
web_app.icons.push_back(icon);
}
bookmark_app_helper_.reset(new extensions::BookmarkAppHelper(
Profile::FromBrowserContext(context), web_app, nullptr,
WebappInstallSource::MANAGEMENT_API));
bookmark_app_helper_->Create(
base::Bind(&extensions::ManagementGenerateAppForLinkFunction::
FinishCreateBookmarkApp,
function));
}
std::unique_ptr<extensions::BookmarkAppHelper> bookmark_app_helper_;
// Used for favicon loading tasks.
base::CancelableTaskTracker cancelable_task_tracker_;
};
} // namespace
ChromeManagementAPIDelegate::ChromeManagementAPIDelegate() {
}
ChromeManagementAPIDelegate::~ChromeManagementAPIDelegate() {
}
void ChromeManagementAPIDelegate::LaunchAppFunctionDelegate(
const extensions::Extension* extension,
content::BrowserContext* context) const {
// Look at prefs to find the right launch container.
// If the user has not set a preference, the default launch value will be
// returned.
extensions::LaunchContainer launch_container =
GetLaunchContainer(extensions::ExtensionPrefs::Get(context), extension);
OpenApplication(AppLaunchParams(Profile::FromBrowserContext(context),
extension, launch_container,
WindowOpenDisposition::NEW_FOREGROUND_TAB,
extensions::SOURCE_MANAGEMENT_API));
extensions::RecordAppLaunchType(extension_misc::APP_LAUNCH_EXTENSION_API,
extension->GetType());
}
GURL ChromeManagementAPIDelegate::GetFullLaunchURL(
const extensions::Extension* extension) const {
return extensions::AppLaunchInfo::GetFullLaunchURL(extension);
}
extensions::LaunchType ChromeManagementAPIDelegate::GetLaunchType(
const extensions::ExtensionPrefs* prefs,
const extensions::Extension* extension) const {
return extensions::GetLaunchType(prefs, extension);
}
void ChromeManagementAPIDelegate::
GetPermissionWarningsByManifestFunctionDelegate(
extensions::ManagementGetPermissionWarningsByManifestFunction* function,
const std::string& manifest_str) const {
data_decoder::SafeJsonParser::Parse(
content::ServiceManagerConnection::GetForProcess()->GetConnector(),
manifest_str,
base::Bind(
&extensions::ManagementGetPermissionWarningsByManifestFunction::
OnParseSuccess,
function),
base::Bind(
&extensions::ManagementGetPermissionWarningsByManifestFunction::
OnParseFailure,
function));
}
std::unique_ptr<extensions::InstallPromptDelegate>
ChromeManagementAPIDelegate::SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const extensions::Extension* extension,
const base::Callback<void(bool)>& callback) const {
return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>(
new ManagementSetEnabledFunctionInstallPromptDelegate(
web_contents, browser_context, extension, callback));
}
std::unique_ptr<extensions::UninstallDialogDelegate>
ChromeManagementAPIDelegate::UninstallFunctionDelegate(
extensions::ManagementUninstallFunctionBase* function,
const extensions::Extension* target_extension,
bool show_programmatic_uninstall_ui) const {
return std::unique_ptr<extensions::UninstallDialogDelegate>(
new ManagementUninstallFunctionUninstallDialogDelegate(
function, target_extension, show_programmatic_uninstall_ui));
}
bool ChromeManagementAPIDelegate::CreateAppShortcutFunctionDelegate(
extensions::ManagementCreateAppShortcutFunction* function,
const extensions::Extension* extension,
std::string* error) const {
Browser* browser = chrome::FindBrowserWithProfile(
Profile::FromBrowserContext(function->browser_context()));
if (!browser) {
// Shouldn't happen if we have user gesture.
*error = extension_management_api_constants::kNoBrowserToCreateShortcut;
return false;
}
chrome::ShowCreateChromeAppShortcutsDialog(
browser->window()->GetNativeWindow(), browser->profile(), extension,
base::Bind(&extensions::ManagementCreateAppShortcutFunction::
OnCloseShortcutPrompt,
function));
return true;
}
std::unique_ptr<extensions::AppForLinkDelegate>
ChromeManagementAPIDelegate::GenerateAppForLinkFunctionDelegate(
extensions::ManagementGenerateAppForLinkFunction* function,
content::BrowserContext* context,
const std::string& title,
const GURL& launch_url) const {
favicon::FaviconService* favicon_service =
FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context),
ServiceAccessType::EXPLICIT_ACCESS);
DCHECK(favicon_service);
ChromeAppForLinkDelegate* delegate = new ChromeAppForLinkDelegate;
favicon_service->GetFaviconImageForPageURL(
launch_url,
base::Bind(&ChromeAppForLinkDelegate::OnFaviconForApp,
base::Unretained(delegate), base::RetainedRef(function),
context, title, launch_url),
&delegate->cancelable_task_tracker_);
return std::unique_ptr<extensions::AppForLinkDelegate>(delegate);
}
bool ChromeManagementAPIDelegate::CanHostedAppsOpenInWindows() const {
return extensions::util::CanHostedAppsOpenInWindows();
}
bool ChromeManagementAPIDelegate::IsNewBookmarkAppsEnabled() const {
return extensions::util::IsNewBookmarkAppsEnabled();
}
void ChromeManagementAPIDelegate::EnableExtension(
content::BrowserContext* context,
const std::string& extension_id) const {
const extensions::Extension* extension =
extensions::ExtensionRegistry::Get(context)->GetExtensionById(
extension_id, extensions::ExtensionRegistry::EVERYTHING);
// If the extension was disabled for a permissions increase, the Management
// API will have displayed a re-enable prompt to the user, so we know it's
// safe to grant permissions here.
extensions::ExtensionSystem::Get(context)
->extension_service()
->GrantPermissionsAndEnableExtension(extension);
}
void ChromeManagementAPIDelegate::DisableExtension(
content::BrowserContext* context,
const extensions::Extension* source_extension,
const std::string& extension_id,
extensions::disable_reason::DisableReason disable_reason) const {
extensions::ExtensionSystem::Get(context)
->extension_service()
->DisableExtensionWithSource(source_extension, extension_id,
disable_reason);
}
bool ChromeManagementAPIDelegate::UninstallExtension(
content::BrowserContext* context,
const std::string& transient_extension_id,
extensions::UninstallReason reason,
base::string16* error) const {
return extensions::ExtensionSystem::Get(context)
->extension_service()
->UninstallExtension(transient_extension_id, reason, error);
}
void ChromeManagementAPIDelegate::SetLaunchType(
content::BrowserContext* context,
const std::string& extension_id,
extensions::LaunchType launch_type) const {
extensions::SetLaunchType(context, extension_id, launch_type);
}
GURL ChromeManagementAPIDelegate::GetIconURL(
const extensions::Extension* extension,
int icon_size,
ExtensionIconSet::MatchType match,
bool grayscale) const {
return extensions::ExtensionIconSource::GetIconURL(extension, icon_size,
match, grayscale);
}
| [
"[email protected]"
] | |
4ef853182624957acf06ee882e1c5e690ef8d852 | 1d0163d142aa6c64dc7c0e1f5cfa2b6dfa4d538d | /src/patterns.cpp | 5e3a0c24ddf5844aca449ff2e1bb27fdcc9a2703 | [] | no_license | bwlewis/rchk | 9a280f5df8bf153dd15b0b3975117e407e8a216c | bc479a2a3de00af81147567928f116956ab23b1b | refs/heads/master | 2021-05-06T04:55:57.782495 | 2018-04-18T00:49:46 | 2018-04-18T00:49:46 | 115,020,991 | 0 | 0 | null | 2017-12-21T15:37:26 | 2017-12-21T15:37:24 | null | UTF-8 | C++ | false | false | 13,479 | cpp |
#include "patterns.h"
#include <llvm/IR/CallSite.h>
#include <llvm/IR/Constants.h>
#include <llvm/IR/Instructions.h>
#include <llvm/Support/raw_ostream.h>
using namespace llvm;
bool isAllocVectorOfKnownType(Value *inst, unsigned& type) {
CallSite cs(inst);
if (!cs) {
return false;
}
Function *tgt = cs.getCalledFunction();
if (!tgt || tgt->getName() != "Rf_allocVector") {
return false;
}
Value *arg = cs.getArgument(0);
if (!ConstantInt::classof(arg)) {
return false;
}
ConstantInt *ctype = cast<ConstantInt>(arg);
type = ctype->getZExtValue();
return true;
}
bool isCallPassingVar(Value *inst, AllocaInst*& var, std::string& fname) {
CallSite cs(inst);
if (!cs) {
return false;
}
Function *tgt = cs.getCalledFunction();
if (!tgt) {
return false;
}
Value *lval = cs.getArgument(0);
if (!LoadInst::classof(lval)) {
return false;
}
Value *lvar = cast<LoadInst>(lval)->getPointerOperand();
if (!AllocaInst::classof(lvar)) {
return false;
}
var = cast<AllocaInst>(lvar);
fname = tgt->getName();
return true;
}
bool isBitCastOfVar(Value *inst, AllocaInst*& var, Type*& type) {
if (!BitCastInst::classof(inst)) {
return false;
}
BitCastInst* bc = cast<BitCastInst>(inst);
Value *lvar = bc->getOperand(0);
if (!LoadInst::classof(lvar)) {
return false;
}
Value *avar = cast<LoadInst>(lvar)->getPointerOperand();
if (!AllocaInst::classof(avar)) {
return false;
}
var = cast<AllocaInst>(avar);
type = cast<Type>(bc->getDestTy());
return true;
}
// this is useful e.g. for detecting when a variable is stored into the node stack
// isStoreToStructureElement(in, "struct.R_bcstack_t", "union.ieee_double", protectedVar)
bool isStoreToStructureElement(Value *inst, std::string structType, std::string elementType, AllocaInst*& var) {
// [] %431 = load %struct.SEXPREC** %__v__7, align 8, !dbg !152225 ; [#uses=1 type=%struct.SEXPREC*] [debug line = 4610:5]
// %432 = load %struct.R_bcstack_t** %3, align 8, !dbg !152225 ; [#uses=1 type=%struct.R_bcstack_t*] [debug line = 4610:5]
// %433 = getelementptr inbounds %struct.R_bcstack_t* %432, i32 0, i32 1, !dbg !152225 ; [#uses=1 type=%union.ieee_double*] [debug line = 4610:5]
// %434 = bitcast %union.ieee_double* %433 to %struct.SEXPREC**, !dbg !152225 ; [#uses=1 type=%struct.SEXPREC**] [debug line = 4610:5]
// store %struct.SEXPREC* %431, %struct.SEXPREC** %434, align 8, !dbg !152225 ; [debug line = 4610:5]
StoreInst *si = dyn_cast<StoreInst>(inst);
if (!si) {
return false;
}
LoadInst *li = dyn_cast<LoadInst>(si->getValueOperand());
if (!li) {
return false;
}
AllocaInst *pvar = dyn_cast<AllocaInst>(li->getPointerOperand());
if (!pvar) {
return false;
}
BitCastInst *bc = dyn_cast<BitCastInst>(si->getPointerOperand());
if (!bc) {
return false;
}
if (!isPointerToStruct(bc->getSrcTy(), elementType)) {
return false;
}
GetElementPtrInst* gep = dyn_cast<GetElementPtrInst>(bc->getOperand(0));
if (!gep || !gep->isInBounds() || !isPointerToStruct(gep->getPointerOperandType(), structType)) {
return false;
}
var = pvar;
return true;
}
// detect if variable proxyVar when used at instruction "useInst" has the same value as
// some other variable origVar
//
// this is very primitive form of alias analysis, intended for cases like
//
// #define SETSTACK_PTR(s, v) do {
// SEXP __v__ = (v);
// (s)->tag = 0;
// (s)->u.sxpval = __v__;
// } while (0)
//
// when we need to know the real name of variable "v"
bool aliasesVariable(Value *useInst, AllocaInst *proxyVar, AllocaInst*& origVar) {
StoreInst *si = NULL;
if (!findOnlyStoreTo(proxyVar, si)) {
return false;
}
LoadInst *li = dyn_cast<LoadInst>(si->getValueOperand());
if (!li) {
return false;
}
AllocaInst *ovar = dyn_cast<AllocaInst>(li->getPointerOperand());
if (!ovar) {
return false;
}
// ovar may be the original variable...
// but we need to check that ovar is not overwritten between the store (si) and the use (useInst)
Instruction *ui = dyn_cast<Instruction>(useInst);
if (!ui) {
return false;
}
BasicBlock *bb = si->getParent();
if (bb != ui->getParent()) {
return false;
}
bool reachedStore = false;
for(BasicBlock::iterator ii = bb->begin(), ie = bb->end(); ii != ie; ++ii) {
Instruction *in = &*ii;
if (in == si) {
reachedStore = true;
continue;
}
if (in == ui) {
if (reachedStore) {
origVar = ovar;
return true;
}
return false;
}
// FIXME: check if the variable(s) have address taken
if (reachedStore) {
if (StoreInst *s = dyn_cast<StoreInst>(in)) {
if (s->getPointerOperand() == ovar) {
// detected interleacing write
return false;
}
}
}
}
// not reached really
return false;
}
bool findOnlyStoreTo(AllocaInst* var, StoreInst*& definingStore) {
StoreInst *si = NULL;
for(Value::user_iterator ui = var->user_begin(), ue = var->user_end(); ui != ue; ++ui) {
User *u = *ui;
if (StoreInst *s = dyn_cast<StoreInst>(u)) {
if (s->getPointerOperand() == var) {
if (si == NULL) {
si = s;
} else {
// more than one store
return false;
}
}
}
}
if (si == NULL) {
return false;
}
definingStore = si;
return true;
}
// just does part of a type check
static bool isTypeExtraction(Value *inst, AllocaInst*& var) {
// %33 = load %struct.SEXPREC** %2, align 8, !dbg !21240 ; [#uses=1 type=%struct.SEXPREC*] [debug line = 1097:0]
// %34 = getelementptr inbounds %struct.SEXPREC* %33, i32 0, i32 0, !dbg !21240 ; [#uses=1 type=%struct.sxpinfo_struct*] [debug line = 1097:0]
// %35 = bitcast %struct.sxpinfo_struct* %34 to i32*, !dbg !21240 ; [#uses=1 type=i32*] [debug line = 1097:0]
// %36 = load i32* %35, align 4, !dbg !21240 ; [#uses=1 type=i32] [debug line = 1097:0]
// %37 = and i32 %36, 31, !dbg !21240 ; [#uses=1 type=i32] [debug line = 1097:0]
BinaryOperator* andv = dyn_cast<BinaryOperator>(inst);
if (!andv) {
return false;
}
if (andv->getOpcode() != Instruction::And) {
return false;
}
LoadInst* bitsLoad;
ConstantInt* cmask;
if (LoadInst::classof(andv->getOperand(0)) && ConstantInt::classof(andv->getOperand(1))) {
bitsLoad = cast<LoadInst>(andv->getOperand(0));
cmask = cast<ConstantInt>(andv->getOperand(1));
} else if (LoadInst::classof(andv->getOperand(1)) && ConstantInt::classof(andv->getOperand(0))) {
bitsLoad = cast<LoadInst>(andv->getOperand(0));
cmask = cast<ConstantInt>(andv->getOperand(1));
} else {
return false;
}
if (cmask->getZExtValue() != 31) {
return false;
}
if (!BitCastInst::classof(bitsLoad->getPointerOperand())) {
return false;
}
Value *gepv = cast<BitCastInst>(bitsLoad->getPointerOperand())->getOperand(0);
if (!GetElementPtrInst::classof(gepv)) {
return false;
}
GetElementPtrInst *gep = cast<GetElementPtrInst>(gepv);
if (!gep->isInBounds() || !gep->hasAllZeroIndices() || !isSEXP(gep->getPointerOperandType())) {
return false;
}
if (!LoadInst::classof(gep->getPointerOperand())) {
return false;
}
Value *varv = cast<LoadInst>(gep->getPointerOperand())->getPointerOperand();
if (!AllocaInst::classof(varv)) {
return false;
}
var = cast<AllocaInst>(varv);
return true;
}
bool isTypeCheck(Value *inst, bool& positive, AllocaInst*& var, unsigned& type) {
// %33 = load %struct.SEXPREC** %2, align 8, !dbg !21240 ; [#uses=1 type=%struct.SEXPREC*] [debug line = 1097:0]
// %34 = getelementptr inbounds %struct.SEXPREC* %33, i32 0, i32 0, !dbg !21240 ; [#uses=1 type=%struct.sxpinfo_struct*] [debug line = 1097:0]
// %35 = bitcast %struct.sxpinfo_struct* %34 to i32*, !dbg !21240 ; [#uses=1 type=i32*] [debug line = 1097:0]
// %36 = load i32* %35, align 4, !dbg !21240 ; [#uses=1 type=i32] [debug line = 1097:0]
// %37 = and i32 %36, 31, !dbg !21240 ; [#uses=1 type=i32] [debug line = 1097:0]
// %38 = icmp eq i32 %37, 22, !dbg !21240 ; [#uses=1 type=i1] [debug line = 1097:0]
// but since ALTREP header changes, the pattern is
// %42 = load %struct.SEXPREC*, %struct.SEXPREC** %5, align 8, !dbg !44519 ; [#uses=1 type=%struct.SEXPREC*] [debug line = 164:9]
// %43 = getelementptr inbounds %struct.SEXPREC, %struct.SEXPREC* %42, i32 0, i32 0, !dbg !44519 ; [#uses=1 type=%struct.sxpinfo_struct*] [debug line = 164:9]
// %44 = bitcast %struct.sxpinfo_struct* %43 to i64*, !dbg !44519 ; [#uses=1 type=i64*] [debug line = 164:9]
// %45 = load i64, i64* %44, align 8, !dbg !44519 ; [#uses=1 type=i64] [debug line = 164:9]
// %46 = and i64 %45, 31, !dbg !44519 ; [#uses=1 type=i64] [debug line = 164:9]
// %47 = trunc i64 %46 to i32, !dbg !44519 ; [#uses=1 type=i32] [debug line = 164:9] <===== extra truncate
// %48 = icmp eq i32 %47, 16, !dbg !44519 ; [#uses=1 type=i1] [debug line = 164:9]
// br i1 %48, label %49, label %53, !dbg !44521 ; [debug line = 164:9]
if (!CmpInst::classof(inst)) {
return false;
}
CmpInst *ci = cast<CmpInst>(inst);
if (!ci->isEquality()) {
return false;
}
positive = ci->isTrueWhenEqual();
ConstantInt* ctype;
Value *other;
if (ConstantInt::classof(ci->getOperand(0))) {
ctype = cast<ConstantInt>(ci->getOperand(0));
other = ci->getOperand(1);
} else if (ConstantInt::classof(ci->getOperand(1))) {
ctype = cast<ConstantInt>(ci->getOperand(1));
other = ci->getOperand(0);
} else {
return false;
}
if (TruncInst::classof(other)) {
other = (cast<TruncInst>(other))->getOperand(0);
}
BinaryOperator* andv;
if (BinaryOperator::classof(other)) {
andv = cast<BinaryOperator>(other);
} else {
return false;
}
if (isTypeExtraction(andv, var)) {
type = ctype->getZExtValue();
return true;
}
return false;
}
bool isTypeSwitch(Value *inst, AllocaInst*& var, BasicBlock*& defaultSucc, TypeSwitchInfoTy& info) {
// switch (TYPEOF(var)) {
// case ...
// case ....
// %187 = load %struct.SEXPREC** %4, align 8, !dbg !195121 ; [#uses=1 type=%struct.SEXPREC*] [debug line = 407:13]
// %188 = getelementptr inbounds %struct.SEXPREC* %187, i32 0, i32 0, !dbg !195121 ; [#uses=1 type=%struct.sxpinfo_struct*] [debug line = 407:13]
// %189 = bitcast %struct.sxpinfo_struct* %188 to i32*, !dbg !195121 ; [#uses=1 type=i32*] [debug line = 407:13]
// %190 = load i32* %189, align 4, !dbg !195121 ; [#uses=1 type=i32] [debug line = 407:13]
// %191 = and i32 %190, 31, !dbg !195121 ; [#uses=1 type=i32] [debug line = 407:13]
// switch i32 %191, label %224 [
// i32 0, label %192 <==== NILSXP
// i32 2, label %192 <==== LISTSXP
// i32 19, label %193 <=== VECSXP
// ], !dbg !195122 ; [debug line = 407:5]
SwitchInst *si = dyn_cast<SwitchInst>(inst);
if (!si) {
return false;
}
if (!isTypeExtraction(si->getCondition(), var)) {
return false;
}
info.clear();
for(SwitchInst::CaseIt ci = si->case_begin(), ce = si->case_end(); ci != ce; ++ci) {
ConstantInt *val = ci.getCaseValue();
BasicBlock *succ = ci.getCaseSuccessor();
info.insert({succ, val->getZExtValue()});
}
defaultSucc = si->getDefaultDest();
return true;
}
bool isCallThroughPointer(Value *inst) {
if (CallInst* ci = dyn_cast<CallInst>(inst)) {
return LoadInst::classof(ci->getCalledValue());
} else {
return false;
}
}
ValuesSetTy valueOrigins(Value *inst) {
ValuesSetTy origins;
origins.insert(inst);
bool insertedValue = true;
while(insertedValue) {
insertedValue = false;
for(ValuesSetTy::iterator vi = origins.begin(), ve = origins.end(); vi != ve; ++vi) {
Value *v = *vi;
if (!Instruction::classof(v) || CallInst::classof(v) || InvokeInst::classof(v) || AllocaInst::classof(v)) {
continue;
}
Instruction *inst = cast<Instruction>(v);
for(Instruction::op_iterator oi = inst->op_begin(), oe = inst->op_end(); oi != oe; ++oi) {
Value *op = *oi;
auto vinsert = origins.insert(op);
if (vinsert.second) {
insertedValue = true;
}
}
}
}
return origins;
}
// check if value inst origins from a load of variable var
// it may directly be the load of var
// but it may also be a result of a number of non-load and non-call instructions
AllocaInst* originsOnlyFromLoad(Value *inst) {
if (LoadInst *l = dyn_cast<LoadInst>(inst)) {
if (AllocaInst *lv = dyn_cast<AllocaInst>(l->getPointerOperand())) { // fast path
return lv;
}
}
ValuesSetTy origins = valueOrigins(inst);
AllocaInst* onlyVar = NULL;
for(ValuesSetTy::iterator vi = origins.begin(), ve = origins.end(); vi != ve; ++vi) {
Value *v = *vi;
if (CallInst::classof(v) || InvokeInst::classof(v)) {
return NULL;
}
if (AllocaInst *curVar = dyn_cast<AllocaInst>(v)) {
if (!onlyVar) {
onlyVar = curVar;
} else {
if (onlyVar != curVar) {
// multiple origins
return NULL;
}
}
}
// FIXME: need to handle anything more?
}
return onlyVar;
}
| [
"[email protected]"
] | |
b03694bc631c65d65a320ebe4ccbd5bce5f089f4 | 37fe1bba682550af3d7f4808a35c84e9d2178ceb | /Source/RobCoG/Utilities/HandInformationParser.h | be5a5cb5eb9dfa020e5346dca8f041ebe90e9c7b | [
"BSD-3-Clause"
] | permissive | yukilikespie/RobCoG_FleX-4.16 | 706ba29ff21043d015f08716c8d85544c78fe6c6 | a6d1e8c0abb8ac1e36c5967cb886de8c154b2948 | refs/heads/master | 2021-06-30T18:01:21.603607 | 2017-09-21T14:20:30 | 2017-09-21T14:20:30 | 103,666,355 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,591 | h | // Copyright 2017, Institute for Artificial Intelligence - University of Bremen
#pragma once
#include "Enums/GraspType.h"
#include "Structs/HandOrientation.h"
#include "Structs/HandVelocity.h"
/**
* This class parses the HandOrientation for all Grasp types out of ini files
*/
class ROBCOG_API HandInformationParser
{
public:
HandInformationParser();
~HandInformationParser();
// Reads the initial and the closed hand orientation out of the ini file
void GetHandInformationForGraspType(FHandOrientation & InitialHandOrientation, FHandOrientation & ClosedHandOrietation, FHandVelocity & HandVelocity, const FString ConfigPath);
void SetHandInformationForGraspType(const FHandOrientation & InitialHandOrientation, const FHandOrientation & ClosedHandOrietation, const FHandVelocity & HandVelocity, const FString ConfigPath);
private:
const FString InitOrientationSection = "InitialHandOrientation";
const FString ClosedOrientationSection = "ClosedHandOrientation";
const FString VelocitySection = "HandVelocity";
// This shared pointer contains the config file
TSharedPtr<FConfigCacheIni> ConfigFileHandler;
// Writes an ini file for a grasptype
void WriteGraspTypeIni(const FHandOrientation & InitialHandOrientation, const FHandOrientation & ClosedHandOrientation, const FHandVelocity & HandVelocity, const FString ConfigPath);
// Reads the initial and the closed hand orientation out of the ini file
void ReadGraspTypeIni(FHandOrientation & InitialHandOrientation, FHandOrientation & ClosedHandOrientation, FHandVelocity & HandVelocity, const FString ConfigPath);
};
| [
"[email protected]"
] | |
73e6f9477fa5a2e34b71976ebdb15787a0a8afd2 | 413ee35c5c3e88e9e20daa9bbef8fd74633f0449 | /GAM300_SkyLine/SkyLine/System/Physics/Physics.hpp | 514417e751d919c05dd952e11ea584139d4b04af | [] | no_license | heejae-kwon/Game-Project | 17807b177f7bcd4b5c4c6707e18267a4b013e60d | 810023c9408342f8cdfea499b3afefdddf0e3fd8 | refs/heads/master | 2021-07-16T12:19:36.872803 | 2020-07-05T14:53:30 | 2020-07-05T14:53:30 | 187,778,325 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,519 | hpp | #pragma once
#include <btBulletDynamicsCommon.h>
#include "Rigidbody.hpp"
// TO DO:
// Move btRigidBody ownership from Component::Rigidbodies to Physics
// Handle removing btRigidBody objects from Bullet's world simulator
class Physics {
public:
Physics() = delete;
// Make sure you set gravity to a negative float, unless you want weird gravity for some raisin
Physics(float gravity);
~Physics();
void Initialize();
void Update(float dt);
void addRigidbody(Component::Rigidbody& rb);
std::vector<Component::Rigidbody*>& getRigidBodies() { return rigidBodies_; }
btRigidBody* add_RB_Box(float width, float height, float depth, float x, float y, float z, float mass);
btRigidBody* add_RB_Sphere(float rad, float x, float y, float z, float mass);
btRigidBody* add_RB_Cylinder(float d, float h, float x, float y, float z, float mass);
btRigidBody* add_RB_Cone(float d, float h, float x, float y, float z, float mass);
btRigidBody* add_RB_StaticPlane(float x, float y, float z);
private:
float timeStepAccumulator_ = 0.0f;
std::vector<Component::Rigidbody*> rigidBodies_;
// Bullet specific stuff below
// This is simply holds configuration options
btDefaultCollisionConfiguration * collisionConfig_;
// CollisionDispatcher iterates over each pair and uses the appropriate collision algorithm to compute contact points
// TLDR: Bullet uses this to calculate WHERE and HOW two objects are colliding
btCollisionDispatcher * collisionDispatcher_;
// Broadphase is basically a fast "initial" algorithm pass to reject pairs of objects
// Broadphase adds and removes overlapping pairs from a pair cache
// Bullet has three different algorithms available all inheriting from the base btBroadPhaseInterface type:
// btBroadphaseInterface foobar =
// 1) btDbvtBroadphase : a fast dynamic bounding volume hierarchy based on AABB tree (Axis aligned bounding boxes)
// 2) btAxisSweep3 : incremental 3D sweep and prune
// 3) btCudaBroadphase : fast uniform grid using GPU hardware
// For our purposes we will be using 1)
btBroadphaseInterface* broadphaseInterface_;
btSequentialImpulseConstraintSolver* constraintSolver_;
// The actual world simulator
btDiscreteDynamicsWorld* dynamicWorld_;
// Bullet has its own array type to handle its collision objects
// This is only here because we need to delete these ourselves
btAlignedObjectArray<btRigidBody*> bodies_;
}; | [
"[email protected]"
] | |
05240bb95c49b66e0ad610ec107ba22eaab2f8ef | e565def47d49a21467442f7ad0ffe9a692303ff0 | /src/game_state_popup.cpp | d9ee203a5d56d594aa322caded4e0624b0adbe50 | [] | no_license | MisanthropicBit/Blockzorz-2 | 8a10dc62119ff5a8309ded3381ad5650d7a5e0d1 | 3045b4722fc7652998f0bd4e2e509796821057b6 | refs/heads/master | 2021-01-18T20:29:49.348879 | 2016-10-05T18:25:51 | 2016-10-05T18:25:51 | 20,334,643 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,546 | cpp | #include "audio_manager.hpp"
#include "color.hpp"
#include "font.hpp"
#include "game_state_manager.hpp"
#include "game_state_pop_up.hpp"
#include "graphics.hpp"
#include "particle_effect.hpp"
#include "screen.hpp"
game_state_popup::GameStatePopUp() {
fader = nullptr;
popup = nullptr;
title = nullptr;
text = nullptr;
}
game_state_popup::game_state_popup(const std::string& caption,
const std::string& text,
const std::string& confirmtext,
const std::string& quittext,
game_state* return_state) {
fader = nullptr;
popup = nullptr;
title = nullptr;
text = nullptr;
font title_font("./fonts/biocomv2.ttf", 30);
font text_font("./fonts/biocomv2.ttf", 20);
title = title_font.load_hq_text_image(caption, color::dark_blue);
text = text_font.load_hq_text_image(text, color::black);
yes.load(confirm_text, "./fonts/biocomv2.ttf", color::black, 25, 200 - text_font.string_width(confirm_text)/2, 280);
no.load(quit_text, "./fonts/biocomv2.ttf", color::black, 25, 400 - text_font.string_width(quit_text)/2, 280);
yes.set_alpha(0.8f);
no.set_alpha(0.8f);
this->return_state = return_state;
titlex = screen::get().width()/2 - title_font.string_width(caption)/2;
textx = screen::get().width()/2 - text_font.string_width(text)/2;
title_font.close();
text_font.close();
}
game_state_popup::~game_state_popup() {
}
bool game_state_popup::load() {
fader = graphics::load_image("./images/fader.png");
popup = graphics::load_image("./images/popup.png", color::magenta);
graphics::set_transparency(fader, 0.5f);
return fader && popup && title && text;
}
void game_state_popup::on_event(SDL_Event& event) {
event::on_event(event);
}
void game_state_popup::update(int dt) {
}
void game_state_popup::draw() {
graphics::draw_image(fader, 0, 0);
graphics::draw_image(popup, 120, 140);
graphics::draw_image(title, titlex, 150);
graphics::draw_image(text, 140, 230);
yes.draw();
no.draw();
}
void game_state_popup::unload() {
returnstate = nullptr;
SDL_FreeSurface(fader);
SDL_FreeSurface(popup);
SDL_FreeSurface(title);
SDL_FreeSurface(text);
fader = nullptr;
popup = nullptr;
title = nullptr;
text = nullptr;
}
void game_state_popup::key_down(SDLKey key, SDLMod modifier, Uint16 unicode) {
if (key == SDLK_y || key == SDLK_RETURN) {
if (return_state) {
game_state_manager::get().change_state(return_state);
} else {
delete return_state;
game_state_manager::get().quit();
}
} else if (key == SDLK_n || key == SDLK_BACKSPACE || key == SDLK_ESCAPE) {
delete return_state;
game_state_manager::get().pop_state();
}
}
void game_state_popup::mouse_move(int mx, int my, int relx, int rely, Uint8 state) {
yes.mouse_move(mx, my);
no.mouse_move(mx, my);
}
void game_state_popup::left_button_down(int mx, int my) {
if (yes.has_mouse_hover(mx, my)) {
if (return_state) {
game_state_manager::get().change_state(return_state);
} else {
delete return_state;
game_state_manager::get().quit();
}
} else if (no.has_mouse_hover(mx, my)) {
delete return_state;
game_state_manager::get().pop_state();
}
}
game_state_mode_unlocked::game_state_mode_unlocked() : game_state_popup() {
particle_interval = 400;
}
game_state_mode_unlocked::game_state_mode_unlocked(const std::string& caption,
const std::string& text,
game_state* return_state) : game_state_popup() {
font title_font("./fonts/biocomv2.ttf", 30);
font text_font("./fonts/biocomv2.ttf", 20);
title = title_font.load_hq_text_image(caption, color::dark_blue);
text = text_font.load_hq_text_image(text, color::black);
awesome.load("Yeeees!", "./fonts/biocomv2.ttf", color::gold, 25, 250, 280);
awesome.set_alpha(0.5f);
this->return_state = return_state;
particle_interval = 400;
titlex = screen::get().width()/2 - title_font.string_width(caption)/2;
textx = screen::get().width()/2 - text_font.string_width(text)/2;
title_font.close();
text_font.close();
}
game_state_mode_unlocked::~game_state_mode_unlocked() {
}
bool game_state_mode_unlocked::Load() {
audio_manager::get()->play_sound("screech", 0);
audio_manager::get()->play_sound("moves", 0);
return game_state_popup::load();
}
void game_state_mode_unlocked::on_event(SDL_Event& event) {
event::on_event(event);
}
void game_state_mode_unlocked::update(int dt) {
particle_interval -= dt;
pe_manager.update(dt);
if (particle_interval <= 0) {
particle_interval = 400;
particle_explosion_effect* pex = new particle_explosion_effect("./images/cursor.png", 8, 0.1f, 0.1f, rand() % 641, rand() % 481);
pex->set_update_interval(40, 80);
pex->show();
pe_manager.add_effect(pex);
}
}
void game_state_mode_unlocked::draw() {
graphics::draw_image(fader, 0, 0);
graphics::draw_image(popup, 120, 140);
graphics::draw_image(title, titlex, 150);
graphics::draw_image(text, 140, 230);
awesome.draw();
pe_manager.draw();
}
void game_state_mode_unlocked::unload() {
game_state_popup::unload();
}
void game_state_mode_unlocked::key_down(SDLKey key, SDLMod modifier, Uint16 unicode) {
if (key == SDLK_RETURN) {
game_state_manager::get().pop_state();
}
}
void game_state_mode_unlocked::mouse_move(int mx, int my, int relx, int rely, Uint8 state) {
if (awesome.has_mouse_hover(mx, my)) {
if (!awesome.selected()) {
awesome.select();
awesome.set_alpha(0.f);
audio_manager::get()->play_sound("click", 0);
}
} else {
if (awesome.selected()) {
awesome.deselect();
awesome.set_alpha(0.8f);
}
}
}
void game_state_mode_unlocked::left_button_down(int mx, int my) {
if (awesome.has_mouse_hover(mx, my)) {
game_state_manager::get().pop_state();
}
}
| [
"[email protected]"
] | |
7ee48d2752e224bcf93fe2a336a5a0b2835892dc | 61070bede040a6f5318adafdd661dcb1bbe622e2 | /src/hsdk/win/direct3d/d3d10_font.h | 5646d204c6fb75c8a581595727d96bb3af030695 | [] | no_license | hanjuho/mysdk | 835694f73bc8b808b2ec87f23043f6fd63090bac | 284922ed3f962bb46124f3553e15ca7cfd94d613 | refs/heads/master | 2021-01-10T11:04:57.272796 | 2015-12-27T15:07:48 | 2015-12-27T15:07:48 | 44,182,150 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,079 | h | #pragma once
#include "d3d10_common.h"
namespace hsdk
{
namespace direct3d
{
// 설명 :
DECL_STRUCT(D3D10MY_FONTINFO)
{
// 설명 :
float left;
// 설명 :
float right;
// 설명 :
int size;
};
// 설명 :
DECL_CLASS(D3D10_Font)
{
public:
// 설명 :
INTERFACE_DECL_FUNC(initialize)(
_In_ const char * _fontDirecoty,
_In_ const wchar_t * _fontTableDirecoty);
// 설명 :
INTERFACE_DECL_FUNC_T(void, destory)(
_X_ void);
// 설명 :
INTERFACE_DECL_FUNC(build_Text)(
_Out_ D3D10MY_CONTEXT & _context,
_In_ const char * _text)const;
// 설명 :
INTERFACE_DECL_FUNC_T(ID3D10ShaderResourceView *, font)(
_X_ void)const;
private:
// 설명 :
INTERFACE_DECL_FUNC(create_ContexBuffer)(
_Out_ ID3D10Buffer ** _buffer,
_In_ unsigned int _width,
_In_ D3D10_USAGE _usage = D3D10_USAGE_DEFAULT)const;
protected:
// 설명 :
std::vector<D3D10MY_FONTINFO> my_DataTable;
// 설명 :
AutoRelease<ID3D10ShaderResourceView> my_Texture;
};
}
}
| [
"[email protected]"
] | |
67f4af331ab9d3cb2e48a8f28291e3f09cab7aed | 73e9d2c0da0748799af2a1939c4f62d8d95c5f51 | /c++/501 - Find Mode in Binary Search Tree.cpp | 55e5459c7364cd891e6d2396d1321a8166cefc89 | [] | no_license | jaymody/leetcode | bcc95e023d30ec8a0007dbfdbfd6f6798fb64631 | 20ca7d6148a9ce66a91d6c147f34097bd681ad4d | refs/heads/master | 2021-06-28T11:35:24.038139 | 2020-12-19T20:25:48 | 2020-12-19T20:25:48 | 197,073,473 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,444 | cpp | // 501
// Find Mode in Binary Search Tree
// https://leetcode.com/problems/find-mode-in-binary-search-tree/submissions/
// c++
// easy
// O(n^2)
// O(n)
// tree
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
// initial O(n^2) O(n) solution using a hash map
// time complexity is n^2 because worst case, every entry in the BST
// is unique and so the traversal through the hash map is O(n)
// NOTE: there is a better solution out there with O(n) time O(1) space
// that I haven't solved for yet (but know exists)
class Solution {
public:
void visit(TreeNode* root, unordered_map<int,int>& map) {
if (root) {
visit(root->left, map);
visit(root->right, map);
map[root->val] += 1;
}
}
vector<int> findMode(TreeNode* root) {
unordered_map<int,int> map;
visit(root, map);
int max = 0;
vector<int> results;
for (auto& it : map) {
// cout << it.first << ": " << it.second << endl;
if (it.second > max) {
max = it.second;
results.clear();
results.push_back(it.first);
}
else if (it.second == max) {
results.push_back(it.first);
}
}
return results;
}
};
| [
"[email protected]"
] | |
e06538ffb65d7be4e404db22b1b54b95bfc7ec73 | c724b322b2569cca483d2efc7e4f72891489bec6 | /arduino/IoTServer/ThingSpeak/dht11_client_dev/dht11_client_dev.ino | 15db0afd355c3a2cac033aba7b2b06b2711b4ce8 | [] | no_license | lunix983/iotelasticproject | 11417fc4359b00c4e321479a261901c23c06775f | f7509846198957d791c820901ed87729c444c79a | refs/heads/master | 2021-09-17T02:40:28.284447 | 2018-06-26T21:12:12 | 2018-06-26T21:12:12 | 124,667,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,674 | ino |
#include <DHT.h>
#include <SdFat.h>
#include <FreeStack.h>
#include <SdFatConfig.h>
#include <BlockDriver.h>
#include <SysCall.h>
#include <MinimumSerial.h>
#include <SPI.h>
#include <RH_RF95.h>
/*
Upload Data to IoT Server ThingSpeak (https://thingspeak.com/):
Support Devices: LoRa Shield + Arduino
Example sketch showing how to read Temperature and Humidity from DHT11 sensor,
Then send the value to LoRa Gateway, the LoRa Gateway will send the value to the
IoT server
It is designed to work with the other sketch dht11_server.
modified 24 11 2016
by Edwin Chen <[email protected]>
Dragino Technology Co., Limited
*/
/*#include <String.h>*/
RH_RF95 rf95;
#define DHTPIN 7
#define DHTTYPE DHT11
//#define dht_dpin A0 // Use A0 pin as Data pin for DHT11.
int dht_dpin = 7;
byte bGlobalErr;
char dht_dat[5]; // Store Sensor Data
char node_id[3] = {1,1,1}; //LoRa End Node ID
String stringOne;
float frequency = 868.0;
unsigned int count = 1;
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
// InitDHT();
Serial.begin(9600);
if (!rf95.init())
Serial.println("init failed");
// Setup ISM frequency
rf95.setFrequency(frequency);
// Setup Power,dBm
rf95.setTxPower(13);
dht.begin();
Serial.println("LoRa End Node Example --");
Serial.println(" DHT11 Temperature and Humidity Sensor by Luix\n");
Serial.print("LoRa End Node ID: ");
for(int i = 0;i < 3; i++)
{
Serial.print(node_id[i],HEX);
}
Serial.println();
}
void InitDHT()
{
pinMode(dht_dpin,OUTPUT);//Set A0 to output
digitalWrite(dht_dpin,HIGH);//Pull high A0
}
//Get Sensor Data
void ReadDHT()
{
bGlobalErr=0;
byte dht_in;
byte i;
//pinMode(dht_dpin,OUTPUT);
digitalWrite(dht_dpin,LOW);//Pull Low A0 and send signal
delay(30);//Delay > 18ms so DHT11 can get the start signal
digitalWrite(dht_dpin,HIGH);
delayMicroseconds(40);//Check the high level time to see if the data is 0 or 1
pinMode(dht_dpin,INPUT);
// delayMicroseconds(40);
dht_in=digitalRead(dht_dpin);//Get A0 Status
// Serial.println(dht_in,DEC);
if(dht_in){
bGlobalErr=1;
return;
}
delayMicroseconds(80);//DHT11 send response, pull low A0 80us
dht_in=digitalRead(dht_dpin);
if(!dht_in){
bGlobalErr=2;
return;
}
delayMicroseconds(80);//DHT11 send response, pull low A0 80us
for (i=0; i<5; i++)//Get sensor data
dht_dat[i] = read_dht_dat();
pinMode(dht_dpin,OUTPUT);
digitalWrite(dht_dpin,HIGH);//release signal and wait for next signal
byte dht_check_sum = dht_dat[0]+dht_dat[1]+dht_dat[2]+dht_dat[3];//calculate check sum
if(dht_dat[4]!= dht_check_sum)//check sum mismatch
{bGlobalErr=3;}
};
byte read_dht_dat(){
byte i = 0;
byte result=0;
for(i=0; i< 8; i++)
{
while(digitalRead(dht_dpin)==LOW);//wait 50us
delayMicroseconds(30);//Check the high level time to see if the data is 0 or 1
if (digitalRead(dht_dpin)==HIGH)
result |=(1<<(7-i));//
while (digitalRead(dht_dpin)==HIGH);//Get High, Wait for next data sampleing.
}
return result;
}
uint16_t calcByte(uint16_t crc, uint8_t b)
{
uint32_t i;
crc = crc ^ (uint32_t)b << 8;
for ( i = 0; i < 8; i++)
{
if ((crc & 0x8000) == 0x8000)
crc = crc << 1 ^ 0x1021;
else
crc = crc << 1;
}
return crc & 0xffff;
}
uint16_t CRC16(uint8_t *pBuffer,uint32_t length)
{
uint16_t wCRC16=0;
uint32_t i;
if (( pBuffer==0 )||( length==0 ))
{
return 0;
}
for ( i = 0; i < length; i++)
{
wCRC16 = calcByte(wCRC16, pBuffer[i]);
}
return wCRC16;
}
void loop()
{
Serial.print("########### ");
Serial.print("COUNT=");
Serial.print(count);
Serial.println(" ###########");
count++;
// ReadDHT();
char data[50] = {0} ;
int dataLength = 7; // Payload Length
// Use data[0], data[1],data[2] as Node ID
data[0] = node_id[0] ;
data[1] = node_id[1] ;
data[2] = node_id[2] ;
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
int tempIntPart = t;
int tempDecPart = (t - tempIntPart) * 100;
int umIntPart = h;
int unDecPart = (h - umIntPart) * 100;
data[3] = umIntPart;
data[4] = unDecPart;
data[5] = tempIntPart;
data[6] = tempDecPart;
// String umidityIntegerStr = buffer_um[0]+ String("") + buffer_um[1];
// Serial.println(umidityIntegerStr);
switch (bGlobalErr)
{
case 0:
Serial.print("Current humidity = ");
Serial.print(data[3], DEC);//Show humidity
Serial.print(".");
Serial.print(data[4], DEC);//Show humidity
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(data[5], DEC);//Show temperature
Serial.print(".");
Serial.print(data[6], DEC);//Show temperature
Serial.println("C ");
break;
case 1:
Serial.println("Error 1: DHT start condition 1 not met.");
break;
case 2:
Serial.println("Error 2: DHT start condition 2 not met.");
break;
case 3:
Serial.println("Error 3: DHT checksum error.");
break;
default:
Serial.println("Error: Unrecognized code encountered.");
break;
}
uint16_t crcData = CRC16((unsigned char*)data,dataLength);//get CRC DATA
//Serial.println(crcData,HEX);
Serial.print("Data to be sent(without CRC): ");
int i;
for(i = 0;i < dataLength; i++)
{
Serial.print(data[i],HEX);
Serial.print(" ");
}
Serial.println();
unsigned char sendBuf[50]={0};
for(i = 0;i < dataLength;i++)
{
sendBuf[i] = data[i] ;
}
sendBuf[dataLength] = (unsigned char)crcData; // Add CRC to LoRa Data
sendBuf[dataLength+1] = (unsigned char)(crcData>>8); // Add CRC to LoRa Data
Serial.print("Data to be sent(with CRC): ");
for(i = 0;i < (dataLength +2); i++)
{
Serial.print(sendBuf[i],HEX);
Serial.print(" ");
}
Serial.println();
rf95.send(sendBuf, dataLength+2);//Send LoRa Data
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];//Reply data array
uint8_t len = sizeof(buf);//reply data length
if (rf95.waitAvailableTimeout(3000))// Check If there is reply in 3 seconds.
{
// Should be a reply message for us now
if (rf95.recv(buf, &len))//check if reply message is correct
{
if(buf[0] == node_id[0] ||buf[1] == node_id[2] ||buf[2] == node_id[2] ) // Check if reply message has the our node ID
{
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
Serial.print("Got Reply from Gateway: ");//print reply
Serial.println((char*)buf);
delay(400);
digitalWrite(4, LOW);
//Serial.print("RSSI: "); // print RSSI
//Serial.println(rf95.lastRssi(), DEC);
}
}
else
{
Serial.println("recv failed");//
rf95.send(sendBuf, strlen((char*)sendBuf));//resend if no reply
}
}
else
{
Serial.println("No reply, is LoRa gateway running?");//No signal reply
rf95.send(sendBuf, strlen((char*)sendBuf));//resend data
}
delay(30000); // Send sensor data every 30 seconds
Serial.println("");
}
| [
"[email protected]"
] | |
5d413a08e8be5e8a35d0d9b54aed68a8eddecfc6 | d6bcfbc0173d84f25e9edb9aa49624f8af167a46 | /Communication/Network/DataClient.h | 9a8519839ac1631cf6ec62281cc00a449aa2c148 | [] | no_license | 15831944/DH1551 | 11bdba9b7904ccdbb1644a76ba44c3c5479176ea | 1bff86b4b6cc4bd4cc1a3c94900377c753f15089 | refs/heads/master | 2023-03-16T05:48:55.919303 | 2020-07-13T09:39:25 | 2020-07-13T09:39:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 530 | h | #ifndef DATACLIENT_H_
#define DATACLIENT_H_
#include "Network.h"
#include "../Common/UpgradeCommon.h"
class DataClient : public Network
{
public:
DataClient();
~DataClient();
public:
int StartConnectCastpalServer(char * pIPStr, unsigned short usPort);
int SendDataToCastpalServer(unsigned char *pBuffer, unsigned int unLen, unsigned int nDataType);
int RecvDataFromCastpalServer(unsigned char *pBuffer, unsigned int unLen, unsigned int & nDataType);
private:
UpgradeCommon m_UpgradeCommon;
};
#endif /* DATACLIENT_H_ */ | [
"[email protected]"
] | |
592cef35658bd9324055b3fbb90168a1ee4aed6b | 12ad42a6ff34ddf72f43bfeddb9f623816686747 | /lib/ui3/utils/DragMode.cpp | b299e8fd421dfee4752db9f782fd3395ab4fc263 | [] | no_license | cmann1/DustScripts | 45ba9c7161cee91e2de1056cc71b0c5314258a3b | 90a876a566461bca6aaf782455618d0c466b8d1f | refs/heads/master | 2023-04-27T05:38:08.151035 | 2023-04-24T12:54:11 | 2023-04-24T12:54:11 | 168,861,112 | 0 | 1 | null | 2021-03-27T17:46:33 | 2019-02-02T18:02:27 | C++ | UTF-8 | C++ | false | false | 127 | cpp | enum DragMode
{
Idle = 0x0,
Dragging = 0x1,
Resizing = 0x2,
Top = 0x4,
Bottom = 0x8,
Left = 0x10,
Right = 0x20,
}
| [
"[email protected]"
] | |
250875ce1552251d6b64b46eb8150afdba72375a | 803f0fbc5973ff31fd5faca5c0f2981b2c52a591 | /C++/CodeForces/R-486-div.3/pB.cpp | 2102c5aaf0179b7b40769685cc7a7aeae18995ba | [] | no_license | MiohitoKiri5474/CodesBackUp | 00ab52bd55732b8164a42cffd664407878f4390e | 4247fa032c8e88259dcc3992a21c510b6f2e8850 | refs/heads/master | 2023-08-09T14:46:10.445697 | 2023-08-04T01:12:58 | 2023-08-04T01:12:58 | 126,162,563 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,614 | cpp | // by. MiohitoKiri5474
#include<bits/stdc++.h>
#pragma GCC optimize ( "O3" )
#pragma loop_opt ( on )
using namespace std;
typedef long long LL;
// define tools
#define REPP(i,f,s) for ( int i = f ; i < s ; i++ )
#define REPM(i,f,s) for ( int i = f ; i >= s ; i-- )
#define REPALL(i,n) for ( auto &i: n )
#define debuger cout << "111\n"
#define MEM(n,i) memset ( n, i, sizeof n )
// define pair
typedef pair < LL, LL > pll;
typedef pair < int, int > pii;
#define F first
#define S second
#define mp make_pair
// define vector && some stl's api
template < class T > using vec = vector < T >;
typedef vec < int > vi;
typedef vec < LL > vl;
#define pb push_back
#define ep emplace_back
#define REV reverse
#define SZ(n) ( int ) n.size()
#define CLR(n) n.clear()
#define BEG(n) n.begin()
#define END(n) n.end()
#define EMP(n) n.empty()
#define RSZ(n,s) n.resize ( s )
#define ALL(n) BEG ( n ), END ( n )
#define PIO(n) REPALL ( i, n ) cout << i << ' '; cout << '\n'
#define GETDATA(data,n) RSZ ( data, n ); REPALL ( i, data ) cin >> i
// define set
typedef set < int > si;
typedef set < LL > sl;
#define FID(n,Index) ( n.find ( Index ) != n.end() )
// graph
#define GRE(T,edge) vec < T > edge[maxN]
#define UNI(u,v,edge) edge[u].pb ( v ), edge[v].pb ( u )
#define UNIw(u,v,w,edge) edge[u].pb ( mp ( v, w ) ), edge[v].pb ( mp ( u, w ) )
// IO
#define GL(n) getline ( cin, n )
// define stack, queue, pri-queue
template < class T > using stack = stack < T, vec < T > >;
template < class T > using MaxHeap = priority_queue < T, vec < T >, less < T > >;
template < class T > using MinHeap = priority_queue < T, vec < T >, greater < T > >;
// define stringstream
#define sstr stringstream
// number~ remember change maxN
#define INF 0x3f3f3f3f
#define NEG_INF 0x8f8f8f8f
#define maxN 100005
// ready~ go!
// let's go coding and have fun!
// I can solve this problem!
inline bool cmpSZ ( string a, string b ){
return SZ ( a ) < SZ ( b );
}
int main(){
ios::sync_with_stdio ( false );
cin.tie ( 0 );
cout.tie ( 0 );
int n;
cin >> n;
vec < string > data;
GETDATA ( data, n );
sort ( ALL ( data ), cmpSZ );
REPP ( k, 1, n ){
bool check = false;
string a = data[k], b = data[k - 1];
REPP ( i, 0, SZ ( a ) - SZ ( b ) + 1 ){
if ( a[i] == b[0] ){
bool tf = true;
REPP ( j, 1, SZ ( b ) ){
if ( a[i + j] != b[j] ){
tf = false;
break;
}
}
if ( tf )
check = true;
}
if ( check )
break;
}
if ( !check ){
cout << "NO\n";
return 0;
}
// cout << k << ' ' << check << '\n';
}
cout << "YES\n";
REPALL ( i, data ) cout << i << '\n';
} | [
"[email protected]"
] | |
7e882256a08ab76974f4434afd45e01eadcdcd29 | 865bfdce73e6c142ede4a7c9163c2ac9aac5ceb6 | /Source/Game/UI/Scenes/UIScene_Dialog.cpp | ab59fc9e15d29c495b77aba0eb6db79936d57ee8 | [] | no_license | TLeonardUK/ZombieGrinder | d1b77aa0fcdf4a5b765e394711147d5621c8d4e8 | 8fc3c3b7f24f9980b75a143cbf37fab32cf66bbf | refs/heads/master | 2021-03-19T14:20:54.990622 | 2019-08-26T16:35:58 | 2019-08-26T16:35:58 | 78,782,741 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,660 | cpp | // ===================================================================
// Copyright (C) 2013 Tim Leonard
// ===================================================================
#include "Game/UI/Scenes/UIScene_Dialog.h"
#include "Engine/UI/Transitions/UISlideInTransition.h"
#include "Engine/UI/Transitions/UIFadeOutTransition.h"
#include "Engine/UI/Layouts/UILayoutFactory.h"
#include "Engine/Platform/Platform.h"
#include "Engine/Display/GfxDisplay.h"
#include "Engine/Input/Input.h"
#include "Engine/UI/UIManager.h"
#include "Engine/UI/Elements/UIPanel.h"
#include "Engine/UI/Elements/UISlider.h"
#include "Engine/UI/Elements/UIListView.h"
#include "Engine/UI/Elements/UIProgressBar.h"
#include "Engine/UI/Elements/UILabel.h"
#include "Engine/Renderer/RenderPipeline.h"
#include "Engine/Resources/ResourceFactory.h"
#include "Engine/Localise/Locale.h"
#include "Game/UI/Scenes/UIScene_Game.h"
#include "Game/Runner/Game.h"
#include "Engine/Engine/EngineOptions.h"
#include "Game/Runner/GameOptions.h"
UIScene_Dialog::UIScene_Dialog(std::string value, std::string button_text, bool game_style, bool large_size, std::string override_layout)
: m_text(value)
, m_game_style(game_style)
{
if (override_layout != "")
{
Set_Layout(override_layout.c_str());
}
else
{
if (game_style)
{
if (large_size)
{
Set_Layout("large_dialog");
}
else
{
Set_Layout("dialog");
}
}
else
{
Set_Layout("editor_dialog");
}
}
if (button_text != "")
{
Find_Element<UILabel*>("back_button")->Set_Value(button_text.c_str());
}
}
bool UIScene_Dialog::Can_Accept_Invite()
{
return false;
}
const char* UIScene_Dialog::Get_Name()
{
return "UIScene_Dialog";
}
bool UIScene_Dialog::Should_Render_Lower_Scenes()
{
return true;
}
bool UIScene_Dialog::Should_Display_Cursor()
{
return true;
}
bool UIScene_Dialog::Should_Display_Focus_Cursor()
{
return m_game_style;
}
bool UIScene_Dialog::Is_Focusable()
{
return true;
}
void UIScene_Dialog::Enter(UIManager* manager)
{
Find_Element<UILabel*>("label")->Set_Value(S(m_text.c_str()));
}
void UIScene_Dialog::Exit(UIManager* manager)
{
}
void UIScene_Dialog::Tick(const FrameTime& time, UIManager* manager, int scene_index)
{
UIScene::Tick(time, manager, scene_index);
}
void UIScene_Dialog::Draw(const FrameTime& time, UIManager* manager, int scene_index)
{
UIScene::Draw(time, manager, scene_index);
}
void UIScene_Dialog::Recieve_Event(UIManager* manager, UIEvent e)
{
switch (e.Type)
{
case UIEventType::Button_Click:
{
if (e.Source->Get_Name() == "back_button")
{
manager->Go(UIAction::Pop(new UIFadeOutTransition()));
}
}
break;
}
}
| [
"[email protected]"
] | |
a46129e7bf56301a7dade7e1f826ed7489e94250 | 9866acd66b81d25e74195a22f9f5867d166b1380 | /gc/src/qnx/control/speed/chassis.h | 63f0d316879ec0037c9576e5ee21a2465976a5e2 | [] | no_license | John-Nagle/Overbot | af45bcba87ddf1442c44830cc966cdb4b5107fef | 80c56adb16b673ff7d667ac3d6ed4a0ee36e25a3 | refs/heads/master | 2020-04-15T20:37:27.263381 | 2019-01-10T06:36:19 | 2019-01-10T06:36:19 | 165,001,886 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,386 | h | //
// File: chassis.h -- interface to the Overbot Polaris Ranger with Galil controllers
//
//
// John Nagle
// Team Overbot
// November, 2004
//
//
#ifndef CHASSIS_H
#define CHASSIS_H
#include <time.h>
#include "simplecontroller.h"
#include "throttlecontroller.h"
#include "transmissioncontroller.h"
#include "brakecontroller.h"
#include "steeringcontroller.h"
#include "speedservermsg.h"
#include "timedloop.h"
//
// class Chassis -- all the engine-related controllers
//
class Chassis {
private:
// Controllers for hardware
BrakeController m_brake; // brake controlller (GOAL is pressure)
ThrottleController m_throttle; // throttle controller (GOAL is position)
TransmissionController m_transmission; // transmission controller (GOAL is gear)
SteeringController m_steer; // steering controller (GOAL is position)
// State info
MsgSpeedSet::State m_state; // what state we are in
SimpleLowPassFilter m_speed; // filtered speed
SimpleLowPassFilter m_accel; // filtered acceleration
double m_prevodometer; // previous odometer value
double m_prevspeed; // previous speed value
double m_accumspeederror; // accumulated speed error, for I term
double m_statetimestamp; // time of last state change
double m_updatetimestamp; // time of last update
double m_dumptimestamp; // time of last dump to log
bool m_hillholder; // hill holder mode; lock brakes until RPM is up
bool m_controllersready; // controllers ready at last update?
bool m_verbose; // true if verbose mode
Fault::Faultcode m_fault; // current fault code if any
public:
Chassis(bool readonly=false); // constructor
~Chassis(); // destructor
void SetVerbose(bool verbose) { m_verbose = verbose; }
void Update(); // update incoming info from controllers.
bool SetState(MsgSpeedSet::State newstate, bool& busy); // change to new state
void SetSpeed(float desiredaccel, float desiredspeed, float desiredsteer); // actually set the speed and steering
void SetFault(Fault::Faultcode faultid, const char* msg = 0); // report a fault - causes an emergency stop
void SetFault(Fault::Faultcode faultid, Controller::Err err); // report a fault - causes an emergency stop
bool ResetFault(); // reset fault, returns true if reset allowed.
bool SetGear(MsgSpeedSet::Gear newgear, bool busy); // request gear change
// Access functions
MsgSpeedSet::State GetState() const { return(m_state); }
MsgSpeedSet::Gear GetGear();
float GetSpeed(); // get speed in m/sec
float GetAccel(); // get acceleration in m^2/sec
float GetCurvature(); // get turning curvature (1/radius in meters, > 0 means right turn)
int GetDir(); // -1 reverse, +1 forward, 0 neutral.
Fault::Faultcode GetFault() const { return(m_fault); }
MsgSpeedSetReply::Hint GetHint(); // not yet
double GetUpdateTmestamp() const { return(m_updatetimestamp); }
bool GetControllersReady() const { return(m_controllersready); }
bool GetStopped() { return(stopped()); } // export Stopped
double GetOdometer(); // get odometer value
void Dump(); // dump state (to logprintf)
private:
void UpdateState(); // update state, called on each update cycle
Controller::Err UpdateControllersTry(Fault::Faultcode& faultid); // update local copy of controller state, make sure all are up
Controller::Err UpdateControllers(Fault::Faultcode& faultid); // update local copy of controller state, make sure all are up
void StateChange(MsgSpeedSet::State newstate, const char* msg); // note a state change
void ControllerSanityCheck(); // check state of recently updated controllers
float calcThrottle(float desiredspeed); // calculate throttle setting
float calcBrake(float desiredaccel); // calculate brake setting
float calcSteering(float desiredinvrad); // convert 1/r to steering goal
float calcSteeringRadius(float goal); // convert steering goal to 1/r
bool SetGoals(float throttlesetting, float brakesetting, float steersetting); // set moving throttle, brakes, steering
bool SetGoalsStopped(); // set throttle, brakes for stopped state
bool controllersready(); // true if controllers are ready
bool brakeslocked(); // true if brake pressure is above high threshold
bool brakesreleased(); // true if brake pressure is below low threshold
bool engineabovehillholdrelease(); // true if engine above hill hold release point
bool engineaboveidle(); // true if engine RPM is above movement threshold
bool enginerunning(); // true if engine RPM is above cranking threshold
bool throttlezero(); // true if throttle is at zero
bool notmoving(); // true if not moving according to encoder
bool stopped(); // true if brakes locked and engine idle and not moving
bool indesiredgear(); // true if in desired gear
bool unpaused(); // true if not estop, not paused, not manual
bool unpaused(bool& notestop, bool& unpaused, bool& inauto); // long form
};
#endif // CHASSIS_H
| [
"[email protected]"
] | |
92abeb29bdf51d7d32c9e977f0a372bfe0ca2d21 | 6915155b31bfd3f945d2da6b51cdda9037b68f2f | /schlee_qt/024_falloff_buttons/main.cpp | 31fddc9136991d8e7915f7fe70d12fc49591d426 | [] | no_license | AxelStoneX/tutorial | 86c1e5cdaa749fb2a109d0a8ed51153194a23d03 | eef7e73da27de342094958ff836fb87258d6a53f | refs/heads/master | 2021-01-11T16:46:30.602132 | 2017-01-23T18:16:58 | 2017-01-23T18:16:58 | 79,669,825 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 385 | cpp | #include "mainwindow.h"
#include <QApplication>
#include <QtWidgets>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton cmd("Menu");
QMenu* pmnu = new QMenu(&cmd);
pmnu->addAction("Item1");
pmnu->addAction("Item2");
pmnu->addAction("&Quit", &app, SLOT(quit()));
cmd.setMenu(pmnu);
cmd.show();
return app.exec();
}
| [
"[email protected]"
] | |
63c3538600d768e6f735afb4f5316b2901072777 | 0287787791d1fd921590a988bae5adce2299e218 | /hrs/src/business/idgen/EmpIdGen.cpp | 378708f559f4872c6a6699a608e33ecab5a17401 | [] | no_license | samridhi22/HRSapp | a41922e8c443982b8a2865946300b2c731581a76 | 79a66db7181d9cdb44356ff62f02411fe439c63e | refs/heads/master | 2021-01-21T08:44:09.487822 | 2016-07-13T05:02:07 | 2016-07-13T05:02:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,908 | cpp | #include <fstream>
#include <iostream>
#include<string>
#include<common/GeneralException.h> // must be declared before DBException.
#include<dao/DAOConstants.h>
#include<dbaccess/ODBCConnection.h>
#include<dbaccess/ODBCResultSet.h>
#include<dbaccess/ODBCStatement.h>
#include<dbaccess/dbAccess.h>
#include<dbaccess/DBException.h>
#include<dbaccess/ODBCError.h>
#include<business/idgen/EmpIdGen.h>
#include<string>
/**@file EmpIdGen.h
* @brief Declares the EmpIdGen
*
* <BR>NAME:EmpIdGen
*
* <BR>BASE CLASSES:None
*
* <BR>PURPOSE:To generate employee id.
*
* <BR>AUTHOR:Smitha Manjunath
* <BR>
* <BR>$Revision: $12/14/2005
*
* <BR>$Log:12/14/2005
*
* <BR>COPYRIGHT NOTICE:
* <BR>Copyright (c) 2005 C++ Capability team at Accenture. All rights reserved.
*/
/**@namespace idgen
*@brief All the classes related to IDGenerator is defined in this namespace.
*/
namespace idgen {
EmpIdGen* EmpIdGen::m_thisInstance = NULL;
/**@class EmpIdGen
* @brief Declaration of EmpIdGen
* <PRE>This class shall do the following
* This class is the singleton.
* It will provide a method to get an instance of it.
* It will also provide a method to create a next id.
</PRE>
*/
/**@fn EmpIdGen.
* @brief empty private Constructor.
* This constructor will not take any argument.
* Instance can be obtained through getInstance()
* @param none
* @return none
*/
EmpIdGen::EmplIdGen()
{
}
/**@fn getInstance
* @brief implements singleton EmplIdGen class.
* @param none
* @return Pointer to EmpIdGen.
*/
static EmpIdGen* EmpIdGen::getInstance()
{
if (m_thisInstance == Null)
{
m_thisInstance = new EmplIdGen;
}
return m_thisInstance;
}
/**@fn getNextId
* @brief gets the next system-generated id.
* @param none.
* @return string.
*/
std::string EmpIdGen::getNextId()
{
try{
dbaccess::ODBCConnection* conn = dbaccess::DBAccess::getConnection();
if(conn->getError().isError()) //Checks for error.
{
throw new GeneralException(conn->getError().getErrorMessage());
}
dbaccess::ODBCStatement* stmt = conn->createStatement();
if(conn->getError().isError()) //Checks for error.
{
throw new GeneralException(conn->getError().getErrorMessage());
}
dbaccess::ODBCResultSet* res = stmt->executeQuery( DAOConstants::EMPSQL_GETID);
if(conn->getError().isError()) //Checks for error.
{
throw new GeneralException(conn->getError().getErrorMessage());
}
if(!res->next())
{
res->close();
stmt->close();
dbaccess::DBAccess::releaseConnection();
throw new GeneralException("Error obtaining next Id");
}
std::string id = res->getString(1);
res->close();
stmt->close();
dbaccess::DBAccess::releaseConnection();
return id;
}catch(dbaccess::DBException* dbe)
{
throw new GeneralException(dbe->getMessage());
}
}
} //namespace idgen
#endif //EMPIDGEN_H
| [
"[email protected]"
] | |
3ae64a05c591afc71b0bc5d109c377a8492b3ab2 | 6b84794b2b0aa23a2d2c3c5f1437001d103213ae | /Problems & Contents/URI/2-Ad-Hoc/1428-ProcurandoNessy.cpp | 3874ba2314069393027506e93b59e080d45b73d2 | [] | no_license | mtreviso/university | 2406d3782759a75ef00af4da8e4e1ed99cfb89d8 | 164dbfc13d6dddb3bdbb04957c4702d0e0885402 | refs/heads/master | 2021-01-09T08:14:21.551497 | 2016-06-09T23:19:01 | 2016-06-09T23:19:01 | 16,703,296 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 279 | cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){
int n, a, b;
cin >> n;
while(n--){
cin >> a >> b;
int x = a-2;
int y = b-2;
int val = ceil(double(x)/3) * ceil(double(y)/3);
cout << val << endl;
}
return 0;
} | [
"[email protected]"
] | |
ac4fb3631e627a64372f68394563978646565895 | fea779942fbbe4e3c03cb9bc78b0a99e56cb17e5 | /cpp/m4engine/src/region.cpp | 9c5d3939a91782dd5223656b77cca2e15d308afb | [] | no_license | jesuscraf/peopletech | 66e372af07f9a3dd4660ef14b93daddf92a5e3c8 | 3ab9470cf2e7cb7a44baf4185710cb707f081ff4 | refs/heads/master | 2021-09-03T13:37:13.701453 | 2018-01-09T11:49:34 | 2018-01-09T11:49:34 | 114,750,048 | 0 | 0 | null | null | null | null | ISO-8859-3 | C++ | false | false | 11,612 | cpp | //==============================================================================
//
// (c) Copyright 1991-1997 Meta Software M.S., S.A
// All rights reserved.
//
// Module: <modulo>
// File: region.cpp
// Project:
// Author: Meta Software M.S. , S.A
// Date:7/18/97
// Language: C++
// Operating System: ALL
// Design Document:
//
// Propietary: Fernando Abad Garcia
// Modifications: Who && Date
//
// Definition:
//
// This module defines...
//
//
//==============================================================================
#include "eng.h"
#include "engdf.inl"
#include "designdt.h"
#include "region.h"
#define GROUP_ID ENG_TGI_FIELD
//==============================================================================ClENG_Line
ClENG_Line::ClENG_Line()
{
m_poInsp=GET_INSP();
m_poDvc =NULL;
}
void ClENG_Line::End()
{
m_poDvc =NULL;
}
void ClENG_Line::Init(
ClENG_OutDevice * ai_poDvc,
DvcUnit_t ai_Top, DvcUnit_t ai_Left, DvcUnit_t ai_Top2, DvcUnit_t ai_Left2,
m4bool_t ai_bAdjustLineToContainer,
DvcUnit_t ai_Width, ClENG_OutDevice::STYLE ai_Style, m4uint32_t ai_uiIdColour,
m4bool_t ai_bSwVisible )
{
ClENG_Line::End() ;
m_poDvc = ai_poDvc ;
m_Top = ai_Top ;
m_Left = ai_Left ;
m_Top2 = ai_Top2 ;
m_Left2 = ai_Left2 ;
m_Width = ai_Width ;
m_Style = ai_Style ;
m_uiIdColour = ai_uiIdColour ;
m_bSwVisible = ai_bSwVisible ;
m_bAdjustLineToContainer = ai_bAdjustLineToContainer ;
}
void ClENG_Line::Init( ClENG_Line *ai_poSource )
{
Init(
ai_poSource->m_poDvc,
ai_poSource->GetTop(), ai_poSource->GetLeft(),
ai_poSource->GetTop2(), ai_poSource->GetLeft2(),
ai_poSource->GetAdjustLineToContainer(),
ai_poSource->GetWidth(), ai_poSource->GetStyle(), ai_poSource->GetIdColour(),
ai_poSource->IsVisible() ) ;
}
void ClENG_Line::Show( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase )
{
if ( IsVisible() ) {
m_poDvc->SelectColour(ai_iNumPage, m_uiIdColour);
m_poDvc->PrintLine( ai_iNumPage, ai_XBase+m_Left, ai_YBase+m_Top,
ai_XBase+m_Left2, ai_YBase+m_Top2, m_Width, m_Style ) ;
} ;
}
void ClENG_Line::Show( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase,
DvcUnit_t ai_HeightPrinted, DvcUnit_t ai_HeightToPrint )
{
m4double_t PendX, K ;
m4bool_t Inf, SwShow ;
DvcUnit_t X1,Y1,X2,Y2 ; //Puntos de la linea ordenados de < a > por eje Y
DvcUnit_t YLim1, YLim2 ; //Limites Y de impresion
if ( IsVisible() ) {
//Ordeno puntos por eje Y, para que el signo de la pendiente sea correcto
//Opero sobre coordenadas ya reales
if (m_Top<m_Top2) {
Y1=m_Top ; X1=m_Left; Y2=m_Top2; X2=m_Left2 ;
} else {
Y2=m_Top ; X2=m_Left; Y1=m_Top2; X1=m_Left2 ;
} ;
Y1+=ai_YBase - ai_HeightPrinted ; Y2+=ai_YBase - ai_HeightPrinted ; X1+=ai_XBase ;X2+=ai_XBase ;
//Hayo f(x)=PendX*x+k.
if ( Y1==Y2 ) {
Inf=M4_TRUE ; //Pendiente infinita, linea horizontal
} else {
Inf=M4_FALSE ;
PendX=(X2-X1)*1.0/(Y2-Y1) ;
K = X1-PendX*Y1 ;
} ;
//Recalculo puntos teniendo en cuenta la intersección
YLim1=ai_YBase ;
YLim2=ai_YBase+ai_HeightToPrint-1 ;
if (Inf) {
SwShow = M4_BOOL(M4_IN_RANGE(Y1,YLim1,YLim2));
} else {
SwShow = M4_BOOL(! ( Y1>YLim2 || Y2<YLim1 ));
if (SwShow) {
if (Y1<YLim1) {
Y1=YLim1 ;
X1=Y1*PendX+K ;
} ;
if (Y2>YLim2) {
Y2=YLim2 ;
X2=Y2*PendX+K ;
} ;
} ;
} ;
if (SwShow) {
m_poDvc->SelectColour(ai_iNumPage, m_uiIdColour);
m_poDvc->PrintLine( ai_iNumPage, X1, Y1, X2, Y2, m_Width, m_Style ) ;
} ;
} ;
}
m4bool_t ClENG_Line::SetLine( m4char_t *ai_pcLineProps )
{
m4bool_t SwOk=M4_TRUE ;
m4int16_t B ;
ClMIT_Str StrAux ;
if ( ClMIT_Str::StrLenTrim(ai_pcLineProps)==0 ) {
SetVisible(M4_FALSE) ;
goto exit ;
}
if ( ClMIT_Str::StrLenTrim(ai_pcLineProps)!=GetSizeStrLine() ) {
SwOk=M4_FALSE ;
goto exit ;
} ;
StrAux.ToASCIZ( &ai_pcLineProps[0],4) ;
SetWidth( ClMetric::DPointToDvc( atol(StrAux)/10.0 ) ) ;
StrAux.ToASCIZ( &ai_pcLineProps[4],2) ;
SwOk = M4_BOOL( SwOk && ClENG_DesignTree::TestLineStyle((ClENG_OutDevice::STYLE)atol(StrAux)) ) ;
if (!SwOk) goto exit ;
SetStyle( (ClENG_OutDevice::STYLE)atol(StrAux) ) ;
StrAux.ToASCIZ( &ai_pcLineProps[6],1) ;
SetVisible( M4_BOOL(atol(StrAux)==1) ) ;
StrAux.ToASCIZ( &ai_pcLineProps[7],5) ;
SetIdColour( atol(StrAux)) ;
exit:
if (!SwOk) {
/*##Cambiar num msg*/
*m_poInsp->m_poTrace << ClMIT_Msg( ClMIT_Msg::MSG_ERROR, GROUP_ID,
"Sintax error in SetLine: parameter %0:s", ClMIT_Msg::MIXED_OUT)
<< ai_pcLineProps << SEND_MSG ;
} ;
return SwOk ;
}
//==============================================================================ClENG_Region
ClENG_Region::ClENG_Region()
{
m_poInsp=GET_INSP();
m_poDvc =NULL;
}
void ClENG_Region::End()
{
m_poDvc =NULL;
}
void ClENG_Region::Init(
ClENG_OutDevice * ai_poDvc,
DvcUnit_t ai_Top, DvcUnit_t ai_Left, DvcUnit_t ai_Width, DvcUnit_t ai_Height,
m4char_t *ai_pcBordeProps, m4uint32_t ai_uiFillColour
)
{
m4int16_t B ;
ClENG_Region::End() ;
m_poDvc = ai_poDvc ;
m_Top = ai_Top ;
m_Left = ai_Left ;
m_Width = ai_Width ;
m_Height = ai_Height ;
m_uiFillColour = ai_uiFillColour ;
for (B=0; B<LINE_COUNT; ++B ) m_Line[B].Init(m_poDvc,0,0,0,0,M4_FALSE,0,ClENG_OutDevice::SOLID,0,M4_FALSE) ;
AdjustFrameAndFillZone() ;
SetFrame(ai_pcBordeProps) ;
}
void ClENG_Region::Init( ClENG_Region *ai_poSource )
{
m4int16_t B ;
Init(
ai_poSource->m_poDvc,
ai_poSource->GetTop(), ai_poSource->GetLeft(), ai_poSource->GetWidth(),
ai_poSource->GetHeight(), "", ai_poSource->GetFillColour() ) ;
for (B=0;B<LINE_COUNT;++B) m_Line[B].Init( &ai_poSource->m_Line[B] ) ;
}
void ClENG_Region::LineIndex(LINE_ID ai_Line, m4int16_t *ao_piBeg,m4int16_t *ao_piEnd)
{
if (ai_Line==FRAME) {
*ao_piBeg=0 ; *ao_piEnd=LINE_COUNT-1 ;
} else {
*ao_piBeg=ai_Line; *ao_piEnd=ai_Line;
} ;
}
void ClENG_Region::SetStyle( LINE_ID ai_Line, ClENG_OutDevice::STYLE ai_Style)
{
m4int16_t B, Beg, End ;
LineIndex(ai_Line,&Beg,&End) ;
for (B=Beg;B<=End;++B) m_Line[B].SetStyle(ai_Style) ;
}
void ClENG_Region::SetIdColour( LINE_ID ai_Line, m4uint32_t ai_uiIdColour)
{
m4int16_t B, Beg, End ;
LineIndex(ai_Line,&Beg,&End) ;
for (B=Beg;B<=End;++B) m_Line[B].SetIdColour(ai_uiIdColour) ;
}
void ClENG_Region::SetVisible( LINE_ID ai_Line, m4bool_t ai_bSw)
{
m4int16_t B, Beg, End ;
LineIndex(ai_Line,&Beg,&End) ;
for (B=Beg;B<=End;++B) m_Line[B].SetVisible(ai_bSw) ;
}
void ClENG_Region::SetWidth( LINE_ID ai_Line, DvcUnit_t ai_Width)
{
m4int16_t B, Beg, End ;
LineIndex(ai_Line,&Beg,&End) ;
for (B=Beg;B<=End;++B) m_Line[B].SetWidth(ai_Width) ;
AdjustFrameAndFillZone() ;
}
void ClENG_Region::SetTop(DvcUnit_t ai_Top)
{
m_Top=ai_Top ;
AdjustFrameAndFillZone() ;
}
void ClENG_Region::SetLeft(DvcUnit_t ai_Left)
{
m_Left=ai_Left ;
AdjustFrameAndFillZone() ;
}
void ClENG_Region::SetWidth(DvcUnit_t ai_Width)
{
m_Width=ai_Width ;
AdjustFrameAndFillZone() ;
}
void ClENG_Region::SetHeight(DvcUnit_t ai_Height)
{
m_Height=ai_Height ;
AdjustFrameAndFillZone() ;
}
m4bool_t ClENG_Region::IsHomogeneousFrame()
{
m4bool_t SwRet=M4_TRUE ;
m4int16_t B ;
for (B=0;B<LINE_COUNT && SwRet ; ++B) {
if ( ! m_Line[B].IsVisible() ) {
SwRet=M4_FALSE ;
} else {
if (
m_Line[B].GetStyle() != m_Line[0].GetStyle() ||
m_Line[B].GetIdColour() != m_Line[0].GetIdColour() ||
m_Line[B].GetWidth() != m_Line[0].GetWidth()
)
{
SwRet=M4_FALSE ;
}
} ;
} ;
return SwRet ;
}
void ClENG_Region::AdjustFrameAndFillZone()
{
DvcUnit_t Int[LINE_COUNT],Ext[LINE_COUNT] ;
m4int16_t B ;
for (B=0; B<LINE_COUNT;++B) {
if ( m_Line[B].IsVisible() ) {
Int[B] = m_Line[B].GetWidth()/2 ;
Ext[B] = m_Line[B].GetWidth()-Int[B]*2 ;
} else {
Ext[B] = Int[B] = 0 ;
} ;
} ;
m_Line[TOP_LINE].SetTop( m_Top ) ;
m_Line[TOP_LINE].SetLeft( m_Left-Ext[LEFT_LINE]) ;
m_Line[TOP_LINE].SetTop2( m_Top ) ;
m_Line[TOP_LINE].SetLeft2( m_Left+m_Width+Ext[RIGHT_LINE] ) ;
m_Line[BOTTOM_LINE].SetTop( m_Top+m_Height-1 ) ;
m_Line[BOTTOM_LINE].SetLeft( m_Line[TOP_LINE].GetLeft() ) ;
m_Line[BOTTOM_LINE].SetTop2( m_Top+m_Height-1 ) ;
m_Line[BOTTOM_LINE].SetLeft2( m_Line[TOP_LINE].GetLeft2() ) ;
m_Line[LEFT_LINE].SetTop( m_Top-Ext[TOP_LINE] ) ;
m_Line[LEFT_LINE].SetLeft( m_Left ) ;
m_Line[LEFT_LINE].SetTop2( m_Top+m_Height-1+Ext[BOTTOM_LINE] ) ;
m_Line[LEFT_LINE].SetLeft2( m_Left ) ;
m_Line[RIGHT_LINE].SetTop( m_Top-Ext[TOP_LINE] ) ;
m_Line[RIGHT_LINE].SetLeft( m_Left+m_Width-1 ) ;
m_Line[RIGHT_LINE].SetTop2( m_Top+m_Height-1+Ext[BOTTOM_LINE] ) ;
m_Line[RIGHT_LINE].SetLeft2( m_Left+m_Width-1 ) ;
m_FillTop=m_Top+Int[TOP_LINE] ;
m_FillLeft=m_Left+Int[LEFT_LINE] ;
m_FillWidth=m_Width-Int[LEFT_LINE]-Int[RIGHT_LINE] ;
m_FillHeight=m_Height-Int[TOP_LINE]-Int[BOTTOM_LINE] ;
if( m_FillWidth<=0 || m_FillHeight<=0 ) {
m_FillTop=m_FillLeft=m_FillWidth=m_FillHeight=0;
} ;
}
void ClENG_Region::Show( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase )
{
m_poDvc->ShowRegion(this,ai_iNumPage,ai_XBase,ai_YBase) ;
}
void ClENG_Region::Show( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase,
DvcUnit_t ai_HeightPrinted, DvcUnit_t ai_HeightToPrint )
{
m_poDvc->ShowRegion(this,ai_iNumPage,ai_XBase,ai_YBase,ai_HeightPrinted,ai_HeightToPrint) ;
}
void ClENG_Region::ShowOnDvc( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase )
{
m4int16_t B ;
if ( m_uiFillColour!=ClENG_Colour::ID_TRANSPARENT && m_FillWidth>0) {
m_poDvc->SelectColour(ai_iNumPage, m_uiFillColour );
m_poDvc->FillZone(
ai_iNumPage, ai_XBase+m_FillLeft, ai_YBase+m_FillTop, m_FillWidth, m_FillHeight ) ;
} ;
if ( IsHomogeneousFrame() ) {
m_poDvc->SelectColour(ai_iNumPage, m_Line[0].GetIdColour() );
m_poDvc->PrintFrame(
ai_iNumPage, ai_XBase+m_Left, ai_YBase+m_Top, m_Width, m_Height,
m_Line[0].GetWidth(), m_Line[0].GetStyle() ) ;
} else {
for (B=0;B<LINE_COUNT;++B) m_Line[B].Show(ai_iNumPage,ai_XBase,ai_YBase);
} ;
}
void ClENG_Region::ShowOnDvc( m4int16_t ai_iNumPage, DvcUnit_t ai_XBase, DvcUnit_t ai_YBase,
DvcUnit_t ai_HeightPrinted, DvcUnit_t ai_HeightToPrint )
{
m4int16_t B ;
if ( ai_HeightPrinted==0 && ai_HeightToPrint>=m_Height ) {
ShowOnDvc( ai_iNumPage, ai_XBase, ai_YBase ) ;
return ;
} ;
if ( m_uiFillColour!=ClENG_Colour::ID_TRANSPARENT && m_FillWidth>0) {
m_poDvc->SelectColour(ai_iNumPage, m_uiFillColour );
m_poDvc->FillZone(
ai_iNumPage, ai_XBase+m_FillLeft,
ai_HeightPrinted==0 ? ai_YBase+m_FillTop : ai_YBase,
m_FillWidth, ai_HeightToPrint ) ;
} ;
for (B=0;B<LINE_COUNT;++B) m_Line[B].Show(
ai_iNumPage,ai_XBase,ai_YBase,ai_HeightPrinted,ai_HeightToPrint);
}
m4bool_t ClENG_Region::SetFrame( m4char_t *ai_pcBordeProps )
{
m4bool_t SwOk=M4_TRUE ;
m4int16_t B ;
ClMIT_Str StrAux ;
if ( ClMIT_Str::StrLenTrim(ai_pcBordeProps)==0 ) {
SetVisible(FRAME,M4_FALSE) ;
goto exit ;
}
if ( ClMIT_Str::StrLenTrim(ai_pcBordeProps)!= ClENG_Line::GetSizeStrLine()*4 ) {
SwOk=M4_FALSE ;
goto exit ;
} ;
for ( B=0; B<LINE_COUNT; ++B ) {
StrAux.ToASCIZ( &ai_pcBordeProps[
ClENG_Line::GetSizeStrLine()*B], ClENG_Line::GetSizeStrLine() ) ;
if ( ! m_Line[ (LINE_ID)B ].SetLine( StrAux ) ) {
SwOk=M4_FALSE ;
goto exit ;
} ;
} ;
exit:
if (!SwOk) {
/*##Cambiar num msg*/
*m_poInsp->m_poTrace << ClMIT_Msg( ClMIT_Msg::MSG_ERROR, GROUP_ID,
"Sintax error in SetFrame: parameter %0:s", ClMIT_Msg::MIXED_OUT)
<< ai_pcBordeProps << SEND_MSG ;
} ;
return SwOk ;
}
| [
"[email protected]"
] | |
5253a4ec6bbf524e2face4acc81d3cc6c4e3d791 | fcb200a43b37e63df6760c33c9427131e40650c6 | /StackWithMin.h | 2bb0cd5fa3616c53eefb7e099430059ef8e32516 | [] | no_license | ruoan777/HelloGithub | 3e80d2b37a5385b61e964d7f1ffb909d0840f32b | 7399d3193c912fc15f1b87f6206418d01359d1ab | refs/heads/master | 2020-03-22T21:25:10.869717 | 2018-07-12T09:12:29 | 2018-07-12T09:12:29 | 140,686,393 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,999 | h | //==================================================================
// 《剑指Offer——名企面试官精讲典型编程题》代码
// 作者:何海涛
//==================================================================
// 面试题30:包含min函数的栈
// 题目:定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min
// 函数。在该栈中,调用min、push及pop的时间复杂度都是O(1)。
#pragma once
#include <stack>
#include <assert.h>
template <typename T> class StackWithMin
{
public:
StackWithMin() {}
virtual ~StackWithMin() {}
T& top();
const T& top() const;
void push(const T& value);
void pop();
const T& min() const;
bool empty() const;
size_t size() const;
private:
std::stack<T> m_data; // 数据栈,存放栈的所有元素
std::stack<T> m_min; // 辅助栈,存放栈的最小元素
};
template <typename T> void StackWithMin<T>::push(const T& value)
{
// 把新元素添加到辅助栈
m_data.push(value);
// 当新元素比之前的最小元素小时,把新元素插入辅助栈里;
// 否则把之前的最小元素重复插入辅助栈里
if(m_min.size() == 0 || value < m_min.top())
m_min.push(value);
else
m_min.push(m_min.top());
}
template <typename T> void StackWithMin<T>::pop()
{
assert(m_data.size() > 0 && m_min.size() > 0);
m_data.pop();
m_min.pop();
}
template <typename T> const T& StackWithMin<T>::min() const
{
assert(m_data.size() > 0 && m_min.size() > 0);
return m_min.top();
}
template <typename T> T& StackWithMin<T>::top()
{
return m_data.top();
}
template <typename T> const T& StackWithMin<T>::top() const
{
return m_data.top();
}
template <typename T> bool StackWithMin<T>::empty() const
{
return m_data.empty();
}
template <typename T> size_t StackWithMin<T>::size() const
{
return m_data.size();
}
| [
"[email protected]"
] | |
8b857aafefcdbc63d9a9250817d04455570fe9b4 | ebfe9aef86a7d98d28f58f9b36d10b8c211e5e21 | /bin/vertexBinning.h | b10a25983168cb0475931dfac3768e1434949f13 | [] | no_license | lattaud/NewGammaJet | a3b47bad121ae5f6e8e029b5bdae0a4dfc176a46 | e5278b938f67b6435e8d04e7b0e4066095bc45e2 | refs/heads/master | 2020-06-28T20:37:35.267709 | 2018-06-14T07:25:41 | 2018-06-14T07:25:41 | 74,473,629 | 0 | 3 | null | 2018-03-28T15:15:58 | 2016-11-22T13:11:08 | C++ | UTF-8 | C++ | false | false | 1,398 | h | #pragma once
#include <cmath>
#include <vector>
#include <utility>
class VertexBinning {
public:
VertexBinning() {
fillVertexBins();
}
int getVertexBin(int n) {
std::vector<std::pair<int, int> >::const_iterator it = mVertexBins.begin();
for (; it != mVertexBins.end(); ++it) {
std::pair<int, int> bin = *it;
if (n >= bin.first && n < bin.second) {
return it - mVertexBins.begin();
}
}
return -1;
}
size_t size() const {
return mVertexBins.size();
}
std::pair<int, int> getBinValue(int bin) const {
return mVertexBins[bin];
}
std::vector<std::pair<int, int> > getBinning(int n = -1) const {
if (n < 0) {
n = size();
}
return std::vector<std::pair<int, int> >(mVertexBins.begin(), mVertexBins.begin() + n);
}
std::vector<std::pair<int, int> > getBinning(unsigned int from, unsigned int to) const {
if (to > size()) {
to = size();
}
return std::vector<std::pair<int, int> >(mVertexBins.begin() + from, mVertexBins.begin() + to);
}
private:
std::vector<std::pair<int, int> > mVertexBins;
void fillVertexBins() {
mVertexBins.push_back(std::make_pair(0, 6)); // 6 escluso = Npv <= 5
mVertexBins.push_back(std::make_pair(6, 13));
mVertexBins.push_back(std::make_pair(13, 50));
}
};
| [
"[email protected]"
] | |
381a69934cc9bcc0cb8b073bddfbc9f2e69e51db | d5cef2c6bcb7188cb7c917c450528cf37e98bc5e | /ArchaicDomination/BitmapFont.h | 8d686b8edf30f509a78b1f7d80942ecd27864fef | [] | no_license | ahfawaz/ArchaicDomination | 3fa809e720cca8140514a7af6f2efeaf72a7a794 | af6c4bbabb47f76702b288faa6175d04a866d9df | refs/heads/master | 2021-01-10T14:58:56.915798 | 2016-03-16T07:04:27 | 2016-03-16T07:04:27 | 54,007,385 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 980 | h | ////////////////////////////////////////////////////
// File: CBitmapFont.h
// Purpose: Loads in the bitmap font to be used by
// Other classes throughout the project
//
// Author: Joshua Ford ([email protected])
// Course: SGP 1310
////////////////////////////////////////////////////
#pragma once
#include <Windows.h>
#include "SGD Wrappers\SGD_String.h"
#include <vector>
//class CAnimation;
class CLetters;
class CBitmapFont
{
public:
CBitmapFont(void);
~CBitmapFont(void);
void Initialize ( void );
void Terminate ( void );
void Draw ( const TCHAR* OutputText, int X, int Y, float Scale , DWORD Color );
bool LoadFiles ( std::vector<CLetters*> TempLetters );
private:
int ImageID;
int CharWidth;
int CharHeight;
TCHAR FirstChar;
float PositionX;
float PositionY;
int NumRows;
int NumCols;
//CAnimation* m_cAnimation;
RECT CellAlgorithm( int id ) const;
std::vector<CLetters*> m_cCharacters;
bool m_bOnlyUpperCasse;
};
| [
"[email protected]"
] | |
d44f407a49e3ff4bd4cb9b62ecb24c60b9c75446 | 1fbb86a68429b4a013e4dd5536bd11b5f01bd481 | /libs/glbinding/include/glbinding/gl43core/values.h | cb1410cd697880d0bc06f0664d9875235272b552 | [
"MIT"
] | permissive | drzajwo/UJ-Programowanie-grafiki-3D | e1dfcf0c6ba7706eada293425262905588136f26 | 9e76ed4d528208bb18525e2b5e80a74944a9b67d | refs/heads/master | 2020-08-28T12:06:27.049514 | 2019-11-23T12:49:47 | 2019-11-23T12:49:47 | 217,693,941 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 205 | h |
#pragma once
#include <glbinding/nogl.h>
#include <glbinding/gl/values.h>
namespace gl43core
{
using gl::GL_INVALID_INDEX;
using gl::GL_TIMEOUT_IGNORED;
} // namespace gl43core
| [
"[email protected]"
] | |
7df96eddfde48e1c81037bf2cafdfa8535dc4b88 | 464aa9d7d6c4906b083e6c3da12341504b626404 | /src/lib/math/unit_test/test_blend_transform.cpp | d0ea5317adc7b4ec06be9f304cd3809bf7a2793b | [] | no_license | v2v3v4/BigWorld-Engine-2.0.1 | 3a6fdbb7e08a3e09bcf1fd82f06c1d3f29b84f7d | 481e69a837a9f6d63f298a4f24d423b6329226c6 | refs/heads/master | 2023-01-13T03:49:54.244109 | 2022-12-25T14:21:30 | 2022-12-25T14:21:30 | 163,719,991 | 182 | 167 | null | null | null | null | UTF-8 | C++ | false | false | 1,814 | cpp | /******************************************************************************
BigWorld Technology
Copyright BigWorld Pty, Ltd.
All Rights Reserved. Commercial in confidence.
WARNING: This computer program is protected by copyright law and international
treaties. Unauthorized use, reproduction or distribution of this program, or
any portion of this program, may result in the imposition of civil and
criminal penalties as provided by law.
******************************************************************************/
#include "pch.hpp"
#include "cstdmf/cstdmf.hpp"
#include "math/blend_transform.hpp"
namespace
{
struct Fixture
{
Fixture()
{
new CStdMf;
}
~Fixture()
{
delete CStdMf::pInstance();
}
BlendTransform transform_;
};
}
TEST_F( Fixture, BlendTransform_testValid )
{
// Identity matrix should be valid
BlendTransform bt( Matrix::identity );
CHECK( bt.valid() );
}
TEST_F( Fixture, BlendTransform_testValid2 )
{
Quaternion okRotation( 0.70711f, 0.0f, 0.0f, 0.70711f );
Vector3 okScale( 10.0f, 1.0f, 1.5f );
Vector3 okTranslation( -10.0f, 10.0f, -10.f );
Quaternion nonUnitRotation( 1.0f, -1.0f, -1.0f, 1.0f );
Vector3 badScale( 1100.0f, -1100.0f, 10.0f );
Vector3 badTranslation( 250.0f, -250.0f, 10.0f );
// Control test - this should be fine
BlendTransform bt1( okRotation,
okScale,
okTranslation );
CHECK( bt1.valid() );
// Bad rotation, should not be valid
BlendTransform bt2( nonUnitRotation,
okScale,
okTranslation );
CHECK( !bt2.valid() );
// Bad scale, should not be valid
BlendTransform bt3( okRotation,
badScale,
okTranslation );
CHECK( !bt3.valid() );
// Bad translation, should not be valid
BlendTransform bt4( okRotation,
okScale,
badTranslation );
CHECK( !bt4.valid() );
}
| [
"[email protected]"
] | |
da478dc4f4a557501db7002b6f974d182ea1ea0a | ea12a42ba43f23bfcdf7d6c97ba658cc7cf07e89 | /src/analysisgraph.hpp | 3e2b08d459aecde78abc44b60543d45cffa7a6fc | [
"MIT"
] | permissive | svenojavee/hydra | 16cbd4d9416087920cfd8e3453ea9cfc47b8c663 | cbbf70867b016d2e8b016d373cc1e0dd044bd5ca | refs/heads/master | 2022-12-19T15:33:41.223814 | 2020-10-05T18:33:29 | 2020-10-05T18:33:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | hpp | #ifndef ANALYSISGRAPH_H
#define ANALYSISGRAPH_H
#include <cstddef>
#include <vector>
class BayesRRmz;
class AnalysisGraph
{
public:
AnalysisGraph(BayesRRmz *bayes, size_t maxParallel = 12);
virtual ~AnalysisGraph();
virtual void exec(unsigned int numInds,
unsigned int numSnps,
const std::vector<unsigned int> &markerIndices) = 0;
protected:
BayesRRmz *m_bayes = nullptr;
size_t m_maxParallel = 12;
};
#endif // ANALYSISGRAPH_H
| [
"[email protected]"
] | |
f4c770a7f5827f4c07b3c954f1db9a72759687f2 | 337c527999a16059b99bdb4fb07424730b871c6f | /gtest/LearningGtest/tests/hello_test.cc | 4899a97bc42cb768ac415d6442040a4ea9ab42dc | [
"Apache-2.0"
] | permissive | JuhunC/SelfStudy | 5a94b46f7a0f9071baae679761870143bc25008a | 0742bfa96be588c04a8a2eaed6e3eeaa0a9ce52a | refs/heads/main | 2023-07-05T11:59:56.412601 | 2021-08-05T14:24:07 | 2021-08-05T14:24:07 | 363,918,108 | 0 | 0 | null | 2021-05-21T14:02:52 | 2021-05-03T12:12:57 | null | UTF-8 | C++ | false | false | 230 | cc | #include <gtest/gtest.h>
// Demonstrate some basic assertions.
TEST(HelloTest, BasicAssertions)
{
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
} | [
"[email protected]"
] | |
24cf14fb4b52f0e3775a564445e2d45ec504fbdd | f83ef53177180ebfeb5a3e230aa29794f52ce1fc | /ACE/ACE_wrappers/TAO/tao/ORB_Core.h | 6832bac73a7f795e4112eb49b3bb15092fceef21 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-sun-iiop"
] | permissive | msrLi/portingSources | fe7528b3fd08eed4a1b41383c88ee5c09c2294ef | 57d561730ab27804a3172b33807f2bffbc9e52ae | refs/heads/master | 2021-07-08T01:22:29.604203 | 2019-07-10T13:07:06 | 2019-07-10T13:07:06 | 196,183,165 | 2 | 1 | Apache-2.0 | 2020-10-13T14:30:53 | 2019-07-10T10:16:46 | null | UTF-8 | C++ | false | false | 48,198 | h | // -*- C++ -*-
// ===================================================================
/**
* @file ORB_Core.h
*
* @author DOC Center - Washington University at St. Louis
* @author DOC Laboratory - University of California at Irvine
*/
// ===================================================================
#ifndef TAO_ORB_CORE_H
#define TAO_ORB_CORE_H
#include /**/ "ace/pre.h"
#include "tao/Resource_Factory.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "tao/Collocation_Strategy.h"
#include "tao/params.h"
#include "tao/ORB_Constants.h"
#include "tao/Parser_Registry.h"
#include "tao/Service_Callbacks.h"
#include "tao/Fault_Tolerance_Service.h"
#include "tao/Cleanup_Func_Registry.h"
#include "tao/Object_Ref_Table.h"
#include "tao/ObjectKey_Table.h"
#include "tao/Messaging_SyncScopeC.h"
#include "tao/Object.h"
#include "tao/Invocation_Utils.h"
#include "tao/Adapter_Registry.h"
#include "tao/ORB_Core_TSS_Resources.h"
#include "tao/Service_Context_Handler_Registry.h"
#include "ace/Array_Map.h"
#include "ace/Auto_Ptr.h"
#include "ace/Thread_Manager.h"
#include "ace/Lock_Adapter_T.h"
#include "ace/TSS_T.h"
#include "ace/Service_Config.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Data_Block;
ACE_END_VERSIONED_NAMESPACE_DECL
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
#if TAO_HAS_INTERCEPTORS == 1
namespace TAO
{
class ClientRequestInterceptor_Adapter;
class ServerRequestInterceptor_Adapter;
}
#endif /* TAO_HAS_INTERCEPTORS == 1 */
class TAO_Adapter;
class TAO_Acceptor;
class TAO_Connector;
class TAO_Connector_Registry;
class TAO_Resource_Factory;
class TAO_Client_Strategy_Factory;
class TAO_Server_Strategy_Factory;
class TAO_TSS_Resources;
class TAO_Leader_Follower;
class TAO_LF_Strategy;
class TAO_RT_ORB;
class TAO_MProfile;
class TAO_Profile;
class TAO_Endpoint_Selector_Factory;
class TAO_Message_State_Factory;
class TAO_Protocols_Hooks;
class TAO_Network_Priority_Protocols_Hooks;
class TAO_BiDir_Adapter;
class TAO_ZIOP_Adapter;
class TAO_Flushing_Strategy;
class TAO_Thread_Lane_Resources_Manager;
class TAO_Collocation_Resolver;
class TAO_Thread_Lane_Resources;
class TAO_Stub_Factory;
class TAO_Endpoint_Selector_Factory;
class TAO_Service_Context;
class TAO_Request_Dispatcher;
class TAO_Policy_Set;
class TAO_Policy_Manager;
class TAO_Policy_Current;
class TAO_Codeset_Manager;
class TAO_IORInterceptor_Adapter;
class TAO_Valuetype_Adapter;
class TAO_Policy_Validator;
namespace TAO
{
class GUIResource_Factory;
class PolicyFactory_Registry_Adapter;
class ORBInitializer_Registry_Adapter;
class Transport_Queueing_Strategy;
}
namespace CORBA
{
class ORB_ObjectIdList; // CORBA::ORB::ObjectIdList
class ORB;
typedef ORB *ORB_ptr;
class PolicyList;
}
namespace IOP
{
class ServiceContextList;
}
namespace PortableInterceptor
{
class IORInterceptor;
typedef IORInterceptor *IORInterceptor_ptr;
#if TAO_HAS_INTERCEPTORS == 1
class ClientRequestInterceptor;
typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr;
class ServerRequestInterceptor;
typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr;
#endif /* TAO_HAS_INTERCEPTORS == 1 */
}
// ****************************************************************
/**
* @class TAO_ORB_Core
*
* @brief Encapsulates the state of an ORB.
*
* This is the implementation class for the CORBA::ORB interface. The
* class also encapsulates the access to the ORB resources and its
* state.
* @par
* Some resources can be TSS or global, those resources are always
* accessed through a TSS interface, but are allocated using the
* Resource_Factory. If the resource is really global the
* Resource_Factory will simply return a pointer to the global
* instance.
*/
class TAO_Export TAO_ORB_Core
{
friend class TAO_ORB_Core_Auto_Ptr;
friend TAO_Export CORBA::ORB_ptr CORBA::ORB_init (int &,
ACE_TCHAR *argv[],
const char *);
public:
/// Constructor.
TAO_ORB_Core (const char* id, ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> g);
/// Accessor for the ORB parameters.
TAO_ORB_Parameters *orb_params (void);
/**
* @todo
* In the future this hook should change, instead of hardcoding the
* object we should add a "Resolver" to the ORB, so the "POACurrent"
* object returns a per-ORB object.
* @par
* Similarly, each ORB should implement the TSS pattern to put the
* POA_Current_Impl in a void* slot. The current approach *does*
* decouple the POA from the ORB, but it cannot add new adapters or
* other components transparently.
*/
/// Accessor to the POA current.
//@{
CORBA::Object_ptr poa_current(void);
//@}
/// Get the connector registry
TAO_Connector_Registry *connector_registry (void);
/// Get the IOR parser registry
TAO_Parser_Registry *parser_registry (void);
/// Return pointer to the policy factory registry associated with
/// this ORB core.
TAO::PolicyFactory_Registry_Adapter *policy_factory_registry (void);
/// Return pointer to the orb initializer registry associated with
/// this ORB core. Tries to load the PI library if it is not loaded
/// yet
TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry (void);
TAO_ZIOP_Adapter *ziop_adapter () const;
void ziop_adapter (TAO_ZIOP_Adapter *adapter);
TAO_Service_Context_Registry &service_context_registry (void);
/// Get the protocol factories
TAO_ProtocolFactorySet *protocol_factories (void);
/// Get pointer to the ORB.
CORBA::ORB_ptr orb (void);
/// Wrappers that forward the request to the concurrency strategy.
ACE_Reactor *reactor (void);
/// Get the ACE_Thread_Manager
ACE_Thread_Manager *thr_mgr (void);
/// Return the RootPOA, or try to load it if not initialized already.
CORBA::Object_ptr root_poa (void);
/// Get the adapter registry
TAO_Adapter_Registry &adapter_registry (void);
/// @name Collocation Strategies as configured by the user
//@{
enum
{
/// Indicate object should refer to ORB for either one of the
/// following strategies.
ORB_CONTROL,
/// Collocated calls will go thru POA.
TAO_COLLOCATION_THRU_POA,
/// Collocated calls invoke operation on Servant directly.
TAO_COLLOCATION_DIRECT,
/// Collocated calls invoke operation on Servant directly if possible,
/// else Collocated calls will go thru POA if possible, else
/// use REMOTE_STRATEGY
TAO_COLLOCATION_BEST
};
/// Set/get the collocation flags
//@{
void optimize_collocation_objects (CORBA::Boolean opt);
CORBA::Boolean optimize_collocation_objects (void) const;
void use_global_collocation (CORBA::Boolean opt);
CORBA::Boolean use_global_collocation (void) const;
CORBA::ULong get_collocation_strategy (void) const;
//@}
/// Get the adapter named "RootPOA" and cache the result, this is an
/// optimization for the POA.
TAO_Adapter *poa_adapter (void);
/**
* @name Access to Factories
*
* These factories are not thread-specific, and are presented here
* in order to have one place to get useful information. Often, the
* instances to which the return pointers are stored in the Service
* Repository.
*/
//@{
/// Returns pointer to the resource factory.
TAO_Resource_Factory *resource_factory (void);
/// Returns pointer to the factory for creating gui resources
TAO::GUIResource_Factory *gui_resource_factory (void);
/// Returns pointer to the client factory.
TAO_Client_Strategy_Factory *client_factory (void);
/// Returns pointer to the server factory.
TAO_Server_Strategy_Factory *server_factory (void);
/// Returns pointer to the Protocols_Hooks.
TAO_Protocols_Hooks *protocols_hooks (void);
/// Returns a pointer to the Thread Lane Resources Manager.
TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager (void);
/// Returns a pointer to the Collocation Resolver.
TAO_Collocation_Resolver &collocation_resolver (void);
/// Returns a pointer to the Stub factory.
TAO_Stub_Factory *stub_factory (void);
/// Returns a pointer to the endpoint selector factory.
TAO_Endpoint_Selector_Factory *endpoint_selector_factory (void);
//@}
/// Sets the value of TAO_ORB_Core::resource_factory_
static void set_resource_factory (const char *resource_factory_name);
/** Sets the value of TAO_ORB_Core::gui_resource_factory_.
*
* Sets the value of gui_resource_factory in TSS. ORB_Core is responsible
* for releasing this factory if needed.
*/
static void set_gui_resource_factory (TAO::GUIResource_Factory *gui_factory);
/// Sets the value of TAO_ORB_Core::network_priority_protocols_hooks_
static void set_network_priority_protocols_hooks (
const char *network_priority_protocols_hooks_name);
/// Gets the value of TAO_ORB_Core::protocols_hooks__
TAO_Protocols_Hooks * get_protocols_hooks (void);
/// Gets the value of TAO_ORB_Core::network_priority_protocols_hooks__
TAO_Network_Priority_Protocols_Hooks *
get_network_priority_protocols_hooks (void);
/// Sets the value of TAO_ORB_Core::dynamic_adapter_name_.
static void dynamic_adapter_name (const char *name);
/// Gets the value of TAO_ORB_Core::dynamic_adapter_name_.
static const char *dynamic_adapter_name (void);
/// Sets the value of TAO_ORB_Core::ifr_client_adapter_name_.
static void ifr_client_adapter_name (const char *name);
/// Gets the value of TAO_ORB_Core::ifr_client_adapter_name_.
static const char *ifr_client_adapter_name (void);
/// Sets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
static void typecodefactory_adapter_name (const char *name);
/// Gets the value of TAO_ORB_Core::typecodefactory_adapter_name_.
static const char *typecodefactory_adapter_name (void);
/// Sets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_.
static void iorinterceptor_adapter_factory_name (const char *name);
/// Gets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_.
static const char *iorinterceptor_adapter_factory_name (void);
/// Sets the value of TAO_ORB_Core::valuetype_adapter_factory_name.
static void valuetype_adapter_factory_name (const char *name);
/// Gets the value of TAO_ORB_Core::valuetype_adapter_factory_name.
static const char *valuetype_adapter_factory_name (void);
/// See if we have a collocated address, if yes, return the POA
/// associated with the address.
int is_collocated (const TAO_MProfile& mprofile);
/// This allocator is always TSS and has no locks. It is intended
/// for allocating the ACE_Data_Blocks used in *outgoing* CDR
/// streams.
ACE_Allocator *output_cdr_dblock_allocator (void);
/// This allocator is always TSS and has no locks. It is intended
/// for allocating the buffers used in *outgoing* CDR streams.
ACE_Allocator *output_cdr_buffer_allocator (void);
/// This allocator is always TSS and has no locks. It is intended
/// for allocating the ACE_Data_Blocks used in *outgoing* CDR
/// streams.
ACE_Allocator *output_cdr_msgblock_allocator (void);
/// This allocator is global, may or may not have locks. It is
/// intended for allocating the ACE_Data_Blocks used in *incoming*
/// CDR streams.
ACE_Allocator *input_cdr_dblock_allocator (void);
/// This allocator is always global and has no locks. It is intended
/// for allocating the buffers used in *incoming* CDR streams.
ACE_Allocator *input_cdr_buffer_allocator (void);
/// This allocator is always global and has no locks. It is intended
/// for allocating the buffers used in *incoming* CDR streams.
ACE_Allocator *input_cdr_msgblock_allocator (void);
/// This allocator is always global and has no locks. It is intended
/// for allocating the buffers used to queue messages in
/// transports.
ACE_Allocator *transport_message_buffer_allocator (void);
/// The Message Blocks used for input CDRs must have appropiate
/// locking strategies.
ACE_Data_Block *create_input_cdr_data_block (size_t size);
/// Return the locking strategy used for the data blocks.
ACE_Lock *locking_strategy (void);
#if (TAO_HAS_CORBA_MESSAGING == 1)
/// Accessor method for the default_policies_
TAO_Policy_Set *get_default_policies (void);
/// Get a policy. First, check the ORB-level Policy Manager, then
/// check the ORB defaults.
CORBA::Policy_ptr get_policy (CORBA::PolicyType type);
/// Get a policy. First, check the thread current, then check the
/// ORB-level Policy Manager, then check the ORB defaults.
CORBA::Policy_ptr get_policy_including_current (CORBA::PolicyType type);
/// Get a cached policy. First, check the ORB-level Policy Manager,
/// then check the ORB defaults.
CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type);
/// Get a cached policy. First, check the thread current, then
/// check the ORB-level Policy Manager, then check the ORB defaults.
CORBA::Policy_ptr get_cached_policy_including_current (
TAO_Cached_Policy_Type type);
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
/**
* The thread has a default environment to simplify porting between
* platforms that support native C++ exceptions and those that
* don't. This is a TSS resource (always), but with a twist: if the
* user creates a new environment the old one is "pushed" (actually
* the new one remembers it), eventually the new environment
* destructor pops itself from the stack and we recover the old
* environment.
* @par
* This means that if the user create a new environment and somebody
* calls a function using the default one the exception will still
* be received in the environment created by the user.
* The only drawback is that environments life time must nest
* properly, this shouldn't be a problem because environments are
* usually created on the stack, but, the spec allows their creation
* on the heap and/or as class members; we need to investigate the
* tradeoffs and take a decision.
*/
//@{
CORBA::Environment *default_environment (void) const;
void default_environment (CORBA::Environment*);
//@}
#if (TAO_HAS_CORBA_MESSAGING == 1)
/// Return the Policy_Manager for this ORB.
TAO_Policy_Manager *policy_manager (void);
/// Accesors to the policy current, this object should be kept in
/// TSS storage. The POA has to reset the policy current object on
/// every upcall.
TAO_Policy_Current &policy_current (void);
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
/// Invoke the timeout hook if present.
/**
* The timeout hook is used to determine if the timeout policy is
* set and with what value. If the ORB is compiled without support
* for Messaging this feature does not take effect
* \param has_timeout returns 0 if there is no timeout policy set.
* \param time_value returns the timeout value in effect for the object,
* thread and current ORB.
*/
void call_timeout_hook (TAO_Stub *stub,
bool &has_timeout,
ACE_Time_Value &time_value);
/// Define the Timeout_Hook signature
typedef void (*Timeout_Hook) (TAO_ORB_Core *,
TAO_Stub *,
bool&,
ACE_Time_Value&);
void set_timeout_hook (Timeout_Hook hook);
/// Invoke the timeout hook if present.
/**
* The timeout hook is used to determine if the timeout policy is
* set and with what value. If the ORB is compiled without support
* for Messaging this feature does not take effect
* \param has_timeout returns 0 if there is no timeout policy set.
* \param time_value returns the timeout value in effect for the object,
* thread and current ORB.
*/
void connection_timeout (TAO_Stub *stub,
bool &has_timeout,
ACE_Time_Value &time_value);
/// Define the Timeout_Hook signature
/**
* The connection timeout hook was originally defined to allow the
* TAO Messaging code to be factored out of the core TAO library and
* placed in to an optional library. Since then, a new invocation
* endpoint selector, the optimised connection endpoint selector
* (see Strategies/OC_Endpoint_Selector.h) reused this connection
* timeout hook. However, this set up a problem when both the
* Messaging library and OCES are being used in the same
* application.
*
* The solution was to add a new connection timeout hook attribute
* (see alt_connection_timeout_hook_ below). This method now checks
* to see if the connection timeout hook is already set, and if so
* assigns the supplied hook value to the alternate connection
* timeout hook. This functionality has a side-effect of assuming
* that hooks are NEVER unloaded or actively replaced. IOW, no one
* will call this method with a 0 or some other pointer value to
* replace an existing hook.
*
* If such functionality as unloading a hook pointer is required,
* then this method must be extended to give some kind of identity
* for the hook. Additional changes to the definition of the hook
* will also be necessary to support such identity and manipulation.
*/
static void connection_timeout_hook (Timeout_Hook hook);
void call_sync_scope_hook (TAO_Stub *stub,
bool &has_synchronization,
Messaging::SyncScope &scope);
#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
TAO::Transport_Queueing_Strategy *get_transport_queueing_strategy (
TAO_Stub *stub,
Messaging::SyncScope &scope);
#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
typedef void (*Sync_Scope_Hook) (TAO_ORB_Core *,
TAO_Stub *,
bool &,
Messaging::SyncScope &);
void set_sync_scope_hook (Sync_Scope_Hook hook);
/// Default Sync_Scope_Hook.
static void default_sync_scope_hook (TAO_ORB_Core *,
TAO_Stub *,
bool &has_synchronization,
Messaging::SyncScope &scope);
/// Return the default sync scope configured for this ORB
Messaging::SyncScope default_sync_scope (void);
/// Handle to the factory for protocols_hooks_..
TAO_Protocols_Hooks *protocols_hooks_;
/// Handle to the factory for network_priority_protocols_hooks_..
TAO_Network_Priority_Protocols_Hooks *network_priority_protocols_hooks_;
/// Obtain the TSS resources of this orb.
TAO_ORB_Core_TSS_Resources* get_tss_resources (void);
/// Obtain the TSS resource in the given slot.
void* get_tss_resource (size_t slot_id);
/// Set the TSS resource at the given slot.
/// Returns 0 on success, and -1 on failure.
int set_tss_resource (size_t slot_id, void *);
/// Register a TSS cleanup function. The slot ID for the
/// corresponding ORB core TSS resource is returned by the reference
/// argument. This method return 0 on success, and -1 on failure.
int add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup, size_t &slot_id);
/// Cleans up ts_objects using the underlying TSS cleanup function registry.
void tss_cleanup (ACE_Array_Base<void *> &ts_objects);
/// Get access to the leader_follower class.
TAO_Leader_Follower &leader_follower (void);
/// Get access to the leader follower strategy.
TAO_LF_Strategy &lf_strategy (void);
/// Get access to the thread lane resources.
TAO_Thread_Lane_Resources &lane_resources (void);
/// Run the event loop.
int run (ACE_Time_Value *tv, int perform_work);
/// End the event loop
void shutdown (CORBA::Boolean wait_for_completion);
/// Get the shutdown flag value
bool has_shutdown (void) const;
/// Shutdown the ORB and free resources
void destroy (void);
/// Check if ORB has shutdown. If it has, throw an exception.
void check_shutdown (void);
/// Returns the @a timeout value used by the server threads to poll
/// the shutdown flag. If the return value is zero then the server
/// threads block forever.
int thread_per_connection_timeout (ACE_Time_Value &timeout) const;
/// Makes sure that the ORB is open and then creates a TAO_Stub
/// based on the endpoint.
TAO_Stub *create_stub_object (TAO_MProfile &mprofile,
const char *type_id,
CORBA::PolicyList *policy_list);
/// Factory method that create the "right" Stub depending on
/// wheather RTCORBA is loaded or not. The factory used to create
/// the stub, is loaded at ORB initialization, and its type depends
/// on the fact that RTCORBA is being used or not.
TAO_Stub *create_stub (const char *repository_id,
const TAO_MProfile &profiles);
/// Create a new object, use the adapter registry to create a
/// collocated object, if not possible then create a regular
/// object.
CORBA::Object_ptr create_object (TAO_Stub *the_stub);
/// Initialize a new object, use the adapter registry to initialize a
/// collocated object, if not possible then initialize a regular
/// object.
/// NOTE: Why would this method be required? The answer is if the
/// user decides to use lazy initialization of CORBA object, then
/// this is the route that we have to take to do the
/// initialization.
CORBA::Long initialize_object (TAO_Stub *the_stub, CORBA::Object_ptr obj);
/// Reinitialise a stub after the effective profile has changed.
/// This will happen after a location forward has been received
/// or if a location forward supplied new target subsequently fails.
CORBA::Long reinitialize_object (TAO_Stub *stub);
/// Return ORBid string.
const char *orbid (void) const;
/// Set/Get the IOR of the Implementation Repository service.
//@{
CORBA::Object_ptr implrepo_service (void);
void implrepo_service (const CORBA::Object_ptr ir);
//@}
/// Do we attempt to register with the Implementation Repository
CORBA::Boolean use_implrepo (void);
/// Do we put the ImR's endpoints into persistent object references we create
CORBA::Boolean imr_endpoints_in_ior (void);
/// Resolve the TypeCodeFactory DLL.
CORBA::Object_ptr resolve_typecodefactory (void);
#if TAO_HAS_INTERCEPTORS == 1
/// Resolve the PICurrent.
CORBA::Object_ptr resolve_picurrent (void);
#endif /* TAO_HAS_INTERCEPTORS == 1 */
/// Resolve POA Current.
CORBA::Object_ptr resolve_poa_current (void);
/// Resolve the CodecFactory DLL.
CORBA::Object_ptr resolve_codecfactory (void);
/// Resolve the Compression DLL.
CORBA::Object_ptr resolve_compression_manager (void);
/// Resolve the Dynamic Any Factory
CORBA::Object_ptr resolve_dynanyfactory (void);
/// Resolve the IOR Manipulation reference for this ORB.
CORBA::Object_ptr resolve_ior_manipulation (void);
TAO_ZIOP_Adapter* ziop_adapter_i (void);
/// Resolve the IOR Table reference for this ORB.
CORBA::Object_ptr resolve_ior_table (void);
/// Resolve the Async IOR Table reference for this ORB.
CORBA::Object_ptr resolve_async_ior_table (void);
/// Resolve the Monitor reference for this ORB.
CORBA::Object_ptr resolve_monitor (void);
/// Resolve an initial reference via the -ORBInitRef and
// -ORBDefaultInitRef options.
CORBA::Object_ptr resolve_rir (const char *name);
#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
/// Resolve the RT ORB reference for this ORB.
CORBA::Object_ptr resolve_rt_orb (void);
#endif
/// Resolve the RT Current flyweight for this ORB.
/// Return server_id string.
const char *server_id (void) const;
/// List all the service known by the ORB
CORBA::ORB_ObjectIdList *list_initial_references (void);
/// Reference counting...
unsigned long _incr_refcnt (void);
unsigned long _decr_refcnt (void);
unsigned long _refcnt (void) const;
/// Register the handle of an open connection with the ORB Core
/// handle set. This handle set will be used to explicitly remove
/// corresponding event handlers from the reactor.
int register_handle (ACE_HANDLE handle);
/// Remove @a handle from the ORB Core's handle set so that it
/// isn't included in the set that is passed to the reactor upon ORB
/// destruction.
int remove_handle (ACE_HANDLE handle);
/**
* @name ORB Core Service Hooks
*
* These methods would represent the hooks in the ORB Core. These
* hooks would be used to call back on the services or other
* features that are dynamically loaded.
*/
//@{
/**
* The loaded service in the ORB_Core would determine if the profile
* selection is going to be made by the services or not. If the
* services do make the selection they would return the selected
* profile through <profile>.
*/
CORBA::Boolean service_profile_selection (const TAO_MProfile &mprofile,
TAO_Profile *&profile);
/**
* The loaded service would determine if the CORBA::Object_ptr is
* actually nil or not. This would be useful to accomodate new
* enhanced definitions as defined by the service specification.
*/
CORBA::Boolean object_is_nil (CORBA::Object_ptr object);
/// Hook for the services to determine whether the profiles are
/// equivalent or not.
/**
* For details on how this is used please see the FT service
*/
TAO_Service_Callbacks::Profile_Equivalence is_profile_equivalent (
const TAO_Profile *this_p,
const TAO_Profile *that_p);
/// Hook for the services to determine the <hash> value of a
/// profile.
/**
* For details on how this is used please see the FT service
*/
CORBA::ULong hash_service (TAO_Profile *this_p, CORBA::ULong max);
/// Return a reference to the Fault Tolerant service object.
TAO_Fault_Tolerance_Service &fault_tolerance_service (void);
/// Transmit the entire TAG_FT_GROUP component data from a server IOGR as
/// a FT_GROUP_VERSION tagged service context on requests to that IOGR instead
/// of just the group version.
CORBA::Boolean ft_send_extended_sc (void);
/// Raise a comm failure exception if a service is not loaded, else
/// delegate to the service to see what the service has to do for
/// this case.
TAO::Invocation_Status service_raise_comm_failure (
IOP::ServiceContextList &clist,
TAO_Profile *profile);
/// Raise a transient failure exception if a service is not loaded,
/// else delegate to the service to see what the service has to do
/// for this case.
TAO::Invocation_Status service_raise_transient_failure (
IOP::ServiceContextList &clist,
TAO_Profile *profile);
//@}
/**
* @name Portable Interceptor Related Methods
*
* These are support methods for interceptor registration and
* interceptor set (an array) access, in addition to PICurrent
* access.
*/
//@{
#if TAO_HAS_INTERCEPTORS == 1
/// Return a pointer to the cached TAO::PICurrent object.
CORBA::Object_ptr pi_current (void);
/// Set the pointer to the cached TAO::PICurrent object.
void pi_current (CORBA::Object_ptr current);
/// Register a client request interceptor.
void add_interceptor (
PortableInterceptor::ClientRequestInterceptor_ptr interceptor);
/// Register a server request interceptor.
void add_interceptor (
PortableInterceptor::ServerRequestInterceptor_ptr interceptor);
/// Register a client request interceptor with policies.
void add_interceptor (
PortableInterceptor::ClientRequestInterceptor_ptr interceptor,
const CORBA::PolicyList& policies);
/// Register a server request interceptor with policies.
void add_interceptor (
PortableInterceptor::ServerRequestInterceptor_ptr interceptor,
const CORBA::PolicyList& policies);
/// Get the Client Request Interceptor adapter.
/// Will not create a new one if not available yet.
TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter (void);
/// Get the Server Request Interceptor adapter.
/// Will not create a new one if not available yet.
TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter (void);
#endif /* TAO_HAS_INTERCEPTORS */
/// Register an IOR interceptor.
void add_interceptor (PortableInterceptor::IORInterceptor_ptr interceptor);
//@}
/// Return the valuetype adapter
TAO_Valuetype_Adapter *valuetype_adapter (void);
#if !defined(CORBA_E_MICRO)
/// Value factory operations (CORBA 2.3 ptc/98-10-05 Ch. 4.2 p.4-7)
CORBA::ValueFactory register_value_factory (
const char *repository_id,
CORBA::ValueFactory factory);
#endif
#if !defined(CORBA_E_MICRO)
void unregister_value_factory (const char * repository_id);
#endif
#if !defined(CORBA_E_MICRO)
CORBA::ValueFactory lookup_value_factory (const char *repository_id);
#endif
/// Get the IOR Interceptor adapter. If not created, this method will try
/// to create one.
TAO_IORInterceptor_Adapter *ior_interceptor_adapter (void);
/// Set and Get methods to indicate whether a BiDir IIOP policy has
/// been set in the POA.
/// @note At present, the value will be true even if one of the POA's
/// is set with the Bi Dir GIOP policy.
CORBA::Boolean bidir_giop_policy (void);
void bidir_giop_policy (CORBA::Boolean);
/// Return the table that maps object key/name to de-stringified
/// object reference. It is needed for supporting local objects in
/// the resolve_initial_references() mechanism.
TAO_Object_Ref_Table &object_ref_table (void);
/// Acceessor to the table that stores the object_keys.
TAO::ObjectKey_Table &object_key_table (void);
/// Return the current request dispatcher strategy.
TAO_Request_Dispatcher *request_dispatcher (void);
/// Set a new request dispatcher. The ORB Core retains ownership
/// of the request dispatcher once it gets it. Currently, this only
/// gets called at initialization.
void request_dispatcher (TAO_Request_Dispatcher *rd);
/// Call the libraries to handover the validators if they haven't
/// registered yet with the list of validators.
void load_policy_validators (TAO_Policy_Validator &validator);
/// Return the flushing strategy
/**
* The flushing strategy is created by the resource factory, and it
* is used by the ORB to control the mechanism used to flush the
* outgoing data queues.
* The flushing strategies are stateless, therefore, there is only
* one per ORB.
*/
TAO_Flushing_Strategy *flushing_strategy (void);
/// Get Code Set Manager
TAO_Codeset_Manager *codeset_manager (void);
typedef ACE_Array_Map<ACE_CString, ACE_CString> InitRefMap;
/// Return a pointer to the -ORBInitRef map.
InitRefMap * init_ref_map (void);
/// Set the ORB related to the orb_id as the default ORB and not the
/// ORB that is first binded in the ORB Table
void set_default (const char * orb_id);
/// Choose to be not a default ORB when there is more than one ORB.
void not_default (const char * orb_id);
/// Verify condition for permanent forward is given,
/// both parameters must provide group attributes.
CORBA::Boolean is_permanent_forward_condition
(const CORBA::Object_ptr obj,
const TAO_Service_Context &service_context);
/// Configuration accessor method
ACE_Service_Gestalt* configuration () const;
/// Get outgoing fragmentation strategy.
auto_ptr<TAO_GIOP_Fragmentation_Strategy>
fragmentation_strategy (TAO_Transport * transport);
#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
void set_eager_transport_queueing_strategy (
TAO::Transport_Queueing_Strategy* strategy);
void set_delayed_transport_queueing_strategy (
TAO::Transport_Queueing_Strategy* strategy);
#endif
protected:
/// Destructor is protected since the ORB Core is a reference
/// counted object.
~TAO_ORB_Core (void);
/// Initialize the guts of the ORB Core. It is intended that this be
/// called by CORBA::ORB_init().
int init (int &argc, char *argv[]);
/// Final termination hook, typically called by CORBA::ORB's
/// destructor.
int fini (void);
/// Routine that creates a ACE_Data_Block given the lock and allocators.
ACE_Data_Block *create_data_block_i (size_t size,
ACE_Allocator *buffer_allocator,
ACE_Allocator *dblock_allocator,
ACE_Lock *lock);
/// Obtain and cache the typecode factory object reference.
void resolve_typecodefactory_i (void);
/// Obtain and cache the poa current.
void resolve_poa_current_i (void);
#if TAO_HAS_INTERCEPTORS == 1
/// Obtain and cache the picurrent factory object reference.
void resolve_picurrent_i (void);
/// Get the Client Request Interceptor adapter.
/// If not created, this method will try to create one if needed.
TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter_i (void);
/// Get the Server Request Interceptor adapter.
/// If not created, this method will try to create one if needed.
TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter_i (void);
#endif /* TAO_HAS_INTERCEPTORS */
/// Obtain and cache the codec factory object reference.
void resolve_codecfactory_i (void);
/// Obtain and cache the compression manager object reference.
void resolve_compression_manager_i (void);
/// Obtain and cache the dynamic any factory object reference.
void resolve_dynanyfactory_i (void);
/// Obtain and cache the IORManipulation factory object reference.
void resolve_iormanipulation_i (void);
/// Obtain and cache the Monitor object reference.
void resolve_monitor_i (void);
/// Search the Dynamic service list for well known services that has
/// callbacks which can be dynamically loaded.
void services_callbacks_init (void);
/// Helper method that invokes Interceptor::destroy() on all
/// registered interceptors when ORB::destroy() is called. Prevents
/// exceptions from propagating up the call chain.
void destroy_interceptors (void);
/// Pointer to the list of protocol loaded into this ORB instance.
/// Helper method to hold the common code part for -ORBEndpoint and
/// -ORBListenEndpoints options.
int set_endpoint_helper (const ACE_CString &lane,
const ACE_CString &endpoints);
/// Return pointer to the policy factory registry associated with
/// this ORB core.
TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_i (void);
/// Return pointer to the orb initializer registry associated with
/// this ORB core.
TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_i (void);
/// Common code from ::initialize_object and ::reinitialize_object
CORBA::Long initialize_object_i (TAO_Stub *the_stub,
const TAO_MProfile& mprofile);
private:
/// The ORB Core should not be copied.
//@{
TAO_ORB_Core(const TAO_ORB_Core&);
void operator=(const TAO_ORB_Core&);
//@}
/// Obtain and cache the ior table object reference.
void resolve_ior_table_i (void);
/// Obtain and cache the async ior table object reference.
void resolve_async_ior_table_i (void);
/// Checks to see whether collocation optimizations have to be
/// applied on objects in the @a other_orb
CORBA::Boolean is_collocation_enabled (TAO_ORB_Core *other_orb,
const TAO_MProfile &mp);
bool use_local_memory_pool_;
protected:
/// Synchronize internal state...
TAO_SYNCH_MUTEX lock_;
TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_;
TAO_Collocation_Resolver *collocation_resolver_;
TAO_Stub_Factory *stub_factory_;
TAO_ProtocolFactorySet *protocol_factories_;
/// The cached IOR for the Implementation Repository.
// @@ If this is a _var, where should it get deleted? (brunsch)
CORBA::Object_ptr implrepo_service_;
/// Flag for whether the implrepo support is enabled or not.
int use_implrepo_;
/// Flag for whether to put the ImR endpoints into our object refs.
int imr_endpoints_in_ior_;
/// The cached IOR for the TypeCodeFactory DLL.
CORBA::Object_ptr typecode_factory_;
/// The cached IOR for the CodecFactory DLL.
CORBA::Object_ptr codec_factory_;
/// The cached IOR for the Compression DLL.
CORBA::Object_ptr compression_manager_;
/// The cached object reference for the DynAnyFactory.
CORBA::Object_ptr dynany_factory_;
/// The cached object reference for the IORManipulataion.
CORBA::Object_ptr ior_manip_factory_;
/// The cached object reference for the IORTable.
CORBA::Object_ptr ior_table_;
/// The cached object reference for the Async_IORTable.
CORBA::Object_ptr async_ior_table_;
/// The cached object reference for the Monitor.
CORBA::Object_ptr monitor_;
#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
/// The cached object reference for the RTCORBA::RTORB.
CORBA::Object_var rt_orb_;
/// The cached object reference for the RTCORBA::Current interface.
CORBA::Object_var rt_current_;
#endif
/**
* @note
* Should we keep a single ORB pointer? This is good because
* multiple calls to ORB_init() with the same ORBid can use the same
* object, but maybe don't want so much coupling.
*
* Pointer to the ORB.
*/
CORBA::ORB_ptr orb_;
/// Object reference to the root POA. It will eventually be the
/// object reference returned by calls to
/// CORBA::ORB::resolve_initial_references ("RootPOA").
CORBA::Object_var root_poa_;
/// Parameters used by the ORB.
TAO_ORB_Parameters orb_params_;
/// Return InitRefMap to find if a particular object id is present.
InitRefMap init_ref_map_;
/// Table that maps object key/name to (de-stringified) object
/// reference. It is needed for supporting local objects in the
/// resolve_initial_references() mechanism.
TAO_Object_Ref_Table object_ref_table_;
/// Table that stores the object key instead of caching one per-profile.
TAO::ObjectKey_Table object_key_table_;
/// The ORBid for this ORB.
char *orbid_;
/// Handle to the factory for resource information..
TAO_Resource_Factory *resource_factory_;
/// The server_id_ that was passed via -ORBServerId option
ACE_CString server_id_;
/// Handle to the factory for Client-side strategies.
TAO_Client_Strategy_Factory *client_factory_;
/// Handle to the factory for Server-side strategies.
TAO_Server_Strategy_Factory *server_factory_;
/**
* @name Service Level Hooks
*/
//@{
/// Fault Tolerant service hook.
TAO_Fault_Tolerance_Service ft_service_;
//@}
/// TRUE transmits a full TAG_FT_GROUP component in place of the FT_GROUP_VERSION
/// context on FT requests. This is contrary to the spec but enables more effective
/// fault tolerant stuff. @todo reference to OMG issue. Default false.
CORBA::Boolean ft_send_extended_sc_;
/// TRUE if we want to take advantage of collocation optimization in
/// this ORB.
CORBA::Boolean opt_for_collocation_;
/// TRUE if we want to consider all ORBs in this address space
/// collocated.
CORBA::Boolean use_global_collocation_;
/// Default collocation policy. This should never be ORB_CONTROL.
CORBA::ULong collocation_strategy_;
#if (TAO_HAS_CORBA_MESSAGING == 1)
/// The Policy_Manager for this ORB.
TAO_Policy_Manager *policy_manager_;
/// The default policies.
TAO_Policy_Set *default_policies_;
/// Policy current.
TAO_Policy_Current *policy_current_;
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
/// The request dispatching strategy.
TAO_Request_Dispatcher *request_dispatcher_;
/**
* POA current.
*/
CORBA::Object_var poa_current_;
/// The list of Adapters used in this ORB.
TAO_Adapter_Registry adapter_registry_;
/// An optimization for the POA.
TAO_Adapter *poa_adapter_;
/// The Thread Manager
ACE_Thread_Manager tm_;
/// The data block reference counts are locked using this mutex
ACE_Lock_Adapter<TAO_SYNCH_MUTEX> data_block_lock_;
/// TSS Object cleanup functions. These correspond to the TSS
/// objects stored in TAO's TSS resources.
TAO_Cleanup_Func_Registry tss_cleanup_funcs_;
/// This is where the tss resources for this ORB are stored.
ACE_TSS_TYPE (TAO_ORB_Core_TSS_Resources) tss_resources_;
/// Flag which denotes that the ORB has been shutdown.
bool has_shutdown_;
/// The value of the timeout if the flag above is not zero.
//@{
int thread_per_connection_use_timeout_;
ACE_Time_Value thread_per_connection_timeout_;
//@}
/// Mutual exclusion for calling open.
TAO_SYNCH_MUTEX open_lock_;
TAO_Endpoint_Selector_Factory *endpoint_selector_factory_;
#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
/// This strategy will buffer messages.
TAO::Transport_Queueing_Strategy *eager_transport_queueing_strategy_;
/// This strategy will buffer messages.
TAO::Transport_Queueing_Strategy *delayed_transport_queueing_strategy_;
/// This strategy will not queue by default, but will flush the queue
/// each time
TAO::Transport_Queueing_Strategy *flush_transport_queueing_strategy_;
#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
/// Number of outstanding references to this object.
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
/// Registry containing all registered policy factories.
TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_;
/// Registry containing all orb initializers
TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_;
/// Registry containing all service context handlers
TAO_Service_Context_Registry service_context_registry_;
#if (TAO_HAS_INTERCEPTORS == 1)
/// Cached pointer/reference to the PICurrent object.
/**
* A pointer/reference to the PICurrent object is cached in the ORB
* Core since it is accessed in the critical path (i.e. the request
* invocation path). Caching it prevents additional overhead to due
* object resolution from occurring.
*/
CORBA::Object_ptr pi_current_;
/// The adapter for handling client request interceptors
TAO::ClientRequestInterceptor_Adapter *client_request_interceptor_adapter_;
/// The adapter for handling server request interceptors
TAO::ServerRequestInterceptor_Adapter *server_request_interceptor_adapter_;
#endif /* TAO_HAS_INTERCEPTORS */
/// IORInterceptor adapter.
TAO_IORInterceptor_Adapter *ior_interceptor_adapter_;
/// Pointer to the valuetype adapter.
TAO_Valuetype_Adapter *valuetype_adapter_;
/// The IOR parser registry.
TAO_Parser_Registry parser_registry_;
/// BiDirectional GIOP factory
TAO_BiDir_Adapter *bidir_adapter_;
/// Bir Dir GIOP policy value
CORBA::Boolean bidir_giop_policy_;
/// ZIOP Adapter
TAO_ZIOP_Adapter *ziop_adapter_;
/// ZIOP enabled or not
CORBA::Boolean ziop_enabled_;
/// Hold the flushing strategy
TAO_Flushing_Strategy *flushing_strategy_;
/// Code Set Manager, received from the Resource Factory
TAO_Codeset_Manager *codeset_manager_;
/// ORB's service configuration
ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> config_;
/// The hook to be set for the SyncScopePolicy
Sync_Scope_Hook sync_scope_hook_;
/// The configured value used as the default sync scope
Messaging::SyncScope default_sync_scope_;
/// The hook to be set for the RelativeRoundtripTimeoutPolicy.
Timeout_Hook timeout_hook_;
};
// ****************************************************************
/**
* @class TAO_ORB_Core_Static_Resources
*
* @brief The static (global) resoures of all ORB cores.
*
* This class is used by the ORB_Core to store the resources global to
* all ORB_Cores. All instance variables that would have been
* declared "static" in TAO_ORB_Core, should be declared in this class
* to avoid the "static initialization order fiasco" as described in
* http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
* Briefly, this is the problem that occurs if any static initializers
* in any other code call into set static members of TAO_ORB_Core.
* Since the order in which these initializers execute is unspecified,
* uninitialized members can be accessed.
*/
class TAO_Export TAO_ORB_Core_Static_Resources : public ACE_Service_Object
{
public:
/// Return the context-specific singleton instance.
static TAO_ORB_Core_Static_Resources* instance (void);
public:
/**
* Name of the network_priority_protocols_hooks that needs to be instantiated.
*/
ACE_CString network_priority_protocols_hooks_name_;
/// The hook to be set for the ConnectionTimeoutPolicy
TAO_ORB_Core::Timeout_Hook connection_timeout_hook_;
/**
* Name of the resource factory that needs to be instantiated.
* The default value is "Resource_Factory". If TAO_Strategies is
* linked, the set_resource_factory will be called to set the value
* to be "Advanced_Resource_Factory".
*/
ACE_CString resource_factory_name_;
/**
* Name of the service object for DII request creation that needs
* to be instantiated. The default value is "Dynamic_Adaper". If
* TAO_DynamicInterface is linked, dynamic_adapter_name() will be
* called to set the value to "Concrete_Dynamic_Adapter".
*/
ACE_CString dynamic_adapter_name_;
/**
* Name of the service object for functions that make calls on
* the Interface Repository. The default value is "IFR_Client_Adaper".
* If TAO_IFR_CLient is linked, ifr_client_adapter_name() will be
* called to set the value to "Concrete_IFR_Client_Adapter".
*/
ACE_CString ifr_client_adapter_name_;
/**
* Name of the service object used by the ORB create_*_tc functions.
* The default value is "TypeCodeFactory_Adapter". If the
* TypeCodeFactory library is linked, the corresponding accessor
* function typecodefactory_adapter_name() will be called to set
* the value to "Concrete_TypeCodeFactory_Adapter".
*/
ACE_CString typecodefactory_adapter_name_;
/**
* Name of the factory object used to adapt function calls on
* the PortableInterceptor interfaces IORInfo and IORInterceptor.
* The default value is "IORInterceptor_Adapter_Factory". If the
* IORInterceptor library is linked, the corresponding accessor
* function iorinterceptor_adapter_factory_name() will be called to set
* the value to "Concrete_IORInterceptor_Adapter_Factory".
*/
ACE_CString iorinterceptor_adapter_factory_name_;
/**
* Name of the factory object used to adapt function calls on
* the valuetype-related interfaces.
* The default value is "Valuetype_Adapter_Factory". If the
* Valuetype library is linked, the corresponding accessor
* function valuetype_adapter_factory_name() will be called to set
* the value to "Concrete_Valuetype_Adapter_Factory".
*/
ACE_CString valuetype_adapter_factory_name_;
/// An alternative hook to be set for the ConnectionTimeoutPolicy
TAO_ORB_Core::Timeout_Hook alt_connection_timeout_hook_;
//private:
/// Constructor.
TAO_ORB_Core_Static_Resources (void);
TAO_ORB_Core_Static_Resources& operator=
(const TAO_ORB_Core_Static_Resources&);
private:
/// Mostly unused variable whose sole purpose is to enforce
/// the instantiation of a TAO_ORB_Core_Static_Resources instance
/// at initialization time.
static TAO_ORB_Core_Static_Resources* initialization_reference_;
};
// ****************************************************************
/// Obtain an instance of the first ORB core registered in the ORB
/// table.
TAO_Export TAO_ORB_Core * TAO_ORB_Core_instance (void);
// ****************************************************************
ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_ORB_Core_Static_Resources)
ACE_FACTORY_DECLARE (TAO, TAO_ORB_Core_Static_Resources)
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
# include "tao/ORB_Core.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif /* TAO_ORB_CORE_H */
| [
"[email protected]"
] | |
4de11b417b247cec9edd9e4dbd2e76293aa4c4d9 | 4db34f4ac120894642ff9404a2d06af2e3d5a3f3 | /bmjcui/src/ui/trojancheck/trojancheckwidget.cpp | c0b36abe639e5dcbf7639db56308250f04218163 | [] | no_license | zhanrui/apollo | a233449f27d7469e9d33d76bd4709bd05815ddc1 | a43c007c9db340797b56649bc2b396d21ca50023 | refs/heads/master | 2020-05-19T18:55:37.053102 | 2015-05-24T22:45:54 | 2015-05-24T22:45:54 | 29,225,236 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 10,596 | cpp | #include "trojancheckwidget.h"
#include "src/ui/base/basestylewidget.h"
#include "src/ui/base/staticbutton.h"
#include "src/ui/base/commonwidget.h"
#include "src/ui/commoncheck/tabbutton.h"
#include "src/ui/commoncheck/mydelegate.h"
#include "src/common/globals.h"
#include "src/common/common.h"
#include <QLabel>
#include <QStandardItemModel>
#include <QTableView>
#include <QHeaderView>
#include <QBrush>
#include <QScrollBar>
#include <QAbstractItemView>
#include <QStyledItemDelegate>
#include <QItemDelegate>
#include <QFrame>
#include <QDateTime>
#include <QTimer>
#include <QTime>
#include <QDebug>
#include <QMovie>
#include <QFileDialog>
#include <QCheckBox>
#include <QComboBox>
#include <QtWidgets>
TrojanCheckWidget::TrojanCheckWidget(QWidget* parent)
: BaseStyleWidget(parent)
{
initUI();
initConnect();
}
TrojanCheckWidget::~TrojanCheckWidget()
{
}
void TrojanCheckWidget::initUI()
{
this->setFixedSize(900, 600);
returnbtn = new StaticButton(":image/common/returnbtn", 3, this);
returnbtn->move(0, 0);
startcheckbtn = new StaticButton(":image/common/startcheckbtn", 3, this);
startcheckbtn->move(703, 60);
cancelcheckbtn = new StaticButton(":image/common/cancelcheckbtn", 3, this);
cancelcheckbtn->move(739, 74);
cancelcheckbtn->hide();
trojanchecklogo = new QLabel(this);
trojanchecklogo->setPixmap(QPixmap(":image/trojancheck/trojanchecklogo"));
trojanchecklogo->move(40, 55);
descriptiontitle = new QLabel(this);
descriptiontitle->setText("木马检查");
descriptiontitle->setObjectName("tc_descriptiontitle");
descriptiontitle->move(130, 69);
description = new QLabel(this);
description->setText("查看用户终端是否存在威胁文档和网络武器");
description->setObjectName("tc_description");
description->move(133, 109);
progressbar_background = new QLabel(this);
progressbar_background->setPixmap(QPixmap(":image/common/progressbar_background"));
progressbar_background->move(0, 147);
progressbar_background->hide();
progressbar_front = new QLabel(this);
QMovie* movie = new QMovie(":image/common/progressbar_front");
movie->setParent(this);
movie->start();
progressbar_front->setMovie(movie);
//progressbar_front->setPixmap(QPixmap(":image/commoncheck/progressbar_front"));
progressbar_front->move(-900, 147);
progressbar_front->hide();
checkingElapsedTime = new QLabel(this);
checkingElapsedTime->move(584, 82);
checkingElapsedTime->setObjectName("tc_checkingelapsedtime");
checkingElapsedTime->setText("已用时:00:00:00");
checkingElapsedTime->hide();
checkingElapsedTimer = new QTimer(this);
settings = new CommonWidget(this);
settings->setFixedSize(900, 447);
settings->setObjectName("trojanchecksetting");
int y = 153;
settings->move(0, y);
// QLabel* typeIcon = new QLabel(settings);
// typeIcon->setPixmap(QPixmap(":image/trojancheck/typeIcon"));
// typeIcon->move(53, 184 - y);
// QLabel* typeDes = new QLabel(settings);
// typeDes->move(82, 184 - y);
// typeDes->setText("检查类型");
// QLabel* typeLabel = new QLabel(settings);
// typeLabel->move(0, 0);
// typeLabel->setText("选择检查类型");
// typeLabel->move(757, 180 - y);
// QLabel* hline1 = new QLabel(settings);
// hline1->move(0, 209 - y);
// hline1->setPixmap(QPixmap(":image/filecheck/hline"));
// typeLE = new QLineEdit(settings);
// typeLE->setText("威胁文档;网络武器");
// typeLE->setPlaceholderText("请选择检查类型");
// typeLE->move(51, 218 - y);
// typeLE->setReadOnly(true);
// threatdocumentCheck = new QCheckBox("威胁文档", settings);
// threatdocumentCheck->setCheckState(Qt::Checked);
// threatdocumentCheck->move(177, 181 - y);
// networkweaponCheck = new QCheckBox("网络武器", settings);
// networkweaponCheck->setCheckState(Qt::Checked);
// networkweaponCheck->move(277, 181 - y);
QLabel* pathIcon = new QLabel(settings);
pathIcon->move(53, 184 - y);
pathIcon->setPixmap(QPixmap(":image/trojancheck/pathIcon"));
QLabel* pathDes = new QLabel(settings);
pathDes->move(82, 184- y);
pathDes->setText("检查路径");
pathBrowserBtn = new StaticButton(":image/trojancheck/pathBrowserBtn", 3, settings);
pathBrowserBtn->move(772, 180- y);
QLabel* hline2 = new QLabel(settings);
hline2->move(0, 209 - y);
hline2->setPixmap(QPixmap(":image/trojancheck/hline"));
pathLE = new QLineEdit(settings);
pathLE->setPlaceholderText("请设置检查路径");
pathLE->move(51, 218 - y);
checkResultBtn = new StaticButton(":image/trojancheck/checkResultBtn", 3, settings);
checkResultBtn->move(738, 272 - y);
checkResultBtn->hide();
}
void TrojanCheckWidget::initConnect()
{
connect(startcheckbtn, SIGNAL(buttonClicked()), this, SLOT(startCheck()));
connect(cancelcheckbtn, SIGNAL(buttonClicked()), this, SLOT(cancelCheck()));
connect(checkingElapsedTimer, SIGNAL(timeout()), this, SLOT(updateCheckingElapsedTime()));
connect(checkingElapsedTimer, SIGNAL(timeout()), this, SLOT(updateCheckingElapsedTime()));
connect(pathBrowserBtn, &StaticButton::buttonClicked, this, &TrojanCheckWidget::setFolderPath);
//connect(threatdocumentCheck, &QCheckBox::stateChanged, this, &TrojanCheckWidget::setCheckType);
//connect(networkweaponCheck, &QCheckBox::stateChanged, this, &TrojanCheckWidget::setCheckType);
//connect(threatdocumentCheck, &QCheckBox::stateChanged, [=](int status) {
// if(status == Qt::Unchecked){
// emit disableThreatDocument();
// }
// if(status == Qt::Checked){
// emit enableThreatDocument();
// }
//});
//connect(networkweaponCheck, &QCheckBox::stateChanged, [=](int status) {
// if(status == Qt::Unchecked){
// emit disableNetworkWeapon();
// }
// if(status == Qt::Checked){
// emit enableNetworkWeapon();
// }
//});
connect(pathLE, &QLineEdit::textChanged, [=](const QString& newValue) {
emit setParameter("path", newValue.trimmed());
});
//connect(typeLE, &QLineEdit::textChanged, [=](const QString& newValue) {
// emit setParameter("type", newValue);
//});
}
void TrojanCheckWidget::setFolderPath()
{
QString directory = QFileDialog::getExistingDirectory(this, "选择文件夹", QDir::currentPath());
if (!directory.isEmpty()) {
pathLE->setText(directory.trimmed());
// QString currentText = pathLE->text();
// if (currentText.trimmed().isEmpty()) {
// pathLE->setText(directory.trimmed());
// } else {
// pathLE->setText(currentText.trimmed().append(";").append(directory.trimmed()));
// }
}
}
void TrojanCheckWidget::setCheckType()
{
//QString types;
//if (threatdocumentCheck->checkState() == Qt::Checked) {
// if (!types.isEmpty()) {
// types.append(";");
// }
// types.append("威胁文档");
//}
//if (networkweaponCheck->checkState() == Qt::Checked) {
// if (!types.isEmpty()) {
// types.append(";");
// }
// types.append("网络武器");
// }
//typeLE->setText(types);
}
void TrojanCheckWidget::startCheck()
{
if (pathLE->text().trimmed().isEmpty()) {
pathLE->setFocus();
return;
}
//if (typeLE->text().isEmpty()) {
// typeLE->setFocus();
// return;
//}
emit setParameter("path", pathLE->text().trimmed());
//emit setParameter("type", typeLE->text());
// keyWordCB->set
startcheckbtn->hide();
cancelcheckbtn->show();
progressbar_background->show();
progressbar_front->move(-900, 147);
progressbar_front->show();
descriptiontitle->setText("正在检查。。。");
descriptiontitle->adjustSize();
description->setText("还未检查出可疑问题");
description->adjustSize();
checkingElapsedTime->show();
checkingElapsedTime->setText("已用时:00:00:00");
checkingElapsedTime->adjustSize();
checkingStartTime = (QDateTime::currentDateTime()).toTime_t();
checkingElapsedTimer->start(1000);
checkResultBtn->show();
emit startCheckSig();
}
void TrojanCheckWidget::cancelCheck()
{
startcheckbtn->show();
cancelcheckbtn->hide();
progressbar_background->hide();
progressbar_front->hide();
QString currentstatus=descriptiontitle->text();
if(currentstatus.contains("发现")){
descriptiontitle->setText(currentstatus+"检查取消!");
}else{
descriptiontitle->setText("检查已取消!");
}
descriptiontitle->adjustSize();
checkingElapsedTime->hide();
checkingElapsedTime->setText("");
checkingElapsedTimer->stop();
}
void TrojanCheckWidget::updateCheckingElapsedTime()
{
//qDebug() << "updateCheckingElapsedTime";
unsigned int timedifference = (QDateTime::currentDateTime()).toTime_t() - checkingStartTime;
checkingElapsedTime->setText("已用时:" + (QTime(0, 0)).addSecs(timedifference).toString("hh:mm:ss"));
}
void TrojanCheckWidget::completerateUpdate(const int completerate, const QString& status)
{
qDebug() << "completerate::" << completerate;
progressbar_front->move(-895 + 900 * completerate / 100, 147);
description->setText(status);
description->adjustSize();
if(completerate ==100){
startcheckbtn->show();
cancelcheckbtn->hide();
progressbar_background->hide();
progressbar_front->hide();
QString currentstatus=descriptiontitle->text();
if(currentstatus.contains("发现")){
descriptiontitle->setText(currentstatus+"检查完成!");
}else{
descriptiontitle->setText("检查完成!");
}
descriptiontitle->adjustSize();
checkingElapsedTime->hide();
checkingElapsedTime->setText("");
checkingElapsedTimer->stop();
}
}
void TrojanCheckWidget::dataCountUpdate(const int totalproblems, const int totalinfomations)
{
QString qs;
if (totalproblems > 0)
qs.append("已发现问题").append(QString::number(totalproblems)).append("条");
if (qs.size() > 0 && totalinfomations > 0)
qs.append(",");
if (totalinfomations > 0)
qs.append("发现信息").append(QString::number(totalinfomations)).append("条");
if (qs.size() > 0)
qs.append(".");
if (qs.size() > 0)
descriptiontitle->setText(qs);
descriptiontitle->adjustSize();
}
| [
"[email protected]"
] | |
82f357fd409c86af1774b6e0688f621e08ccef8a | 2865d0fd61bc33d1d10f73460508de64601b8f24 | /OREZ_Reconstruct/orez_reconstruct.h | 022464f3adc0f4020d1e598829465a667bcfa8a6 | [] | no_license | XungangYin/ZERO | 85c4f0d5982e79e26116864af55c591c929b6d36 | ffb4d53cd43a8e956f8040df0f6f69cb00b0c966 | refs/heads/master | 2020-04-14T23:19:41.451374 | 2019-04-02T07:09:09 | 2019-04-02T07:09:09 | 164,198,622 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 975 | h | #ifndef OREZ_RECONSTRUCT_H
#define OREZ_RECONSTRUCT_H
#include "orez_reconstruct_global.h"
#include "../common.h"
#include "../Common/common.h"
#include <pcl/surface/poisson.h> //泊松
#include <pcl/surface/marching_cubes.h> //mc重建
class OREZ_RECONSTRUCTSHARED_EXPORT OREZ_Reconstruct
{
public:
OREZ_Reconstruct();
pcl::PolygonMesh poissonReconstruction(PointCloudT::Ptr p,bool confidence,unsigned int depth,unsigned int samplePerNode,float scale/*,unsigned int solverDivide*/);
pcl::PolygonMesh poissonReconstruction(PointCloudTRGB::Ptr p,bool confidence,unsigned int depth,unsigned int samplePerNode,float scale/*,unsigned int solverDivide*/);
private:
pcl::PolygonMesh mesh;
// pcl::search::KdTree<PointNormal>::Ptr kdtree;
//泊松重建参数
bool confidence;
unsigned int depth;
unsigned int samplePerNode;
float scale;
unsigned int solverDivide;
//法向
Common *common;
};
#endif // OREZ_RECONSTRUCT_H
| [
""
] | |
3123db8d24352ccd89b207e4fa8e5f3daf7d496c | 9a687607c91f13c53f06d92f78579b838fc227a7 | /common/common/PlatformUtil.cpp | cf85bf667700a9239d75c1cc663fef246e458a65 | [
"MIT"
] | permissive | lemontreehuang/cef-demos | 3ca80a60a3707c0febcd66adf68370f93b4b0bbc | 29386b72312231634f86c03e36763f2a2dfdf064 | refs/heads/master | 2020-06-21T06:38:45.474677 | 2019-04-03T17:16:44 | 2019-04-03T17:20:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,885 | cpp | // CEF-Demos
// Copyright (c) 2019 Borislav Stanimirov
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// http://opensource.org/licenses/MIT
//
#include "PlatformUtil.hpp"
#if defined(_WIN32)
# include <Windows.h>
#else
# include <dlfcn.h>
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
namespace cefdemos
{
#if defined(_WIN32)
namespace
{
// local function used to identify the current module on Windows
void getAddr() {}
}
#endif
std::string PlatformUtil::getCurrentExecutablePath()
{
std::string modulePath;
#if defined(_WIN32)
HMODULE engine;
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)getAddr,
&engine);
char path[_MAX_PATH + _MAX_FNAME + 1];
GetModuleFileNameA(engine, path, _MAX_PATH + _MAX_FNAME);
// normalize path
char* p = path;
while (*p)
{
if (*p == '\\')
{
*p = '/';
}
++p;
}
modulePath = path;
#else
// retrieve the executable path and hope for the best
char buff[2048];
size_t len = readlink("/proc/self/exe", buff, sizeof(buff) - 1);
if (len > 0)
{
buff[len] = 0;
modulePath = buff;
}
#endif
return modulePath;
}
std::string PlatformUtil::getAssetPath(std::string baseDir, const std::string& assetDir)
{
while (true)
{
auto slash = baseDir.rfind('/');
if (slash == std::string::npos)
{
baseDir = assetDir;
break;
}
baseDir.erase(slash + 1);
baseDir += assetDir;
struct stat info;
if (stat(baseDir.c_str(), &info) == 0 && (info.st_mode & S_IFDIR))
{
break;
}
baseDir.erase(slash);
}
return baseDir;
}
}
| [
"[email protected]"
] | |
04fd92d270b58ad8de84092dea2f771a5bf032f9 | 834ede1ca23230af8c3dec93585fd9ba8b05780a | /src/enemyAnimate.h | a8723f42beba3216da380b6ab30b8f1bf11baf07 | [] | no_license | mintos5/quickBall | 6010d47785046c0f2f4306baada6a5bfa8cde47f | ca238a10e1dad68e93359627775cddda3d9d0b31 | refs/heads/master | 2021-04-30T22:18:39.313681 | 2016-12-14T18:25:28 | 2016-12-14T18:25:28 | 74,216,940 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 842 | h | //
// Created by michal on 7.12.2016.
//
#ifndef PPGSO_ENEMYA_H
#define PPGSO_ENEMYA_H
#include <mesh.h>
#include <shader.h>
#include <texture.h>
#include <meshAnimate.h>
#include "object.h"
#include "scene.h"
class enemyAnimate : public Object {
public:
enemyAnimate();
enemyAnimate(bool combiAnimation);
~enemyAnimate();
bool Update(Scene &scene, float dt) override;
void Render(Scene &scene) override;
void setWorldPosition(const glm::vec3 &worldPosition);
private:
float lifeTime = 0.0f;
glm::vec3 worldPosition;
bool combiAnimation = false;
int animationCount = 0;
// Static resources (Shared between instances)
static MeshAnimatePtr mesh;
static ShaderPtr shader;
static TexturePtr texture;
};
typedef std::shared_ptr<enemyAnimate> EnemyAnimPtr;
#endif //PPGSO_ENEMYA_H
| [
"[email protected]"
] | |
2a28446a74c289b5fee46c5a471abc63382c6a0f | 572580660d475027fa349e47a078479222066726 | /Server/kennel/monitor/base/SNMP_lib.cpp | ed836470cd875fd69b1107a8e21d46b9eb2dacec | [] | no_license | SiteView/ecc82Server | 30bae118932435e226ade01bfbb05b662742e6dd | 084b06af3a7ca6c5abf5064e0d1f3f8069856d25 | refs/heads/master | 2021-01-10T21:11:37.487455 | 2013-01-16T09:22:02 | 2013-01-16T09:22:02 | 7,639,874 | 6 | 3 | null | null | null | null | GB18030 | C++ | false | false | 41,534 | cpp |
#include "SNMP_lib.h"
#ifdef SNMP_PP_NAMESPACE
using namespace Snmp_pp;
#endif
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
/////////////////////////////////////////////////////////////////////////////
// BasicSNMP类
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 函数:BasicSNMP //
// 说明:构造函数 //
/////////////////////////////////////////////////////////////////////////////
BasicSNMP::BasicSNMP()
{
timeout = 500;//超时时间
retries = 3;
community = "public";//共同体
m_nPort = 161;//网络设备端口
version = version1;//SNMP版本
pResult = NULL;//链表头
oid = "1.3.6";//OID
m_nOIDValue = 0;
pSnmp = NULL;
authProtocol = SNMPv3_usmNoAuthProtocol;//用户密码加密方式
privProtocol = SNMPv3_usmNoPrivProtocol;//私有访问密码加密方式
memset(chOIDStart, 0 , MAX_BUFF_LEN);//
memset(chErrMsg, 0 , MAX_BUFF_LEN);//错误消息提示
}
/////////////////////////////////////////////////////////////////////////////
// 函数:~BasicSNM //
// 说明:析构函数 //
/////////////////////////////////////////////////////////////////////////////
BasicSNMP::~BasicSNMP()
{
if(pSnmp)
delete pSnmp;//销毁SNMP++环境
DestroyResultList();//销毁结果链表
}
/////////////////////////////////////////////////////////////////////////////
// 函数:DestroyResultList //
// 说明:销毁查询OID结果链表 //
// 参数:无 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::DestroyResultList()
{
try
{
if(pResult)
{//如果存在结果链表
while(pResult != NULL)
{//循环终止条件是:链表指向地址为空
OIDResult *pTemp = pResult;//得到第一条
pResult = pResult->pNext;//当前链表头下移一条
free(pTemp);//释放当前
pTemp = NULL;
}
}
}
catch(...)
{
DWORD dwError = GetLastError();
char strErr[MAX_BUFF_LEN];
sprintf(strErr, "%u", dwError);
MessageBox(NULL,strErr, "Error Code", MB_OK);
}
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetBulkRequest //
// 说明:得到表格变量的结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回一个非0 值 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::GetBulkRequest()
{
puts("BasicSNMP::GetBulkRequest");
int nResult = 0;
char chPrvOID[MAX_BUFF_LEN] = {0};
bool bEnd = false;
Pdu pdu; // construct a Pdu object
Vb vb; // construct a Vb object
vb.set_oid( oid); // set the Oid portion of the Vb
pdu += vb; // add the vb to the Pdu
DestroyResultList();
SnmpTarget *target;// = &ctarget;
if(version ==version3)
{//If SNMP Version Is 3
nResult = InitUTarget();//Init UTarget
pdu.set_security_level( m_nSecurityLevel);//Set the Security Level portion of Pdu
pdu.set_context_name (contextName);//Set the Context Name portion of Pdu
pdu.set_context_engine_id(contextEngineID);//Set the Context Engine ID portion of Pdu
target = &utarget; //Set SNMP Target
}
else
{
target = &ctarget; //Set SNMP Target
}
OIDResult *pTemp = new OIDResult();
OIDResult *pPrevResult = pTemp;
//pTemp->pNext = NULL;
pResult = pTemp;
// try
// {
//SnmpTarget *target = &ctarget;
while (( nResult = pSnmp->get_next(pdu, *target))== SNMP_CLASS_SUCCESS)
{
if(bEnd)
{
break;
}
for ( int z=0;z<pdu.get_vb_count(); z++)
{
pdu.get_vb( vb,z);
if (pdu.get_type() == REPORT_MSG)
{
Oid tmp;
vb.get_oid(tmp);
return -5;
}
// look for var bind exception, applies to v2 only
if ( vb.get_syntax() != sNMP_SYNTAX_ENDOFMIBVIEW)
{
char chOID[MAX_BUFF_LEN] = {0};
sprintf(chOID, "%s", vb.get_printable_oid());
char *pDest = strstr(chOID, chOIDStart);
if(pDest == NULL)
{//OID名称是否包含开始OID
bEnd = true;
break;
}
if(strlen(chPrvOID)>0)
{//如果上次OID不为空
if(strcmp(vb.get_printable_oid(), chPrvOID) == 0)
{//比较OID名称是否相同,相同则退出循环
bEnd = true;
break;
}
}
//结果赋值
strcpy(chPrvOID, vb.get_printable_oid());
strcpy(pTemp->chOID, vb.get_printable_oid());
strcpy(pTemp->chValue,vb.get_printable_value());
puts(oid.get_printable());
puts(pTemp->chOID);
char *pIndex;
pIndex=pTemp->chOID+strlen(oid.get_printable())+1;
//puts(pIndex);
//puts(pTemp->chValue);
pTemp->nLen = strlen(pTemp->chValue);
//char *pdest = strrchr(pTemp->chOID, '.');
//int nLast = (int)(pdest - pTemp->chOID + 1);
//memcpy(pTemp->chIndex, (pTemp->chOID)+nLast, strlen(pTemp->chOID) - nLast);
strcpy(pTemp->chIndex,pIndex);
//pTemp->chIndex[strlen(pTemp->chOID) - nLast] = '\0';
puts(pTemp->chIndex);
}
else
{
memset(chErrMsg, 0 , MAX_BUFF_LEN);
strcpy(chErrMsg, "End of MIB Reached");
return -4;
}
if(pTemp->pNext == NULL)
{
pPrevResult = pTemp;
pTemp->pNext = new OIDResult();
pTemp = pTemp->pNext;
//pTemp->pNext = NULL;
}
}
// last vb becomes seed of next rquest
pdu.set_vblist(&vb, 1);
}
if(nResult == 0)
{
if(pTemp->pNext == NULL)
{
free(pTemp);
pTemp = NULL;
pPrevResult->pNext = NULL;
}
}
// }
// catch(...)
// {
// DWORD dwErr = GetLastError();
// char strErr[MAX_BUFF_LEN];
// sprintf(strErr, "%u", dwErr);
// MessageBox(NULL, strErr, "", MB_OK);
// }
if(nResult == SNMP_ERROR_NO_SUCH_NAME)
{
nResult = 0;
pPrevResult->pNext = NULL;
}
return nResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetNextRequest //
// 说明:以当前OID变量为开始,得到下一个简单变量的结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回一个非0 值 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::GetNextRequest()
{
int nResult = 0;
Pdu pdu; // construct a Pdu object
Vb vb; // construct a Vb object
vb.set_oid( oid); // set the Oid portion of the Vb
pdu += vb; // add the vb to the Pdu
DestroyResultList();
SnmpTarget *target;// = &ctarget;
if(version ==version3)
{//If SNMP Version Is 3
nResult = InitUTarget();//Init UTarget
pdu.set_security_level( m_nSecurityLevel);//Set the Security Level portion of Pdu
pdu.set_context_name (contextName);//Set the Context Name portion of Pdu
pdu.set_context_engine_id(contextEngineID);//Set the Context Engine ID portion of Pdu
target = &utarget; //Set SNMP Target
}
else
{
target = &ctarget; //Set SNMP Target
}
OIDResult *pTemp = new OIDResult();
pTemp->pNext = NULL;
pResult = pTemp;
//SnmpTarget *target = &ctarget;
nResult = pSnmp->get_next( pdu,*target);
if(nResult != 0)
{//当有错误发生时候
strcpy(chErrMsg, pSnmp->error_msg(nResult));
}
for ( int z=0;z<pdu.get_vb_count(); z++)
{
pdu.get_vb( vb,z);
if (pdu.get_type() == REPORT_MSG)
{
Oid tmp;
vb.get_oid(tmp);
return -5;
}
// look for var bind exception, applies to v2 only
if ( vb.get_syntax() != sNMP_SYNTAX_ENDOFMIBVIEW)
{
strcpy(pTemp->chOID, vb.get_printable_oid());
strcpy(pTemp->chValue,vb.get_printable_value());
pTemp->nLen = strlen(pTemp->chValue);
char *pdest = strrchr(pTemp->chOID, '.');
int nLast = (int)(pdest - pTemp->chOID + 1);
memcpy(pTemp->chIndex, (pTemp->chOID)+nLast, strlen(pTemp->chOID) - nLast);
pTemp->chIndex[strlen(pTemp->chOID) - nLast] = '\0';
oid = pTemp->chOID;
}
else
{
// memset(chErrMsg, 0 , MAX_BUFF_LEN);
// strcpy(chErrMsg, "End of MIB Reached");
return -4;
}
}
return nResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetErrorMsg //
// 说明:根据错误号得到错误信息 //
// 参数: //
// nErrCode,错误号 //
// 返回值: //
// 错误信息 //
/////////////////////////////////////////////////////////////////////////////
const char* BasicSNMP::GetErrorMsg(int nErrCode)
{
strcpy(chErrMsg, pSnmp->error_msg(nErrCode));//拷贝错误信息
return chErrMsg;//返回错误信息
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetResultList //
// 说明:得到结果列表 //
// 参数:无 //
// 返回值: //
// 结果列表 //
/////////////////////////////////////////////////////////////////////////////
OIDResult* BasicSNMP::GetResultList()
{
return pResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetRequest //
// 说明:设置简单变量的结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回一个非0 值 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::SetRequest()
{
int nResult = 0;
Pdu pdu; // construct a Pdu object
Vb vb; // construct a Vb object
vb.set_oid(oid); // set the Oid portion of the Vb
vb.set_value(m_nOIDValue); // set the Oid portion of the Vb
pdu += vb;
SnmpTarget *target;// = &ctarget;
if(version ==version3)
{//If SNMP Version Is 3
nResult = InitUTarget();//Init UTarget
pdu.set_security_level( m_nSecurityLevel);//Set the Security Level portion of Pdu
pdu.set_context_name (contextName);//Set the Context Name portion of Pdu
pdu.set_context_engine_id(contextEngineID);//Set the Context Engine ID portion of Pdu
target = &utarget; //Set SNMP Target
}
else
{
target = &ctarget; //Set SNMP Target
}
nResult = pSnmp->set(pdu,*target);//Get Reques
return nResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetRequest //
// 说明:得到简单变量的结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回一个非0 值 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::GetRequest()
{
int nResult = 0;
Pdu pdu; // construct a Pdu object
Vb vb; // construct a Vb object
vb.set_oid( oid); // set the Oid portion of the Vb
pdu += vb; // add the vb to the Pdu
DestroyResultList();
SnmpTarget *target;// = &ctarget;
if(version ==version3)
{//If SNMP Version Is 3
nResult = InitUTarget();//Init UTarget
pdu.set_security_level( m_nSecurityLevel);//Set the Security Level portion of Pdu
pdu.set_context_name (contextName);//Set the Context Name portion of Pdu
pdu.set_context_engine_id(contextEngineID);//Set the Context Engine ID portion of Pdu
target = &utarget; //Set SNMP Target
}
else
{
target = &ctarget; //Set SNMP Target
}
OIDResult *pTemp = new OIDResult();//construct OIDResult Struct
pTemp->pNext = NULL;
pResult = pTemp;
nResult = pSnmp->get( pdu,*target);//Get Reques
if(nResult != 0)
{//当有错误发生时候
strcpy(chErrMsg, pSnmp->error_msg(nResult));
return nResult;
}
for ( int z=0;z<pdu.get_vb_count(); z++)
{
pdu.get_vb( vb,z);
if (pdu.get_type() == REPORT_MSG)
{
Oid tmp;
vb.get_oid(tmp);
return -5;
}
// look for var bind exception, applies to v2 only
if ( vb.get_syntax() != sNMP_SYNTAX_ENDOFMIBVIEW)
{
//Set OIDResult Value
strcpy(pTemp->chOID, vb.get_printable_oid());
strcpy(pTemp->chValue,vb.get_printable_value());
pTemp->nLen = strlen(pTemp->chValue);
char *pdest = strrchr(pTemp->chOID, '.');
int nLast = (int)(pdest - pTemp->chOID + 1);
memcpy(pTemp->chIndex, (pTemp->chOID)+nLast, strlen(pTemp->chOID) - nLast);
pTemp->chIndex[strlen(pTemp->chOID) - nLast] = '\0';
}
else
{
memset(chErrMsg, 0 , MAX_BUFF_LEN);
strcpy(chErrMsg, "End of MIB Reached");
return -4;
}
}
return nResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:InitSNMP //
// 说明:初始化SNMP //
// 参数:无 //
// 返回值: //
// 成功为0,否则为1 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::InitSNMP()
{
int nResult = 0;
// bind to any port and use IPv6 if needed
pSnmp = new Snmp(nResult, 0, (address.get_ip_version() == Address::version_ipv6));
address.set_port(m_nPort);
ctarget = address; // make a target using the address
ctarget.set_version( version); // set the SNMP version SNMPV1 or V2
ctarget.set_retry( retries); // set the number of auto retries
ctarget.set_timeout( timeout); // set timeout
ctarget.set_readcommunity( community); // set the read community name
//add by mtx
ctarget.set_writecommunity("private"); // set the write community name
if(version == version3)
{//如果SNMP版本是V3
nResult = InitSNMPV3();//初始化V3变量
}
// else
// {
// int construct_status;
// v3MP *v3_MP = new v3MP("dummy", 0, construct_status);
// }
return nResult;
}
/////////////////////////////////////////////////////////////////////////////
// 函数: InitSNMPV3 //
// 说明: 当SNMP版本是3,初始化环境变量 //
// 参数: //
// 无 //
// 返回值: //
// 成功为0 ,否则为1 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::InitSNMPV3()
{
char *engineId = "snmpWalk";//Engine ID
char *filename = "snmpv3_boot_counter"; //Local File Name
unsigned int snmpEngineBoots = 0;
int status = 0;
//Get Current Boot Counter
status = getBootCounter(filename, engineId, snmpEngineBoots);
if ((status != SNMPv3_OK) && (status < SNMPv3_FILEOPEN_ERROR))
{
return 1;
}
//Add Boot Counter
snmpEngineBoots++;
//Save Boot Counter In File
status = saveBootCounter(filename, engineId, snmpEngineBoots);
if (status != SNMPv3_OK)
{//Save File Failed
return 1;
}
//Construct Status
int construct_status;
//Create v3MP Class By Engine ID and Boot Counter, return Result into
//Construct status
v3MP *v3_MP = new v3MP(engineId, snmpEngineBoots, construct_status);
//Get v3MP Property (Point to USM Class)
USM *usm = v3_MP->get_usm();
//Set USM Discovery Mode
usm->set_discovery_mode();
//Add Auth User , Auth Password and Private Password
usm->add_usm_user(securityName, authProtocol, privProtocol,
authPassword, privPassword);
//Return Status
delete v3_MP;
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:InitUTarget //
// 说明:当SNMP版本是3时,初始化Utarget //
// 参数: //
// 无 //
// 返回: //
// 成功返回0,否则返回1 //
/////////////////////////////////////////////////////////////////////////////
int BasicSNMP::InitUTarget()
{
int nResult = 0;
utarget = address;//construct UTarger By address Class
utarget.set_version(version); // set the SNMP version SNMPV1 or V2 or V3
utarget.set_retry(retries); // set the number of auto retries
utarget.set_timeout(timeout); // set timeout
utarget.set_security_model(m_nSecurityModel);//Set Security Model
utarget.set_security_name( securityName);//Set Security Name (Auth Name)
OctetStr EgID;//Engine ID
//Get Engine ID
nResult = pSnmp->unicast_discovery(EgID,
(timeout + 99) / 100,
address, version, &community);
if(EgID.len()>0)
{//Engine ID Length Big Than 0
utarget.set_engine_id(EgID);//Set Engine ID
}
else
{//Less Than 0
return 1;//return Failed
}
return 0;//retrun Successed
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetAuthProtocol //
// 说明:设置Auth Password的加密方式 //
// 参数: //
// chAuthProtocol,Auth Password的加密方式 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetAuthProtocol(char* chAuthProtocol)
{
strlwr(chAuthProtocol);//字符串全部小写
if ( strcmp(chAuthProtocol ,"sha") == 0)
{//比较加密方式字符串是否与'sha'完全相等
authProtocol = SNMPv3_usmHMACSHAAuthProtocol;//加密算法为SHA
}
if ( strcmp(chAuthProtocol ,"md5") == 0)
{//比较加密方式字符串是否与'md5'完全相等
authProtocol = SNMPv3_usmHMACMD5AuthProtocol;//加密算法为MD5
}
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetPrivProtocol //
// 说明:设置Priv Password的加密方式 //
// 参数: //
// chAuthProtocol,Priv Password的加密方式 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetPrivProtocol(char* chPrivProtocol)
{
strlwr(chPrivProtocol);//字符串全部小写
if ( strcmp(chPrivProtocol, "des") == 0)
{//比较加密方式字符串是否与'des'完全相等
privProtocol = SNMPv3_usmDESPrivProtocol;
}
if ( strcmp(chPrivProtocol,"idea") == 0)
{//比较加密方式字符串是否与'idea'完全相等
privProtocol = SNMPv3_usmIDEAPrivProtocol;
}
if ( strcmp(chPrivProtocol, "aes128") == 0)
{//比较加密方式字符串是否与'aes128'完全相等
privProtocol = SNMPv3_usmAES128PrivProtocol;
}
if ( strcmp(chPrivProtocol, "aes192") == 0)
{//比较加密方式字符串是否与'aes192'完全相等
privProtocol = SNMPv3_usmAES192PrivProtocol;
}
if ( strcmp(chPrivProtocol, "aes256") == 0)
{//比较加密方式字符串是否与'aes256'完全相等
privProtocol = SNMPv3_usmAES256PrivProtocol;
}
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetCommunity //
// 说明:设置共同体名称,缺省为public //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetCommunity(char* chCommunity)
{
community = chCommunity;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetIPAddress //
// 说明:设置网络设备的IP地址 //
// 参数:网络设备的IP地址 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetIPAddress(char* chAddress)
{
address = chAddress;
if ( !address.valid())
{// check validity of address
memset(chErrMsg, 0 , MAX_BUFF_LEN);
strcpy(chErrMsg, "Invalid Address or DNS Name");
}
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetOID //
// 说明:设置开始查询使用的OID //
// 参数:OID //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetOID(char *chOID)
{
strcpy(chOIDStart, chOID);
oid = chOID;
if ( !oid.valid())
{// check validity of user oid
memset(chErrMsg, 0 , MAX_BUFF_LEN);
strcpy(chErrMsg, "Invalid Oid");
}
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetPort //
// 说明:设置网络设备的端口号,缺省为161 //
// 参数:端口号 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetNetworkPort(int nPort)
{
m_nPort = nPort;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetPrivatePwd //
// 说明:设置私有访问密码,仅限于SNMPV3版本 //
// 参数: //
// chPassword,char类型指针变量,私有访问密码 //
// 返回值: //
// 无 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetPrivatePwd(char* chPassword)
{
privPassword = chPassword;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetPwd //
// 说明:设置访问用户密码,仅限于SNMPV3版本 //
// 参数: //
// chPassword,char类型指针变量,访问用户密码 //
// 返回值: //
// 无 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetPwd(char* chPassword)
{
authPassword = chPassword;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 函数:SetSecurityLevel //
// 说明:设置SNMP安全级别,只适用于V3 //
// 参数:安全级别 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetSecurityLevel(int nSecurityLevel)
{
m_nSecurityLevel = nSecurityLevel;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetSecurityMode //
// 说明:设置SNMP安全模式,只适用于V3 //
// 参数:安全级别 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetSecurityMode(int nSecurityMode)
{
m_nSecurityModel = nSecurityMode;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetUser //
// 说明:设置访问用户,仅限于SNMPV3版本 //
// 参数: //
// chUserName,char类型指针变量,访问用户名称 //
// 返回值: //
// 无 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetUser(char* chUserName)
{
securityName = chUserName;//construct Auth User Name By Parameter
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetVersion //
// 说明:设置SNMP的版本 //
// 参数: //
// nVersion,int类型变量,SNMP版本 //
// 返回值: //
// 无 //
/////////////////////////////////////////////////////////////////////////////
void BasicSNMP::SetVersion(int nVersion)
{
switch (nVersion)
{
case SNMP_VERSION_C1://版本号等于1
version = version1;//SNMP版本为1
break;
case SNMP_VERSION_C2://版本号等于2
version = version2c;//SNMP版本为2
break;
case SNMP_VERSION_C3://版本号等于3
version = version3;//SNMP版本为3
break;
default://缺省情况下为SNMP版本为1
version = version1;
break;
}
}
/////////////////////////////////////////////////////////////////////////////
// 类:clsOID //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 函数:clsOID //
// 说明:构造函数 //
/////////////////////////////////////////////////////////////////////////////
clsOID::clsOID()
{
m_nType = 0;//OID类型为简单标量
m_nValue = 0;
memset(chOIDIndex, 0 , MAX_BUFF_LEN);//初始化OID为空字符串
}
/////////////////////////////////////////////////////////////////////////////
// 函数:clsOID //
// 说明:构造函数 //
// 参数: //
// objSNMP,已经初始化的BasicSNMP //
/////////////////////////////////////////////////////////////////////////////
clsOID::clsOID(BasicSNMP objSNMP)
{
pSNMP = (BasicSNMP*)&objSNMP;//
memset(chOIDIndex, 0 , MAX_BUFF_LEN);//初始化OID为空字符串
m_nType = 0;//OID类型为简单标量
}
/////////////////////////////////////////////////////////////////////////////
// 函数:clsOID //
// 说明:析构函数 //
/////////////////////////////////////////////////////////////////////////////
clsOID::~clsOID()
{
}
/////////////////////////////////////////////////////////////////////////////
// 函数:Average //
// 说明:计算结果的平均值 //
// 参数:无 //
// 返回值: //
// 平均值 //
/////////////////////////////////////////////////////////////////////////////
unsigned long clsOID::IndexCount()
{
unsigned long nIndexCount = 0;
OIDResult *pTemp = pResultList;
while(pTemp != NULL)
{//循环得到总数
if(stricmp(selname,pTemp->chValue)==0)
nIndexCount++;
pTemp = pTemp->pNext;//下一条
}
return nIndexCount;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:Average //
// 说明:计算结果的平均值 //
// 参数:无 //
// 返回值: //
// 平均值 //
/////////////////////////////////////////////////////////////////////////////
unsigned long clsOID::Average()
{
unsigned long nAverage = 0;
__int64 nTotal = 0;
int nCount = 0;
OIDResult *pTemp = pResultList;
while(pTemp != NULL)
{//循环得到总数
nTotal += _atoi64(pTemp->chValue);
pTemp = pTemp->pNext;//下一条
nCount ++;
}
nAverage = (unsigned long)(nTotal / nCount);//计算平均值
return nAverage;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetOID //
// 说明:得到当前正在查询OID //
// 参数:无 //
// 返回值: //
// OID //
/////////////////////////////////////////////////////////////////////////////
char* clsOID::GetOID()
{
return chOID;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetResult //
// 说明:取得结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回1
/////////////////////////////////////////////////////////////////////////////
int clsOID::GetResult()
{
int nResult = 0;
pSNMP->SetOID(chOID);//设置OID
if(m_nType == 0)
{//如果OID类型是简单变量
nResult = pSNMP->GetRequest();
//失败
if(nResult != 0)
return nResult;
}
else
{//如果是表格变量
if(strlen(chOIDIndex) ==0)
{//如果索引值为空,取表格变量
nResult = pSNMP->GetBulkRequest();//获得表格变量结果
}
else
{//索引值不为空,取简单变量
char chOIDTmp[MAX_BUFF_LEN] = {0};
sprintf(chOIDTmp, "%s.%s", chOID, chOIDIndex);
//strcpy(chOID, chOIDTmp);//替换当前查询OID
pSNMP->SetOID(chOIDTmp);//重新设置OID
nResult = pSNMP->GetRequest();//获得简单变量结果
}
}
if(nResult == 0)
{
pResultList = pSNMP->GetResultList();//得到结果列表
}
return nResult;//返回结果
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetResult //
// 说明:取得结果 //
// 参数:无 //
// 返回值: //
// 成功返回0,否则返回1
/////////////////////////////////////////////////////////////////////////////
//add by mtx
int clsOID::SetResult()
{
int nResult = 0;
pSNMP->SetOID(chOID);//设置OID
pSNMP->SetOIDValue(m_nValue);//设置OID的值
if(m_nType == 0)
{//如果OID类型是简单变量
nResult = pSNMP->SetRequest();
}
return nResult;//返回结果
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetResultList //
// 说明:得到所有值的列表 //
// 参数:无 //
// 返回值: //
// 所有值列表 //
/////////////////////////////////////////////////////////////////////////////
OIDResult* clsOID::GetResultList()
{
return pResultList;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:GetValue //
// 说明:得到第一条数据的值 //
// 参数:无 //
// 返回值: //
// char类型指针,第一条数据的值 //
/////////////////////////////////////////////////////////////////////////////
char* clsOID::GetValue()
{
return pResultList->chValue;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:Max //
// 说明:求全部结果的最大值 //
// 参数:无 //
// 返回值: //
// 最大值 //
/////////////////////////////////////////////////////////////////////////////
unsigned long clsOID::Max()
{
unsigned long nMax = 0;
OIDResult *pTemp = pResultList;
nMax = (unsigned long)_atoi64(pTemp->chValue);
while(pTemp != NULL)
{//循环每一条数据以得到最大值
if((unsigned long)_atoi64(pTemp->chValue) > nMax)
nMax = (unsigned long)_atoi64(pTemp->chValue);
pTemp = pTemp->pNext;//下一条
}
return nMax;//返回最大值
}
/////////////////////////////////////////////////////////////////////////////
// 函数:Min //
// 说明:求全部结果的最小值 //
// 参数:无 //
// 返回值: //
// 最小值 //
/////////////////////////////////////////////////////////////////////////////
unsigned long clsOID::Min()
{
unsigned long nMin = 0;
OIDResult *pTemp = pResultList;
nMin = (unsigned long)_atoi64(pTemp->chValue);
while(pTemp != NULL)
{//循环每一条数据以得到最小值
if((unsigned long)(_atoi64(pTemp->chValue)) < nMin)
nMin = (unsigned long)_atoi64(pTemp->chValue);
pTemp = pTemp->pNext;
}
return nMin;//返回结果
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetObjSNMP //
// 说明:设置clsOID使用的SNMP基类 //
// 参数: //
// objSNMP,BasicSNMP基类指针 //
// 返回值:无 //
/////////////////////////////////////////////////////////////////////////////
void clsOID::SetObjSNMP(BasicSNMP *objSNMP)
{
pSNMP = objSNMP;//
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetOID //
// 说明:设置OID //
// 参数: //
// chOIDValue,OID //
// 返回值:无 //
/////////////////////////////////////////////////////////////////////////////
void clsOID::SetOID(char* chOIDValue)
{
strcpy(chOID, chOIDValue);
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetOIDIndex //
// 说明:设置OID索引 //
// 参数: //
// chIndex,OID索引值 //
// 返回值:无 //
/////////////////////////////////////////////////////////////////////////////
void clsOID::SetOIDIndex(char* chIndex)
{
strcpy(chOIDIndex, chIndex);
}
/////////////////////////////////////////////////////////////////////////////
// 函数:SetOIDType //
// 说明:设置OID类型 //
// 参数: //
// nType,OID的类型(0简单变量,1表格变量;缺省为简单变量) //
// 返回值:无 //
/////////////////////////////////////////////////////////////////////////////
void clsOID::SetOIDType(int nType)
{
m_nType = nType;
}
/////////////////////////////////////////////////////////////////////////////
// 函数:Total //
// 说明:计算表格变量类型的OID总数 //
// 参数:无 //
// 返回值: //
// __int64类型的总数 //
/////////////////////////////////////////////////////////////////////////////
__int64 clsOID::Total()
{
__int64 nTotal = 0;
OIDResult *pTemp = pResultList;
while(pTemp != NULL)
{//循环每一条数据累加以得到总数
nTotal += _atoi64(pTemp->chValue);
pTemp = pTemp->pNext;
}
return nTotal;//返回总数
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
const char* clsOID::GetErrorMsg(int nErrCode)
{
return pSNMP->GetErrorMsg(nErrCode);
}
void clsOID::SetSValue(int nValue)
{
m_nValue = nValue;
}
int clsOID::GetSValue()
{
return m_nValue;
}
/////////////////////////////////////////////////////////////////////////////
// 命名空间SV_SNMP_LIB //
// 初始化LIB, 释放LIB //
/////////////////////////////////////////////////////////////////////////////
namespace SV_SNMP_LIB
{//命名空间Siteview SNMP LIB
void InitLib()
{//初始化Lib
Snmp::socket_startup();//初始化Socket子系统
}
void ReleaseLib()
{//释放Lib
Snmp::socket_cleanup(); //关闭socket子系统
}
}
| [
"[email protected]"
] | |
52195bf98020d931fe10cd49dc9b116a1583aef8 | a06a9ae73af6690fabb1f7ec99298018dd549bb7 | /_Library/_Include/boost/icl/detail/interval_morphism.hpp | 4b2f88573cc3270f8045cd1a5e66b6fd92b35491 | [] | no_license | longstl/mus12 | f76de65cca55e675392eac162dcc961531980f9f | 9e1be111f505ac23695f7675fb9cefbd6fa876e9 | refs/heads/master | 2021-05-18T08:20:40.821655 | 2020-03-29T17:38:13 | 2020-03-29T17:38:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,522 | hpp | ////////////////////////////////////////////////////////////////////////////////
// interval_morphism.hpp
/*-----------------------------------------------------------------------------+
Copyright (c) 2008-2009: Joachim Faulhaber
+------------------------------------------------------------------------------+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
#ifndef BOOST_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315
#define BOOST_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315
#include <boost/icl/detail/notate.hpp>
#include <boost/icl/concept/interval_set_value.hpp>
#include <boost/icl/concept/element_set_value.hpp>
#include <boost/icl/concept/set_value.hpp>
#include <boost/icl/concept/map_value.hpp>
#include <boost/icl/associative_interval_container.hpp>
#include <boost/icl/associative_element_container.hpp>
namespace boost{namespace icl
{
namespace segmental
{
template <typename ElementContainerT, typename IntervalContainerT>
void atomize(ElementContainerT& result, const IntervalContainerT& src)
{
ICL_const_FORALL(typename IntervalContainerT, itv_, src)
{
const typename IntervalContainerT::key_type& itv = icl::key_value<IntervalContainerT>(itv_);
typename IntervalContainerT::codomain_type coval = icl::co_value<IntervalContainerT>(itv_);
for(typename IntervalContainerT::domain_type element = first(itv); element <= last(itv); ++element)
icl::insert(result, icl::make_value<ElementContainerT>(element, coval));
}
}
template <typename IntervalContainerT, typename ElementContainerT>
void cluster(IntervalContainerT& result, const ElementContainerT& src)
{
typedef typename IntervalContainerT::key_type key_type;
ICL_const_FORALL(typename ElementContainerT, element_, src)
{
const typename ElementContainerT::key_type& key
= key_value<ElementContainerT>(element_);
const typename codomain_type_of<ElementContainerT>::type& coval
= co_value<ElementContainerT>(element_);
result += icl::make_value<IntervalContainerT>(key_type(key), coval);
}
}
template <typename AtomizedType, typename ClusteredType>
struct atomizer
{
void operator()(AtomizedType& atomized, const ClusteredType& clustered)
{
segmental::atomize(atomized, clustered);
}
};
template <typename ClusteredType, typename AtomizedType>
struct clusterer
{
void operator()(ClusteredType& clustered, const AtomizedType& atomized)
{
segmental::cluster(clustered, atomized);
}
};
template <typename JointType, typename SplitType>
struct joiner
{
void operator()(JointType& joint, SplitType& split)
{
icl::join(split);
ICL_FORALL(typename SplitType, split_, split)
joint.insert(*split_);
}
};
template <typename AbsorberType, typename EnricherType>
struct identity_absorber
{
void operator()(AbsorberType& absorber, EnricherType& enricher)
{
icl::absorb_identities(enricher);
ICL_FORALL(typename EnricherType, enricher_, enricher)
absorber.insert(*enricher_);
}
};
} // namespace Interval
template<>
inline std::string binary_template_to_string<segmental::atomizer>::apply() { return "@"; }
template<>
inline std::string binary_template_to_string<segmental::clusterer>::apply() { return "&"; }
template<>
inline std::string binary_template_to_string<segmental::joiner>::apply() { return "j"; }
template<>
inline std::string binary_template_to_string<segmental::identity_absorber>::apply() { return "a0"; }
}} // namespace boost icl
#endif // BOOST_ICL_DETAIL_INTERVAL_MORPHISM_HPP_JOFA_080315
/////////////////////////////////////////////////
// vnDev.Games - Trong.LIVE - DAO VAN TRONG //
////////////////////////////////////////////////////////////////////////////////
| [
"[email protected]"
] | |
fa20bafe15a697bd15d1026a04f7bc111b03b6d7 | c588c442150354d4b6b0005982cbc9eb760ff7bd | /include/KeyfileIncIndex.hpp | fce81a2c0a5f354cb4f1f9ca123fc5621b32fdec | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | danrugeles/retrieval-algorithms | 548d593637e9ecc2029b89fa2e0e15e7b10310e7 | 970a645107200a79e6f5a8ef62a34d54bc72f254 | refs/heads/master | 2020-05-29T15:35:00.906805 | 2013-02-19T02:22:56 | 2013-02-19T02:22:56 | 8,242,635 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 12,564 | hpp | /*==========================================================================
* Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved.
*
* Use of the Lemur Toolkit for Language Modeling and Information Retrieval
* is subject to the terms of the software license set forth in the LICENSE
* file included with this software, and also available at
* http://www.lemurproject.org/license.html
*
*==========================================================================
*/
#ifndef _LEMUR_KEYFILE_INCINDEX_HPP
#define _LEMUR_KEYFILE_INCINDEX_HPP
/*
* NAME DATE - COMMENTS
* tnt 01/02 - created
* dmf 07/03 - converted to incremental berkeley db btree indexer with
* integrated document manager.
* tds 09/03 - modified from BTIncIndex to use keyfile
* dmf 12/03 - update to 2.1 API and remove parser/docmgr components.
*/
#include "common_headers.hpp"
#include "Index.hpp"
#include "InvFPDocList.hpp"
#include "InvFPTermList.hpp"
#include "InvFPTypes.hpp"
#include "BasicCollectionProps.hpp"
#include "Param.hpp"
#include "PushIndex.hpp"
#include "MemCache.hpp"
#include "Keyfile.hpp"
#include "KeyfileDocMgr.hpp"
#include "ReadBuffer.hpp"
#include "WriteBuffer.hpp"
#include "TermCache.hpp"
#include <cstring>
#include <queue>
namespace lemur
{
namespace index
{
// for counts array
#define UNIQUE_TERMS 0
#define TOTAL_TERMS 1
#define DOCS 2
#define DT_FILES 3
#define INV_FILES 4
// keyref.h -- 512
#define MAX_DOCID_LENGTH 512
#define MAX_TERM_LENGTH 512
#define KEYFILE_MAX_SEGMENTS (16)
// we love multiple inheritance
/*!
KeyfileIncIndex builds an index assigning termids, docids, tracking
locations of term within documents, and tracking terms within
documents. It also expects a DocumentProp to have the total number of
terms that were in a document. It expects that all stopping and
stemming (if any) occurs before the term is passed in. If used with an
existing index, new documents are added incrementally. Records are stored
in keyfile b-trees. KeyfileIncIndex also provides the Index API for using
the index.
*/
class KeyfileIncIndex : public PushIndex, public lemur::api::Index {
public:
/// principle record
class record {
public:
/// file offset
lemur::file::File::offset_type offset;
/// length of list
int len;
/// token length of doc
int totalLen;
/// mgrid for terminfolist, df for docinfolist
int num;
};
/// offset within an individual file segment
struct SegmentOffset {
/// segment number
unsigned int segment;
/// length of data
unsigned int length;
/// file offset
lemur::file::File::offset_type offset;
};
/// individual term data
struct TermData {
/// total number of times this term occurs in the corpus
lemur::api::COUNT_T totalCount;
/// total number of documents this term occurs in
lemur::api::COUNT_T documentCount;
/// segments containing the data associated with the the term
SegmentOffset segments[ KEYFILE_MAX_SEGMENTS ];
};
/// Instantiate with index name without extension. Optionally pass in
/// cachesize and starting document id number.
KeyfileIncIndex(const string &prefix, int cachesize=128000000,
lemur::api::DOCID_T startdocid=1);
/// New empty one for index manager to use.
KeyfileIncIndex();
/// Clean up.
~KeyfileIncIndex();
/// sets the name for this index
void setName(const string &prefix);
/// the beginning of a new document
bool beginDoc(const lemur::parse::DocumentProps* dp);
/// adding a term to the current document
bool addTerm(const lemur::api::Term& t);
/// signify the end of current document
void endDoc(const lemur::parse::DocumentProps* dp);
/// signify the end of current document
virtual void endDoc(const lemur::parse::DocumentProps* dp, const string &mgr);
/// signify the end of this collection.
void endCollection(const lemur::parse::CollectionProps* cp);
/// set the document manager to use for succeeding documents
void setDocManager(const string &mgrID);
protected:
/// try to open an existing index
bool tryOpen();
/// write out the table of contents file.
void writeTOC(const lemur::parse::CollectionProps* cp);
/// write out the cache
void writeCache( bool lastRun = false );
/// final run write out of cache
void lastWriteCache();
/// out-of-tree cache management combine segments into single segment
void mergeCacheSegments();
/// write out segments
void writeCacheSegment();
/// write out document manager ids
void writeDocMgrIDs();
/// returns the internal id of given docmgr
/// if not already registered, mgr will be added
int docMgrID(const string &mgr);
/// handle end of document token.
virtual void doendDoc(const lemur::parse::DocumentProps* dp, int mgrid);
/// how long all the lists are
int listlengths;
public:
/// @name Open index
//@{
/// Open previously created Index with given prefix
bool open(const string &indexName);
//@}
/// @name Spelling and index conversion
//@{
/// Convert a term spelling to a termID
lemur::api::TERMID_T term(const lemur::api::TERM_T &word) const;
/// Convert a termID to its spelling
const lemur::api::TERM_T term(lemur::api::TERMID_T termID) const;
/// Convert a spelling to docID
lemur::api::DOCID_T document(const lemur::api::EXDOCID_T &docIDStr) const;
/// Convert a docID to its spelling
const lemur::api::EXDOCID_T document(lemur::api::DOCID_T docID) const;
/// The document manager for this document
const lemur::api::DocumentManager *docManager(lemur::api::DOCID_T docID) const;
const lemur::parse::CollectionProps *collectionProps() const;
//@}
/// @name Summary counts
//@{
/// Total count (i.e., number) of documents in collection
lemur::api::COUNT_T docCount() const { return counts[DOCS]; };
/// Total count of unique terms in collection
lemur::api::COUNT_T termCountUnique() const { return counts[UNIQUE_TERMS]; };
/// Total counts of a term in collection
lemur::api::COUNT_T termCount(lemur::api::TERMID_T termID) const;
/// Total counts of all terms in collection
lemur::api::COUNT_T termCount() const { return counts[TOTAL_TERMS]; };
/// Average document length
float docLengthAvg() const;
/// Total counts of doc with a given term
lemur::api::COUNT_T docCount(lemur::api::TERMID_T termID) const;
/// Total counts of terms in a document, including stop words maybe
lemur::api::COUNT_T docLength(lemur::api::DOCID_T docID) const;
/// Total counts of terms in a document including stopwords for sure.
virtual lemur::api::COUNT_T totaldocLength (lemur::api::DOCID_T docID) const;
/// Total count of terms in given document, not including stop words
lemur::api::COUNT_T docLengthCounted(lemur::api::DOCID_T docID) const;
//@}
/// @name Index entry access
//@{
/// doc entries in a term index, @see DocList @see InvFPDocList
lemur::api::DocInfoList* docInfoList(lemur::api::TERMID_T termID) const;
/// word entries in a document index (bag of words), @see TermList
lemur::api::TermInfoList* termInfoList(lemur::api::DOCID_T docID) const;
/// word entries in a document index (sequence of words), @see TermList
lemur::api::TermInfoList* termInfoListSeq(lemur::api::DOCID_T docID) const;
//@}
/// set the mesg stream
void setMesgStream(ostream * lemStream);
/// update data for an already seen term
void addKnownTerm( lemur::api::TERMID_T termID, lemur::api::LOC_T position );
/// initialize data for a previously unseen term.
lemur::api::TERMID_T addUnknownTerm( const InvFPTerm* term );
/// update data for a term that is not cached in the term cache.
lemur::api::TERMID_T addUncachedTerm( const InvFPTerm* term );
protected:
/// open the database files
void openDBs();
/// open the segment files
void openSegments();
/// create the database files
void createDBs();
/// readin all toc
void fullToc();
/// read in document manager internal and external ids map
bool docMgrIDs();
/// retrieve a document record.
record fetchDocumentRecord( lemur::api::DOCID_T key ) const;
/// store a document record
void addDocumentLookup( lemur::api::DOCID_T documentKey, const char* documentName );
/// store a term record
void addTermLookup( lemur::api::TERMID_T termKey, const char* termSpelling );
/// store a record
void addGeneralLookup( lemur::file::Keyfile& numberNameIndex,
lemur::file::Keyfile& nameNumberIndex,
lemur::api::TERMID_T number, const char* name );
/// retrieve and construct the DocInfoList for a term.
InvFPDocList* internalDocInfoList(lemur::api::TERMID_T termID) const;
/// add a position to a DocInfoList
void _updateTermlist( InvFPDocList* curlist, lemur::api::LOC_T position );
/// total memory used by cache
int _cacheSize();
/// cache size limits based on cachesize parameter to constructor
void _computeMemoryBounds( int memorySize );
/// Approximate how many updates to collect before flushing the cache.
void _resetEstimatePoint();
/// array to hold all the overall count stats of this db
lemur::api::COUNT_T* counts;
/// array to hold all the names for files we need for this db
std::vector<std::string> names;
/// the average document length in this index
float aveDocLen;
/// list of document managers
vector<std::string> docmgrs;
/// Lemur code messages stream
ostream* msgstream;
// All database handles are marked mutable since they sometimes
// must be used to fetch values during const methods
/// termID -> TermData (term statistics and inverted list segment offsets)
mutable lemur::file::Keyfile invlookup;
// int <-> string mappings for documents and terms
/// documentName -> documentID
mutable lemur::file::Keyfile dIDs;
/// documentID -> documentName
mutable lemur::file::Keyfile dSTRs;
/// termName -> termID
mutable lemur::file::Keyfile tIDs;
/// termID -> termName
mutable lemur::file::Keyfile tSTRs;
/// document statistics (document length, etc.)
mutable lemur::file::File dtlookup;
/// read buffer for dtlookup
lemur::file::ReadBuffer* dtlookupReadBuffer;
/// filestream for writing the list of located terms
/// mutable for index access mode of Index API (not PushIndex)
mutable lemur::file::File writetlist;
/// buffers for term() lookup functions
mutable char termKey[MAX_TERM_LENGTH];
/// buffers for document() lookup functions
mutable char docKey[MAX_DOCID_LENGTH];
/// memory for use by inverted list buffers
int _listsSize;
/// upper bound for memory use
int _memorySize;
/// the prefix name
std::string name;
/// array of pointers to doclists
vector<InvFPDocList*> invertlists;
/// list of terms and their locations in this document
vector<LocatedTerm> termlist;
/// the current docmanager to use
int curdocmgr;
/// list of document manager objects
vector<lemur::api::DocumentManager*> docMgrs;
/// cache of term entries
lemur::utility::TermCache _cache;
/// list of collection properties
mutable lemur::parse::BasicCollectionProps* cprops;
/// out-of-tree segments for data
std::vector<lemur::file::File*> _segments;
/// highest term id flushed to disk.
lemur::api::TERMID_T _largestFlushedTermID;
/// invertlists point where we should next check on the cache size
int _estimatePoint;
/// are we in a bad document state?
bool ignoreDoc;
/// are we read only
bool _readOnly;
};
}
}
#endif //_LEMUR_KEYFILE_INCINDEX_HPP
| [
"[email protected]"
] | |
3777d770b84763c168128288bf781f352539c8f9 | 09a4962b93c196f2f8a70c2384757142793612fd | /Dripdoctors/build/Android/Preview/Dripdoctors/app/src/main/include/Uno.Diagnostics.FreeEvent.h | 833a96a93272c5de341c9fa1b93c5bf1216a00fa | [] | no_license | JimmyRodriguez/apps-fuse | 169779ff2827a6e35be91d9ff17e0c444ba7f8cd | 14114328c3cea08c1fd766bf085bbf5a67f698ae | refs/heads/master | 2020-12-03T09:25:26.566750 | 2016-09-24T14:24:49 | 2016-09-24T14:24:49 | 65,154,944 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 617 | h | // This file was generated based on C:\ProgramData\Uno\Packages\UnoCore\0.32.2\Source\Uno\Diagnostics\$.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Diagnostics.ProfileEvent.h>
namespace g{namespace Uno{namespace Diagnostics{struct FreeEvent;}}}
namespace g{
namespace Uno{
namespace Diagnostics{
// public sealed class FreeEvent :226
// {
::g::Uno::Diagnostics::ProfileEvent_type* FreeEvent_typeof();
void FreeEvent__get_Type_fn(FreeEvent* __this, int* __retval);
struct FreeEvent : ::g::Uno::Diagnostics::ProfileEvent
{
};
// }
}}} // ::g::Uno::Diagnostics
| [
"[email protected]"
] | |
e922ed63db494a05bbcc9cd33d8809aeef317b82 | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /third_party/blink/common/privacy_budget/scoped_identifiability_test_sample_collector.cc | 2dc799a72fb7301308ba9a632bc0dc29f6f3183c | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 1,884 | cc | // Copyright 2020 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 "third_party/blink/public/common/privacy_budget/scoped_identifiability_test_sample_collector.h"
#include <memory>
#include "base/notreached.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "third_party/blink/common/privacy_budget/aggregating_sample_collector.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_sample_collector.h"
#include "third_party/blink/public/common/privacy_budget/scoped_switch_sample_collector.h"
namespace blink {
namespace test {
ScopedIdentifiabilityTestSampleCollector::
ScopedIdentifiabilityTestSampleCollector()
: scoped_default_(this) {}
ScopedIdentifiabilityTestSampleCollector::
~ScopedIdentifiabilityTestSampleCollector() = default;
void ScopedIdentifiabilityTestSampleCollector::Record(
ukm::UkmRecorder* recorder,
ukm::SourceId source,
std::vector<IdentifiableSample> metrics) {
entries_.emplace_back(source, std::move(metrics));
AggregatingSampleCollector::UkmMetricsContainerType metrics_map;
for (auto metric : metrics) {
metrics_map.emplace(metric.surface.ToUkmMetricHash(),
metric.value.ToUkmMetricValue());
}
recorder->AddEntry(ukm::mojom::UkmEntry::New(
source, ukm::builders::Identifiability::kEntryNameHash,
std::move(metrics_map)));
}
void ScopedIdentifiabilityTestSampleCollector::Flush(
ukm::UkmRecorder* recorder) {}
void ScopedIdentifiabilityTestSampleCollector::FlushSource(
ukm::UkmRecorder* recorder,
ukm::SourceId source) {}
void ScopedIdentifiabilityTestSampleCollector::ClearEntries() {
entries_.clear();
}
} // namespace test
} // namespace blink
| [
"[email protected]"
] | |
e32c24d268c1515931f785a7382377147171a712 | acd26d78390e5943690d4966f4392010acf85c7d | /PrevisUI/Source/PrevisUIEditor/Menu/MenuBar.cpp | 21b4a38713b965405ec2ba60382cd659dd19facb | [] | no_license | OlivierArgentieri/save_unrealPrevisTools | 494156b970a77dc6669ae3042baf8114400838e1 | 272099913eb9b9b47a0c32b7901aeb38923729ae | refs/heads/main | 2023-03-01T03:30:29.609619 | 2021-02-04T13:01:47 | 2021-02-04T13:01:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,568 | cpp | #include "MenuBar.h"
void FMenuBar::OnStartupModule()
{
if (!IsRunningCommandlet())
{
// Store a reference to the level editor
FLevelEditorModule& LevelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
// Store a reference to the extensibility manager
TSharedPtr<FExtensibilityManager> LevelEditorMenuExtensibilityManager = LevelEditorModule.GetMenuExtensibilityManager();
// Initialize the class containing the elements for the extension (in our case it will be the menu bar)
MenuExtender = MakeShareable(new FExtender);
// Add to the extender a menu bar extension
MenuExtender->AddMenuBarExtension(
"Window", // The name of the extension of the menu bar
EExtensionHook::After, // The place where we want to place our extension
NULL, // The command list to be called when it is open
FMenuBarExtensionDelegate::CreateRaw(this, &FMenuBar::CreateMenuBar)); // Funcion that will create the UI element
// Apply the extender to the extensibility manager
LevelEditorMenuExtensibilityManager->AddExtender(MenuExtender);
}
UE_LOG(LogTemp, Warning, TEXT("PrevisUI Module : Menu bar loaded"));
}
void FMenuBar::OnShutdownModule()
{
}
void FMenuBar::CreateMenuBar(FMenuBarBuilder& menuBuilder)
{
// Create the menu bar
menuBuilder.AddPullDownMenu(
FText::FromString("Example"), // The name of the menu bar
FText::FromString("Open the Example menu"), // The tooltip
FNewMenuDelegate::CreateRaw(this, &FMenuBar::CreateMenuContent), // Funcion that will create the content of this menu bar
"Example"); // Hook name to place future extensions
}
void FMenuBar::CreateMenuContent(FMenuBuilder& menuBuilder)
{
// Create sections for the menu
menuBuilder.BeginSection("ExampleSection", FText::FromString("Section 1"));
menuBuilder.AddMenuSeparator(FName("Section_1"));
menuBuilder.EndSection();
menuBuilder.BeginSection("ExampleSection", FText::FromString("Section 2"));
menuBuilder.AddMenuSeparator(FName("Section_2"));
menuBuilder.EndSection();
menuBuilder.BeginSection("DebugSection", FText::FromString("Shot Section"));
menuBuilder.AddMenuSeparator(FName("Shot_Section"));
menuBuilder.EndSection();
}
void FMenuBar::AddMenuExtension(const FMenuExtensionDelegate& extensionDelegate, FName extensionHook, const TSharedPtr<FUICommandList>& CommandList, EExtensionHook::Position position)
{
if (!CommandList) return;
; MenuExtender->AddMenuExtension(extensionHook, position, CommandList, extensionDelegate);
} | [
"[email protected]"
] | |
bedcb685539f6717909330dcd2808997e2a88be6 | 618e345bd49738101d1720fbe94896aa953a64ba | /VINS/src/utility/utility.cpp | e8d382775d0706ed425c359e472a8182b72c9817 | [] | no_license | 0iui0/slam_play | 16174cf10d5c56b5811ac553e8677ca29c7300cd | d8dd535b9bf550a5d6172a082c3d35f15a554d82 | refs/heads/main | 2023-08-01T15:56:35.869318 | 2021-09-30T10:28:48 | 2021-09-30T10:28:48 | 382,791,469 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 441 | cpp | #include "utility/utility.h"
Eigen::Matrix3d Utility::g2R(const Eigen::Vector3d &g) {
Eigen::Matrix3d R0;
Eigen::Vector3d ng1 = g.normalized();
Eigen::Vector3d ng2{0, 0, 1.0};
R0 = Eigen::Quaterniond::FromTwoVectors(ng1, ng2).toRotationMatrix();
double yaw = Utility::R2ypr(R0).x();
R0 = Utility::ypr2R(Eigen::Vector3d{-yaw, 0, 0}) * R0;
// R0 = Utility::ypr2R(Eigen::Vector3d{-90, 0, 0}) * R0;
return R0;
}
| [
"[email protected]"
] | |
067c092838a63fd108bfe61db36b248f03097f7c | 62816626aca6f4ed73ef576c0dfdf1c586ca7a9d | /VSL/source/vsGLInfoLib.cpp | 73ae6c02c473689292958783af9997138ed7790e | [] | no_license | pfac/CG-MV | 7274aaa6d7cb075513f23f00a7323e2c278c7e4a | e5b90f80c3cbea52eb7ef3957303e1526c2bebca | refs/heads/master | 2020-04-05T21:35:51.341005 | 2012-02-22T04:27:22 | 2012-02-22T04:27:22 | 3,112,668 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 57,408 | cpp | /** ----------------------------------------------------------
* \class VSGLInfoLib
*
* Lighthouse3D
*
* VSGLInfoLib - Very Simple GL Information Library
*
*
* \version 0.1.0
* - Initial Release
*
* This class provides information about GL stuff
*
* Full documentation at
* http://www.lighthouse3d.com/very-simple-libs
*
---------------------------------------------------------------*/
#include "vsGLInfoLib.h"
// static local variables
std::map<int, std::string> VSGLInfoLib::spInternalF;
std::map<int, std::string> VSGLInfoLib::spDataF;
std::map<int, std::string> VSGLInfoLib::spTextureDataType;
std::map<int, std::string> VSGLInfoLib::spGLSLType;
std::map<int, int> VSGLInfoLib::spGLSLTypeSize;
std::map<int, std::string> VSGLInfoLib::spTextureFilter;
std::map<int, std::string> VSGLInfoLib::spTextureWrap;
std::map<int, std::string> VSGLInfoLib::spTextureCompFunc;
std::map<int, std::string> VSGLInfoLib::spTextureCompMode;
std::map<int, std::string> VSGLInfoLib::spTextureUnit;
std::map<int, int> VSGLInfoLib::spTextureBound;
std::map<int, std::string> VSGLInfoLib::spHint;
std::map<int, std::string> VSGLInfoLib::spTextureTarget;
std::map<int, std::string> VSGLInfoLib::spBufferAccess;
std::map<int, std::string> VSGLInfoLib::spBufferUsage;
std::map<int, std::string> VSGLInfoLib::spBufferBinding;
std::map<int, int> VSGLInfoLib::spBufferBound;
std::map<int, int> VSGLInfoLib::spBoundBuffer;
std::map<int, std::string> VSGLInfoLib::spShaderType;
std::map<int, std::string> VSGLInfoLib::spTransFeedBufferMode;
std::map<int, std::string> VSGLInfoLib::spGLSLPrimitives;
std::map<int, std::string> VSGLInfoLib::spTessGenSpacing;
std::map<int, std::string> VSGLInfoLib::spVertexOrder;
std::map<int, std::string> VSGLInfoLib::spShaderPrecision;
std::vector<unsigned int> VSGLInfoLib::spResult;
std::ostream *VSGLInfoLib::spOutS = (std::iostream *)&std::cout;
bool VSGLInfoLib::__spInit = VSGLInfoLib::init();
char VSGLInfoLib::spAux[256];
// sets the output stream
void
VSGLInfoLib::setOutputStream(std::ostream *outStream) {
if (!outStream)
// if null use cout
spOutS = (std::iostream *)&std::cout;
else
spOutS = outStream;
}
// check if an extension is supported
bool
VSGLInfoLib::isExtensionSupported(std::string extName) {
int max, i = 0;
char *s;
glGetIntegerv(GL_NUM_EXTENSIONS, &max);
do {
s = (char *)glGetStringi(GL_EXTENSIONS, ++i);
}
while (i < max && strcmp(s,extName.c_str()) != 0);
if (i == max)
return false;
else
return true;
}
// general information
void
VSGLInfoLib::getGeneralInfo() {
int info;
addNewLine();
addMessage("General Information");
addMessage("Vendor: %s", glGetString (GL_VENDOR));
addMessage("Renderer: %s", glGetString (GL_RENDERER));
addMessage("Version: %s", glGetString (GL_VERSION));
addMessage("GLSL: %s", glGetString (GL_SHADING_LANGUAGE_VERSION));
glGetIntegerv (GL_NUM_EXTENSIONS, &info);
addMessage("Num. Extensions: %d", info);
}
/* ------------------------------------------------------
Buffers
-------------------------------------------------------- */
// display info for currently bound buffers
void
VSGLInfoLib::getCurrentBufferInfo() {
int info;
addNewLine();
addMessage("Current Buffer Bindings");
// iterate for all buffer types
std::map<int, int>::iterator iter = spBufferBound.begin();
for ( ; iter != spBufferBound.end(); ++iter) {
// get current binding for a type of buffer
glGetIntegerv(iter->first, &info);
// if a buffer is bound get its info
if (info) {
addMessage("Buffer Info for name: %d", info);
addMessage(" Buffer Type: %s", spBufferBinding[iter->first].c_str());
glGetBufferParameteriv(iter->second, GL_BUFFER_ACCESS, &info);
addMessage(" Access: %s", spBufferAccess[info].c_str());
glGetBufferParameteriv(iter->second, GL_BUFFER_MAPPED, &info);
addMessage(" Mapped: %d", info);
glGetBufferParameteriv(iter->second, GL_BUFFER_SIZE, &info);
addMessage(" Size: %d", info);
glGetBufferParameteriv(iter->second, GL_BUFFER_USAGE, &info);
addMessage(" Usage: %s", spBufferUsage[info].c_str());
}
}
}
// gets all the names currently bound to buffers
std::vector<unsigned int> &
VSGLInfoLib::getBufferNames() {
spResult.clear();
for (unsigned int i = 0; i < 65535; ++i) {
if (glIsBuffer(i)) {
spResult.push_back(i);
}
}
return spResult;
}
// display buffer info
void
VSGLInfoLib::getBufferInfo(GLenum target, int bufferName) {
int info, prevBuffer;
addNewLine();
addMessage("Info for buffer name: %d target: %s", bufferName, spBufferBinding[spBoundBuffer[target]].c_str());
// get previously bound buffer
glGetIntegerv(spBoundBuffer[target], &prevBuffer);
// bind requested buffer to get info
glBindBuffer(target,bufferName);
glGetBufferParameteriv(target, GL_BUFFER_ACCESS, &info);
addMessage(" Access: %s", spBufferAccess[info].c_str());
glGetBufferParameteriv(target, GL_BUFFER_MAPPED, &info);
addMessage(" Mapped: %d", info);
glGetBufferParameteriv(target, GL_BUFFER_SIZE, &info);
addMessage(" Size: %d", info);
glGetBufferParameteriv(target, GL_BUFFER_USAGE, &info);
addMessage(" Usage: %s", spBufferUsage[info].c_str());
// re-bind previous buffer
glBindBuffer(target, prevBuffer);
}
/* ------------------------------------------------------
Textures
-------------------------------------------------------- */
// gets all the names currently bound to textures
std::vector<unsigned int> &
VSGLInfoLib::getTextureNames() {
spResult.clear();
for (unsigned int i = 0; i < 65535; ++i) {
if (glIsTexture(i))
spResult.push_back(i);
}
return spResult;
}
// gets the current texture bindings for all texture units
void
VSGLInfoLib::getCurrentTextureInfo() {
int info, activeUnit, anyBindings;
std::vector<int> textures;
// get current active unit, for later restoration
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeUnit);
addNewLine();
addMessage("Current Texture Bindings");
addMessage("Currently Active Texture Unit: %s", spTextureUnit[activeUnit].c_str());
addMessage("Texture Bindings:");
// for each unit
for (int i = 0; i < 8; ++i) {
glActiveTexture(GL_TEXTURE0 + i);
textures.clear();
anyBindings = 0;
std::map<int, int>::iterator iterTT;
iterTT = spTextureBound.begin();
for ( ; iterTT != spTextureBound.end(); ++iterTT) {
glGetIntegerv((iterTT)->second, &info);
textures.push_back(info);
anyBindings |= info;
}
if (anyBindings) {
addMessage("Unit %d", i);
iterTT = spTextureBound.begin();
for (int j = 0 ; iterTT != spTextureBound.end(); ++j, ++iterTT) {
if (textures[j])
addMessage(" %s: %d", spTextureTarget[(iterTT)->first].c_str(), textures[j]);
}
}
}
// restore previous active texture unit
glActiveTexture(activeUnit);
}
// returns the name of the currently bound texture for a target
int
VSGLInfoLib::getCurrentTexture(GLenum textureTarget) {
int t;
glGetIntegerv(spTextureBound[textureTarget], &t);
return(t);
}
// returns the currently active texture unit
int
VSGLInfoLib::getCurrentTextureActiveUnitInfo() {
int activeUnit;
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeUnit);
return(activeUnit);
}
// sends to the stream all the texture info
void
VSGLInfoLib::getTextureInfo(GLenum textureTarget, GLenum textureID) {
addNewLine();
if (!glIsTexture(textureID)) {
addMessage("name: %d is not a texture", textureID);
return;
}
if (!glIsTexture(textureID)) {
addMessage("ID %d does not represent a valid texture name", textureID);
return;
}
addMessage("Texture Info - target: %s tex ID %d", spTextureTarget[textureTarget].c_str(), textureID);
int prevTex = getCurrentTexture(textureTarget);
glBindTexture(textureTarget, textureID);
int info;
// Dimensions
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_WIDTH, &info);
addMessage("Dimensions");
addMessage(" Width: %d", info);
if (textureTarget != GL_TEXTURE_1D) {
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_HEIGHT, &info);
addMessage(" Height: %d", info);
if (textureTarget != GL_TEXTURE_2D) {
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_DEPTH, &info);
addMessage(" Depth: %d", info);
}
}
// Internal Format
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_INTERNAL_FORMAT, &info);
addMessage("Internal Format: %s", spInternalF[info].c_str());
// Compression info
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_COMPRESSED, &info);
// sizes
if (info) {
glGetIntegerv(GL_TEXTURE_COMPRESSION_HINT, &info);
addMessage("Compression Hint: %s", spHint[info].c_str());
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &info);
addMessage("Compressed Size: %d", info);
}
else {
addMessage("Bits per channel -");
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_RED_SIZE, &info);
if (info)
addMessage(" Red: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_GREEN_SIZE, &info);
if (info)
addMessage(" Green: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_BLUE_SIZE, &info);
if (info)
addMessage(" Blue: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_ALPHA_SIZE, &info);
if (info)
addMessage(" Alpha: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_DEPTH_SIZE, &info);
if (info)
addMessage(" Depth: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_STENCIL_SIZE, &info);
if (info)
addMessage(" Stencil: %d", info);
glGetTexLevelParameteriv(textureTarget, 0,
GL_TEXTURE_RED_TYPE, &info);
addMessage("Data Type: %s", spTextureDataType[info].c_str());
}
// Get texture sampling state
glGetTexParameteriv(textureTarget, GL_TEXTURE_MIN_FILTER, &info);
addMessage("Min Filter: %s", spTextureFilter[info].c_str());
glGetTexParameteriv(textureTarget, GL_TEXTURE_MAG_FILTER, &info);
addMessage("Mag Filter: %s", spTextureFilter[info].c_str());
// wrapping info
glGetTexParameteriv(textureTarget, GL_TEXTURE_WRAP_S, &info);
addMessage("Wrap S: %s", spTextureWrap[info].c_str());
if (textureTarget != GL_TEXTURE_1D) {
glGetTexParameteriv(textureTarget, GL_TEXTURE_WRAP_T, &info);
addMessage("Wrap T: %s", spTextureWrap[info].c_str());
if (textureTarget != GL_TEXTURE_2D) {
glGetTexParameteriv(textureTarget, GL_TEXTURE_WRAP_R, &info);
addMessage("Wrap R: %s", spTextureWrap[info].c_str());
}
}
// mipmap info
glGetTexParameteriv(textureTarget, GL_TEXTURE_BASE_LEVEL, &info);
addMessage("Base Level: %d", info);
glGetTexParameteriv(textureTarget, GL_TEXTURE_MAX_LEVEL, &info);
addMessage("Max Level: %d", info);
// compare info
glGetTexParameteriv(textureTarget, GL_TEXTURE_COMPARE_MODE, &info);
addMessage("Compare Mode : %s", spTextureCompMode[info].c_str());
if (info != GL_NONE) {
glGetTexParameteriv(textureTarget, GL_TEXTURE_COMPARE_FUNC, &info);
addMessage("Compare Mode : %s", spTextureCompFunc[info].c_str());
}
glBindTexture(textureTarget, prevTex);
}
/* ------------------------------------------------------
GLSL
-------------------------------------------------------- */
// gets all the names currently boundo to programs
std::vector<unsigned int> &
VSGLInfoLib::getProgramNames() {
spResult.clear();
for (unsigned int i = 0; i < 65535; ++i) {
if (glIsProgram(i))
spResult.push_back(i);
}
return spResult;
}
// gets all the names currently bound to Shaders
std::vector<unsigned int> &
VSGLInfoLib::getShaderNames() {
spResult.clear();
for (unsigned int i = 0; i < 65535; ++i) {
if (glIsShader(i))
spResult.push_back(i);
}
return spResult;
}
// gets all the names currently bound to VAOs
std::vector<unsigned int> &
VSGLInfoLib::getVAONames() {
spResult.clear();
for (unsigned int i = 0; i < 65535; ++i) {
if (glIsVertexArray(i))
spResult.push_back(i);
}
return spResult;
}
// display VAO information, including its attributes
void
VSGLInfoLib::getVAOInfo(unsigned int buffer) {
int count, info, prevBuffer;
addNewLine();
// is it a VAO?
if (!glIsVertexArray(buffer)) {
addMessage("name: %d is not a VAO", buffer);
return;
}
addMessage("VAO Info for name: %d", buffer);
// bind requested VAO
// should be able to get previously bounded VAO...
glBindVertexArray(buffer);
// get element array buffer name
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &info);
if (info)
addMessage("Element Array: %d", info);
// get info for each attrib mapped buffer
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &count);
for (int i = 0; i < count; ++i) {
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &info);
if (info) {
addMessage("Attrib index: %d", i);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &info);
addMessage(" Buffer bound: %d", info);
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &prevBuffer);
glBindBuffer(GL_ARRAY_BUFFER, info);
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &info);
glBindBuffer(GL_ARRAY_BUFFER, prevBuffer);
addMessage(" Size: %d", info);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &info);
addMessage(" Components: %d", info);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &info);
addMessage(" Data Type: %s", spDataF[info].c_str());
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &info);
addMessage(" Stride: %d", info);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &info);
addMessage(" Normalized: %d", info);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &info);
addMessage(" Divisor: %d", info);
glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_INTEGER, &info);
addMessage(" Integer: %d", info);
}
}
}
// display info for all active uniforms in a program
void
VSGLInfoLib::getUniformsInfo(unsigned int program) {
addNewLine();
// is it a program ?
if (!glIsProgram(program)) {
addMessage("name: %d is not a program", program);
return;
}
int activeUnif, actualLen, index, uniType,
uniSize, uniMatStride, uniArrayStride, uniOffset;
char name[256];
// Get uniforms info (not in named blocks)
addMessage("Uniforms Info for program: %d", program);
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &activeUnif);
for (unsigned int i = 0; i < (unsigned int)activeUnif; ++i) {
glGetActiveUniformsiv(program, 1, &i, GL_UNIFORM_BLOCK_INDEX, &index);
if (index == -1) {
glGetActiveUniformName(program, i, 256, &actualLen, name);
glGetActiveUniformsiv(program, 1, &i, GL_UNIFORM_TYPE, &uniType);
addMessage("%s", name);
addMessage(" %s", spGLSLType[uniType].c_str());
addMessage(" location: %d", i);
glGetActiveUniformsiv(program, 1, &i, GL_UNIFORM_SIZE, &uniSize);
glGetActiveUniformsiv(program, 1, &i, GL_UNIFORM_ARRAY_STRIDE, &uniArrayStride);
int auxSize;
if (uniArrayStride > 0)
auxSize = uniArrayStride * uniSize;
else
auxSize = spGLSLTypeSize[uniType];
addMessage(" size: %d", auxSize);
if (uniArrayStride > 0)
addMessage(" stride: %d", uniArrayStride);
}
}
// Get named blocks info
int count, dataSize, info;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &count);
for (int i = 0; i < count; ++i) {
// Get buffers name
glGetActiveUniformBlockName(program, i, 256, NULL, name);
glGetActiveUniformBlockiv(program, i, GL_UNIFORM_BLOCK_DATA_SIZE, &dataSize);
addMessage("%s\n Size %d", name, dataSize);
glGetActiveUniformBlockiv(program, i, GL_UNIFORM_BLOCK_BINDING, &index);
addMessage(" Block binding point: %d", index);
glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, index, &info);
addMessage(" Buffer bound to binding point: %d {", info);
glGetActiveUniformBlockiv(program, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &activeUnif);
unsigned int *indices;
indices = (unsigned int *)malloc(sizeof(unsigned int) * activeUnif);
glGetActiveUniformBlockiv(program, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, (int *)indices);
for (int k = 0; k < activeUnif; ++k) {
glGetActiveUniformName(program, indices[k], 256, &actualLen, name);
glGetActiveUniformsiv(program, 1, &indices[k], GL_UNIFORM_TYPE, &uniType);
addMessage("\t%s\n\t %s", name, spGLSLType[uniType].c_str());
glGetActiveUniformsiv(program, 1, &indices[k], GL_UNIFORM_OFFSET, &uniOffset);
addMessage("\t offset: %d", uniOffset);
glGetActiveUniformsiv(program, 1, &indices[k], GL_UNIFORM_SIZE, &uniSize);
glGetActiveUniformsiv(program, 1, &indices[k], GL_UNIFORM_ARRAY_STRIDE, &uniArrayStride);
glGetActiveUniformsiv(program, 1, &indices[k], GL_UNIFORM_MATRIX_STRIDE, &uniMatStride);
int auxSize;
if (uniArrayStride > 0)
auxSize = uniArrayStride * uniSize;
else if (uniMatStride > 0) {
switch(uniType) {
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
case GL_DOUBLE_MAT2:
case GL_DOUBLE_MAT2x3:
case GL_DOUBLE_MAT2x4:
auxSize = 2 * uniMatStride;
break;
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
case GL_DOUBLE_MAT3:
case GL_DOUBLE_MAT3x2:
case GL_DOUBLE_MAT3x4:
auxSize = 3 * uniMatStride;
break;
case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
case GL_DOUBLE_MAT4:
case GL_DOUBLE_MAT4x2:
case GL_DOUBLE_MAT4x3:
auxSize = 4 * uniMatStride;
break;
}
}
else
auxSize = spGLSLTypeSize[uniType];
auxSize = getUniformByteSize(uniSize, uniType, uniArrayStride, uniMatStride);
addMessage("\t size: %d", auxSize);
if (uniArrayStride > 0)
addMessage("\t array stride: %d", uniArrayStride);
if (uniMatStride > 0)
addMessage("\t mat stride: %d", uniMatStride);
}
addMessage(" }");
}
}
// display the values for uniforms in the default block
void
VSGLInfoLib::getUniformInfo(unsigned int program, std::string uniName) {
addNewLine();
// is it a program ?
if (!glIsProgram(program)) {
addMessage("name: %d is not a program", program);
return;
}
GLenum type;
GLsizei l;
GLint s;
char c[50];
int loc = glGetUniformLocation((int)program, uniName.c_str());
glGetActiveUniform(program, loc, 0, &l, &s, &type, c);
if (loc != -1) {
addMessage("Values for uniform %s in program %d", uniName.c_str(), program);
int rows = getRows(type), columns = getColumns(type);
if (getType(type) == FLOAT) {
float f[16];
glGetUniformfv(program, loc, f);
displayUniformf(f,rows,columns);
}
else if (getType(type) == INT) {
int f[16];
glGetUniformiv(program, loc, f);
displayUniformi(f,rows,columns);
}
else if (getType(type) == UNSIGNED_INT) {
unsigned int f[16];
glGetUniformuiv(program, loc, f);
displayUniformui(f,rows,columns);
}
else if (getType(type) == DOUBLE) {
double f[16];
glGetUniformdv(program, loc, f);
displayUniformd(f,rows,columns);
}
}
else
addMessage("%s is not an active uniform in program %u", uniName, program);
}
// display the values for a uniform in a named block
void
VSGLInfoLib::getUniformInBlockInfo(unsigned int program,
std::string blockName,
std::string uniName) {
addNewLine();
// is it a program ?
if (!glIsProgram(program)) {
addMessage("name: %d is not a program", program);
return;
}
int index = glGetUniformBlockIndex(program, blockName.c_str());
if (index == GL_INVALID_INDEX) {
addMessage("%s is not a valid uniform name in block %s", uniName.c_str(), blockName.c_str());
return;
}
int bindIndex,bufferIndex;
glGetActiveUniformBlockiv(program, index, GL_UNIFORM_BLOCK_BINDING, &bindIndex);
addMessage("Block binding point: %d", bindIndex);
glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, bindIndex, &bufferIndex);
addMessage("Buffer bound to binding point: %d ", bufferIndex);
unsigned int uniIndex;
const char *c = uniName.c_str();
glGetUniformIndices(program, 1, &c, &uniIndex);
addMessage("Index of Uniform: %u", uniIndex);
int uniType, uniOffset, uniSize, uniArrayStride, uniMatStride;
glGetActiveUniformsiv(program, 1, &uniIndex, GL_UNIFORM_TYPE, &uniType);
glGetActiveUniformsiv(program, 1, &uniIndex, GL_UNIFORM_OFFSET, &uniOffset);
glGetActiveUniformsiv(program, 1, &uniIndex, GL_UNIFORM_SIZE, &uniSize);
glGetActiveUniformsiv(program, 1, &uniIndex, GL_UNIFORM_ARRAY_STRIDE, &uniArrayStride);
glGetActiveUniformsiv(program, 1, &uniIndex, GL_UNIFORM_MATRIX_STRIDE, &uniMatStride);
int auxSize = getUniformByteSize(uniSize, uniType, uniArrayStride, uniMatStride);
// get previously bound buffer
int prevBuffer;
glGetIntegerv(spBoundBuffer[GL_UNIFORM_BUFFER], &prevBuffer);
glBindBuffer(GL_UNIFORM_BUFFER, bufferIndex);
int rows = getRows(uniType);
int columns = auxSize / (rows * sizeof(float));
if (getType(uniType) == FLOAT) {
float f[16];
glGetBufferSubData(GL_UNIFORM_BUFFER, uniOffset, auxSize, f);
displayUniformf(f,rows,columns);
}
else if (getType(uniType) == INT) {
int f[16];
glGetBufferSubData(GL_UNIFORM_BUFFER, uniOffset, auxSize, f);
displayUniformi(f,rows,columns);
}
else if (getType(uniType) == UNSIGNED_INT) {
unsigned int f[16];
glGetBufferSubData(GL_UNIFORM_BUFFER, uniOffset, auxSize, f);
displayUniformui(f,rows,columns);
}
else if (getType(uniType) == DOUBLE) {
double f[16];
glGetBufferSubData(GL_UNIFORM_BUFFER, uniOffset, auxSize, f);
displayUniformd(f,rows,columns);
}
glBindBuffer(GL_UNIFORM_BUFFER, prevBuffer);
}
// display information for a program's attributes
void
VSGLInfoLib::getAttributesInfo(unsigned int program) {
int activeAttr, size, loc;
GLsizei length;
GLenum type;
char name[256];
addNewLine();
// check if it is a program
if (!glIsProgram(program)) {
addMessage("name: %d is not a program", program);
return;
}
addMessage("Attribute Info for program %d", program);
// how many attribs?
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &activeAttr);
// get location and type for each attrib
for (unsigned int i = 0; i < (unsigned int)activeAttr; ++i) {
glGetActiveAttrib(program, i, 256, &length, &size, &type, name);
loc = glGetAttribLocation(program, name);
addMessage("%s loc: %d type: %s", name, loc, spGLSLType[type].c_str());
}
}
// display program's information
void
VSGLInfoLib::getProgramInfo(unsigned int program) {
addNewLine();
// check if name is really a program
if (!glIsProgram(program)) {
addMessage("Name %u is not a program", program);
return;
}
addMessage("Program Information for name %u", program);
unsigned int shaders[5];
int count, info, linked;
bool geom= false, tess = false;
// Get the shader's name
addMessage(" Shaders {");
glGetProgramiv(program, GL_ATTACHED_SHADERS,&count);
glGetAttachedShaders(program, count, NULL, shaders);
for (int i = 0; i < count; ++i) {
glGetShaderiv(shaders[i], GL_SHADER_TYPE, &info);
addMessage("\t%s: %d", spShaderType[info].c_str(), shaders[i]);
if (info == GL_GEOMETRY_SHADER)
geom = true;
if (info == GL_TESS_EVALUATION_SHADER || info == GL_TESS_CONTROL_SHADER)
tess = true;
}
addMessage(" }");
// Get program info
glGetProgramiv(program, GL_PROGRAM_SEPARABLE, &info);
addMessage(" Program Separable: %d", info);
glGetProgramiv(program, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, &info);
addMessage(" Program Binary Retrievable Hint: %d", info);
glGetProgramiv(program, GL_LINK_STATUS, &linked);
addMessage(" Link Status: %d", linked);
glGetProgramiv(program, GL_VALIDATE_STATUS, &info);
addMessage(" Validate_Status: %d", info);
glGetProgramiv(program, GL_DELETE_STATUS, &info);
addMessage(" Delete_Status: %d", info);
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &info);
addMessage(" Active_Attributes: %d", info);
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &info);
addMessage(" Active_Uniforms: %d", info);
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &info);
addMessage(" Active_Uniform_Blocks: %d", info);
#ifdef VSGL_VERSION_4_2
glGetProgramiv(program, GL_ACTIVE_ATOMIC_COUNTER_BUFFERS, &info);
addMessage(" Active_Atomic Counters: %d", info);
#endif
// check if trans feed is active
glGetProgramiv(program, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, &info);
addMessage(" Transform Feedback Buffer Mode: %s", spTransFeedBufferMode[info].c_str());
glGetProgramiv(program, GL_TRANSFORM_FEEDBACK_VARYINGS, &info);
addMessage(" Transform Feedback Varyings: %d", info);
// Geometry shader info, if present
if (geom && linked) {
glGetProgramiv(program, GL_GEOMETRY_VERTICES_OUT, &info);
addMessage(" Geometry Vertices Out: %d", info);
glGetProgramiv(program, GL_GEOMETRY_INPUT_TYPE, &info);
addMessage(" Geometry Input Type: %s", spGLSLPrimitives[info].c_str());
glGetProgramiv(program, GL_GEOMETRY_OUTPUT_TYPE, &info);
addMessage(" Geometry Output Type: %s", spGLSLPrimitives[info].c_str());
glGetProgramiv(program, GL_GEOMETRY_SHADER_INVOCATIONS, &info);
addMessage(" Geometry Shader Invocations: %d", info);
}
// tessellation shaders info, if present
if (tess && linked) {
glGetProgramiv(program, GL_TESS_CONTROL_OUTPUT_VERTICES, &info);
addMessage(" Tess Control Output Vertices: %d", info);
glGetProgramiv(program, GL_TESS_GEN_MODE, &info);
addMessage(" Tess Gen Mode: %s", spGLSLPrimitives[info].c_str());
glGetProgramiv(program, GL_TESS_GEN_SPACING, &info);
addMessage(" Tess Spacing: %s", spTessGenSpacing[info].c_str());
glGetProgramiv(program, GL_TESS_GEN_VERTEX_ORDER, &info);
addMessage(" Tess Vertex Order: %s", spVertexOrder[info].c_str());
glGetProgramiv(program, GL_TESS_GEN_POINT_MODE, &info);
addMessage(" Tess Gen Point Mode: %d", info);
}
addMessage("");
}
/* ----------------------------------------------
private auxiliary functions
----------------------------------------------- */
// add a newline to the stream
void
VSGLInfoLib::addNewLine() {
*spOutS << "\n";
}
// Printf style! plus a newline at the end
void
VSGLInfoLib::addMessage(std::string format, ...) {
va_list args;
va_start(args,format);
vsprintf(spAux, format.c_str(), args);
va_end(args);
*spOutS << spAux << "\n";
}
// init the library
// fills up the maps with enum to string
// to display human-readable messages
bool
VSGLInfoLib::init() {
spShaderPrecision[GL_LOW_FLOAT] = "GL_LOW_FLOAT";
spShaderPrecision[GL_MEDIUM_FLOAT] = "GL_MEDIUM_FLOAT";
spShaderPrecision[GL_HIGH_FLOAT] = "GL_HIGH_FLOAT";
spShaderPrecision[GL_LOW_INT] = "GL_LOW_INT";
spShaderPrecision[GL_MEDIUM_INT] = "GL_MEDIUM_INT";
spShaderPrecision[GL_HIGH_INT] = "GL_HIGH_INT";
spTessGenSpacing[GL_EQUAL] = "GL_EQUAL";
spTessGenSpacing[GL_FRACTIONAL_EVEN] = "GL_FRACTIONAL_EVEN";
spTessGenSpacing[GL_FRACTIONAL_ODD] = "GL_FRACTIONAL_ODD";
spVertexOrder[GL_CCW] = "GL_CCW";
spVertexOrder[GL_CW] = "GL_CW";
spGLSLPrimitives[GL_QUADS] = "GL_QUADS";
spGLSLPrimitives[GL_ISOLINES] = "GL_ISOLINES";
spGLSLPrimitives[GL_POINTS] = "GL_POINTS";
spGLSLPrimitives[GL_LINES] = "GL_LINES";
spGLSLPrimitives[GL_LINES_ADJACENCY] = "GL_LINES_ADJACENCY";
spGLSLPrimitives[GL_TRIANGLES] = "GL_TRIANGLES";
spGLSLPrimitives[GL_LINE_STRIP] = "GL_LINE_STRIP";
spGLSLPrimitives[GL_TRIANGLE_STRIP] = "GL_TRIANGLE_STRIP";
spGLSLPrimitives[GL_TRIANGLES_ADJACENCY] = "GL_TRIANGLES_ADJACENCY";
spTransFeedBufferMode[GL_SEPARATE_ATTRIBS] = "GL_SEPARATE_ATTRIBS";
spTransFeedBufferMode[GL_INTERLEAVED_ATTRIBS] = "GL_INTERLEAVED_ATTRIBS";
spShaderType[GL_VERTEX_SHADER] = "GL_VERTEX_SHADER";
spShaderType[GL_GEOMETRY_SHADER] = "GL_GEOMETRY_SHADER";
spShaderType[GL_TESS_CONTROL_SHADER] = "GL_TESS_CONTROL_SHADER";
spShaderType[GL_TESS_EVALUATION_SHADER] = "GL_TESS_EVALUATION_SHADER";
spShaderType[GL_FRAGMENT_SHADER] = "GL_FRAGMENT_SHADER";
spHint[GL_FASTEST] = "GL_FASTEST";
spHint[GL_NICEST] = "GL_NICEST";
spHint[GL_DONT_CARE] = "GL_DONT_CARE";
spBufferBinding[GL_ARRAY_BUFFER_BINDING] = "GL_ARRAY_BUFFER";
spBufferBinding[GL_ELEMENT_ARRAY_BUFFER_BINDING] = "GL_ELEMENT_ARRAY_BUFFER";
spBufferBinding[GL_PIXEL_PACK_BUFFER_BINDING] = "GL_PIXEL_PACK_BUFFER";
spBufferBinding[GL_PIXEL_UNPACK_BUFFER_BINDING] = "GL_PIXEL_UNPACK_BUFFER";
spBufferBinding[GL_TRANSFORM_FEEDBACK_BUFFER_BINDING] = "GL_TRANSFORM_FEEDBACK_BUFFER";
spBufferBinding[GL_UNIFORM_BUFFER_BINDING] = "GL_UNIFORM_BUFFER";
#ifdef VSGL_VERSION_4_2
spBufferBinding[GL_TEXTURE_BUFFER_BINDING] = "GL_TEXTURE_BUFFER";
spBufferBinding[GL_COPY_READ_BUFFER_BINDING] = "GL_COPY_READ_BUFFER";
spBufferBinding[GL_COPY_WRITE_BUFFER_BINDING] = "GL_COPY_WRITE_BUFFER";
spBufferBinding[GL_DRAW_INDIRECT_BUFFER_BINDING] = "GL_DRAW_INDIRECT_BUFFER";
spBufferBinding[GL_ATOMIC_COUNTER_BUFFER_BINDING] = "GL_ATOMIC_COUNTER_BUFFER";
#endif
spBufferBound[GL_ARRAY_BUFFER_BINDING] = GL_ARRAY_BUFFER;
spBufferBound[GL_ELEMENT_ARRAY_BUFFER_BINDING] = GL_ELEMENT_ARRAY_BUFFER;
spBufferBound[GL_PIXEL_PACK_BUFFER_BINDING] = GL_PIXEL_PACK_BUFFER;
spBufferBound[GL_PIXEL_UNPACK_BUFFER_BINDING] = GL_PIXEL_UNPACK_BUFFER;
spBufferBound[GL_TRANSFORM_FEEDBACK_BUFFER_BINDING] = GL_TRANSFORM_FEEDBACK_BUFFER;
spBufferBound[GL_UNIFORM_BUFFER_BINDING] = GL_UNIFORM_BUFFER;
#ifdef VSGL_VERSION_4_2
spBufferBound[GL_TEXTURE_BUFFER_BINDING] = GL_TEXTURE_BUFFER;
spBufferBound[GL_COPY_READ_BUFFER_BINDING] = GL_COPY_READ_BUFFER;
spBufferBound[GL_COPY_WRITE_BUFFER_BINDING] = GL_COPY_WRITE_BUFFER;
spBufferBound[GL_DRAW_INDIRECT_BUFFER_BINDING] = GL_DRAW_INDIRECT_BUFFER;
spBufferBound[GL_ATOMIC_COUNTER_BUFFER_BINDING] = GL_ATOMIC_COUNTER_BUFFER;
#endif
spBoundBuffer[GL_ARRAY_BUFFER] = GL_ARRAY_BUFFER_BINDING;
spBoundBuffer[GL_ELEMENT_ARRAY_BUFFER] = GL_ELEMENT_ARRAY_BUFFER_BINDING;
spBoundBuffer[GL_PIXEL_PACK_BUFFER] = GL_PIXEL_PACK_BUFFER_BINDING;
spBoundBuffer[GL_PIXEL_UNPACK_BUFFER] = GL_PIXEL_UNPACK_BUFFER_BINDING;
spBoundBuffer[GL_TRANSFORM_FEEDBACK_BUFFER] = GL_TRANSFORM_FEEDBACK_BUFFER_BINDING;
spBoundBuffer[GL_UNIFORM_BUFFER] = GL_UNIFORM_BUFFER_BINDING;
#ifdef VSGL_VERSION_4_2
spBoundBuffer[GL_TEXTURE_BUFFER] = GL_TEXTURE_BUFFER_BINDING;
spBoundBuffer[GL_COPY_READ_BUFFER] = GL_COPY_READ_BUFFER_BINDING;
spBoundBuffer[GL_COPY_WRITE_BUFFER] = GL_COPY_WRITE_BUFFER_BINDING;
spBoundBuffer[GL_DRAW_INDIRECT_BUFFER] = GL_DRAW_INDIRECT_BUFFER;
spBoundBuffer[GL_ATOMIC_COUNTER_BUFFER] = GL_ATOMIC_COUNTER_BUFFER;
#endif
spBufferUsage[GL_STREAM_DRAW] = "GL_STREAM_DRAW";
spBufferUsage[GL_STREAM_READ] = "GL_STREAM_READ";
spBufferUsage[GL_STREAM_COPY] = "GL_STREAM_COPY";
spBufferUsage[GL_STATIC_DRAW] = "GL_STATIC_DRAW";
spBufferUsage[GL_STATIC_READ] = "GL_STATIC_READ";
spBufferUsage[GL_STATIC_COPY] = "GL_STATIC_COPY";
spBufferUsage[GL_DYNAMIC_DRAW] = "GL_DYNAMIC_DRAW";
spBufferUsage[GL_DYNAMIC_READ] = "GL_DYNAMIC_READ";
spBufferUsage[GL_DYNAMIC_COPY] = "GL_DYNAMIC_COPY";
spBufferAccess[GL_READ_ONLY] = "GL_READ_ONLY";
spBufferAccess[GL_WRITE_ONLY] = "GL_WRITE_ONLY";
spBufferAccess[GL_READ_WRITE] = "GL_READ_WRITE";
spTextureTarget[GL_TEXTURE_1D] = "GL_TEXTURE_1D";
spTextureTarget[GL_TEXTURE_1D_ARRAY] = "GL_TEXTURE_1D_ARRAY";
spTextureTarget[GL_TEXTURE_2D] = "GL_TEXTURE_2D";
spTextureTarget[GL_TEXTURE_2D_ARRAY] = "GL_TEXTURE_2D_ARRAY";
spTextureTarget[GL_TEXTURE_2D_MULTISAMPLE] = "GL_TEXTURE_2D_MULTISAMPLE";
spTextureTarget[GL_TEXTURE_2D_MULTISAMPLE_ARRAY] = "GL_TEXTURE_2D_MULTISAMPLE_ARRAY";
spTextureTarget[GL_TEXTURE_3D] = "GL_TEXTURE_3D";
spTextureTarget[GL_TEXTURE_BUFFER] = "GL_TEXTURE_BUFFER";
spTextureTarget[GL_TEXTURE_CUBE_MAP] = "GL_TEXTURE_CUBE_MAP";
spTextureTarget[GL_TEXTURE_RECTANGLE] = "GL_TEXTURE_RECTANGLE";
spTextureBound[GL_TEXTURE_1D] = GL_TEXTURE_BINDING_1D;
spTextureBound[GL_TEXTURE_1D_ARRAY] = GL_TEXTURE_BINDING_1D_ARRAY;
spTextureBound[GL_TEXTURE_2D] = GL_TEXTURE_BINDING_2D;
spTextureBound[GL_TEXTURE_2D_ARRAY] = GL_TEXTURE_BINDING_2D_ARRAY;
spTextureBound[GL_TEXTURE_2D_MULTISAMPLE] = GL_TEXTURE_BINDING_2D_MULTISAMPLE;
spTextureBound[GL_TEXTURE_2D_MULTISAMPLE_ARRAY] = GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY;
spTextureBound[GL_TEXTURE_3D] = GL_TEXTURE_BINDING_3D;
spTextureBound[GL_TEXTURE_BUFFER] = GL_TEXTURE_BINDING_BUFFER;
spTextureBound[GL_TEXTURE_CUBE_MAP] = GL_TEXTURE_BINDING_CUBE_MAP;
spTextureBound[GL_TEXTURE_RECTANGLE] = GL_TEXTURE_BINDING_RECTANGLE;
spTextureUnit[GL_TEXTURE0] = "GL_TEXTURE0";
spTextureUnit[GL_TEXTURE1] = "GL_TEXTURE1";
spTextureUnit[GL_TEXTURE2] = "GL_TEXTURE2";
spTextureUnit[GL_TEXTURE3] = "GL_TEXTURE3";
spTextureUnit[GL_TEXTURE4] = "GL_TEXTURE4";
spTextureUnit[GL_TEXTURE5] = "GL_TEXTURE5";
spTextureUnit[GL_TEXTURE6] = "GL_TEXTURE6";
spTextureUnit[GL_TEXTURE7] = "GL_TEXTURE7";
spTextureCompMode[GL_NONE] = "GL_NONE";
spTextureCompFunc[GL_COMPARE_REF_TO_TEXTURE] = "GL_COMPARE_REF_TO_TEXTURE";
spTextureCompFunc[GL_LEQUAL] = "GL_LEQUAL";
spTextureCompFunc[GL_GEQUAL] = "GL_GEQUAL";
spTextureCompFunc[GL_LESS] = "GL_LESS";
spTextureCompFunc[GL_GREATER] = "GL_GREATER";
spTextureCompFunc[GL_EQUAL] = "GL_EQUAL";
spTextureCompFunc[GL_NOTEQUAL] = "GL_NOTEQUAL";
spTextureCompFunc[GL_ALWAYS] = "GL_ALWAYS";
spTextureCompFunc[GL_NEVER] = "GL_NEVER";
spTextureWrap[GL_CLAMP_TO_EDGE] = "GL_CLAMP_TO_EDGE";
spTextureWrap[GL_CLAMP_TO_BORDER] = "GL_CLAMP_TO_BORDER";
spTextureWrap[GL_MIRRORED_REPEAT] = "GL_MIRRORED_REPEAT";
spTextureWrap[GL_REPEAT] = "GL_REPEAT";
spTextureFilter[GL_NEAREST] = "GL_NEAREST";
spTextureFilter[GL_LINEAR] = "GL_LINEAR";
spTextureFilter[GL_NEAREST_MIPMAP_NEAREST] = "GL_NEAREST_MIPMAP_NEAREST";
spTextureFilter[GL_LINEAR_MIPMAP_NEAREST] = "GL_LINEAR_MIPMAP_NEAREST";
spTextureFilter[GL_NEAREST_MIPMAP_LINEAR] = "GL_NEAREST_MIPMAP_LINEAR";
spTextureFilter[GL_LINEAR_MIPMAP_LINEAR] = "GL_LINEAR_MIPMAP_LINEAR";
spGLSLTypeSize[GL_FLOAT] = sizeof(float);
spGLSLTypeSize[GL_FLOAT_VEC2] = sizeof(float)*2;
spGLSLTypeSize[GL_FLOAT_VEC3] = sizeof(float)*3;
spGLSLTypeSize[GL_FLOAT_VEC4] = sizeof(float)*4;
spGLSLTypeSize[GL_DOUBLE] = sizeof(double);
spGLSLTypeSize[GL_DOUBLE_VEC2] = sizeof(double)*2;
spGLSLTypeSize[GL_DOUBLE_VEC3] = sizeof(double)*3;
spGLSLTypeSize[GL_DOUBLE_VEC4] = sizeof(double)*4;
spGLSLTypeSize[GL_SAMPLER_1D] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_3D] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_CUBE] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_1D_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_1D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_1D_ARRAY_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_ARRAY_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_MULTISAMPLE] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_MULTISAMPLE_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_CUBE_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_BUFFER] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_RECT] = sizeof(int);
spGLSLTypeSize[GL_SAMPLER_2D_RECT_SHADOW] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_1D] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_2D] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_3D] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_CUBE] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_1D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_2D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_2D_MULTISAMPLE] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_BUFFER] = sizeof(int);
spGLSLTypeSize[GL_INT_SAMPLER_2D_RECT] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_1D] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_2D] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_3D] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_CUBE] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_1D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_2D_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_BUFFER] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_SAMPLER_2D_RECT] = sizeof(int);
spGLSLTypeSize[GL_BOOL] = sizeof(int);
spGLSLTypeSize[GL_INT] = sizeof(int);
spGLSLTypeSize[GL_BOOL_VEC2] = sizeof(int)*2;
spGLSLTypeSize[GL_INT_VEC2] = sizeof(int)*2;
spGLSLTypeSize[GL_BOOL_VEC3] = sizeof(int)*3;
spGLSLTypeSize[GL_INT_VEC3] = sizeof(int)*3;
spGLSLTypeSize[GL_BOOL_VEC4] = sizeof(int)*4;
spGLSLTypeSize[GL_INT_VEC4] = sizeof(int)*4;
spGLSLTypeSize[GL_UNSIGNED_INT] = sizeof(int);
spGLSLTypeSize[GL_UNSIGNED_INT_VEC2] = sizeof(int)*2;
spGLSLTypeSize[GL_UNSIGNED_INT_VEC3] = sizeof(int)*2;
spGLSLTypeSize[GL_UNSIGNED_INT_VEC4] = sizeof(int)*2;
spGLSLTypeSize[GL_FLOAT_MAT2] = sizeof(float)*4;
spGLSLTypeSize[GL_FLOAT_MAT3] = sizeof(float)*9;
spGLSLTypeSize[GL_FLOAT_MAT4] = sizeof(float)*16;
spGLSLTypeSize[GL_FLOAT_MAT2x3] = sizeof(float)*6;
spGLSLTypeSize[GL_FLOAT_MAT2x4] = sizeof(float)*8;
spGLSLTypeSize[GL_FLOAT_MAT3x2] = sizeof(float)*6;
spGLSLTypeSize[GL_FLOAT_MAT3x4] = sizeof(float)*12;
spGLSLTypeSize[GL_FLOAT_MAT4x2] = sizeof(float)*8;
spGLSLTypeSize[GL_FLOAT_MAT4x3] = sizeof(float)*12;
spGLSLTypeSize[GL_DOUBLE_MAT2] = sizeof(double)*4;
spGLSLTypeSize[GL_DOUBLE_MAT3] = sizeof(double)*9;
spGLSLTypeSize[GL_DOUBLE_MAT4] = sizeof(double)*16;
spGLSLTypeSize[GL_DOUBLE_MAT2x3] = sizeof(double)*6;
spGLSLTypeSize[GL_DOUBLE_MAT2x4] = sizeof(double)*8;
spGLSLTypeSize[GL_DOUBLE_MAT3x2] = sizeof(double)*6;
spGLSLTypeSize[GL_DOUBLE_MAT3x4] = sizeof(double)*12;
spGLSLTypeSize[GL_DOUBLE_MAT4x2] = sizeof(double)*8;
spGLSLTypeSize[GL_DOUBLE_MAT4x3] = sizeof(double)*12;
spGLSLType[GL_FLOAT] = "GL_FLOAT";
spGLSLType[GL_FLOAT_VEC2] = "GL_FLOAT_VEC2";
spGLSLType[GL_FLOAT_VEC3] = "GL_FLOAT_VEC3";
spGLSLType[GL_FLOAT_VEC4] = "GL_FLOAT_VEC4";
spGLSLType[GL_DOUBLE] = "GL_DOUBLE";
spGLSLType[GL_DOUBLE_VEC2] = "GL_DOUBLE_VEC2";
spGLSLType[GL_DOUBLE_VEC3] = "GL_DOUBLE_VEC3";
spGLSLType[GL_DOUBLE_VEC4] = "GL_DOUBLE_VEC4";
spGLSLType[GL_SAMPLER_1D] = "GL_SAMPLER_1D";
spGLSLType[GL_SAMPLER_2D] = "GL_SAMPLER_2D";
spGLSLType[GL_SAMPLER_3D] = "GL_SAMPLER_3D";
spGLSLType[GL_SAMPLER_CUBE] = "GL_SAMPLER_CUBE";
spGLSLType[GL_SAMPLER_1D_SHADOW] = "GL_SAMPLER_1D_SHADOW";
spGLSLType[GL_SAMPLER_2D_SHADOW] = "GL_SAMPLER_2D_SHADOW";
spGLSLType[GL_SAMPLER_1D_ARRAY] = "GL_SAMPLER_1D_ARRAY";
spGLSLType[GL_SAMPLER_2D_ARRAY] = "GL_SAMPLER_2D_ARRAY";
spGLSLType[GL_SAMPLER_1D_ARRAY_SHADOW] = "GL_SAMPLER_1D_ARRAY_SHADOW";
spGLSLType[GL_SAMPLER_2D_ARRAY_SHADOW] = "GL_SAMPLER_2D_ARRAY_SHADOW";
spGLSLType[GL_SAMPLER_2D_MULTISAMPLE] = "GL_SAMPLER_2D_MULTISAMPLE";
spGLSLType[GL_SAMPLER_2D_MULTISAMPLE_ARRAY] = "GL_SAMPLER_2D_MULTISAMPLE_ARRAY";
spGLSLType[GL_SAMPLER_CUBE_SHADOW] = "GL_SAMPLER_CUBE_SHADOW";
spGLSLType[GL_SAMPLER_BUFFER] = "GL_SAMPLER_BUFFER";
spGLSLType[GL_SAMPLER_2D_RECT] = "GL_SAMPLER_2D_RECT";
spGLSLType[GL_SAMPLER_2D_RECT_SHADOW] = "GL_SAMPLER_2D_RECT_SHADOW";
spGLSLType[GL_INT_SAMPLER_1D] = "GL_INT_SAMPLER_1D";
spGLSLType[GL_INT_SAMPLER_2D] = "GL_INT_SAMPLER_2D";
spGLSLType[GL_INT_SAMPLER_3D] = "GL_INT_SAMPLER_3D";
spGLSLType[GL_INT_SAMPLER_CUBE] = "GL_INT_SAMPLER_CUBE";
spGLSLType[GL_INT_SAMPLER_1D_ARRAY] = "GL_INT_SAMPLER_1D_ARRAY";
spGLSLType[GL_INT_SAMPLER_2D_ARRAY] = "GL_INT_SAMPLER_2D_ARRAY";
spGLSLType[GL_INT_SAMPLER_2D_MULTISAMPLE] = "GL_INT_SAMPLER_2D_MULTISAMPLE";
spGLSLType[GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY] = "GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY";
spGLSLType[GL_INT_SAMPLER_BUFFER] = "GL_INT_SAMPLER_BUFFER";
spGLSLType[GL_INT_SAMPLER_2D_RECT] = "GL_INT_SAMPLER_2D_RECT";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_1D] = "GL_UNSIGNED_INT_SAMPLER_1D";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_2D] = "GL_UNSIGNED_INT_SAMPLER_2D";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_3D] = "GL_UNSIGNED_INT_SAMPLER_3D";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_CUBE] = "GL_UNSIGNED_INT_SAMPLER_CUBE";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_1D_ARRAY] = "GL_UNSIGNED_INT_SAMPLER_1D_ARRAY";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_2D_ARRAY] = "GL_UNSIGNED_INT_SAMPLER_2D_ARRAY";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE] = "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY] = "GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_BUFFER] = "GL_UNSIGNED_INT_SAMPLER_BUFFER";
spGLSLType[GL_UNSIGNED_INT_SAMPLER_2D_RECT] = "GL_UNSIGNED_INT_SAMPLER_2D_RECT";
spGLSLType[GL_BOOL] = "GL_BOOL";
spGLSLType[GL_INT] = "GL_INT";
spGLSLType[GL_BOOL_VEC2] = "GL_BOOL_VEC2";
spGLSLType[GL_INT_VEC2] = "GL_INT_VEC2";
spGLSLType[GL_BOOL_VEC3] = "GL_BOOL_VEC3";
spGLSLType[GL_INT_VEC3] = "GL_INT_VEC3";
spGLSLType[GL_BOOL_VEC4] = "GL_BOOL_VEC4";
spGLSLType[GL_INT_VEC4] = "GL_INT_VEC4";
spGLSLType[GL_UNSIGNED_INT] = "GL_UNSIGNED_INT";
spGLSLType[GL_UNSIGNED_INT_VEC2] = "GL_UNSIGNED_INT_VEC2";
spGLSLType[GL_UNSIGNED_INT_VEC3] = "GL_UNSIGNED_INT_VEC3";
spGLSLType[GL_UNSIGNED_INT_VEC4] = "GL_UNSIGNED_INT_VEC4";
spGLSLType[GL_FLOAT_MAT2] = "GL_FLOAT_MAT2";
spGLSLType[GL_FLOAT_MAT3] = "GL_FLOAT_MAT3";
spGLSLType[GL_FLOAT_MAT4] = "GL_FLOAT_MAT4";
spGLSLType[GL_FLOAT_MAT2x3] = "GL_FLOAT_MAT2x3";
spGLSLType[GL_FLOAT_MAT2x4] = "GL_FLOAT_MAT2x4";
spGLSLType[GL_FLOAT_MAT3x2] = "GL_FLOAT_MAT3x2";
spGLSLType[GL_FLOAT_MAT3x4] = "GL_FLOAT_MAT3x4";
spGLSLType[GL_FLOAT_MAT4x2] = "GL_FLOAT_MAT4x2";
spGLSLType[GL_FLOAT_MAT4x3] = "GL_FLOAT_MAT4x3";
spGLSLType[GL_DOUBLE_MAT2] = "GL_DOUBLE_MAT2";
spGLSLType[GL_DOUBLE_MAT3] = "GL_DOUBLE_MAT3";
spGLSLType[GL_DOUBLE_MAT4] = "GL_DOUBLE_MAT4";
spGLSLType[GL_DOUBLE_MAT2x3] = "GL_DOUBLE_MAT2x3";
spGLSLType[GL_DOUBLE_MAT2x4] = "GL_DOUBLE_MAT2x4";
spGLSLType[GL_DOUBLE_MAT3x2] = "GL_DOUBLE_MAT3x2";
spGLSLType[GL_DOUBLE_MAT3x4] = "GL_DOUBLE_MAT3x4";
spGLSLType[GL_DOUBLE_MAT4x2] = "GL_DOUBLE_MAT4x2";
spGLSLType[GL_DOUBLE_MAT4x3] = "GL_DOUBLE_MAT4x3";
spTextureDataType[GL_NONE] = "GL_NONE";
spTextureDataType[GL_SIGNED_NORMALIZED] = "GL_SIGNED_NORMALIZED";
spTextureDataType[GL_UNSIGNED_NORMALIZED] = "GL_UNSIGNED_NORMALIZED";
spTextureDataType[GL_FLOAT] = "GL_FLOAT";
spTextureDataType[GL_INT] = "GL_INT";
spTextureDataType[GL_UNSIGNED_INT] = "GL_UNSIGNED_INT";
spDataF[GL_UNSIGNED_BYTE] = "GL_UNSIGNED_BYTE";
spDataF[GL_BYTE] = "GL_BYTE";
spDataF[GL_UNSIGNED_SHORT] = "GL_UNSIGNED_SHORT";
spDataF[GL_SHORT] = "GL_SHORT";
spDataF[GL_UNSIGNED_INT] = "GL_UNSIGNED_INT";
spDataF[GL_INT] = "GL_INT";
spDataF[GL_HALF_FLOAT] = "GL_HALF_FLOAT";
spDataF[GL_FLOAT] = "GL_FLOAT";
spDataF[GL_UNSIGNED_BYTE_3_3_2] = "GL_UNSIGNED_BYTE_3_3_2";
spDataF[GL_UNSIGNED_BYTE_2_3_3_REV] = "GL_UNSIGNED_BYTE_2_3_3_REV";
spDataF[GL_UNSIGNED_SHORT_5_6_5] = "GL_UNSIGNED_SHORT_5_6_5";
spDataF[GL_UNSIGNED_SHORT_5_6_5_REV] = "GL_UNSIGNED_SHORT_5_6_5_REV";
spDataF[GL_UNSIGNED_SHORT_4_4_4_4] = "GL_UNSIGNED_SHORT_4_4_4_4";
spDataF[GL_UNSIGNED_SHORT_4_4_4_4_REV] = "GL_UNSIGNED_SHORT_4_4_4_4_REV";
spDataF[GL_UNSIGNED_SHORT_5_5_5_1] = "GL_UNSIGNED_SHORT_5_5_5_1";
spDataF[GL_UNSIGNED_SHORT_1_5_5_5_REV] = "GL_UNSIGNED_SHORT_1_5_5_5_REV";
spDataF[GL_UNSIGNED_INT_8_8_8_8] = "GL_UNSIGNED_INT_8_8_8_8";
spDataF[GL_UNSIGNED_INT_8_8_8_8_REV] = "GL_UNSIGNED_INT_8_8_8_8_REV";
spDataF[GL_UNSIGNED_INT_10_10_10_2] = "GL_UNSIGNED_INT_10_10_10_2";
spDataF[GL_UNSIGNED_INT_2_10_10_10_REV] = "GL_UNSIGNED_INT_2_10_10_10_REV";
spInternalF[GL_STENCIL_INDEX] = "GL_STENCIL_INDEX";
spInternalF[GL_DEPTH_COMPONENT] = "GL_DEPTH_COMPONENT";
spInternalF[GL_DEPTH_STENCIL] = "GL_DEPTH_STENCIL";
spInternalF[GL_DEPTH_COMPONENT16] = "GL_DEPTH_COMPONENT16";
spInternalF[GL_DEPTH_COMPONENT24] = "GL_DEPTH_COMPONENT24";
spInternalF[GL_DEPTH_COMPONENT32] = "GL_DEPTH_COMPONENT32";
spInternalF[GL_DEPTH_COMPONENT32F] = "GL_DEPTH_COMPONENT32F";
spInternalF[GL_DEPTH24_STENCIL8] = "GL_DEPTH24_STENCIL8";
spInternalF[GL_DEPTH32F_STENCIL8] = "GL_DEPTH32F_STENCIL8";
spInternalF[GL_RED_INTEGER] = "GL_RED_INTEGER";
spInternalF[GL_GREEN_INTEGER] = "GL_GREEN_INTEGER";
spInternalF[GL_BLUE_INTEGER] = "GL_BLUE_INTEGER";
spInternalF[GL_RG_INTEGER] = "GL_RG_INTEGER";
spInternalF[GL_RGB_INTEGER] = "GL_RGB_INTEGER";
spInternalF[GL_RGBA_INTEGER] = "GL_RGBA_INTEGER";
spInternalF[GL_BGR_INTEGER] = "GL_BGR_INTEGER";
spInternalF[GL_BGRA_INTEGER] = "GL_BGRA_INTEGER";
spInternalF[GL_RED] = "GL_RED";
spInternalF[GL_RG] = "GL_RG";
spInternalF[GL_RGB] = "GL_RGB";
spInternalF[GL_RGBA] = "GL_RGBA";
spInternalF[GL_R3_G3_B2] = "GL_R3_G3_B2";
spInternalF[GL_RGB2_EXT] = "GL_RGB2_EXT";
spInternalF[GL_COMPRESSED_RED] = "GL_COMPRESSED_RED";
spInternalF[GL_COMPRESSED_RG] = "GL_COMPRESSED_RG";
spInternalF[GL_COMPRESSED_RGB] = "GL_COMPRESSED_RGB";
spInternalF[GL_COMPRESSED_RGBA] = "GL_COMPRESSED_RGBA";
spInternalF[GL_COMPRESSED_SRGB] = "GL_COMPRESSED_SRGB";
spInternalF[GL_COMPRESSED_SRGB_ALPHA] = "GL_COMPRESSED_SRGB_ALPHA";
spInternalF[GL_COMPRESSED_RED_RGTC1] = "GL_COMPRESSED_RED_RGTC1";
spInternalF[GL_COMPRESSED_SIGNED_RED_RGTC1] = "GL_COMPRESSED_SIGNED_RED_RGTC1";
spInternalF[GL_COMPRESSED_RG_RGTC2] = "GL_COMPRESSED_RG_RGTC2"; spInternalF[GL_RG] = "GL_RG";
spInternalF[GL_COMPRESSED_SIGNED_RG_RGTC2] = "GL_COMPRESSED_SIGNED_RG_RGTC2";
#ifdef VSGL_VERSION_4_2
spInternalF[GL_COMPRESSED_RGBA_BPTC_UNORM] = "GL_COMPRESSED_RGBA_BPTC_UNORM";
spInternalF[GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM] = "GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM";
spInternalF[GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT] = "GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT";
spInternalF[GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT] = "GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT";
#endif
spInternalF[GL_R8] = "GL_R8";
spInternalF[GL_R16] = "GL_R16";
spInternalF[GL_RG8] = "GL_RG8";
spInternalF[GL_RG16] = "GL_RG16";
spInternalF[GL_R16F] = "GL_R16F";
spInternalF[GL_R32F] = "GL_R32F";
spInternalF[GL_RG16F] = "GL_RG16F";
spInternalF[GL_RG32F] = "GL_RG32F";
spInternalF[GL_R8I] = "GL_R8I";
spInternalF[GL_R8UI] = "GL_R8UI";
spInternalF[GL_R16I] = "GL_R16I";
spInternalF[GL_R16UI] = "GL_R16UI";
spInternalF[GL_R32I] = "GL_R32I";
spInternalF[GL_R32UI] = "GL_R32UI";
spInternalF[GL_RG8I] = "GL_RG8I";
spInternalF[GL_RG8UI] = "GL_RG8UI";
spInternalF[GL_RG16I] = "GL_RG16I";
spInternalF[GL_RG16UI] = "GL_RG16UI";
spInternalF[GL_RG32I] = "GL_RG32I";
spInternalF[GL_RG32UI] = "GL_RG32UI";
spInternalF[GL_RGB_S3TC] = "GL_RGB_S3TC";
spInternalF[GL_RGB4_S3TC] = "GL_RGB4_S3TC";
spInternalF[GL_RGBA_S3TC] = "GL_RGBA_S3TC";
spInternalF[GL_RGBA4_S3TC] = "GL_RGBA4_S3TC";
spInternalF[GL_RGBA_DXT5_S3TC] = "GL_RGBA_DXT5_S3TC";
spInternalF[GL_RGBA4_DXT5_S3TC] = "GL_RGBA4_DXT5_S3TC";
spInternalF[GL_COMPRESSED_RGB_S3TC_DXT1_EXT] = "GL_COMPRESSED_RGB_S3TC_DXT1_EXT";
spInternalF[GL_COMPRESSED_RGBA_S3TC_DXT1_EXT] = "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT";
spInternalF[GL_COMPRESSED_RGBA_S3TC_DXT3_EXT] = "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT";
spInternalF[GL_COMPRESSED_RGBA_S3TC_DXT5_EXT] = "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT";
spInternalF[GL_R1UI_V3F_SUN] = "GL_R1UI_V3F_SUN";
spInternalF[GL_R1UI_C4UB_V3F_SUN] = "GL_R1UI_C4UB_V3F_SUN";
spInternalF[GL_R1UI_C3F_V3F_SUN] = "GL_R1UI_C3F_V3F_SUN";
spInternalF[GL_R1UI_N3F_V3F_SUN] = "GL_R1UI_N3F_V3F_SUN";
spInternalF[GL_R1UI_C4F_N3F_V3F_SUN] = "GL_R1UI_C4F_N3F_V3F_SUN";
spInternalF[GL_R1UI_T2F_V3F_SUN] = "GL_R1UI_T2F_V3F_SUN";
spInternalF[GL_R1UI_T2F_N3F_V3F_SUN] = "GL_R1UI_T2F_N3F_V3F_SUN";
spInternalF[GL_R1UI_T2F_C4F_N3F_V3F_SUN] = "GL_R1UI_T2F_C4F_N3F_V3F_SUN";
spInternalF[GL_RGB_SIGNED_SGIX] = "GL_RGB_SIGNED_SGIX";
spInternalF[GL_RGBA_SIGNED_SGIX] = "GL_RGBA_SIGNED_SGIX";
spInternalF[GL_RGB16_SIGNED_SGIX] = "GL_RGB16_SIGNED_SGIX";
spInternalF[GL_RGBA16_SIGNED_SGIX] = "GL_RGBA16_SIGNED_SGIX";
spInternalF[GL_RGB_EXTENDED_RANGE_SGIX] = "GL_RGB_EXTENDED_RANGE_SGIX";
spInternalF[GL_RGBA_EXTENDED_RANGE_SGIX] = "GL_RGBA_EXTENDED_RANGE_SGIX";
spInternalF[GL_RGB16_EXTENDED_RANGE_SGIX] = "GL_RGB16_EXTENDED_RANGE_SGIX";
spInternalF[GL_RGBA16_EXTENDED_RANGE_SGIX] = "GL_RGBA16_EXTENDED_RANGE_SGIX";
spInternalF[GL_COMPRESSED_RGB_FXT1_3DFX] = "GL_COMPRESSED_RGB_FXT1_3DFX";
spInternalF[GL_COMPRESSED_RGBA_FXT1_3DFX] = "GL_COMPRESSED_RGBA_FXT1_3DFX";
spInternalF[GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV] = "GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV";
spInternalF[GL_RGBA_FLOAT_MODE_ARB] = "GL_RGBA_FLOAT_MODE_ARB";
spInternalF[GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI] = "GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI";
spInternalF[GL_RGB_422_APPLE] = "GL_RGB_422_APPLE";
spInternalF[GL_RGBA_SIGNED_COMPONENTS_EXT] = "GL_RGBA_SIGNED_COMPONENTS_EXT";
spInternalF[GL_COMPRESSED_SRGB_S3TC_DXT1_EXT] = "GL_COMPRESSED_SRGB_S3TC_DXT1_EXT";
spInternalF[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
spInternalF[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
spInternalF[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = "GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
spInternalF[GL_COMPRESSED_LUMINANCE_LATC1_EXT] = "GL_COMPRESSED_LUMINANCE_LATC1_EXT";
spInternalF[GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT] = "GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT";
spInternalF[GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT] = "GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT";
spInternalF[GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT] = "GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT";
spInternalF[GL_RGBA_INTEGER_MODE_EXT] = "GL_RGBA_INTEGER_MODE_EXT";
spInternalF[GL_COMPRESSED_RGBA_BPTC_UNORM_ARB] = "GL_COMPRESSED_RGBA_BPTC_UNORM_ARB";
spInternalF[GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB] = "GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB";
spInternalF[GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB] = "GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB";
spInternalF[GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB] = "GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB";
spInternalF[GL_RG_SNORM] = "GL_RG_SNORM";
spInternalF[GL_RGB_SNORM] = "GL_RGB_SNORM";
spInternalF[GL_RGBA_SNORM] = "GL_RGBA_SNORM";
spInternalF[GL_R8_SNORM] = "GL_R8_SNORM";
spInternalF[GL_RG8_SNORM] = "GL_RG8_SNORM";
spInternalF[GL_RGB8_SNORM] = "GL_RGB8_SNORM";
spInternalF[GL_RGBA8_SNORM] = "GL_RGBA8_SNORM";
spInternalF[GL_R16_SNORM] = "GL_R16_SNORM";
spInternalF[GL_RG16_SNORM] = "GL_RG16_SNORM";
spInternalF[GL_RGB16_SNORM] = "GL_RGB16_SNORM";
spInternalF[GL_RGBA16_SNORM] = "GL_RGBA16_SNORM";
spInternalF[GL_RGB10_A2UI] = "GL_RGB10_A2UI";
return true;
}
// aux function to display float based uniforms
void
VSGLInfoLib::displayUniformf(float *f, int rows, int columns) {
for (int i = 0; i < rows; ++i) {
if (columns == 1)
addMessage("%f", f[i*columns]);
else if (columns == 2)
addMessage("%f %f", f[i*columns], f[i*columns+1]);
else if (columns == 3)
addMessage("%f %f %f", f[i*columns], f[i*columns+1], f[i*columns+2]);
else if (columns == 4)
addMessage("%f %f %f %f", f[i*columns], f[i*columns+1], f[i*columns+2], f[i*columns+3]);
}
}
// aux function to display int based uniforms
void
VSGLInfoLib::displayUniformi(int *f, int rows, int columns) {
for (int i = 0; i < rows; ++i) {
if (columns == 1)
addMessage("%d", f[i*columns]);
else if (columns == 2)
addMessage("%d %d", f[i*columns], f[i*columns+1]);
else if (columns == 3)
addMessage("%d %d %d", f[i*columns], f[i*columns+1], f[i*columns+2]);
else if (columns == 4)
addMessage("%d %d %d %d", f[i*columns], f[i*columns+1], f[i*columns+2], f[i*columns+3]);
}
}
// aux function to display unsigned int based uniforms
void
VSGLInfoLib::displayUniformui(unsigned int *f, int rows, int columns) {
for (int i = 0; i < rows; ++i) {
if (columns == 1)
addMessage("%u", f[i*columns]);
else if (columns == 2)
addMessage("%u %u", f[i*columns], f[i*columns+1]);
else if (columns == 3)
addMessage("%u %u %u", f[i*columns], f[i*columns+1], f[i*columns+2]);
else if (columns == 4)
addMessage("%u %u %u %u", f[i*columns], f[i*columns+1], f[i*columns+2], f[i*columns+3]);
}
}
// aux function to display double based uniforms
void
VSGLInfoLib::displayUniformd(double *f, int rows, int columns) {
for (int i = 0; i < rows; ++i) {
if (columns == 1)
addMessage("%f", f[i*columns]);
else if (columns == 2)
addMessage("%f %f", f[i*columns], f[i*columns+1]);
else if (columns == 3)
addMessage("%f %f %f", f[i*columns], f[i*columns+1], f[i*columns+2]);
else if (columns == 4)
addMessage("%f %f %f %f", f[i*columns], f[i*columns+1], f[i*columns+2], f[i*columns+3]);
}
}
// gets the atomic data type
VSGLInfoLib::Types
VSGLInfoLib::getType(GLenum type) {
switch (type) {
case GL_DOUBLE:
case GL_DOUBLE_MAT2:
case GL_DOUBLE_MAT2x3:
case GL_DOUBLE_MAT2x4:
case GL_DOUBLE_MAT3:
case GL_DOUBLE_MAT3x2:
case GL_DOUBLE_MAT3x4:
case GL_DOUBLE_MAT4:
case GL_DOUBLE_MAT4x2:
case GL_DOUBLE_MAT4x3:
case GL_DOUBLE_VEC2:
case GL_DOUBLE_VEC3:
case GL_DOUBLE_VEC4:
return VSGLInfoLib::DOUBLE;
case GL_FLOAT:
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
case GL_FLOAT_VEC2:
case GL_FLOAT_VEC3:
case GL_FLOAT_VEC4:
return VSGLInfoLib::FLOAT;
case GL_BOOL:
case GL_BOOL_VEC2:
case GL_BOOL_VEC3:
case GL_BOOL_VEC4:
case GL_INT:
case GL_INT_SAMPLER_1D:
case GL_INT_SAMPLER_1D_ARRAY:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D_RECT:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_BUFFER:
case GL_INT_SAMPLER_CUBE:
case GL_INT_VEC2:
case GL_INT_VEC3:
case GL_INT_VEC4:
case GL_SAMPLER_1D:
case GL_SAMPLER_1D_ARRAY:
case GL_SAMPLER_1D_ARRAY_SHADOW:
case GL_SAMPLER_1D_SHADOW:
case GL_SAMPLER_2D:
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_2D_ARRAY_SHADOW:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_RECT:
case GL_SAMPLER_2D_RECT_SHADOW:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_3D:
case GL_SAMPLER_BUFFER:
case GL_SAMPLER_CUBE:
case GL_SAMPLER_CUBE_SHADOW:
return VSGLInfoLib::INT;
case GL_UNSIGNED_INT:
case GL_UNSIGNED_INT_SAMPLER_1D:
case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_RECT:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_BUFFER:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_VEC2:
case GL_UNSIGNED_INT_VEC3:
case GL_UNSIGNED_INT_VEC4:
return VSGLInfoLib::UNSIGNED_INT;
default:
return VSGLInfoLib::DONT_KNOW;
}
}
// gets the number of rows for a GLSL type
int
VSGLInfoLib::getRows(GLenum type) {
switch(type) {
case GL_DOUBLE_MAT2:
case GL_DOUBLE_MAT2x3:
case GL_DOUBLE_MAT2x4:
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
return 2;
case GL_DOUBLE_MAT3:
case GL_DOUBLE_MAT3x2:
case GL_DOUBLE_MAT3x4:
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
return 3;
case GL_DOUBLE_MAT4:
case GL_DOUBLE_MAT4x2:
case GL_DOUBLE_MAT4x3:
case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
return 4;
default: return 1;
}
}
// gets the number of columns for a GLSL type
int
VSGLInfoLib::getColumns(GLenum type) {
switch(type) {
case GL_DOUBLE_MAT2:
case GL_FLOAT_MAT2:
case GL_DOUBLE_MAT3x2:
case GL_FLOAT_MAT3x2:
case GL_DOUBLE_MAT4x2:
case GL_FLOAT_MAT4x2:
case GL_UNSIGNED_INT_VEC2:
case GL_INT_VEC2:
case GL_BOOL_VEC2:
case GL_FLOAT_VEC2:
case GL_DOUBLE_VEC2:
return 2;
case GL_DOUBLE_MAT2x3:
case GL_FLOAT_MAT2x3:
case GL_DOUBLE_MAT3:
case GL_FLOAT_MAT3:
case GL_DOUBLE_MAT4x3:
case GL_FLOAT_MAT4x3:
case GL_UNSIGNED_INT_VEC3:
case GL_INT_VEC3:
case GL_BOOL_VEC3:
case GL_FLOAT_VEC3:
case GL_DOUBLE_VEC3:
return 3;
case GL_DOUBLE_MAT2x4:
case GL_FLOAT_MAT2x4:
case GL_DOUBLE_MAT3x4:
case GL_FLOAT_MAT3x4:
case GL_DOUBLE_MAT4:
case GL_FLOAT_MAT4:
case GL_UNSIGNED_INT_VEC4:
case GL_INT_VEC4:
case GL_BOOL_VEC4:
case GL_FLOAT_VEC4:
case GL_DOUBLE_VEC4:
return 4;
default: return 1;
}
}
// aux function to get the size in bytes of a uniform
// it takes the strides into account
int
VSGLInfoLib::getUniformByteSize(int uniSize,
int uniType,
int uniArrayStride,
int uniMatStride) {
int auxSize;
if (uniArrayStride > 0)
auxSize = uniArrayStride * uniSize;
else if (uniMatStride > 0) {
switch(uniType) {
case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
case GL_DOUBLE_MAT2:
case GL_DOUBLE_MAT2x3:
case GL_DOUBLE_MAT2x4:
auxSize = 2 * uniMatStride;
break;
case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
case GL_DOUBLE_MAT3:
case GL_DOUBLE_MAT3x2:
case GL_DOUBLE_MAT3x4:
auxSize = 3 * uniMatStride;
break;
case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
case GL_DOUBLE_MAT4:
case GL_DOUBLE_MAT4x2:
case GL_DOUBLE_MAT4x3:
auxSize = 4 * uniMatStride;
break;
}
}
else
auxSize = spGLSLTypeSize[uniType];
return auxSize;
}
| [
"[email protected]"
] | |
13a1ee558431b6c85782bf55f8f0780b7bc90f7a | e8a562e13ca47764ba96cb47b9e0c477447a6296 | /graph/cycle_detection/verifier.cpp | 3a00c766881ef44ac8e376f9e854aca56da34c9a | [
"Apache-2.0"
] | permissive | yosupo06/library-checker-problems | 0600700ee39a7b32fdec635076d75ee270c0e636 | 9d8930c908153adc3bd3f50999d782c89f666725 | refs/heads/master | 2023-08-22T19:59:02.303444 | 2023-08-10T07:58:08 | 2023-08-10T07:58:08 | 189,480,738 | 440 | 129 | Apache-2.0 | 2023-09-12T08:39:13 | 2019-05-30T20:49:42 | C++ | UTF-8 | C++ | false | false | 406 | cpp | #include "testlib.h"
#include "params.h"
#include <set>
#include <utility>
int main() {
registerValidation();
int N = inf.readInt(N_MIN, N_MAX);
inf.readSpace();
int M = inf.readInt(M_MIN, M_MAX);
inf.readChar('\n');
for(int i=0; i<M; i++) {
int u = inf.readInt(0, N-1);
inf.readSpace();
int v = inf.readInt(0, N-1);
inf.readChar('\n');
ensure(u != v);
}
inf.readEof();
return 0;
}
| [
"[email protected]"
] | |
9497a13fb7512bf474cbe909cd17dc3f06bb96b0 | 02f9a317672c08aaa8a8c32a3486a4f368febdd4 | /MoneyClass.cpp | 225656868a48f1f2941e095032a0e81b51695b1c | [] | no_license | Akantonio/Homework3 | cbf8a4c0e59d5ac608efff765e490e58b9c1a124 | 425f89a8add88e66f8f37a7661b46df198826482 | refs/heads/master | 2023-03-10T05:27:38.045335 | 2021-02-27T04:59:54 | 2021-02-27T04:59:54 | 341,785,104 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,081 | cpp | //
// Created by Adrian Antonio on 2/23/2021.
//
#include "MoneyClass.h"
Money::Money(): _value(0) {
}
Money::Money(double amount){
_value= amount*100+0.5;
}
Money::Money(int dollar, int cents){
if(cents<0){
_value= -1*(dollar*100-cents);
}else {
_value = dollar * 100 + cents;
}
}
std::ostream &operator<<(std::ostream & os, const Money &right) {
if(right._value==0){
return os<<"$0.00";
}
int dollars = right._value/100.0;
int cents= right._value%100;
if(right._value<0){
dollars*= -1;
cents*=-1;
os<<"-$";
}else{
os<<"$";
}
if(cents>0) {
os << dollars << "." << cents;
}
return os;
}
Money operator+(Money left, const Money &right) {
left+=right;
return left;
}
Money operator-(const Money &right){
return {-right._value};
}
Money operator-(const Money& left, const Money& right){
return left + -right;
}
Money operator*(Money left, const Money& right){
left*=right;
return left;
}
Money operator/(Money left, const Money& right){
return left/=right;
}
bool operator==(const Money & left, const Money& right){
return left._value == right._value;
}
bool operator<(const Money & left, const Money& right){
return left._value < right._value;
}
Money & Money::operator+=(const Money &right) {
_value = _value + right._value;
return *this;
}
Money & Money::operator-=(const Money& right){
*this = *this - right;
return *this;
}
Money & Money::operator/=(const Money& right){
return *this *= {1/right._value};
}
int Money::getValue()const {
return _value;
}
Money &Money::operator*=(const Money &right) {
_value *= right._value;
return *this;
}
bool operator!=(const Money & left, const Money& right){
return !(right==left);
}
bool operator>(const Money & left, const Money& right){
return right < left;
}
bool operator<=(const Money & left, const Money& right){
return !(right>left);
}
bool operator>=(const Money & left, const Money& right){
return !(right<left);
}
| [
"[email protected]"
] | |
da2259d83f09981097624bebdc24eee906446e91 | cf8ddfc720bf6451c4ef4fa01684327431db1919 | /SDK/ARKSurvivalEvolved_TurretWarningLong_classes.hpp | 0b22a1de16d6292adcb89d9cf8db48d60fc63c47 | [
"MIT"
] | permissive | git-Charlie/ARK-SDK | 75337684b11e7b9f668da1f15e8054052a3b600f | c38ca9925309516b2093ad8c3a70ed9489e1d573 | refs/heads/master | 2023-06-20T06:30:33.550123 | 2021-07-11T13:41:45 | 2021-07-11T13:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 803 | hpp | #pragma once
// ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_TurretWarningLong_structs.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass TurretWarningLong.TurretWarningLong_C
// 0x0000 (0x0518 - 0x0518)
class ATurretWarningLong_C : public APrimalEmitterSpawnable
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass TurretWarningLong.TurretWarningLong_C");
return ptr;
}
void UserConstructionScript();
void ExecuteUbergraph_TurretWarningLong(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"[email protected]"
] | |
8496d4482ee899b39a7a623df9cd67cf5e8508d9 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-kinesisanalyticsv2/include/aws/kinesisanalyticsv2/model/UpdateApplicationMaintenanceConfigurationRequest.h | 43288697293dcbfd69c8a602d1368693403e4bed | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 5,443 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/kinesisanalyticsv2/KinesisAnalyticsV2_EXPORTS.h>
#include <aws/kinesisanalyticsv2/KinesisAnalyticsV2Request.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/kinesisanalyticsv2/model/ApplicationMaintenanceConfigurationUpdate.h>
#include <utility>
namespace Aws
{
namespace KinesisAnalyticsV2
{
namespace Model
{
/**
*/
class AWS_KINESISANALYTICSV2_API UpdateApplicationMaintenanceConfigurationRequest : public KinesisAnalyticsV2Request
{
public:
UpdateApplicationMaintenanceConfigurationRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "UpdateApplicationMaintenanceConfiguration"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline const Aws::String& GetApplicationName() const{ return m_applicationName; }
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline bool ApplicationNameHasBeenSet() const { return m_applicationNameHasBeenSet; }
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline void SetApplicationName(const Aws::String& value) { m_applicationNameHasBeenSet = true; m_applicationName = value; }
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline void SetApplicationName(Aws::String&& value) { m_applicationNameHasBeenSet = true; m_applicationName = std::move(value); }
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline void SetApplicationName(const char* value) { m_applicationNameHasBeenSet = true; m_applicationName.assign(value); }
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline UpdateApplicationMaintenanceConfigurationRequest& WithApplicationName(const Aws::String& value) { SetApplicationName(value); return *this;}
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline UpdateApplicationMaintenanceConfigurationRequest& WithApplicationName(Aws::String&& value) { SetApplicationName(std::move(value)); return *this;}
/**
* <p>The name of the application for which you want to update the maintenance
* configuration.</p>
*/
inline UpdateApplicationMaintenanceConfigurationRequest& WithApplicationName(const char* value) { SetApplicationName(value); return *this;}
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline const ApplicationMaintenanceConfigurationUpdate& GetApplicationMaintenanceConfigurationUpdate() const{ return m_applicationMaintenanceConfigurationUpdate; }
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline bool ApplicationMaintenanceConfigurationUpdateHasBeenSet() const { return m_applicationMaintenanceConfigurationUpdateHasBeenSet; }
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline void SetApplicationMaintenanceConfigurationUpdate(const ApplicationMaintenanceConfigurationUpdate& value) { m_applicationMaintenanceConfigurationUpdateHasBeenSet = true; m_applicationMaintenanceConfigurationUpdate = value; }
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline void SetApplicationMaintenanceConfigurationUpdate(ApplicationMaintenanceConfigurationUpdate&& value) { m_applicationMaintenanceConfigurationUpdateHasBeenSet = true; m_applicationMaintenanceConfigurationUpdate = std::move(value); }
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline UpdateApplicationMaintenanceConfigurationRequest& WithApplicationMaintenanceConfigurationUpdate(const ApplicationMaintenanceConfigurationUpdate& value) { SetApplicationMaintenanceConfigurationUpdate(value); return *this;}
/**
* <p>Describes the application maintenance configuration update.</p>
*/
inline UpdateApplicationMaintenanceConfigurationRequest& WithApplicationMaintenanceConfigurationUpdate(ApplicationMaintenanceConfigurationUpdate&& value) { SetApplicationMaintenanceConfigurationUpdate(std::move(value)); return *this;}
private:
Aws::String m_applicationName;
bool m_applicationNameHasBeenSet;
ApplicationMaintenanceConfigurationUpdate m_applicationMaintenanceConfigurationUpdate;
bool m_applicationMaintenanceConfigurationUpdateHasBeenSet;
};
} // namespace Model
} // namespace KinesisAnalyticsV2
} // namespace Aws
| [
"[email protected]"
] | |
95edf215d41a681c2e9fca0d4d2e8e2498ceb03b | c3106e8b2d46dc5c23dd1797b00462f2873dd321 | /Codeforces/Contest1486/A.Shifting_Stacks.cpp | ebad52408d0c8e26cce65c51b25fadf9603d4413 | [] | no_license | cppaymurat/Codeforces_contests | 00dfa66b6b3ce60566c044633ba3a4bd731356fb | 2e900f372af6c67b07f8700a60baa0bdb24d9b2e | refs/heads/main | 2023-05-25T07:41:23.063186 | 2021-06-06T14:26:06 | 2021-06-06T14:26:06 | 374,211,344 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 789 | cpp | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define ll long long
void solve() {
int n;
cin >> n;
vector<ll> a(n + 1);
ll s = 0;
bool ok = 1;
for(int i = 0; i < n; i += 1) {
cin >> a[i];
}
vector<ll> need(n);
for(int i = 0; i < n; i += 1) {
need[i] = i;
}
for(int i = 0; i < n; i += 1) {
if (a[i] < need[i]) {
ok = 0;
break;
}
a[i + 1] += a[i] - need[i];
}
if (ok) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("taskA.in", "r", stdin);
// freopen("taskA.out", "w", stdout);
int t = 1;
cin >> t;
while(t--) {
solve();
}
return 0;
}
| [
"[email protected]"
] | |
bf9c4e33809b366f7d87a5641a15f509e16089af | a33aac97878b2cb15677be26e308cbc46e2862d2 | /program_data/PKU_raw/58/313.c | af0c6662fa31a456cacdf61eea2fdd855de5e743 | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,165 | c | int main()
{
char sen[200][90];
int i,n,p,j,len,q;
cin>>n;
cin.ignore();
for(i=1;i<=n;i++)
{
cin.getline(sen[i],90);
}
for(i=1;i<=n;i++)
{
q=0;
p=0;
len=strlen(sen[i]);
if(len==1)
{
if(sen[i][0]=='_'||(sen[i][0]>='a'&&sen[i][0]<='z')||(sen[i][0]>='A'&&sen[i][0]<='Z'))
{
cout<<1<<endl;continue;
}
}
else
{
for(j=1;j<=len-1;j++)
{
if(sen[i][0]=='_'||(sen[i][0]>='a'&&sen[i][0]<='z')||(sen[i][0]>='A'&&sen[i][0]<='Z'))
{
p=1;
}
if((sen[i][j]>='a'&&sen[i][0]<='z')||(sen[i][j]>='A'&&sen[i][j]<='Z')||(sen[i][j]>='0'&&sen[i][j]<='9')||(sen[i][j]=='_'))
{
q=1;
}
else
{
q=0;break;
}
}
if(p==1&&q==1)
{
cout<<1<<endl;
}
else
{
cout<<0<<endl;
}
}
}
return 0;
}
| [
"[email protected]"
] | |
6a76e77095d26ceb7f772b852429b3f472f8d726 | 970f7c9f5b2f80f4cb6b11cf33a6349047c3b4e2 | /Tues/145.binary-tree-postorder-traversal.35792090.ac.cpp | c39b4f98e18b9dcbc4851e224248fe797428a9eb | [] | no_license | claireyuan92/expressCourse | 02b36e3b54915a668ba8c986f67093705c5b932f | 2de236894f41c3587fe9fd53d6dc21e3726b9610 | refs/heads/master | 2021-01-25T09:14:25.097211 | 2017-08-22T07:19:29 | 2017-08-22T07:19:29 | 93,800,028 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 486 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
vector<int> res;
public:
vector<int> postorderTraversal(TreeNode* root) {
if(!root)return res;
postorderTraversal(root->left);
postorderTraversal(root->right);
res.push_back(root->val);
return res;
}
}; | [
"[email protected]"
] | |
3e4360253fc6ff8f2f104ae0972c4a8196c01e90 | 030e2b6547d937956716ac484de829b19a35a644 | /src/model.cpp | 0cc85cbd0cca8adf87660b7c814e0c6de95527cc | [] | no_license | sigsegv/tinyrenderer | cc5bbb253c5d7522ef1208aa69d3d29978ad5eca | ec474a7de868d210917b2827341a693cd112bd20 | refs/heads/master | 2021-01-02T08:53:27.604046 | 2019-12-31T01:37:24 | 2019-12-31T01:37:24 | 99,086,354 | 0 | 1 | null | 2018-01-08T05:35:01 | 2017-08-02T07:29:36 | C++ | UTF-8 | C++ | false | false | 3,901 | cpp | #include "model.hpp"
#include <fstream>
#include <sstream>
model::model()
{
}
void model::load_from_disk(const std::string& filepath)
{
std::ifstream fin(filepath);
if(!fin.is_open()) throw std::runtime_error("unable to open file " + filepath);
std::string line;
while(!fin.eof())
{
std::getline(fin, line);
std::istringstream iss(line);
if(line.compare(0, 2, "vt") == 0)
{
iss.ignore(2, ' ');
vertex_texture vt;
iss >> vt.u >> vt.v;
this->vt.push_back(vt);
}
else if(line.compare(0, 2, "vn") == 0)
{
iss.ignore(2, ' ');
vertex_normal vn;
iss >> vn.x >> vn.y >> vn.z;
this->vn.push_back(vn);
}
else if(line.compare(0, 2, "vp") == 0)
{
}
else if(line.compare(0, 1, "v") == 0)
{
iss.ignore(1, ' ');
vertex v;
iss >> v.x >> v.y >> v.z;
this->v.push_back(v);
}
else if(line.compare(0, 1, "f") == 0)
{
//std::string trash;
char trash;
iss.ignore(1, ' ');
face f;
iss >> f.v1 >> trash >> f.vt1 >> trash >> f.vn1
>> f.v2 >> trash >> f.vt2 >> trash >> f.vn2
>> f.v3 >> trash >> f.vt3 >> trash >> f.vn3;
// shift indexes down 1
--f.v1;
--f.vt1;
--f.vn1;
--f.v2;
--f.vt2;
--f.vn2;
--f.v3;
--f.vt3;
--f.vn3;
this->f.push_back(f);
}
}
}
TGAColor model::diffuse(const vector2f& uv)
{
const float u = m_diffuse.get_width() * uv[0];
const float v = m_diffuse.get_height() * uv[1];
return m_diffuse.get(static_cast<int>(u), static_cast<int>(v));
}
TGAColor model::specular(const vector2f& uv)
{
const int u = static_cast<int>(m_specular.get_width() * uv[0]);
const int v = static_cast<int>(m_specular.get_height() * uv[1]);
TGAColor color = m_specular.get(u, v);
if (color.bytespp == 1)
{
return TGAColor(color.b, color.b, color.b, color.a);
}
return color;
}
vector3f model::normal(const vector2f& uv)
{
const float u = m_normal.get_width() * uv[0];
const float v = m_normal.get_height() * uv[1];
TGAColor color = m_normal.get(static_cast<int>(u), static_cast<int>(v));
return {static_cast<float>(color.r) / 255.0f, static_cast<float>(color.g) / 255.0f, static_cast<float>(color.b) / 255.0f};
}
//const vector3f& model::normal(int iface, int nthvert)
//{
// face& fc = f[iface];
// const unsigned int ni = (nthvert == 0) ? fc.vn1 : ((nthvert == 1) ? fc.vn2 : fc.vn3);
// return vn[ni];
//}
vector2f model::get_uv(int iface, int nthvert)
{
face& fc = f[iface];
const unsigned int ti = (nthvert == 0) ? fc.vt1 : ((nthvert == 1) ? fc.vt2 : fc.vt3);
return {vt[ti].u, vt[ti].v};
}
vector3f model::get_vertex(int iface, int nthvert)
{
face& fc = f[iface];
const unsigned int vi = (nthvert == 0) ? fc.v1 : ((nthvert == 1) ? fc.v2 : fc.v3);
return v[vi];
}
void model::load_diffuse_map_from_disk(const std::string& filepath)
{
if(!m_diffuse.read_tga_file(filepath.c_str()))
{
throw std::runtime_error("unable to open file " + filepath);
}
m_diffuse.flip_vertically();
}
void model::load_normal_map_from_disk(const std::string& filepath)
{
if(!m_normal.read_tga_file(filepath.c_str()))
{
throw std::runtime_error("unable to open file " + filepath);
}
m_normal.flip_vertically();
}
void model::load_specular_map_from_disk(const std::string& filepath)
{
if(!m_specular.read_tga_file(filepath.c_str()))
{
throw std::runtime_error("unable to open file " + filepath);
}
m_specular.flip_vertically();
}
| [
"[email protected]"
] | |
2505f922b79f390a2a22dc06016ee5981c7b0899 | c2a1c834cb35cfacc000a8116c671455ed1704ca | /trie.cc | f494b29e4fe25e751bda14d65f6a5a406be5053f | [] | no_license | rollschild/MyAlgorithms | a4ece400bd5730999efcf7a5afc0fdc29eecf50d | cff86bbad5cca099b26467e06e4fe23ed9ce8840 | refs/heads/master | 2021-06-05T07:58:03.293145 | 2020-01-25T20:09:15 | 2020-01-25T20:09:15 | 111,488,428 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,811 | cc | /* Trie
*/
#include <iostream>
#include <vector>
#define ALPHABET 26
using namespace std;
struct TrieNode {
// vector<TrieNode*> children(ALPHABET);
bool is_end;
TrieNode* children[ALPHABET];
};
TrieNode* make_node() {
TrieNode* node = new TrieNode();
for (auto trie_node_ptr : node->children) {
trie_node_ptr = nullptr;
}
node->is_end = false;
return node;
}
void insert(TrieNode* root, string word) {
TrieNode* crawler_ptr = root;
for (int i = 0; i < word.length(); ++i) {
int index = word[i] - 'a';
if (crawler_ptr->children[index] == nullptr) {
crawler_ptr->children[index] = make_node();
}
crawler_ptr = crawler_ptr->children[index];
}
crawler_ptr->is_end = true;
}
bool search(TrieNode* root, string word) {
TrieNode* crawler_ptr = root;
for (int j = 0; j < word.length(); ++j) {
int index = word[j] - 'a';
if (crawler_ptr->children[index] == nullptr) return false;
crawler_ptr = crawler_ptr->children[index];
}
return (crawler_ptr != nullptr && crawler_ptr->is_end == true);
}
int main() {
vector<string> words = {"the", "a", "there", "answer",
"any", "by", "bye", "their"};
TrieNode* root = make_node();
for (auto word : words) {
insert(root, word);
}
search(root, "the") ? cout << "\"the\" exists" << endl
: cout << "\"the\" does not exist" << endl;
search(root, "these") ? cout << "\"theese\" exists" << endl
: cout << "\"these\" does not exist" << endl;
search(root, "their") ? cout << "\"their\" exists" << endl
: cout << "\"their\" does not exist" << endl;
search(root, "thaw") ? cout << "\"thaw\" exists" << endl
: cout << "\"thaw\" does not exist " << endl;
return 0;
}
| [
"[email protected]"
] | |
47583c06a65870aed4fdcec3a880d90425c76174 | 9804b34b1ac01c5873401779875154a675223d3c | /arduino/Project Backup/Project 1.2.2020/loop/setup.ino | 44813493e3140f267eb33b0e6ddba27280c9072d | [] | no_license | AnushkaX/Hik | ad364c5dba98ceb79ad5bdaf54c202087ffb9cad | 41615256d5f93b9184fbd06c87c5a8ce8d4633d7 | refs/heads/master | 2020-12-04T04:27:14.306547 | 2020-02-27T06:07:13 | 2020-02-27T06:07:13 | 231,611,884 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,163 | ino | #include <Servo.h>
//-------color sensor----------
#define Color_S0 3
#define Color_S1 4
#define Color_S2 5
#define Color_S3 6
#define Color_sensorOut 2
int frequency = 0;
//-------------------------------
//--------Servo-----------
Servo BigServo;
Servo SmallServo;
#define smallServoPin 5
#define bigServoPin 10
//------------------------
//-----------Sonar-----------
#define pingPin 4
#define echoPin 3
//----------------------
boolean flag = false;
void setup() {
//-------------Servo setup-------------------
BigServo.attach(bigServoPin);
SmallServo.attach(smallServoPin);
//-------------------------------------------
//------------Sonar setup--------------------------
pinMode(pingPin, OUTPUT);
pinMode(echoPin, INPUT);
//-------------------------------------------
//------------Color sense setup---------------
pinMode(Color_S0, OUTPUT);
pinMode(Color_S1, OUTPUT);
pinMode(Color_S2, OUTPUT);
pinMode(Color_S3, OUTPUT);
pinMode(Color_sensorOut, INPUT);
// Setting frequency-scaling to 20%
digitalWrite(Color_S0, HIGH);
digitalWrite(Color_S1, LOW);
//----------------------------------------------
}
| [
"[email protected]"
] | |
af097ed3f047e0f058b4f5ca8cb20d3e3893842f | 8dff0d8850bc7f1e5ecfbb50592f530809a15ec8 | /TopTagger/include/TTModule.h | bc74a7d99d132eac3e76e8e9eba71ec1e569039b | [] | no_license | zhenbinwu/TopTagger | 3dee3b5e7b41aa502264541c05015168fb3dfbf6 | fab6957fc53eb16550a3de8b96e54a02ec418f0a | refs/heads/master | 2020-12-03T04:03:16.205013 | 2017-06-06T20:41:25 | 2017-06-06T20:41:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 641 | h | #ifndef TTMODULE_H
#define TTMODULE_H
#include "TopTagger/TopTagger/include/TTMFactory.h"
#include <functional>
class TopTaggerResults;
namespace cfg
{
class CfgDocument;
}
//Base Object for Top Taggger Modules
class TTModule
{
private:
protected:
public:
virtual void getParameters(const cfg::CfgDocument*, const std::string&) = 0;
virtual void run(TopTaggerResults&) = 0;
};
//magic macro for registering classes with the factory object
#define REGISTER_TTMODULE( _module ) \
static bool _module ## _module_created = TTMFactory::registerModule( #_module, []()->TTModule*{ return new _module(); } )
#endif
| [
"[email protected]"
] | |
bcabdb3d92cf4e4c728991013d0c092199e5e3d2 | 299f5e3a469a2d888496ff81f660f1f26cfcb01c | /core/sse_matrix.cc | e83c3945921e3c3e76f20fc3c7bb495fe84d9dc6 | [] | no_license | SRaimondi/pixel | 2ecdb1d159e76c92ab8de53ad4aa2f132091925b | fd5cc8d956d37db852f800758a160924a9637c01 | refs/heads/master | 2020-02-26T17:25:35.192005 | 2016-11-12T22:04:21 | 2016-11-12T22:04:21 | 71,735,696 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,391 | cc | /*
* The MIT License
*
* Copyright 2016 simon.
*
* 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 "sse_matrix.h"
namespace pixel {
SSEMatrix Inverse(const SSEMatrix &m) {
// Matrix inversion based on the Gauss method
int indxc[4], indxr[4];
int ipiv[4] = {0, 0, 0, 0};
float minv[4][4];
memcpy(minv, Transpose(m).data, 16 * sizeof(float));
for (int i = 0; i < 4; i++) {
int irow = 0, icol = 0;
float big = 0.f;
// Choose pivot
for (int j = 0; j < 4; j++) {
if (ipiv[j] != 1) {
for (int k = 0; k < 4; k++) {
if (ipiv[k] == 0) {
if (std::abs(minv[j][k]) >= big) {
big = std::abs(minv[j][k]);
irow = j;
icol = k;
}
} else if (ipiv[k] > 1) {
std::cerr << "Singular matrix given to inversion procedure" << std::endl;
exit(EXIT_FAILURE);
}
}
}
}
++ipiv[icol];
// Swap rows irow_ and icol_ for pivot
if (irow != icol) {
for (int k = 0; k < 4; ++k) {
std::swap(minv[irow][k], minv[icol][k]);
}
}
indxr[i] = irow;
indxc[i] = icol;
if (minv[icol][icol] == 0.f) {
std::cerr << "Singular matrix given to inversion procedure" << std::endl;
exit(EXIT_FAILURE);
}
// Set $m[icol][icol]$ to one by scaling row _icol_ appropriately
float pivinv = 1.f / minv[icol][icol];
minv[icol][icol] = 1.f;
for (int j = 0; j < 4; j++) {
minv[icol][j] *= pivinv;
}
// Subtract this row from others to zero out their columns
for (int j = 0; j < 4; j++) {
if (j != icol) {
float save = minv[j][icol];
minv[j][icol] = 0;
for (int k = 0; k < 4; k++) {
minv[j][k] -= minv[icol][k] * save;
}
}
}
}
// Swap columns to reflect permutation
for (int j = 3; j >= 0; j--) {
if (indxr[j] != indxc[j]) {
for (int k = 0; k < 4; k++) {
std::swap(minv[k][indxr[j]], minv[k][indxc[j]]);
}
}
}
return SSEMatrix(minv[0][0], minv[0][1], minv[0][2], minv[0][3],
minv[1][0], minv[1][1], minv[1][2], minv[1][3],
minv[2][0], minv[2][1], minv[2][2], minv[2][3],
minv[3][0], minv[3][1], minv[3][2], minv[3][3]);
}
void PrintSSEMatrix(const SSEMatrix &m) {
for (size_t i = 0; i < 4; i++) {
std::cout << "[";
for (size_t j = 0; j < 4; j++) {
std::cout << m.data[j][i];
if (j < 3) {
std::cout << "\t";
}
}
std::cout << "]" << std::endl;
}
std::cout << std::endl;
}
} | [
"[email protected]"
] | |
f61eb6c01bf3a9c9232bd1cbb0245d57415b8c79 | 73ee941896043f9b3e2ab40028d24ddd202f695f | /external/chromium_org/chrome/browser/download/download_path_reservation_tracker_unittest.cc | 06183a54cfa893b91e10af535be290b5ba5564b2 | [
"BSD-3-Clause"
] | permissive | CyFI-Lab-Public/RetroScope | d441ea28b33aceeb9888c330a54b033cd7d48b05 | 276b5b03d63f49235db74f2c501057abb9e79d89 | refs/heads/master | 2022-04-08T23:11:44.482107 | 2016-09-22T20:15:43 | 2016-09-22T20:15:43 | 58,890,600 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 24,026 | cc | // 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.
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/observer_list.h"
#include "base/strings/stringprintf.h"
#include "base/test/test_file_util.h"
#include "chrome/browser/download/download_path_reservation_tracker.h"
#include "chrome/browser/download/download_target_determiner.h"
#include "content/public/test/mock_download_item.h"
#include "content/public/test/test_browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
using content::DownloadItem;
using content::MockDownloadItem;
using testing::AnyNumber;
using testing::Return;
using testing::ReturnRef;
using testing::ReturnRefOfCopy;
namespace {
// MockDownloadItem with real observers and state.
class FakeDownloadItem : public MockDownloadItem {
public:
explicit FakeDownloadItem()
: state_(IN_PROGRESS) {
}
virtual ~FakeDownloadItem() {
FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this));
EXPECT_EQ(0u, observers_.size());
}
virtual void AddObserver(Observer* observer) OVERRIDE {
observers_.AddObserver(observer);
}
virtual void RemoveObserver(Observer* observer) OVERRIDE {
observers_.RemoveObserver(observer);
}
virtual void UpdateObservers() OVERRIDE {
FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this));
}
virtual DownloadState GetState() const OVERRIDE {
return state_;
}
void SetState(DownloadState state) {
state_ = state;
UpdateObservers();
}
private:
DownloadState state_;
ObserverList<Observer> observers_;
};
class DownloadPathReservationTrackerTest : public testing::Test {
public:
DownloadPathReservationTrackerTest();
// testing::Test
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
FakeDownloadItem* CreateDownloadItem(int32 id);
base::FilePath GetPathInDownloadsDirectory(
const base::FilePath::CharType* suffix);
bool IsPathInUse(const base::FilePath& path);
void CallGetReservedPath(
DownloadItem* download_item,
const base::FilePath& target_path,
bool create_directory,
DownloadPathReservationTracker::FilenameConflictAction conflict_action,
base::FilePath* return_path,
bool* return_verified);
const base::FilePath& default_download_path() const {
return default_download_path_;
}
void set_default_download_path(const base::FilePath& path) {
default_download_path_ = path;
}
// Creates a name of form 'a'*repeat + suffix
base::FilePath GetLongNamePathInDownloadsDirectory(
size_t repeat, const base::FilePath::CharType* suffix);
protected:
base::ScopedTempDir test_download_dir_;
base::FilePath default_download_path_;
base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
private:
void TestReservedPathCallback(base::FilePath* return_path,
bool* return_verified, bool* did_run_callback,
const base::FilePath& path, bool verified);
};
DownloadPathReservationTrackerTest::DownloadPathReservationTrackerTest()
: ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_) {
}
void DownloadPathReservationTrackerTest::SetUp() {
ASSERT_TRUE(test_download_dir_.CreateUniqueTempDir());
set_default_download_path(test_download_dir_.path());
}
void DownloadPathReservationTrackerTest::TearDown() {
message_loop_.RunUntilIdle();
}
FakeDownloadItem* DownloadPathReservationTrackerTest::CreateDownloadItem(
int32 id) {
FakeDownloadItem* item = new ::testing::StrictMock<FakeDownloadItem>;
EXPECT_CALL(*item, GetId())
.WillRepeatedly(Return(id));
EXPECT_CALL(*item, GetTargetFilePath())
.WillRepeatedly(ReturnRefOfCopy(base::FilePath()));
return item;
}
base::FilePath DownloadPathReservationTrackerTest::GetPathInDownloadsDirectory(
const base::FilePath::CharType* suffix) {
return default_download_path().Append(suffix).NormalizePathSeparators();
}
bool DownloadPathReservationTrackerTest::IsPathInUse(
const base::FilePath& path) {
return DownloadPathReservationTracker::IsPathInUseForTesting(path);
}
void DownloadPathReservationTrackerTest::CallGetReservedPath(
DownloadItem* download_item,
const base::FilePath& target_path,
bool create_directory,
DownloadPathReservationTracker::FilenameConflictAction conflict_action,
base::FilePath* return_path,
bool* return_verified) {
// Weak pointer factory to prevent the callback from running after this
// function has returned.
base::WeakPtrFactory<DownloadPathReservationTrackerTest> weak_ptr_factory(
this);
bool did_run_callback = false;
DownloadPathReservationTracker::GetReservedPath(
download_item,
target_path,
default_download_path(),
create_directory,
conflict_action,
base::Bind(&DownloadPathReservationTrackerTest::TestReservedPathCallback,
weak_ptr_factory.GetWeakPtr(), return_path, return_verified,
&did_run_callback));
message_loop_.RunUntilIdle();
EXPECT_TRUE(did_run_callback);
}
void DownloadPathReservationTrackerTest::TestReservedPathCallback(
base::FilePath* return_path, bool* return_verified, bool* did_run_callback,
const base::FilePath& path, bool verified) {
*did_run_callback = true;
*return_path = path;
*return_verified = verified;
}
base::FilePath
DownloadPathReservationTrackerTest::GetLongNamePathInDownloadsDirectory(
size_t repeat, const base::FilePath::CharType* suffix) {
return GetPathInDownloadsDirectory(
(base::FilePath::StringType(repeat, FILE_PATH_LITERAL('a'))
+ suffix).c_str());
}
} // namespace
// A basic reservation is acquired and committed.
TEST_F(DownloadPathReservationTrackerTest, BasicReservation) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(verified);
EXPECT_EQ(path.value(), reserved_path.value());
// Destroying the item should release the reservation.
item->SetState(DownloadItem::COMPLETE);
item.reset();
message_loop_.RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
// A download that is interrupted should lose its reservation.
TEST_F(DownloadPathReservationTrackerTest, InterruptedDownload) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(verified);
EXPECT_EQ(path.value(), reserved_path.value());
// Once the download is interrupted, the path should become available again.
item->SetState(DownloadItem::INTERRUPTED);
message_loop_.RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
// A completed download should also lose its reservation.
TEST_F(DownloadPathReservationTrackerTest, CompleteDownload) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(verified);
EXPECT_EQ(path.value(), reserved_path.value());
// Once the download completes, the path should become available again. For a
// real download, at this point only the path reservation will be released.
// The path wouldn't be available since it is occupied on disk by the
// completed download.
item->SetState(DownloadItem::COMPLETE);
message_loop_.RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
}
// If there are files on the file system, a unique reservation should uniquify
// around it.
TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
base::FilePath path1(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt")));
// Create a file at |path|, and a .crdownload file at |path1|.
ASSERT_EQ(0, file_util::WriteFile(path, "", 0));
ASSERT_EQ(0,
file_util::WriteFile(
DownloadTargetDeterminer::GetCrDownloadPath(path1), "", 0));
ASSERT_TRUE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
bool create_directory = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::UNIQUIFY;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(IsPathInUse(reserved_path));
EXPECT_TRUE(verified);
// The path should be uniquified, skipping over foo.txt but not over
// "foo (1).txt.crdownload"
EXPECT_EQ(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt")).value(),
reserved_path.value());
item->SetState(DownloadItem::COMPLETE);
item.reset();
message_loop_.RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
EXPECT_FALSE(IsPathInUse(reserved_path));
}
// Multiple reservations for the same path should uniquify around each other.
TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) {
scoped_ptr<FakeDownloadItem> item1(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
base::FilePath uniquified_path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt")));
ASSERT_FALSE(IsPathInUse(path));
ASSERT_FALSE(IsPathInUse(uniquified_path));
base::FilePath reserved_path1;
bool verified = false;
bool create_directory = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::UNIQUIFY;
CallGetReservedPath(
item1.get(),
path,
create_directory,
conflict_action,
&reserved_path1,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(verified);
{
// Requesting a reservation for the same path with uniquification results in
// a uniquified path.
scoped_ptr<FakeDownloadItem> item2(CreateDownloadItem(2));
base::FilePath reserved_path2;
CallGetReservedPath(
item2.get(),
path,
create_directory,
conflict_action,
&reserved_path2,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(IsPathInUse(uniquified_path));
EXPECT_EQ(uniquified_path.value(), reserved_path2.value());
item2->SetState(DownloadItem::COMPLETE);
}
message_loop_.RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
EXPECT_FALSE(IsPathInUse(uniquified_path));
{
// Since the previous download item was removed, requesting a reservation
// for the same path should result in the same uniquified path.
scoped_ptr<FakeDownloadItem> item2(CreateDownloadItem(2));
base::FilePath reserved_path2;
CallGetReservedPath(
item2.get(),
path,
create_directory,
conflict_action,
&reserved_path2,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(IsPathInUse(uniquified_path));
EXPECT_EQ(uniquified_path.value(), reserved_path2.value());
item2->SetState(DownloadItem::COMPLETE);
}
message_loop_.RunUntilIdle();
// Now acquire an overwriting reservation. We should end up with the same
// non-uniquified path for both reservations.
scoped_ptr<FakeDownloadItem> item3(CreateDownloadItem(2));
base::FilePath reserved_path3;
conflict_action = DownloadPathReservationTracker::OVERWRITE;
CallGetReservedPath(
item3.get(),
path,
create_directory,
conflict_action,
&reserved_path3,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_FALSE(IsPathInUse(uniquified_path));
EXPECT_EQ(path.value(), reserved_path1.value());
EXPECT_EQ(path.value(), reserved_path3.value());
item1->SetState(DownloadItem::COMPLETE);
item3->SetState(DownloadItem::COMPLETE);
}
// If a unique path cannot be determined after trying kMaxUniqueFiles
// uniquifiers, then the callback should notified that verification failed, and
// the returned path should be set to the original requested path.
TEST_F(DownloadPathReservationTrackerTest, UnresolvedConflicts) {
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
scoped_ptr<FakeDownloadItem> items[
DownloadPathReservationTracker::kMaxUniqueFiles + 1];
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::UNIQUIFY;
bool create_directory = false;
// Create |kMaxUniqueFiles + 1| reservations for |path|. The first reservation
// will have no uniquifier. The |kMaxUniqueFiles| remaining reservations do.
for (int i = 0; i <= DownloadPathReservationTracker::kMaxUniqueFiles; i++) {
base::FilePath reserved_path;
base::FilePath expected_path;
bool verified = false;
if (i > 0) {
expected_path =
path.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", i));
} else {
expected_path = path;
}
items[i].reset(CreateDownloadItem(i));
EXPECT_FALSE(IsPathInUse(expected_path));
CallGetReservedPath(
items[i].get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(expected_path));
EXPECT_EQ(expected_path.value(), reserved_path.value());
EXPECT_TRUE(verified);
}
// The next reservation for |path| will fail to be unique.
scoped_ptr<FakeDownloadItem> item(
CreateDownloadItem(DownloadPathReservationTracker::kMaxUniqueFiles + 1));
base::FilePath reserved_path;
bool verified = true;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_FALSE(verified);
EXPECT_EQ(path.value(), reserved_path.value());
item->SetState(DownloadItem::COMPLETE);
for (int i = 0; i <= DownloadPathReservationTracker::kMaxUniqueFiles; i++) {
items[i]->SetState(DownloadItem::COMPLETE);
}
}
// If the target directory is unwriteable, then callback should be notified that
// verification failed.
TEST_F(DownloadPathReservationTrackerTest, UnwriteableDirectory) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
base::FilePath dir(path.DirName());
ASSERT_FALSE(IsPathInUse(path));
{
// Scope for PermissionRestorer
file_util::PermissionRestorer restorer(dir);
EXPECT_TRUE(file_util::MakeFileUnwritable(dir));
base::FilePath reserved_path;
bool verified = true;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
// Verification fails.
EXPECT_FALSE(verified);
EXPECT_EQ(path.BaseName().value(), reserved_path.BaseName().value());
}
item->SetState(DownloadItem::COMPLETE);
}
// If the default download directory doesn't exist, then it should be
// created. But only if we are actually going to create the download path there.
TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) {
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo/foo.txt")));
base::FilePath dir(path.DirName());
ASSERT_FALSE(base::DirectoryExists(dir));
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
{
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath reserved_path;
bool verified = true;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
// Verification fails because the directory doesn't exist.
EXPECT_FALSE(verified);
item->SetState(DownloadItem::COMPLETE);
}
ASSERT_FALSE(IsPathInUse(path));
{
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath reserved_path;
bool verified = true;
set_default_download_path(dir);
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
// Verification succeeds because the directory is created.
EXPECT_TRUE(verified);
EXPECT_TRUE(base::DirectoryExists(dir));
item->SetState(DownloadItem::COMPLETE);
}
}
// If the target path of the download item changes, the reservation should be
// updated to match.
TEST_F(DownloadPathReservationTrackerTest, UpdatesToTargetPath) {
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt")));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(path));
EXPECT_TRUE(verified);
EXPECT_EQ(path.value(), reserved_path.value());
// The target path is initially empty. If an OnDownloadUpdated() is issued in
// this state, we shouldn't lose the reservation.
ASSERT_EQ(base::FilePath::StringType(), item->GetTargetFilePath().value());
item->UpdateObservers();
message_loop_.RunUntilIdle();
EXPECT_TRUE(IsPathInUse(path));
// If the target path changes, we should update the reservation to match.
base::FilePath new_target_path(
GetPathInDownloadsDirectory(FILE_PATH_LITERAL("bar.txt")));
ASSERT_FALSE(IsPathInUse(new_target_path));
EXPECT_CALL(*item, GetTargetFilePath())
.WillRepeatedly(ReturnRef(new_target_path));
item->UpdateObservers();
message_loop_.RunUntilIdle();
EXPECT_FALSE(IsPathInUse(path));
EXPECT_TRUE(IsPathInUse(new_target_path));
// Destroying the item should release the reservation.
item->SetState(DownloadItem::COMPLETE);
item.reset();
message_loop_.RunUntilIdle();
EXPECT_FALSE(IsPathInUse(new_target_path));
}
// Tests for long name truncation. On other platforms automatic truncation
// is not performed (yet).
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
TEST_F(DownloadPathReservationTrackerTest, BasicTruncation) {
int real_max_length =
file_util::GetMaximumPathComponentLength(default_download_path());
ASSERT_NE(-1, real_max_length);
// TODO(kinaba): the current implementation leaves spaces for appending
// ".crdownload". So take it into account. Should be removed in the future.
const size_t max_length = real_max_length - 11;
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(GetLongNamePathInDownloadsDirectory(
max_length, FILE_PATH_LITERAL(".txt")));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(reserved_path));
EXPECT_TRUE(verified);
// The file name length is truncated to max_length.
EXPECT_EQ(max_length, reserved_path.BaseName().value().size());
// But the extension is kept unchanged.
EXPECT_EQ(path.Extension(), reserved_path.Extension());
item->SetState(DownloadItem::COMPLETE);
}
TEST_F(DownloadPathReservationTrackerTest, TruncationConflict) {
int real_max_length =
file_util::GetMaximumPathComponentLength(default_download_path());
ASSERT_NE(-1, real_max_length);
const size_t max_length = real_max_length - 11;
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(GetLongNamePathInDownloadsDirectory(
max_length, FILE_PATH_LITERAL(".txt")));
base::FilePath path0(GetLongNamePathInDownloadsDirectory(
max_length - 4, FILE_PATH_LITERAL(".txt")));
base::FilePath path1(GetLongNamePathInDownloadsDirectory(
max_length - 8, FILE_PATH_LITERAL(" (1).txt")));
base::FilePath path2(GetLongNamePathInDownloadsDirectory(
max_length - 8, FILE_PATH_LITERAL(" (2).txt")));
ASSERT_FALSE(IsPathInUse(path));
// "aaa...aaaaaaa.txt" (truncated path) and
// "aaa...aaa (1).txt" (truncated and first uniquification try) exists.
// "aaa...aaa (2).txt" should be used.
ASSERT_EQ(0, file_util::WriteFile(path0, "", 0));
ASSERT_EQ(0, file_util::WriteFile(path1, "", 0));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::UNIQUIFY;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
EXPECT_TRUE(IsPathInUse(reserved_path));
EXPECT_TRUE(verified);
EXPECT_EQ(path2, reserved_path);
item->SetState(DownloadItem::COMPLETE);
}
TEST_F(DownloadPathReservationTrackerTest, TruncationFail) {
int real_max_length =
file_util::GetMaximumPathComponentLength(default_download_path());
ASSERT_NE(-1, real_max_length);
const size_t max_length = real_max_length - 11;
scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1));
base::FilePath path(GetPathInDownloadsDirectory(
(FILE_PATH_LITERAL("a.") +
base::FilePath::StringType(max_length, 'b')).c_str()));
ASSERT_FALSE(IsPathInUse(path));
base::FilePath reserved_path;
bool verified = false;
DownloadPathReservationTracker::FilenameConflictAction conflict_action =
DownloadPathReservationTracker::OVERWRITE;
bool create_directory = false;
CallGetReservedPath(
item.get(),
path,
create_directory,
conflict_action,
&reserved_path,
&verified);
// We cannot truncate a path with very long extension.
EXPECT_FALSE(verified);
item->SetState(DownloadItem::COMPLETE);
}
#endif
| [
"[email protected]"
] | |
5e3cb9053c135c80bc6f32dfbd9ad55f7c80679a | 0e61dc2a18ced57b91b81fff43b1c2b59e0154cc | /findMinimum/findMinimum/findMinimum.cpp | ae016dfa90a19ac25ac3c7f057af5d100a7f0584 | [] | no_license | rockdonald2/leetcode | 53179a4435e9ad4582432c435a51c3f22cee1cd4 | 2256ab0a0a00d307bec581b08eae00a83e76a49c | refs/heads/master | 2021-07-13T14:26:03.327928 | 2021-02-20T13:42:13 | 2021-02-20T13:42:13 | 238,773,596 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 686 | cpp | #include <iostream>
#include <vector>
using namespace std;
int findMin(vector<int>& nums) {
if (nums.size() == 1) return nums[0];
if (nums.empty()) return -1;
int left = 0, right = nums.size() - 1, mid;
if (nums[left] < nums[right]) return nums[left];
while (left <= right) {
mid = left + (right - left) / 2;
if (mid < nums.size() - 1 && nums[mid] > nums[mid + 1]) return nums[mid + 1];
else if (mid > 0 && nums[mid - 1] > nums[mid]) return nums[mid];
else if (nums[mid] > nums[left]) left = mid + 1;
else if (nums[mid] < nums[left]) right = mid - 1;
}
return -1;
}
int main() {
vector<int> nums{ 3, 4, 0, 1, 2 };
cout << findMin(nums) << endl;
return 0;
} | [
"[email protected]"
] | |
c2e24ee5c41680654a2de0f7132de0572d2ef2a4 | 7189b85150a21412598291fa29896423a27e434a | /chrome/browser/chromeos/login/screens/update_required_screen.cc | ff00a92752bcdcaa31975b4e8d6b7110c9424022 | [
"BSD-3-Clause"
] | permissive | Cicko/chromium | 328a49cbfa25e7e4e9f27e4510f2f81ab6410384 | 63c6b9d55f6b866d3aa9719dab956ef7940c1dab | refs/heads/master | 2022-11-09T17:04:16.402973 | 2020-02-03T15:21:47 | 2020-02-03T15:21:47 | 238,001,913 | 1 | 0 | BSD-3-Clause | 2020-02-03T15:49:33 | 2020-02-03T15:49:32 | null | UTF-8 | C++ | false | false | 11,016 | cc | // Copyright (c) 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.
#include "chrome/browser/chromeos/login/screens/update_required_screen.h"
#include <algorithm>
#include <utility>
#include "ash/public/cpp/login_screen.h"
#include "ash/public/cpp/system_tray.h"
#include "base/bind.h"
#include "base/time/default_clock.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/error_screens_histogram_helper.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/ui/login_display.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_state_handler.h"
#include "ui/chromeos/devicetype_utils.h"
namespace {
constexpr char kUserActionSelectNetworkButtonClicked[] = "select-network";
constexpr char kUserActionUpdateButtonClicked[] = "update";
constexpr char kUserActionAcceptUpdateOverCellular[] = "update-accept-cellular";
constexpr char kUserActionRejectUpdateOverCellular[] = "update-reject-cellular";
// Delay before showing error message if captive portal is detected.
// We wait for this delay to let captive portal to perform redirect and show
// its login page before error message appears.
constexpr const base::TimeDelta kDelayErrorMessage =
base::TimeDelta::FromSeconds(10);
} // namespace
namespace chromeos {
UpdateRequiredScreen::UpdateRequiredScreen(UpdateRequiredView* view,
ErrorScreen* error_screen)
: BaseScreen(UpdateRequiredView::kScreenId),
view_(view),
error_screen_(error_screen),
histogram_helper_(
std::make_unique<ErrorScreensHistogramHelper>("UpdateRequired")),
version_updater_(std::make_unique<VersionUpdater>(this)),
network_state_helper_(std::make_unique<login::NetworkStateHelper>()),
clock_(base::DefaultClock::GetInstance()) {
error_message_delay_ = kDelayErrorMessage;
if (view_)
view_->Bind(this);
}
UpdateRequiredScreen::~UpdateRequiredScreen() {
UnsubscribeNetworkNotification();
if (view_)
view_->Unbind();
}
void UpdateRequiredScreen::OnViewDestroyed(UpdateRequiredView* view) {
if (view_ == view)
view_ = nullptr;
}
void UpdateRequiredScreen::Show() {
ash::LoginScreen::Get()->SetAllowLoginAsGuest(false);
RefreshNetworkState();
SubscribeNetworkNotification();
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
view_->SetEnterpriseAndDeviceName(connector->GetEnterpriseDisplayDomain(),
ui::GetChromeOSDeviceName());
is_shown_ = true;
if (first_time_shown_) {
first_time_shown_ = false;
if (view_) {
view_->SetUIState(UpdateRequiredView::UPDATE_REQUIRED_MESSAGE);
view_->Show();
}
}
version_updater_->GetEolInfo(base::BindOnce(
&UpdateRequiredScreen::OnGetEolInfo, weak_factory_.GetWeakPtr()));
}
void UpdateRequiredScreen::OnGetEolInfo(
const chromeos::UpdateEngineClient::EolInfo& info) {
// TODO(crbug.com/1020616) : Handle if the device is left on this screen
// for long enough to reach Eol.
if (!info.eol_date.is_null() && info.eol_date <= clock_->Now()) {
EnsureScreenIsShown();
if (view_)
view_->SetUIState(UpdateRequiredView::EOL_REACHED);
}
}
void UpdateRequiredScreen::Hide() {
if (view_)
view_->Hide();
is_shown_ = false;
UnsubscribeNetworkNotification();
}
void UpdateRequiredScreen::OnUserAction(const std::string& action_id) {
if (action_id == kUserActionSelectNetworkButtonClicked) {
OnSelectNetworkButtonClicked();
} else if (action_id == kUserActionUpdateButtonClicked) {
OnUpdateButtonClicked();
} else if (action_id == kUserActionAcceptUpdateOverCellular) {
version_updater_->SetUpdateOverCellularOneTimePermission();
} else if (action_id == kUserActionRejectUpdateOverCellular) {
version_updater_->RejectUpdateOverCellular();
version_updater_->StartExitUpdate(VersionUpdater::Result::UPDATE_ERROR);
} else {
BaseScreen::OnUserAction(action_id);
}
}
void UpdateRequiredScreen::NetworkConnectionStateChanged(
const NetworkState* network) {
RefreshNetworkState();
}
void UpdateRequiredScreen::DefaultNetworkChanged(const NetworkState* network) {
RefreshNetworkState();
}
void UpdateRequiredScreen::RefreshNetworkState() {
if (!view_)
return;
view_->SetIsConnected(network_state_helper_->IsConnected());
}
void UpdateRequiredScreen::RefreshView(
const VersionUpdater::UpdateInfo& update_info) {
if (!view_)
return;
if (update_info.requires_permission_for_cellular) {
view_->SetUIState(UpdateRequiredView::UPDATE_NEED_PERMISSION);
waiting_for_permission_ = true;
} else if (waiting_for_permission_) {
// Return UI state after getting permission.
view_->SetUIState(UpdateRequiredView::UPDATE_PROCESS);
waiting_for_permission_ = false;
}
view_->SetUpdateProgressUnavailable(update_info.progress_unavailable);
view_->SetUpdateProgressValue(update_info.progress);
view_->SetUpdateProgressMessage(update_info.progress_message);
view_->SetEstimatedTimeLeftVisible(update_info.show_estimated_time_left);
view_->SetEstimatedTimeLeft(update_info.estimated_time_left_in_secs);
}
void UpdateRequiredScreen::SubscribeNetworkNotification() {
if (!is_network_subscribed_) {
is_network_subscribed_ = true;
NetworkHandler::Get()->network_state_handler()->AddObserver(this,
FROM_HERE);
}
}
void UpdateRequiredScreen::UnsubscribeNetworkNotification() {
if (is_network_subscribed_) {
is_network_subscribed_ = false;
NetworkHandler::Get()->network_state_handler()->RemoveObserver(this,
FROM_HERE);
}
}
void UpdateRequiredScreen::OnSelectNetworkButtonClicked() {
ash::SystemTray::Get()->ShowNetworkDetailedViewBubble(
true /* show_by_click */);
}
void UpdateRequiredScreen::OnUpdateButtonClicked() {
if (is_updating_now_)
return;
is_updating_now_ = true;
if (view_)
view_->SetUIState(UpdateRequiredView::UPDATE_PROCESS);
version_updater_->StartNetworkCheck();
}
void UpdateRequiredScreen::OnWaitForRebootTimeElapsed() {
EnsureScreenIsShown();
if (view_)
view_->SetUIState(UpdateRequiredView::UPDATE_COMPLETED_NEED_REBOOT);
}
void UpdateRequiredScreen::PrepareForUpdateCheck() {
error_message_timer_.Stop();
error_screen_->HideCaptivePortal();
connect_request_subscription_.reset();
if (version_updater_->update_info().state ==
VersionUpdater::State::STATE_ERROR)
HideErrorMessage();
}
void UpdateRequiredScreen::ShowErrorMessage() {
error_message_timer_.Stop();
is_shown_ = false;
connect_request_subscription_ = error_screen_->RegisterConnectRequestCallback(
base::BindRepeating(&UpdateRequiredScreen::OnConnectRequested,
weak_factory_.GetWeakPtr()));
error_screen_->SetUIState(NetworkError::UI_STATE_UPDATE);
error_screen_->SetParentScreen(UpdateRequiredView::kScreenId);
error_screen_->SetHideCallback(base::BindRepeating(
&UpdateRequiredScreen::OnErrorScreenHidden, weak_factory_.GetWeakPtr()));
error_screen_->SetIsPersistentError(true /* is_persistent */);
error_screen_->Show();
histogram_helper_->OnErrorShow(error_screen_->GetErrorState());
}
void UpdateRequiredScreen::UpdateErrorMessage(
const NetworkPortalDetector::CaptivePortalStatus status,
const NetworkError::ErrorState& error_state,
const std::string& network_name) {
error_screen_->SetErrorState(error_state, network_name);
if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) {
if (is_first_portal_notification_) {
is_first_portal_notification_ = false;
error_screen_->FixCaptivePortal();
}
}
}
void UpdateRequiredScreen::DelayErrorMessage() {
if (error_message_timer_.IsRunning())
return;
error_message_timer_.Start(FROM_HERE, error_message_delay_, this,
&UpdateRequiredScreen::ShowErrorMessage);
}
void UpdateRequiredScreen::SetErrorMessageDelayForTesting(
const base::TimeDelta& delay) {
error_message_delay_ = delay;
}
void UpdateRequiredScreen::UpdateInfoChanged(
const VersionUpdater::UpdateInfo& update_info) {
switch (update_info.status.current_operation()) {
case update_engine::Operation::CHECKING_FOR_UPDATE:
case update_engine::Operation::ATTEMPTING_ROLLBACK:
case update_engine::Operation::DISABLED:
case update_engine::Operation::IDLE:
break;
case update_engine::Operation::UPDATE_AVAILABLE:
case update_engine::Operation::DOWNLOADING:
case update_engine::Operation::VERIFYING:
case update_engine::Operation::FINALIZING:
case update_engine::Operation::NEED_PERMISSION_TO_UPDATE:
EnsureScreenIsShown();
break;
case update_engine::Operation::UPDATED_NEED_REBOOT:
EnsureScreenIsShown();
waiting_for_reboot_ = true;
version_updater_->RebootAfterUpdate();
break;
case update_engine::Operation::ERROR:
case update_engine::Operation::REPORTING_ERROR_EVENT:
version_updater_->StartExitUpdate(VersionUpdater::Result::UPDATE_ERROR);
break;
default:
NOTREACHED();
}
RefreshView(update_info);
}
void UpdateRequiredScreen::FinishExitUpdate(VersionUpdater::Result result) {
if (waiting_for_reboot_)
return;
is_updating_now_ = false;
if (view_)
view_->SetUIState(UpdateRequiredView::UPDATE_ERROR);
}
VersionUpdater* UpdateRequiredScreen::GetVersionUpdaterForTesting() {
return version_updater_.get();
}
void UpdateRequiredScreen::SetClockForTesting(base::Clock* clock) {
clock_ = clock;
}
void UpdateRequiredScreen::EnsureScreenIsShown() {
if (is_shown_ || !view_)
return;
is_shown_ = true;
histogram_helper_->OnScreenShow();
view_->Show();
}
void UpdateRequiredScreen::HideErrorMessage() {
error_screen_->Hide();
if (view_)
view_->Show();
histogram_helper_->OnErrorHide();
}
void UpdateRequiredScreen::OnConnectRequested() {
if (version_updater_->update_info().state ==
VersionUpdater::State::STATE_ERROR) {
LOG(WARNING) << "Hiding error message since AP was reselected";
version_updater_->StartUpdateCheck();
}
}
void UpdateRequiredScreen::OnErrorScreenHidden() {
error_screen_->SetParentScreen(OobeScreen::SCREEN_UNKNOWN);
// Return to the default state.
error_screen_->SetIsPersistentError(false /* is_persistent */);
Show();
}
} // namespace chromeos
| [
"[email protected]"
] | |
63c6f0c370760afa20e07f196694aebb86cf70f4 | 1a7b2722de0092fbee548d9d15649438e95e178c | /build-radar24-Desktop-Release/moc_qcustomplot.cpp | 704e12a0760c4833bd9c3f7e1693be86028e6cab | [] | no_license | kimphg/rasPi | f82145fc76d7b71a91bcf0e20d185db14fe2e7c5 | f16ba38e57398f9da44cad7716a8f392244926ea | refs/heads/master | 2021-07-13T19:55:14.976334 | 2020-10-30T13:54:51 | 2020-10-30T13:54:51 | 74,934,939 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 240,534 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'qcustomplot.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.11.3)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../Radar24/qcustomplot/qcustomplot.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#include <QtCore/QList>
#include <QtCore/QVector>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qcustomplot.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.11.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_QCPScatterStyle_t {
QByteArrayData data[20];
char stringdata0[209];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPScatterStyle_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPScatterStyle_t qt_meta_stringdata_QCPScatterStyle = {
{
QT_MOC_LITERAL(0, 0, 15), // "QCPScatterStyle"
QT_MOC_LITERAL(1, 16, 12), // "ScatterShape"
QT_MOC_LITERAL(2, 29, 6), // "ssNone"
QT_MOC_LITERAL(3, 36, 5), // "ssDot"
QT_MOC_LITERAL(4, 42, 7), // "ssCross"
QT_MOC_LITERAL(5, 50, 6), // "ssPlus"
QT_MOC_LITERAL(6, 57, 8), // "ssCircle"
QT_MOC_LITERAL(7, 66, 6), // "ssDisc"
QT_MOC_LITERAL(8, 73, 8), // "ssSquare"
QT_MOC_LITERAL(9, 82, 9), // "ssDiamond"
QT_MOC_LITERAL(10, 92, 6), // "ssStar"
QT_MOC_LITERAL(11, 99, 10), // "ssTriangle"
QT_MOC_LITERAL(12, 110, 18), // "ssTriangleInverted"
QT_MOC_LITERAL(13, 129, 13), // "ssCrossSquare"
QT_MOC_LITERAL(14, 143, 12), // "ssPlusSquare"
QT_MOC_LITERAL(15, 156, 13), // "ssCrossCircle"
QT_MOC_LITERAL(16, 170, 12), // "ssPlusCircle"
QT_MOC_LITERAL(17, 183, 7), // "ssPeace"
QT_MOC_LITERAL(18, 191, 8), // "ssPixmap"
QT_MOC_LITERAL(19, 200, 8) // "ssCustom"
},
"QCPScatterStyle\0ScatterShape\0ssNone\0"
"ssDot\0ssCross\0ssPlus\0ssCircle\0ssDisc\0"
"ssSquare\0ssDiamond\0ssStar\0ssTriangle\0"
"ssTriangleInverted\0ssCrossSquare\0"
"ssPlusSquare\0ssCrossCircle\0ssPlusCircle\0"
"ssPeace\0ssPixmap\0ssCustom"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPScatterStyle[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
1, 14, // enums/sets
0, 0, // constructors
4, // flags
0, // signalCount
// enums: name, flags, count, data
1, 0x0, 18, 18,
// enum data: key, value
2, uint(QCPScatterStyle::ssNone),
3, uint(QCPScatterStyle::ssDot),
4, uint(QCPScatterStyle::ssCross),
5, uint(QCPScatterStyle::ssPlus),
6, uint(QCPScatterStyle::ssCircle),
7, uint(QCPScatterStyle::ssDisc),
8, uint(QCPScatterStyle::ssSquare),
9, uint(QCPScatterStyle::ssDiamond),
10, uint(QCPScatterStyle::ssStar),
11, uint(QCPScatterStyle::ssTriangle),
12, uint(QCPScatterStyle::ssTriangleInverted),
13, uint(QCPScatterStyle::ssCrossSquare),
14, uint(QCPScatterStyle::ssPlusSquare),
15, uint(QCPScatterStyle::ssCrossCircle),
16, uint(QCPScatterStyle::ssPlusCircle),
17, uint(QCPScatterStyle::ssPeace),
18, uint(QCPScatterStyle::ssPixmap),
19, uint(QCPScatterStyle::ssCustom),
0 // eod
};
QT_INIT_METAOBJECT const QMetaObject QCPScatterStyle::staticMetaObject = {
{ nullptr, qt_meta_stringdata_QCPScatterStyle.data,
qt_meta_data_QCPScatterStyle, nullptr, nullptr, nullptr}
};
struct qt_meta_stringdata_QCPPainter_t {
QByteArrayData data[7];
char stringdata0[85];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPPainter_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPPainter_t qt_meta_stringdata_QCPPainter = {
{
QT_MOC_LITERAL(0, 0, 10), // "QCPPainter"
QT_MOC_LITERAL(1, 11, 11), // "PainterMode"
QT_MOC_LITERAL(2, 23, 9), // "pmDefault"
QT_MOC_LITERAL(3, 33, 12), // "pmVectorized"
QT_MOC_LITERAL(4, 46, 11), // "pmNoCaching"
QT_MOC_LITERAL(5, 58, 13), // "pmNonCosmetic"
QT_MOC_LITERAL(6, 72, 12) // "PainterModes"
},
"QCPPainter\0PainterMode\0pmDefault\0"
"pmVectorized\0pmNoCaching\0pmNonCosmetic\0"
"PainterModes"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPPainter[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
2, 14, // enums/sets
0, 0, // constructors
4, // flags
0, // signalCount
// enums: name, flags, count, data
1, 0x1, 4, 22,
6, 0x1, 4, 30,
// enum data: key, value
2, uint(QCPPainter::pmDefault),
3, uint(QCPPainter::pmVectorized),
4, uint(QCPPainter::pmNoCaching),
5, uint(QCPPainter::pmNonCosmetic),
2, uint(QCPPainter::pmDefault),
3, uint(QCPPainter::pmVectorized),
4, uint(QCPPainter::pmNoCaching),
5, uint(QCPPainter::pmNonCosmetic),
0 // eod
};
QT_INIT_METAOBJECT const QMetaObject QCPPainter::staticMetaObject = {
{ &QPainter::staticMetaObject, qt_meta_stringdata_QCPPainter.data,
qt_meta_data_QCPPainter, nullptr, nullptr, nullptr}
};
struct qt_meta_stringdata_QCPLayer_t {
QByteArrayData data[8];
char stringdata0[82];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayer_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayer_t qt_meta_stringdata_QCPLayer = {
{
QT_MOC_LITERAL(0, 0, 8), // "QCPLayer"
QT_MOC_LITERAL(1, 9, 10), // "parentPlot"
QT_MOC_LITERAL(2, 20, 12), // "QCustomPlot*"
QT_MOC_LITERAL(3, 33, 4), // "name"
QT_MOC_LITERAL(4, 38, 5), // "index"
QT_MOC_LITERAL(5, 44, 8), // "children"
QT_MOC_LITERAL(6, 53, 20), // "QList<QCPLayerable*>"
QT_MOC_LITERAL(7, 74, 7) // "visible"
},
"QCPLayer\0parentPlot\0QCustomPlot*\0name\0"
"index\0children\0QList<QCPLayerable*>\0"
"visible"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayer[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
5, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x00095009,
3, QMetaType::QString, 0x00095001,
4, QMetaType::Int, 0x00095001,
5, 0x80000000 | 6, 0x00095009,
7, QMetaType::Bool, 0x00095103,
0 // eod
};
void QCPLayer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCustomPlot* >(); break;
case 3:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QList<QCPLayerable*> >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPLayer *_t = static_cast<QCPLayer *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCustomPlot**>(_v) = _t->parentPlot(); break;
case 1: *reinterpret_cast< QString*>(_v) = _t->name(); break;
case 2: *reinterpret_cast< int*>(_v) = _t->index(); break;
case 3: *reinterpret_cast< QList<QCPLayerable*>*>(_v) = _t->children(); break;
case 4: *reinterpret_cast< bool*>(_v) = _t->visible(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPLayer *_t = static_cast<QCPLayer *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 4: _t->setVisible(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPLayer::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QCPLayer.data,
qt_meta_data_QCPLayer, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayer::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayer.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int QCPLayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 5;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPLayerable_t {
QByteArrayData data[13];
char stringdata0[135];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayerable_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayerable_t qt_meta_stringdata_QCPLayerable = {
{
QT_MOC_LITERAL(0, 0, 12), // "QCPLayerable"
QT_MOC_LITERAL(1, 13, 12), // "layerChanged"
QT_MOC_LITERAL(2, 26, 0), // ""
QT_MOC_LITERAL(3, 27, 9), // "QCPLayer*"
QT_MOC_LITERAL(4, 37, 8), // "newLayer"
QT_MOC_LITERAL(5, 46, 8), // "setLayer"
QT_MOC_LITERAL(6, 55, 5), // "layer"
QT_MOC_LITERAL(7, 61, 7), // "visible"
QT_MOC_LITERAL(8, 69, 10), // "parentPlot"
QT_MOC_LITERAL(9, 80, 12), // "QCustomPlot*"
QT_MOC_LITERAL(10, 93, 15), // "parentLayerable"
QT_MOC_LITERAL(11, 109, 13), // "QCPLayerable*"
QT_MOC_LITERAL(12, 123, 11) // "antialiased"
},
"QCPLayerable\0layerChanged\0\0QCPLayer*\0"
"newLayer\0setLayer\0layer\0visible\0"
"parentPlot\0QCustomPlot*\0parentLayerable\0"
"QCPLayerable*\0antialiased"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayerable[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
5, 30, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 24, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
5, 1, 27, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
// slots: parameters
QMetaType::Bool, 0x80000000 | 3, 6,
// properties: name, type, flags
7, QMetaType::Bool, 0x00095103,
8, 0x80000000 | 9, 0x00095009,
10, 0x80000000 | 11, 0x00095009,
6, 0x80000000 | 3, 0x0049510b,
12, QMetaType::Bool, 0x00095103,
// properties: notify_signal_id
0,
0,
0,
0,
0,
0 // eod
};
void QCPLayerable::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPLayerable *_t = static_cast<QCPLayerable *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->layerChanged((*reinterpret_cast< QCPLayer*(*)>(_a[1]))); break;
case 1: { bool _r = _t->setLayer((*reinterpret_cast< QCPLayer*(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
default: ;
}
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayer* >(); break;
}
break;
case 1:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayer* >(); break;
}
break;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPLayerable::*)(QCPLayer * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPLayerable::layerChanged)) {
*result = 0;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 3:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayer* >(); break;
case 2:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayerable* >(); break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCustomPlot* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPLayerable *_t = static_cast<QCPLayerable *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< bool*>(_v) = _t->visible(); break;
case 1: *reinterpret_cast< QCustomPlot**>(_v) = _t->parentPlot(); break;
case 2: *reinterpret_cast< QCPLayerable**>(_v) = _t->parentLayerable(); break;
case 3: *reinterpret_cast< QCPLayer**>(_v) = _t->layer(); break;
case 4: *reinterpret_cast< bool*>(_v) = _t->antialiased(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPLayerable *_t = static_cast<QCPLayerable *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setVisible(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setLayer(*reinterpret_cast< QCPLayer**>(_v)); break;
case 4: _t->setAntialiased(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPLayerable::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QCPLayerable.data,
qt_meta_data_QCPLayerable, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayerable::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayerable::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayerable.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int QCPLayerable::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 5;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPLayerable::layerChanged(QCPLayer * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
struct qt_meta_stringdata_QCPMarginGroup_t {
QByteArrayData data[1];
char stringdata0[15];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPMarginGroup_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPMarginGroup_t qt_meta_stringdata_QCPMarginGroup = {
{
QT_MOC_LITERAL(0, 0, 14) // "QCPMarginGroup"
},
"QCPMarginGroup"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPMarginGroup[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void QCPMarginGroup::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPMarginGroup::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QCPMarginGroup.data,
qt_meta_data_QCPMarginGroup, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPMarginGroup::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPMarginGroup::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPMarginGroup.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int QCPMarginGroup::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
return _id;
}
struct qt_meta_stringdata_QCPLayoutElement_t {
QByteArrayData data[14];
char stringdata0[151];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayoutElement_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayoutElement_t qt_meta_stringdata_QCPLayoutElement = {
{
QT_MOC_LITERAL(0, 0, 16), // "QCPLayoutElement"
QT_MOC_LITERAL(1, 17, 6), // "layout"
QT_MOC_LITERAL(2, 24, 10), // "QCPLayout*"
QT_MOC_LITERAL(3, 35, 4), // "rect"
QT_MOC_LITERAL(4, 40, 9), // "outerRect"
QT_MOC_LITERAL(5, 50, 7), // "margins"
QT_MOC_LITERAL(6, 58, 8), // "QMargins"
QT_MOC_LITERAL(7, 67, 14), // "minimumMargins"
QT_MOC_LITERAL(8, 82, 11), // "minimumSize"
QT_MOC_LITERAL(9, 94, 11), // "maximumSize"
QT_MOC_LITERAL(10, 106, 11), // "UpdatePhase"
QT_MOC_LITERAL(11, 118, 13), // "upPreparation"
QT_MOC_LITERAL(12, 132, 9), // "upMargins"
QT_MOC_LITERAL(13, 142, 8) // "upLayout"
},
"QCPLayoutElement\0layout\0QCPLayout*\0"
"rect\0outerRect\0margins\0QMargins\0"
"minimumMargins\0minimumSize\0maximumSize\0"
"UpdatePhase\0upPreparation\0upMargins\0"
"upLayout"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayoutElement[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
7, 14, // properties
1, 35, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x00095009,
3, QMetaType::QRect, 0x00095001,
4, QMetaType::QRect, 0x00095103,
5, 0x80000000 | 6, 0x0009510b,
7, 0x80000000 | 6, 0x0009510b,
8, QMetaType::QSize, 0x00095103,
9, QMetaType::QSize, 0x00095103,
// enums: name, flags, count, data
10, 0x0, 3, 39,
// enum data: key, value
11, uint(QCPLayoutElement::upPreparation),
12, uint(QCPLayoutElement::upMargins),
13, uint(QCPLayoutElement::upLayout),
0 // eod
};
void QCPLayoutElement::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayout* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPLayoutElement *_t = static_cast<QCPLayoutElement *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCPLayout**>(_v) = _t->layout(); break;
case 1: *reinterpret_cast< QRect*>(_v) = _t->rect(); break;
case 2: *reinterpret_cast< QRect*>(_v) = _t->outerRect(); break;
case 3: *reinterpret_cast< QMargins*>(_v) = _t->margins(); break;
case 4: *reinterpret_cast< QMargins*>(_v) = _t->minimumMargins(); break;
case 5: *reinterpret_cast< QSize*>(_v) = _t->minimumSize(); break;
case 6: *reinterpret_cast< QSize*>(_v) = _t->maximumSize(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPLayoutElement *_t = static_cast<QCPLayoutElement *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 2: _t->setOuterRect(*reinterpret_cast< QRect*>(_v)); break;
case 3: _t->setMargins(*reinterpret_cast< QMargins*>(_v)); break;
case 4: _t->setMinimumMargins(*reinterpret_cast< QMargins*>(_v)); break;
case 5: _t->setMinimumSize(*reinterpret_cast< QSize*>(_v)); break;
case 6: _t->setMaximumSize(*reinterpret_cast< QSize*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPLayoutElement::staticMetaObject = {
{ &QCPLayerable::staticMetaObject, qt_meta_stringdata_QCPLayoutElement.data,
qt_meta_data_QCPLayoutElement, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayoutElement::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayoutElement::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayoutElement.stringdata0))
return static_cast<void*>(this);
return QCPLayerable::qt_metacast(_clname);
}
int QCPLayoutElement::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayerable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 7;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPLayout_t {
QByteArrayData data[1];
char stringdata0[10];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayout_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayout_t qt_meta_stringdata_QCPLayout = {
{
QT_MOC_LITERAL(0, 0, 9) // "QCPLayout"
},
"QCPLayout"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayout[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void QCPLayout::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPLayout::staticMetaObject = {
{ &QCPLayoutElement::staticMetaObject, qt_meta_stringdata_QCPLayout.data,
qt_meta_data_QCPLayout, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayout::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayout::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayout.stringdata0))
return static_cast<void*>(this);
return QCPLayoutElement::qt_metacast(_clname);
}
int QCPLayout::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutElement::qt_metacall(_c, _id, _a);
return _id;
}
struct qt_meta_stringdata_QCPLayoutGrid_t {
QByteArrayData data[8];
char stringdata0[113];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayoutGrid_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayoutGrid_t qt_meta_stringdata_QCPLayoutGrid = {
{
QT_MOC_LITERAL(0, 0, 13), // "QCPLayoutGrid"
QT_MOC_LITERAL(1, 14, 8), // "rowCount"
QT_MOC_LITERAL(2, 23, 11), // "columnCount"
QT_MOC_LITERAL(3, 35, 20), // "columnStretchFactors"
QT_MOC_LITERAL(4, 56, 13), // "QList<double>"
QT_MOC_LITERAL(5, 70, 17), // "rowStretchFactors"
QT_MOC_LITERAL(6, 88, 13), // "columnSpacing"
QT_MOC_LITERAL(7, 102, 10) // "rowSpacing"
},
"QCPLayoutGrid\0rowCount\0columnCount\0"
"columnStretchFactors\0QList<double>\0"
"rowStretchFactors\0columnSpacing\0"
"rowSpacing"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayoutGrid[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
6, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::Int, 0x00095001,
2, QMetaType::Int, 0x00095001,
3, 0x80000000 | 4, 0x0009510b,
5, 0x80000000 | 4, 0x0009510b,
6, QMetaType::Int, 0x00095103,
7, QMetaType::Int, 0x00095103,
0 // eod
};
void QCPLayoutGrid::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 3:
case 2:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QList<double> >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPLayoutGrid *_t = static_cast<QCPLayoutGrid *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< int*>(_v) = _t->rowCount(); break;
case 1: *reinterpret_cast< int*>(_v) = _t->columnCount(); break;
case 2: *reinterpret_cast< QList<double>*>(_v) = _t->columnStretchFactors(); break;
case 3: *reinterpret_cast< QList<double>*>(_v) = _t->rowStretchFactors(); break;
case 4: *reinterpret_cast< int*>(_v) = _t->columnSpacing(); break;
case 5: *reinterpret_cast< int*>(_v) = _t->rowSpacing(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPLayoutGrid *_t = static_cast<QCPLayoutGrid *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 2: _t->setColumnStretchFactors(*reinterpret_cast< QList<double>*>(_v)); break;
case 3: _t->setRowStretchFactors(*reinterpret_cast< QList<double>*>(_v)); break;
case 4: _t->setColumnSpacing(*reinterpret_cast< int*>(_v)); break;
case 5: _t->setRowSpacing(*reinterpret_cast< int*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPLayoutGrid::staticMetaObject = {
{ &QCPLayout::staticMetaObject, qt_meta_stringdata_QCPLayoutGrid.data,
qt_meta_data_QCPLayoutGrid, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayoutGrid::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayoutGrid::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayoutGrid.stringdata0))
return static_cast<void*>(this);
return QCPLayout::qt_metacast(_clname);
}
int QCPLayoutGrid::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayout::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPLayoutInset_t {
QByteArrayData data[1];
char stringdata0[15];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLayoutInset_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLayoutInset_t qt_meta_stringdata_QCPLayoutInset = {
{
QT_MOC_LITERAL(0, 0, 14) // "QCPLayoutInset"
},
"QCPLayoutInset"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLayoutInset[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void QCPLayoutInset::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPLayoutInset::staticMetaObject = {
{ &QCPLayout::staticMetaObject, qt_meta_stringdata_QCPLayoutInset.data,
qt_meta_data_QCPLayoutInset, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLayoutInset::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLayoutInset::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLayoutInset.stringdata0))
return static_cast<void*>(this);
return QCPLayout::qt_metacast(_clname);
}
int QCPLayoutInset::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayout::qt_metacall(_c, _id, _a);
return _id;
}
struct qt_meta_stringdata_QCPLineEnding_t {
QByteArrayData data[12];
char stringdata0[124];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLineEnding_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLineEnding_t qt_meta_stringdata_QCPLineEnding = {
{
QT_MOC_LITERAL(0, 0, 13), // "QCPLineEnding"
QT_MOC_LITERAL(1, 14, 11), // "EndingStyle"
QT_MOC_LITERAL(2, 26, 6), // "esNone"
QT_MOC_LITERAL(3, 33, 11), // "esFlatArrow"
QT_MOC_LITERAL(4, 45, 12), // "esSpikeArrow"
QT_MOC_LITERAL(5, 58, 11), // "esLineArrow"
QT_MOC_LITERAL(6, 70, 6), // "esDisc"
QT_MOC_LITERAL(7, 77, 8), // "esSquare"
QT_MOC_LITERAL(8, 86, 9), // "esDiamond"
QT_MOC_LITERAL(9, 96, 5), // "esBar"
QT_MOC_LITERAL(10, 102, 9), // "esHalfBar"
QT_MOC_LITERAL(11, 112, 11) // "esSkewedBar"
},
"QCPLineEnding\0EndingStyle\0esNone\0"
"esFlatArrow\0esSpikeArrow\0esLineArrow\0"
"esDisc\0esSquare\0esDiamond\0esBar\0"
"esHalfBar\0esSkewedBar"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLineEnding[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
1, 14, // enums/sets
0, 0, // constructors
4, // flags
0, // signalCount
// enums: name, flags, count, data
1, 0x0, 10, 18,
// enum data: key, value
2, uint(QCPLineEnding::esNone),
3, uint(QCPLineEnding::esFlatArrow),
4, uint(QCPLineEnding::esSpikeArrow),
5, uint(QCPLineEnding::esLineArrow),
6, uint(QCPLineEnding::esDisc),
7, uint(QCPLineEnding::esSquare),
8, uint(QCPLineEnding::esDiamond),
9, uint(QCPLineEnding::esBar),
10, uint(QCPLineEnding::esHalfBar),
11, uint(QCPLineEnding::esSkewedBar),
0 // eod
};
QT_INIT_METAOBJECT const QMetaObject QCPLineEnding::staticMetaObject = {
{ nullptr, qt_meta_stringdata_QCPLineEnding.data,
qt_meta_data_QCPLineEnding, nullptr, nullptr, nullptr}
};
struct qt_meta_stringdata_QCPGrid_t {
QByteArrayData data[7];
char stringdata0[89];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPGrid_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPGrid_t qt_meta_stringdata_QCPGrid = {
{
QT_MOC_LITERAL(0, 0, 7), // "QCPGrid"
QT_MOC_LITERAL(1, 8, 14), // "subGridVisible"
QT_MOC_LITERAL(2, 23, 18), // "antialiasedSubGrid"
QT_MOC_LITERAL(3, 42, 19), // "antialiasedZeroLine"
QT_MOC_LITERAL(4, 62, 3), // "pen"
QT_MOC_LITERAL(5, 66, 10), // "subGridPen"
QT_MOC_LITERAL(6, 77, 11) // "zeroLinePen"
},
"QCPGrid\0subGridVisible\0antialiasedSubGrid\0"
"antialiasedZeroLine\0pen\0subGridPen\0"
"zeroLinePen"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPGrid[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
6, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::Bool, 0x00095103,
2, QMetaType::Bool, 0x00095103,
3, QMetaType::Bool, 0x00095103,
4, QMetaType::QPen, 0x00095103,
5, QMetaType::QPen, 0x00095103,
6, QMetaType::QPen, 0x00095103,
0 // eod
};
void QCPGrid::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPGrid *_t = static_cast<QCPGrid *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< bool*>(_v) = _t->subGridVisible(); break;
case 1: *reinterpret_cast< bool*>(_v) = _t->antialiasedSubGrid(); break;
case 2: *reinterpret_cast< bool*>(_v) = _t->antialiasedZeroLine(); break;
case 3: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 4: *reinterpret_cast< QPen*>(_v) = _t->subGridPen(); break;
case 5: *reinterpret_cast< QPen*>(_v) = _t->zeroLinePen(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPGrid *_t = static_cast<QCPGrid *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setSubGridVisible(*reinterpret_cast< bool*>(_v)); break;
case 1: _t->setAntialiasedSubGrid(*reinterpret_cast< bool*>(_v)); break;
case 2: _t->setAntialiasedZeroLine(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 4: _t->setSubGridPen(*reinterpret_cast< QPen*>(_v)); break;
case 5: _t->setZeroLinePen(*reinterpret_cast< QPen*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPGrid::staticMetaObject = {
{ &QCPLayerable::staticMetaObject, qt_meta_stringdata_QCPGrid.data,
qt_meta_data_QCPGrid, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPGrid::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPGrid::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPGrid.stringdata0))
return static_cast<void*>(this);
return QCPLayerable::qt_metacast(_clname);
}
int QCPGrid::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayerable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPAxis_t {
QByteArrayData data[97];
char stringdata0[1196];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPAxis_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPAxis_t qt_meta_stringdata_QCPAxis = {
{
QT_MOC_LITERAL(0, 0, 7), // "QCPAxis"
QT_MOC_LITERAL(1, 8, 12), // "ticksRequest"
QT_MOC_LITERAL(2, 21, 0), // ""
QT_MOC_LITERAL(3, 22, 12), // "rangeChanged"
QT_MOC_LITERAL(4, 35, 8), // "QCPRange"
QT_MOC_LITERAL(5, 44, 8), // "newRange"
QT_MOC_LITERAL(6, 53, 8), // "oldRange"
QT_MOC_LITERAL(7, 62, 16), // "scaleTypeChanged"
QT_MOC_LITERAL(8, 79, 18), // "QCPAxis::ScaleType"
QT_MOC_LITERAL(9, 98, 9), // "scaleType"
QT_MOC_LITERAL(10, 108, 16), // "selectionChanged"
QT_MOC_LITERAL(11, 125, 24), // "QCPAxis::SelectableParts"
QT_MOC_LITERAL(12, 150, 5), // "parts"
QT_MOC_LITERAL(13, 156, 17), // "selectableChanged"
QT_MOC_LITERAL(14, 174, 12), // "setScaleType"
QT_MOC_LITERAL(15, 187, 4), // "type"
QT_MOC_LITERAL(16, 192, 8), // "setRange"
QT_MOC_LITERAL(17, 201, 5), // "range"
QT_MOC_LITERAL(18, 207, 18), // "setSelectableParts"
QT_MOC_LITERAL(19, 226, 15), // "selectableParts"
QT_MOC_LITERAL(20, 242, 16), // "setSelectedParts"
QT_MOC_LITERAL(21, 259, 13), // "selectedParts"
QT_MOC_LITERAL(22, 273, 8), // "axisType"
QT_MOC_LITERAL(23, 282, 8), // "AxisType"
QT_MOC_LITERAL(24, 291, 8), // "axisRect"
QT_MOC_LITERAL(25, 300, 12), // "QCPAxisRect*"
QT_MOC_LITERAL(26, 313, 9), // "ScaleType"
QT_MOC_LITERAL(27, 323, 12), // "scaleLogBase"
QT_MOC_LITERAL(28, 336, 13), // "rangeReversed"
QT_MOC_LITERAL(29, 350, 9), // "autoTicks"
QT_MOC_LITERAL(30, 360, 13), // "autoTickCount"
QT_MOC_LITERAL(31, 374, 14), // "autoTickLabels"
QT_MOC_LITERAL(32, 389, 12), // "autoTickStep"
QT_MOC_LITERAL(33, 402, 12), // "autoSubTicks"
QT_MOC_LITERAL(34, 415, 5), // "ticks"
QT_MOC_LITERAL(35, 421, 10), // "tickLabels"
QT_MOC_LITERAL(36, 432, 16), // "tickLabelPadding"
QT_MOC_LITERAL(37, 449, 13), // "tickLabelType"
QT_MOC_LITERAL(38, 463, 9), // "LabelType"
QT_MOC_LITERAL(39, 473, 13), // "tickLabelFont"
QT_MOC_LITERAL(40, 487, 14), // "tickLabelColor"
QT_MOC_LITERAL(41, 502, 17), // "tickLabelRotation"
QT_MOC_LITERAL(42, 520, 13), // "tickLabelSide"
QT_MOC_LITERAL(43, 534, 9), // "LabelSide"
QT_MOC_LITERAL(44, 544, 14), // "dateTimeFormat"
QT_MOC_LITERAL(45, 559, 12), // "dateTimeSpec"
QT_MOC_LITERAL(46, 572, 12), // "Qt::TimeSpec"
QT_MOC_LITERAL(47, 585, 12), // "numberFormat"
QT_MOC_LITERAL(48, 598, 15), // "numberPrecision"
QT_MOC_LITERAL(49, 614, 8), // "tickStep"
QT_MOC_LITERAL(50, 623, 10), // "tickVector"
QT_MOC_LITERAL(51, 634, 15), // "QVector<double>"
QT_MOC_LITERAL(52, 650, 16), // "tickVectorLabels"
QT_MOC_LITERAL(53, 667, 16), // "QVector<QString>"
QT_MOC_LITERAL(54, 684, 12), // "tickLengthIn"
QT_MOC_LITERAL(55, 697, 13), // "tickLengthOut"
QT_MOC_LITERAL(56, 711, 12), // "subTickCount"
QT_MOC_LITERAL(57, 724, 15), // "subTickLengthIn"
QT_MOC_LITERAL(58, 740, 16), // "subTickLengthOut"
QT_MOC_LITERAL(59, 757, 7), // "basePen"
QT_MOC_LITERAL(60, 765, 7), // "tickPen"
QT_MOC_LITERAL(61, 773, 10), // "subTickPen"
QT_MOC_LITERAL(62, 784, 9), // "labelFont"
QT_MOC_LITERAL(63, 794, 10), // "labelColor"
QT_MOC_LITERAL(64, 805, 5), // "label"
QT_MOC_LITERAL(65, 811, 12), // "labelPadding"
QT_MOC_LITERAL(66, 824, 7), // "padding"
QT_MOC_LITERAL(67, 832, 6), // "offset"
QT_MOC_LITERAL(68, 839, 15), // "SelectableParts"
QT_MOC_LITERAL(69, 855, 21), // "selectedTickLabelFont"
QT_MOC_LITERAL(70, 877, 17), // "selectedLabelFont"
QT_MOC_LITERAL(71, 895, 22), // "selectedTickLabelColor"
QT_MOC_LITERAL(72, 918, 18), // "selectedLabelColor"
QT_MOC_LITERAL(73, 937, 15), // "selectedBasePen"
QT_MOC_LITERAL(74, 953, 15), // "selectedTickPen"
QT_MOC_LITERAL(75, 969, 18), // "selectedSubTickPen"
QT_MOC_LITERAL(76, 988, 11), // "lowerEnding"
QT_MOC_LITERAL(77, 1000, 13), // "QCPLineEnding"
QT_MOC_LITERAL(78, 1014, 11), // "upperEnding"
QT_MOC_LITERAL(79, 1026, 4), // "grid"
QT_MOC_LITERAL(80, 1031, 8), // "QCPGrid*"
QT_MOC_LITERAL(81, 1040, 6), // "atLeft"
QT_MOC_LITERAL(82, 1047, 7), // "atRight"
QT_MOC_LITERAL(83, 1055, 5), // "atTop"
QT_MOC_LITERAL(84, 1061, 8), // "atBottom"
QT_MOC_LITERAL(85, 1070, 9), // "AxisTypes"
QT_MOC_LITERAL(86, 1080, 8), // "ltNumber"
QT_MOC_LITERAL(87, 1089, 10), // "ltDateTime"
QT_MOC_LITERAL(88, 1100, 8), // "lsInside"
QT_MOC_LITERAL(89, 1109, 9), // "lsOutside"
QT_MOC_LITERAL(90, 1119, 8), // "stLinear"
QT_MOC_LITERAL(91, 1128, 13), // "stLogarithmic"
QT_MOC_LITERAL(92, 1142, 14), // "SelectablePart"
QT_MOC_LITERAL(93, 1157, 6), // "spNone"
QT_MOC_LITERAL(94, 1164, 6), // "spAxis"
QT_MOC_LITERAL(95, 1171, 12), // "spTickLabels"
QT_MOC_LITERAL(96, 1184, 11) // "spAxisLabel"
},
"QCPAxis\0ticksRequest\0\0rangeChanged\0"
"QCPRange\0newRange\0oldRange\0scaleTypeChanged\0"
"QCPAxis::ScaleType\0scaleType\0"
"selectionChanged\0QCPAxis::SelectableParts\0"
"parts\0selectableChanged\0setScaleType\0"
"type\0setRange\0range\0setSelectableParts\0"
"selectableParts\0setSelectedParts\0"
"selectedParts\0axisType\0AxisType\0"
"axisRect\0QCPAxisRect*\0ScaleType\0"
"scaleLogBase\0rangeReversed\0autoTicks\0"
"autoTickCount\0autoTickLabels\0autoTickStep\0"
"autoSubTicks\0ticks\0tickLabels\0"
"tickLabelPadding\0tickLabelType\0LabelType\0"
"tickLabelFont\0tickLabelColor\0"
"tickLabelRotation\0tickLabelSide\0"
"LabelSide\0dateTimeFormat\0dateTimeSpec\0"
"Qt::TimeSpec\0numberFormat\0numberPrecision\0"
"tickStep\0tickVector\0QVector<double>\0"
"tickVectorLabels\0QVector<QString>\0"
"tickLengthIn\0tickLengthOut\0subTickCount\0"
"subTickLengthIn\0subTickLengthOut\0"
"basePen\0tickPen\0subTickPen\0labelFont\0"
"labelColor\0label\0labelPadding\0padding\0"
"offset\0SelectableParts\0selectedTickLabelFont\0"
"selectedLabelFont\0selectedTickLabelColor\0"
"selectedLabelColor\0selectedBasePen\0"
"selectedTickPen\0selectedSubTickPen\0"
"lowerEnding\0QCPLineEnding\0upperEnding\0"
"grid\0QCPGrid*\0atLeft\0atRight\0atTop\0"
"atBottom\0AxisTypes\0ltNumber\0ltDateTime\0"
"lsInside\0lsOutside\0stLinear\0stLogarithmic\0"
"SelectablePart\0spNone\0spAxis\0spTickLabels\0"
"spAxisLabel"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPAxis[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
10, 14, // methods
52, 94, // properties
7, 302, // enums/sets
0, 0, // constructors
0, // flags
6, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 64, 2, 0x06 /* Public */,
3, 1, 65, 2, 0x06 /* Public */,
3, 2, 68, 2, 0x06 /* Public */,
7, 1, 73, 2, 0x06 /* Public */,
10, 1, 76, 2, 0x06 /* Public */,
13, 1, 79, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
14, 1, 82, 2, 0x0a /* Public */,
16, 1, 85, 2, 0x0a /* Public */,
18, 1, 88, 2, 0x0a /* Public */,
20, 1, 91, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void,
QMetaType::Void, 0x80000000 | 4, 5,
QMetaType::Void, 0x80000000 | 4, 0x80000000 | 4, 5, 6,
QMetaType::Void, 0x80000000 | 8, 9,
QMetaType::Void, 0x80000000 | 11, 12,
QMetaType::Void, 0x80000000 | 11, 12,
// slots: parameters
QMetaType::Void, 0x80000000 | 8, 15,
QMetaType::Void, 0x80000000 | 4, 17,
QMetaType::Void, 0x80000000 | 11, 19,
QMetaType::Void, 0x80000000 | 11, 21,
// properties: name, type, flags
22, 0x80000000 | 23, 0x00095009,
24, 0x80000000 | 25, 0x00095009,
9, 0x80000000 | 26, 0x0049510b,
27, QMetaType::Double, 0x00095103,
17, 0x80000000 | 4, 0x0049510b,
28, QMetaType::Bool, 0x00095103,
29, QMetaType::Bool, 0x00095103,
30, QMetaType::Int, 0x00095103,
31, QMetaType::Bool, 0x00095103,
32, QMetaType::Bool, 0x00095103,
33, QMetaType::Bool, 0x00095103,
34, QMetaType::Bool, 0x00095103,
35, QMetaType::Bool, 0x00095103,
36, QMetaType::Int, 0x00095103,
37, 0x80000000 | 38, 0x0009510b,
39, QMetaType::QFont, 0x00095103,
40, QMetaType::QColor, 0x00095103,
41, QMetaType::Double, 0x00095103,
42, 0x80000000 | 43, 0x0009510b,
44, QMetaType::QString, 0x00095103,
45, 0x80000000 | 46, 0x0009510b,
47, QMetaType::QString, 0x00095103,
48, QMetaType::Int, 0x00095103,
49, QMetaType::Double, 0x00095103,
50, 0x80000000 | 51, 0x0009510b,
52, 0x80000000 | 53, 0x0009510b,
54, QMetaType::Int, 0x00095103,
55, QMetaType::Int, 0x00095103,
56, QMetaType::Int, 0x00095103,
57, QMetaType::Int, 0x00095103,
58, QMetaType::Int, 0x00095103,
59, QMetaType::QPen, 0x00095103,
60, QMetaType::QPen, 0x00095103,
61, QMetaType::QPen, 0x00095103,
62, QMetaType::QFont, 0x00095103,
63, QMetaType::QColor, 0x00095103,
64, QMetaType::QString, 0x00095103,
65, QMetaType::Int, 0x00095103,
66, QMetaType::Int, 0x00095103,
67, QMetaType::Int, 0x00095103,
21, 0x80000000 | 68, 0x0049510b,
19, 0x80000000 | 68, 0x0049510b,
69, QMetaType::QFont, 0x00095103,
70, QMetaType::QFont, 0x00095103,
71, QMetaType::QColor, 0x00095103,
72, QMetaType::QColor, 0x00095103,
73, QMetaType::QPen, 0x00095103,
74, QMetaType::QPen, 0x00095103,
75, QMetaType::QPen, 0x00095103,
76, 0x80000000 | 77, 0x0009510b,
78, 0x80000000 | 77, 0x0009510b,
79, 0x80000000 | 80, 0x00095009,
// properties: notify_signal_id
0,
0,
3,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
// enums: name, flags, count, data
23, 0x1, 4, 330,
85, 0x1, 4, 338,
38, 0x0, 2, 346,
43, 0x0, 2, 350,
26, 0x0, 2, 354,
92, 0x1, 4, 358,
68, 0x1, 4, 366,
// enum data: key, value
81, uint(QCPAxis::atLeft),
82, uint(QCPAxis::atRight),
83, uint(QCPAxis::atTop),
84, uint(QCPAxis::atBottom),
81, uint(QCPAxis::atLeft),
82, uint(QCPAxis::atRight),
83, uint(QCPAxis::atTop),
84, uint(QCPAxis::atBottom),
86, uint(QCPAxis::ltNumber),
87, uint(QCPAxis::ltDateTime),
88, uint(QCPAxis::lsInside),
89, uint(QCPAxis::lsOutside),
90, uint(QCPAxis::stLinear),
91, uint(QCPAxis::stLogarithmic),
93, uint(QCPAxis::spNone),
94, uint(QCPAxis::spAxis),
95, uint(QCPAxis::spTickLabels),
96, uint(QCPAxis::spAxisLabel),
93, uint(QCPAxis::spNone),
94, uint(QCPAxis::spAxis),
95, uint(QCPAxis::spTickLabels),
96, uint(QCPAxis::spAxisLabel),
0 // eod
};
void QCPAxis::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPAxis *_t = static_cast<QCPAxis *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->ticksRequest(); break;
case 1: _t->rangeChanged((*reinterpret_cast< const QCPRange(*)>(_a[1]))); break;
case 2: _t->rangeChanged((*reinterpret_cast< const QCPRange(*)>(_a[1])),(*reinterpret_cast< const QCPRange(*)>(_a[2]))); break;
case 3: _t->scaleTypeChanged((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 4: _t->selectionChanged((*reinterpret_cast< const QCPAxis::SelectableParts(*)>(_a[1]))); break;
case 5: _t->selectableChanged((*reinterpret_cast< const QCPAxis::SelectableParts(*)>(_a[1]))); break;
case 6: _t->setScaleType((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 7: _t->setRange((*reinterpret_cast< const QCPRange(*)>(_a[1]))); break;
case 8: _t->setSelectableParts((*reinterpret_cast< const QCPAxis::SelectableParts(*)>(_a[1]))); break;
case 9: _t->setSelectedParts((*reinterpret_cast< const QCPAxis::SelectableParts(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPAxis::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::ticksRequest)) {
*result = 0;
return;
}
}
{
using _t = void (QCPAxis::*)(const QCPRange & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::rangeChanged)) {
*result = 1;
return;
}
}
{
using _t = void (QCPAxis::*)(const QCPRange & , const QCPRange & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::rangeChanged)) {
*result = 2;
return;
}
}
{
using _t = void (QCPAxis::*)(QCPAxis::ScaleType );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::scaleTypeChanged)) {
*result = 3;
return;
}
}
{
using _t = void (QCPAxis::*)(const QCPAxis::SelectableParts & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::selectionChanged)) {
*result = 4;
return;
}
}
{
using _t = void (QCPAxis::*)(const QCPAxis::SelectableParts & );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAxis::selectableChanged)) {
*result = 5;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxisRect* >(); break;
case 51:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPGrid* >(); break;
case 25:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<QString> >(); break;
case 24:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<double> >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPAxis *_t = static_cast<QCPAxis *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast<int*>(_v) = QFlag(_t->axisType()); break;
case 1: *reinterpret_cast< QCPAxisRect**>(_v) = _t->axisRect(); break;
case 2: *reinterpret_cast< ScaleType*>(_v) = _t->scaleType(); break;
case 3: *reinterpret_cast< double*>(_v) = _t->scaleLogBase(); break;
case 4: *reinterpret_cast< QCPRange*>(_v) = _t->range(); break;
case 5: *reinterpret_cast< bool*>(_v) = _t->rangeReversed(); break;
case 6: *reinterpret_cast< bool*>(_v) = _t->autoTicks(); break;
case 7: *reinterpret_cast< int*>(_v) = _t->autoTickCount(); break;
case 8: *reinterpret_cast< bool*>(_v) = _t->autoTickLabels(); break;
case 9: *reinterpret_cast< bool*>(_v) = _t->autoTickStep(); break;
case 10: *reinterpret_cast< bool*>(_v) = _t->autoSubTicks(); break;
case 11: *reinterpret_cast< bool*>(_v) = _t->ticks(); break;
case 12: *reinterpret_cast< bool*>(_v) = _t->tickLabels(); break;
case 13: *reinterpret_cast< int*>(_v) = _t->tickLabelPadding(); break;
case 14: *reinterpret_cast< LabelType*>(_v) = _t->tickLabelType(); break;
case 15: *reinterpret_cast< QFont*>(_v) = _t->tickLabelFont(); break;
case 16: *reinterpret_cast< QColor*>(_v) = _t->tickLabelColor(); break;
case 17: *reinterpret_cast< double*>(_v) = _t->tickLabelRotation(); break;
case 18: *reinterpret_cast< LabelSide*>(_v) = _t->tickLabelSide(); break;
case 19: *reinterpret_cast< QString*>(_v) = _t->dateTimeFormat(); break;
case 20: *reinterpret_cast< Qt::TimeSpec*>(_v) = _t->dateTimeSpec(); break;
case 21: *reinterpret_cast< QString*>(_v) = _t->numberFormat(); break;
case 22: *reinterpret_cast< int*>(_v) = _t->numberPrecision(); break;
case 23: *reinterpret_cast< double*>(_v) = _t->tickStep(); break;
case 24: *reinterpret_cast< QVector<double>*>(_v) = _t->tickVector(); break;
case 25: *reinterpret_cast< QVector<QString>*>(_v) = _t->tickVectorLabels(); break;
case 26: *reinterpret_cast< int*>(_v) = _t->tickLengthIn(); break;
case 27: *reinterpret_cast< int*>(_v) = _t->tickLengthOut(); break;
case 28: *reinterpret_cast< int*>(_v) = _t->subTickCount(); break;
case 29: *reinterpret_cast< int*>(_v) = _t->subTickLengthIn(); break;
case 30: *reinterpret_cast< int*>(_v) = _t->subTickLengthOut(); break;
case 31: *reinterpret_cast< QPen*>(_v) = _t->basePen(); break;
case 32: *reinterpret_cast< QPen*>(_v) = _t->tickPen(); break;
case 33: *reinterpret_cast< QPen*>(_v) = _t->subTickPen(); break;
case 34: *reinterpret_cast< QFont*>(_v) = _t->labelFont(); break;
case 35: *reinterpret_cast< QColor*>(_v) = _t->labelColor(); break;
case 36: *reinterpret_cast< QString*>(_v) = _t->label(); break;
case 37: *reinterpret_cast< int*>(_v) = _t->labelPadding(); break;
case 38: *reinterpret_cast< int*>(_v) = _t->padding(); break;
case 39: *reinterpret_cast< int*>(_v) = _t->offset(); break;
case 40: *reinterpret_cast<int*>(_v) = QFlag(_t->selectedParts()); break;
case 41: *reinterpret_cast<int*>(_v) = QFlag(_t->selectableParts()); break;
case 42: *reinterpret_cast< QFont*>(_v) = _t->selectedTickLabelFont(); break;
case 43: *reinterpret_cast< QFont*>(_v) = _t->selectedLabelFont(); break;
case 44: *reinterpret_cast< QColor*>(_v) = _t->selectedTickLabelColor(); break;
case 45: *reinterpret_cast< QColor*>(_v) = _t->selectedLabelColor(); break;
case 46: *reinterpret_cast< QPen*>(_v) = _t->selectedBasePen(); break;
case 47: *reinterpret_cast< QPen*>(_v) = _t->selectedTickPen(); break;
case 48: *reinterpret_cast< QPen*>(_v) = _t->selectedSubTickPen(); break;
case 49: *reinterpret_cast< QCPLineEnding*>(_v) = _t->lowerEnding(); break;
case 50: *reinterpret_cast< QCPLineEnding*>(_v) = _t->upperEnding(); break;
case 51: *reinterpret_cast< QCPGrid**>(_v) = _t->grid(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPAxis *_t = static_cast<QCPAxis *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 2: _t->setScaleType(*reinterpret_cast< ScaleType*>(_v)); break;
case 3: _t->setScaleLogBase(*reinterpret_cast< double*>(_v)); break;
case 4: _t->setRange(*reinterpret_cast< QCPRange*>(_v)); break;
case 5: _t->setRangeReversed(*reinterpret_cast< bool*>(_v)); break;
case 6: _t->setAutoTicks(*reinterpret_cast< bool*>(_v)); break;
case 7: _t->setAutoTickCount(*reinterpret_cast< int*>(_v)); break;
case 8: _t->setAutoTickLabels(*reinterpret_cast< bool*>(_v)); break;
case 9: _t->setAutoTickStep(*reinterpret_cast< bool*>(_v)); break;
case 10: _t->setAutoSubTicks(*reinterpret_cast< bool*>(_v)); break;
case 11: _t->setTicks(*reinterpret_cast< bool*>(_v)); break;
case 12: _t->setTickLabels(*reinterpret_cast< bool*>(_v)); break;
case 13: _t->setTickLabelPadding(*reinterpret_cast< int*>(_v)); break;
case 14: _t->setTickLabelType(*reinterpret_cast< LabelType*>(_v)); break;
case 15: _t->setTickLabelFont(*reinterpret_cast< QFont*>(_v)); break;
case 16: _t->setTickLabelColor(*reinterpret_cast< QColor*>(_v)); break;
case 17: _t->setTickLabelRotation(*reinterpret_cast< double*>(_v)); break;
case 18: _t->setTickLabelSide(*reinterpret_cast< LabelSide*>(_v)); break;
case 19: _t->setDateTimeFormat(*reinterpret_cast< QString*>(_v)); break;
case 20: _t->setDateTimeSpec(*reinterpret_cast< Qt::TimeSpec*>(_v)); break;
case 21: _t->setNumberFormat(*reinterpret_cast< QString*>(_v)); break;
case 22: _t->setNumberPrecision(*reinterpret_cast< int*>(_v)); break;
case 23: _t->setTickStep(*reinterpret_cast< double*>(_v)); break;
case 24: _t->setTickVector(*reinterpret_cast< QVector<double>*>(_v)); break;
case 25: _t->setTickVectorLabels(*reinterpret_cast< QVector<QString>*>(_v)); break;
case 26: _t->setTickLengthIn(*reinterpret_cast< int*>(_v)); break;
case 27: _t->setTickLengthOut(*reinterpret_cast< int*>(_v)); break;
case 28: _t->setSubTickCount(*reinterpret_cast< int*>(_v)); break;
case 29: _t->setSubTickLengthIn(*reinterpret_cast< int*>(_v)); break;
case 30: _t->setSubTickLengthOut(*reinterpret_cast< int*>(_v)); break;
case 31: _t->setBasePen(*reinterpret_cast< QPen*>(_v)); break;
case 32: _t->setTickPen(*reinterpret_cast< QPen*>(_v)); break;
case 33: _t->setSubTickPen(*reinterpret_cast< QPen*>(_v)); break;
case 34: _t->setLabelFont(*reinterpret_cast< QFont*>(_v)); break;
case 35: _t->setLabelColor(*reinterpret_cast< QColor*>(_v)); break;
case 36: _t->setLabel(*reinterpret_cast< QString*>(_v)); break;
case 37: _t->setLabelPadding(*reinterpret_cast< int*>(_v)); break;
case 38: _t->setPadding(*reinterpret_cast< int*>(_v)); break;
case 39: _t->setOffset(*reinterpret_cast< int*>(_v)); break;
case 40: _t->setSelectedParts(QFlag(*reinterpret_cast<int*>(_v))); break;
case 41: _t->setSelectableParts(QFlag(*reinterpret_cast<int*>(_v))); break;
case 42: _t->setSelectedTickLabelFont(*reinterpret_cast< QFont*>(_v)); break;
case 43: _t->setSelectedLabelFont(*reinterpret_cast< QFont*>(_v)); break;
case 44: _t->setSelectedTickLabelColor(*reinterpret_cast< QColor*>(_v)); break;
case 45: _t->setSelectedLabelColor(*reinterpret_cast< QColor*>(_v)); break;
case 46: _t->setSelectedBasePen(*reinterpret_cast< QPen*>(_v)); break;
case 47: _t->setSelectedTickPen(*reinterpret_cast< QPen*>(_v)); break;
case 48: _t->setSelectedSubTickPen(*reinterpret_cast< QPen*>(_v)); break;
case 49: _t->setLowerEnding(*reinterpret_cast< QCPLineEnding*>(_v)); break;
case 50: _t->setUpperEnding(*reinterpret_cast< QCPLineEnding*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPAxis::staticMetaObject = {
{ &QCPLayerable::staticMetaObject, qt_meta_stringdata_QCPAxis.data,
qt_meta_data_QCPAxis, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPAxis::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPAxis::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPAxis.stringdata0))
return static_cast<void*>(this);
return QCPLayerable::qt_metacast(_clname);
}
int QCPAxis::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayerable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 10)
qt_static_metacall(this, _c, _id, _a);
_id -= 10;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 10)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 10;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 52;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 52;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 52;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 52;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 52;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 52;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPAxis::ticksRequest()
{
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
}
// SIGNAL 1
void QCPAxis::rangeChanged(const QCPRange & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
// SIGNAL 2
void QCPAxis::rangeChanged(const QCPRange & _t1, const QCPRange & _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
// SIGNAL 3
void QCPAxis::scaleTypeChanged(QCPAxis::ScaleType _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 3, _a);
}
// SIGNAL 4
void QCPAxis::selectionChanged(const QCPAxis::SelectableParts & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 4, _a);
}
// SIGNAL 5
void QCPAxis::selectableChanged(const QCPAxis::SelectableParts & _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 5, _a);
}
struct qt_meta_stringdata_QCPAbstractPlottable_t {
QByteArrayData data[19];
char stringdata0[228];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPAbstractPlottable_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPAbstractPlottable_t qt_meta_stringdata_QCPAbstractPlottable = {
{
QT_MOC_LITERAL(0, 0, 20), // "QCPAbstractPlottable"
QT_MOC_LITERAL(1, 21, 16), // "selectionChanged"
QT_MOC_LITERAL(2, 38, 0), // ""
QT_MOC_LITERAL(3, 39, 8), // "selected"
QT_MOC_LITERAL(4, 48, 17), // "selectableChanged"
QT_MOC_LITERAL(5, 66, 10), // "selectable"
QT_MOC_LITERAL(6, 77, 13), // "setSelectable"
QT_MOC_LITERAL(7, 91, 11), // "setSelected"
QT_MOC_LITERAL(8, 103, 4), // "name"
QT_MOC_LITERAL(9, 108, 15), // "antialiasedFill"
QT_MOC_LITERAL(10, 124, 19), // "antialiasedScatters"
QT_MOC_LITERAL(11, 144, 20), // "antialiasedErrorBars"
QT_MOC_LITERAL(12, 165, 3), // "pen"
QT_MOC_LITERAL(13, 169, 11), // "selectedPen"
QT_MOC_LITERAL(14, 181, 5), // "brush"
QT_MOC_LITERAL(15, 187, 13), // "selectedBrush"
QT_MOC_LITERAL(16, 201, 7), // "keyAxis"
QT_MOC_LITERAL(17, 209, 8), // "QCPAxis*"
QT_MOC_LITERAL(18, 218, 9) // "valueAxis"
},
"QCPAbstractPlottable\0selectionChanged\0"
"\0selected\0selectableChanged\0selectable\0"
"setSelectable\0setSelected\0name\0"
"antialiasedFill\0antialiasedScatters\0"
"antialiasedErrorBars\0pen\0selectedPen\0"
"brush\0selectedBrush\0keyAxis\0QCPAxis*\0"
"valueAxis"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPAbstractPlottable[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
12, 46, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
4, 1, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 1, 40, 2, 0x0a /* Public */,
7, 1, 43, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, QMetaType::Bool, 3,
QMetaType::Void, QMetaType::Bool, 5,
// slots: parameters
QMetaType::Void, QMetaType::Bool, 5,
QMetaType::Void, QMetaType::Bool, 3,
// properties: name, type, flags
8, QMetaType::QString, 0x00095103,
9, QMetaType::Bool, 0x00095103,
10, QMetaType::Bool, 0x00095103,
11, QMetaType::Bool, 0x00095103,
12, QMetaType::QPen, 0x00095103,
13, QMetaType::QPen, 0x00095103,
14, QMetaType::QBrush, 0x00095103,
15, QMetaType::QBrush, 0x00095103,
16, 0x80000000 | 17, 0x0009510b,
18, 0x80000000 | 17, 0x0009510b,
5, QMetaType::Bool, 0x00495103,
3, QMetaType::Bool, 0x00495103,
// properties: notify_signal_id
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0 // eod
};
void QCPAbstractPlottable::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPAbstractPlottable *_t = static_cast<QCPAbstractPlottable *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->selectionChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 1: _t->selectableChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 2: _t->setSelectable((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->setSelected((*reinterpret_cast< bool(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPAbstractPlottable::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractPlottable::selectionChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPAbstractPlottable::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractPlottable::selectableChanged)) {
*result = 1;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 9:
case 8:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxis* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPAbstractPlottable *_t = static_cast<QCPAbstractPlottable *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = _t->name(); break;
case 1: *reinterpret_cast< bool*>(_v) = _t->antialiasedFill(); break;
case 2: *reinterpret_cast< bool*>(_v) = _t->antialiasedScatters(); break;
case 3: *reinterpret_cast< bool*>(_v) = _t->antialiasedErrorBars(); break;
case 4: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 5: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 6: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 7: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
case 8: *reinterpret_cast< QCPAxis**>(_v) = _t->keyAxis(); break;
case 9: *reinterpret_cast< QCPAxis**>(_v) = _t->valueAxis(); break;
case 10: *reinterpret_cast< bool*>(_v) = _t->selectable(); break;
case 11: *reinterpret_cast< bool*>(_v) = _t->selected(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPAbstractPlottable *_t = static_cast<QCPAbstractPlottable *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setName(*reinterpret_cast< QString*>(_v)); break;
case 1: _t->setAntialiasedFill(*reinterpret_cast< bool*>(_v)); break;
case 2: _t->setAntialiasedScatters(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setAntialiasedErrorBars(*reinterpret_cast< bool*>(_v)); break;
case 4: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 5: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 6: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 7: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 8: _t->setKeyAxis(*reinterpret_cast< QCPAxis**>(_v)); break;
case 9: _t->setValueAxis(*reinterpret_cast< QCPAxis**>(_v)); break;
case 10: _t->setSelectable(*reinterpret_cast< bool*>(_v)); break;
case 11: _t->setSelected(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPAbstractPlottable::staticMetaObject = {
{ &QCPLayerable::staticMetaObject, qt_meta_stringdata_QCPAbstractPlottable.data,
qt_meta_data_QCPAbstractPlottable, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPAbstractPlottable::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPAbstractPlottable::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPAbstractPlottable.stringdata0))
return static_cast<void*>(this);
return QCPLayerable::qt_metacast(_clname);
}
int QCPAbstractPlottable::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayerable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 12;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPAbstractPlottable::selectionChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPAbstractPlottable::selectableChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_QCPAbstractItem_t {
QByteArrayData data[11];
char stringdata0[139];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPAbstractItem_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPAbstractItem_t qt_meta_stringdata_QCPAbstractItem = {
{
QT_MOC_LITERAL(0, 0, 15), // "QCPAbstractItem"
QT_MOC_LITERAL(1, 16, 16), // "selectionChanged"
QT_MOC_LITERAL(2, 33, 0), // ""
QT_MOC_LITERAL(3, 34, 8), // "selected"
QT_MOC_LITERAL(4, 43, 17), // "selectableChanged"
QT_MOC_LITERAL(5, 61, 10), // "selectable"
QT_MOC_LITERAL(6, 72, 13), // "setSelectable"
QT_MOC_LITERAL(7, 86, 11), // "setSelected"
QT_MOC_LITERAL(8, 98, 14), // "clipToAxisRect"
QT_MOC_LITERAL(9, 113, 12), // "clipAxisRect"
QT_MOC_LITERAL(10, 126, 12) // "QCPAxisRect*"
},
"QCPAbstractItem\0selectionChanged\0\0"
"selected\0selectableChanged\0selectable\0"
"setSelectable\0setSelected\0clipToAxisRect\0"
"clipAxisRect\0QCPAxisRect*"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPAbstractItem[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
4, 46, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
4, 1, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 1, 40, 2, 0x0a /* Public */,
7, 1, 43, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, QMetaType::Bool, 3,
QMetaType::Void, QMetaType::Bool, 5,
// slots: parameters
QMetaType::Void, QMetaType::Bool, 5,
QMetaType::Void, QMetaType::Bool, 3,
// properties: name, type, flags
8, QMetaType::Bool, 0x00095103,
9, 0x80000000 | 10, 0x0009510b,
5, QMetaType::Bool, 0x00495103,
3, QMetaType::Bool, 0x00495103,
// properties: notify_signal_id
0,
0,
1,
0,
0 // eod
};
void QCPAbstractItem::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPAbstractItem *_t = static_cast<QCPAbstractItem *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->selectionChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 1: _t->selectableChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 2: _t->setSelectable((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->setSelected((*reinterpret_cast< bool(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPAbstractItem::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractItem::selectionChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPAbstractItem::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractItem::selectableChanged)) {
*result = 1;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxisRect* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPAbstractItem *_t = static_cast<QCPAbstractItem *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< bool*>(_v) = _t->clipToAxisRect(); break;
case 1: *reinterpret_cast< QCPAxisRect**>(_v) = _t->clipAxisRect(); break;
case 2: *reinterpret_cast< bool*>(_v) = _t->selectable(); break;
case 3: *reinterpret_cast< bool*>(_v) = _t->selected(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPAbstractItem *_t = static_cast<QCPAbstractItem *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setClipToAxisRect(*reinterpret_cast< bool*>(_v)); break;
case 1: _t->setClipAxisRect(*reinterpret_cast< QCPAxisRect**>(_v)); break;
case 2: _t->setSelectable(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setSelected(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPAbstractItem::staticMetaObject = {
{ &QCPLayerable::staticMetaObject, qt_meta_stringdata_QCPAbstractItem.data,
qt_meta_data_QCPAbstractItem, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPAbstractItem::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPAbstractItem::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPAbstractItem.stringdata0))
return static_cast<void*>(this);
return QCPLayerable::qt_metacast(_clname);
}
int QCPAbstractItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayerable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPAbstractItem::selectionChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPAbstractItem::selectableChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_QCustomPlot_t {
QByteArrayData data[57];
char stringdata0[801];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCustomPlot_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCustomPlot_t qt_meta_stringdata_QCustomPlot = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCustomPlot"
QT_MOC_LITERAL(1, 12, 16), // "mouseDoubleClick"
QT_MOC_LITERAL(2, 29, 0), // ""
QT_MOC_LITERAL(3, 30, 12), // "QMouseEvent*"
QT_MOC_LITERAL(4, 43, 5), // "event"
QT_MOC_LITERAL(5, 49, 10), // "mousePress"
QT_MOC_LITERAL(6, 60, 9), // "mouseMove"
QT_MOC_LITERAL(7, 70, 12), // "mouseRelease"
QT_MOC_LITERAL(8, 83, 10), // "mouseWheel"
QT_MOC_LITERAL(9, 94, 12), // "QWheelEvent*"
QT_MOC_LITERAL(10, 107, 14), // "plottableClick"
QT_MOC_LITERAL(11, 122, 21), // "QCPAbstractPlottable*"
QT_MOC_LITERAL(12, 144, 9), // "plottable"
QT_MOC_LITERAL(13, 154, 20), // "plottableDoubleClick"
QT_MOC_LITERAL(14, 175, 9), // "itemClick"
QT_MOC_LITERAL(15, 185, 16), // "QCPAbstractItem*"
QT_MOC_LITERAL(16, 202, 4), // "item"
QT_MOC_LITERAL(17, 207, 15), // "itemDoubleClick"
QT_MOC_LITERAL(18, 223, 9), // "axisClick"
QT_MOC_LITERAL(19, 233, 8), // "QCPAxis*"
QT_MOC_LITERAL(20, 242, 4), // "axis"
QT_MOC_LITERAL(21, 247, 23), // "QCPAxis::SelectablePart"
QT_MOC_LITERAL(22, 271, 4), // "part"
QT_MOC_LITERAL(23, 276, 15), // "axisDoubleClick"
QT_MOC_LITERAL(24, 292, 11), // "legendClick"
QT_MOC_LITERAL(25, 304, 10), // "QCPLegend*"
QT_MOC_LITERAL(26, 315, 6), // "legend"
QT_MOC_LITERAL(27, 322, 22), // "QCPAbstractLegendItem*"
QT_MOC_LITERAL(28, 345, 17), // "legendDoubleClick"
QT_MOC_LITERAL(29, 363, 10), // "titleClick"
QT_MOC_LITERAL(30, 374, 13), // "QCPPlotTitle*"
QT_MOC_LITERAL(31, 388, 5), // "title"
QT_MOC_LITERAL(32, 394, 16), // "titleDoubleClick"
QT_MOC_LITERAL(33, 411, 22), // "selectionChangedByUser"
QT_MOC_LITERAL(34, 434, 12), // "beforeReplot"
QT_MOC_LITERAL(35, 447, 11), // "afterReplot"
QT_MOC_LITERAL(36, 459, 11), // "rescaleAxes"
QT_MOC_LITERAL(37, 471, 21), // "onlyVisiblePlottables"
QT_MOC_LITERAL(38, 493, 11), // "deselectAll"
QT_MOC_LITERAL(39, 505, 6), // "replot"
QT_MOC_LITERAL(40, 512, 28), // "QCustomPlot::RefreshPriority"
QT_MOC_LITERAL(41, 541, 15), // "refreshPriority"
QT_MOC_LITERAL(42, 557, 8), // "viewport"
QT_MOC_LITERAL(43, 566, 10), // "background"
QT_MOC_LITERAL(44, 577, 16), // "backgroundScaled"
QT_MOC_LITERAL(45, 594, 20), // "backgroundScaledMode"
QT_MOC_LITERAL(46, 615, 19), // "Qt::AspectRatioMode"
QT_MOC_LITERAL(47, 635, 10), // "plotLayout"
QT_MOC_LITERAL(48, 646, 14), // "QCPLayoutGrid*"
QT_MOC_LITERAL(49, 661, 24), // "autoAddPlottableToLegend"
QT_MOC_LITERAL(50, 686, 18), // "selectionTolerance"
QT_MOC_LITERAL(51, 705, 20), // "noAntialiasingOnDrag"
QT_MOC_LITERAL(52, 726, 19), // "multiSelectModifier"
QT_MOC_LITERAL(53, 746, 20), // "Qt::KeyboardModifier"
QT_MOC_LITERAL(54, 767, 15), // "LayerInsertMode"
QT_MOC_LITERAL(55, 783, 8), // "limBelow"
QT_MOC_LITERAL(56, 792, 8) // "limAbove"
},
"QCustomPlot\0mouseDoubleClick\0\0"
"QMouseEvent*\0event\0mousePress\0mouseMove\0"
"mouseRelease\0mouseWheel\0QWheelEvent*\0"
"plottableClick\0QCPAbstractPlottable*\0"
"plottable\0plottableDoubleClick\0itemClick\0"
"QCPAbstractItem*\0item\0itemDoubleClick\0"
"axisClick\0QCPAxis*\0axis\0QCPAxis::SelectablePart\0"
"part\0axisDoubleClick\0legendClick\0"
"QCPLegend*\0legend\0QCPAbstractLegendItem*\0"
"legendDoubleClick\0titleClick\0QCPPlotTitle*\0"
"title\0titleDoubleClick\0selectionChangedByUser\0"
"beforeReplot\0afterReplot\0rescaleAxes\0"
"onlyVisiblePlottables\0deselectAll\0"
"replot\0QCustomPlot::RefreshPriority\0"
"refreshPriority\0viewport\0background\0"
"backgroundScaled\0backgroundScaledMode\0"
"Qt::AspectRatioMode\0plotLayout\0"
"QCPLayoutGrid*\0autoAddPlottableToLegend\0"
"selectionTolerance\0noAntialiasingOnDrag\0"
"multiSelectModifier\0Qt::KeyboardModifier\0"
"LayerInsertMode\0limBelow\0limAbove"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCustomPlot[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
23, 14, // methods
9, 214, // properties
1, 241, // enums/sets
0, 0, // constructors
0, // flags
18, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 129, 2, 0x06 /* Public */,
5, 1, 132, 2, 0x06 /* Public */,
6, 1, 135, 2, 0x06 /* Public */,
7, 1, 138, 2, 0x06 /* Public */,
8, 1, 141, 2, 0x06 /* Public */,
10, 2, 144, 2, 0x06 /* Public */,
13, 2, 149, 2, 0x06 /* Public */,
14, 2, 154, 2, 0x06 /* Public */,
17, 2, 159, 2, 0x06 /* Public */,
18, 3, 164, 2, 0x06 /* Public */,
23, 3, 171, 2, 0x06 /* Public */,
24, 3, 178, 2, 0x06 /* Public */,
28, 3, 185, 2, 0x06 /* Public */,
29, 2, 192, 2, 0x06 /* Public */,
32, 2, 197, 2, 0x06 /* Public */,
33, 0, 202, 2, 0x06 /* Public */,
34, 0, 203, 2, 0x06 /* Public */,
35, 0, 204, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
36, 1, 205, 2, 0x0a /* Public */,
36, 0, 208, 2, 0x2a /* Public | MethodCloned */,
38, 0, 209, 2, 0x0a /* Public */,
39, 1, 210, 2, 0x0a /* Public */,
39, 0, 213, 2, 0x2a /* Public | MethodCloned */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 9, 4,
QMetaType::Void, 0x80000000 | 11, 0x80000000 | 3, 12, 4,
QMetaType::Void, 0x80000000 | 11, 0x80000000 | 3, 12, 4,
QMetaType::Void, 0x80000000 | 15, 0x80000000 | 3, 16, 4,
QMetaType::Void, 0x80000000 | 15, 0x80000000 | 3, 16, 4,
QMetaType::Void, 0x80000000 | 19, 0x80000000 | 21, 0x80000000 | 3, 20, 22, 4,
QMetaType::Void, 0x80000000 | 19, 0x80000000 | 21, 0x80000000 | 3, 20, 22, 4,
QMetaType::Void, 0x80000000 | 25, 0x80000000 | 27, 0x80000000 | 3, 26, 16, 4,
QMetaType::Void, 0x80000000 | 25, 0x80000000 | 27, 0x80000000 | 3, 26, 16, 4,
QMetaType::Void, 0x80000000 | 3, 0x80000000 | 30, 4, 31,
QMetaType::Void, 0x80000000 | 3, 0x80000000 | 30, 4, 31,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
// slots: parameters
QMetaType::Void, QMetaType::Bool, 37,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, 0x80000000 | 40, 41,
QMetaType::Void,
// properties: name, type, flags
42, QMetaType::QRect, 0x00095103,
43, QMetaType::QPixmap, 0x00095103,
44, QMetaType::Bool, 0x00095103,
45, 0x80000000 | 46, 0x0009510b,
47, 0x80000000 | 48, 0x00095009,
49, QMetaType::Bool, 0x00095103,
50, QMetaType::Int, 0x00095103,
51, QMetaType::Bool, 0x00095103,
52, 0x80000000 | 53, 0x0009510b,
// enums: name, flags, count, data
54, 0x0, 2, 245,
// enum data: key, value
55, uint(QCustomPlot::limBelow),
56, uint(QCustomPlot::limAbove),
0 // eod
};
void QCustomPlot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCustomPlot *_t = static_cast<QCustomPlot *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->mouseDoubleClick((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
case 1: _t->mousePress((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
case 2: _t->mouseMove((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
case 3: _t->mouseRelease((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
case 4: _t->mouseWheel((*reinterpret_cast< QWheelEvent*(*)>(_a[1]))); break;
case 5: _t->plottableClick((*reinterpret_cast< QCPAbstractPlottable*(*)>(_a[1])),(*reinterpret_cast< QMouseEvent*(*)>(_a[2]))); break;
case 6: _t->plottableDoubleClick((*reinterpret_cast< QCPAbstractPlottable*(*)>(_a[1])),(*reinterpret_cast< QMouseEvent*(*)>(_a[2]))); break;
case 7: _t->itemClick((*reinterpret_cast< QCPAbstractItem*(*)>(_a[1])),(*reinterpret_cast< QMouseEvent*(*)>(_a[2]))); break;
case 8: _t->itemDoubleClick((*reinterpret_cast< QCPAbstractItem*(*)>(_a[1])),(*reinterpret_cast< QMouseEvent*(*)>(_a[2]))); break;
case 9: _t->axisClick((*reinterpret_cast< QCPAxis*(*)>(_a[1])),(*reinterpret_cast< QCPAxis::SelectablePart(*)>(_a[2])),(*reinterpret_cast< QMouseEvent*(*)>(_a[3]))); break;
case 10: _t->axisDoubleClick((*reinterpret_cast< QCPAxis*(*)>(_a[1])),(*reinterpret_cast< QCPAxis::SelectablePart(*)>(_a[2])),(*reinterpret_cast< QMouseEvent*(*)>(_a[3]))); break;
case 11: _t->legendClick((*reinterpret_cast< QCPLegend*(*)>(_a[1])),(*reinterpret_cast< QCPAbstractLegendItem*(*)>(_a[2])),(*reinterpret_cast< QMouseEvent*(*)>(_a[3]))); break;
case 12: _t->legendDoubleClick((*reinterpret_cast< QCPLegend*(*)>(_a[1])),(*reinterpret_cast< QCPAbstractLegendItem*(*)>(_a[2])),(*reinterpret_cast< QMouseEvent*(*)>(_a[3]))); break;
case 13: _t->titleClick((*reinterpret_cast< QMouseEvent*(*)>(_a[1])),(*reinterpret_cast< QCPPlotTitle*(*)>(_a[2]))); break;
case 14: _t->titleDoubleClick((*reinterpret_cast< QMouseEvent*(*)>(_a[1])),(*reinterpret_cast< QCPPlotTitle*(*)>(_a[2]))); break;
case 15: _t->selectionChangedByUser(); break;
case 16: _t->beforeReplot(); break;
case 17: _t->afterReplot(); break;
case 18: _t->rescaleAxes((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 19: _t->rescaleAxes(); break;
case 20: _t->deselectAll(); break;
case 21: _t->replot((*reinterpret_cast< QCustomPlot::RefreshPriority(*)>(_a[1]))); break;
case 22: _t->replot(); break;
default: ;
}
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 5:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractPlottable* >(); break;
}
break;
case 6:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractPlottable* >(); break;
}
break;
case 7:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractItem* >(); break;
}
break;
case 8:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractItem* >(); break;
}
break;
case 9:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxis* >(); break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxis::SelectablePart >(); break;
}
break;
case 10:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxis* >(); break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAxis::SelectablePart >(); break;
}
break;
case 11:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractLegendItem* >(); break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLegend* >(); break;
}
break;
case 12:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPAbstractLegendItem* >(); break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLegend* >(); break;
}
break;
case 13:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPPlotTitle* >(); break;
}
break;
case 14:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 1:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPPlotTitle* >(); break;
}
break;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCustomPlot::*)(QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::mouseDoubleClick)) {
*result = 0;
return;
}
}
{
using _t = void (QCustomPlot::*)(QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::mousePress)) {
*result = 1;
return;
}
}
{
using _t = void (QCustomPlot::*)(QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::mouseMove)) {
*result = 2;
return;
}
}
{
using _t = void (QCustomPlot::*)(QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::mouseRelease)) {
*result = 3;
return;
}
}
{
using _t = void (QCustomPlot::*)(QWheelEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::mouseWheel)) {
*result = 4;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAbstractPlottable * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::plottableClick)) {
*result = 5;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAbstractPlottable * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::plottableDoubleClick)) {
*result = 6;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAbstractItem * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::itemClick)) {
*result = 7;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAbstractItem * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::itemDoubleClick)) {
*result = 8;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAxis * , QCPAxis::SelectablePart , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::axisClick)) {
*result = 9;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPAxis * , QCPAxis::SelectablePart , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::axisDoubleClick)) {
*result = 10;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPLegend * , QCPAbstractLegendItem * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::legendClick)) {
*result = 11;
return;
}
}
{
using _t = void (QCustomPlot::*)(QCPLegend * , QCPAbstractLegendItem * , QMouseEvent * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::legendDoubleClick)) {
*result = 12;
return;
}
}
{
using _t = void (QCustomPlot::*)(QMouseEvent * , QCPPlotTitle * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::titleClick)) {
*result = 13;
return;
}
}
{
using _t = void (QCustomPlot::*)(QMouseEvent * , QCPPlotTitle * );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::titleDoubleClick)) {
*result = 14;
return;
}
}
{
using _t = void (QCustomPlot::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::selectionChangedByUser)) {
*result = 15;
return;
}
}
{
using _t = void (QCustomPlot::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::beforeReplot)) {
*result = 16;
return;
}
}
{
using _t = void (QCustomPlot::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCustomPlot::afterReplot)) {
*result = 17;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 4:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLayoutGrid* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCustomPlot *_t = static_cast<QCustomPlot *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QRect*>(_v) = _t->viewport(); break;
case 1: *reinterpret_cast< QPixmap*>(_v) = _t->background(); break;
case 2: *reinterpret_cast< bool*>(_v) = _t->backgroundScaled(); break;
case 3: *reinterpret_cast< Qt::AspectRatioMode*>(_v) = _t->backgroundScaledMode(); break;
case 4: *reinterpret_cast< QCPLayoutGrid**>(_v) = _t->plotLayout(); break;
case 5: *reinterpret_cast< bool*>(_v) = _t->autoAddPlottableToLegend(); break;
case 6: *reinterpret_cast< int*>(_v) = _t->selectionTolerance(); break;
case 7: *reinterpret_cast< bool*>(_v) = _t->noAntialiasingOnDrag(); break;
case 8: *reinterpret_cast< Qt::KeyboardModifier*>(_v) = _t->multiSelectModifier(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCustomPlot *_t = static_cast<QCustomPlot *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setViewport(*reinterpret_cast< QRect*>(_v)); break;
case 1: _t->setBackground(*reinterpret_cast< QPixmap*>(_v)); break;
case 2: _t->setBackgroundScaled(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setBackgroundScaledMode(*reinterpret_cast< Qt::AspectRatioMode*>(_v)); break;
case 5: _t->setAutoAddPlottableToLegend(*reinterpret_cast< bool*>(_v)); break;
case 6: _t->setSelectionTolerance(*reinterpret_cast< int*>(_v)); break;
case 7: _t->setNoAntialiasingOnDrag(*reinterpret_cast< bool*>(_v)); break;
case 8: _t->setMultiSelectModifier(*reinterpret_cast< Qt::KeyboardModifier*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCustomPlot::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_QCustomPlot.data,
qt_meta_data_QCustomPlot, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCustomPlot::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCustomPlot::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCustomPlot.stringdata0))
return static_cast<void*>(this);
return QWidget::qt_metacast(_clname);
}
int QCustomPlot::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 23)
qt_static_metacall(this, _c, _id, _a);
_id -= 23;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 23)
qt_static_metacall(this, _c, _id, _a);
_id -= 23;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 9;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCustomPlot::mouseDoubleClick(QMouseEvent * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCustomPlot::mousePress(QMouseEvent * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
// SIGNAL 2
void QCustomPlot::mouseMove(QMouseEvent * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
// SIGNAL 3
void QCustomPlot::mouseRelease(QMouseEvent * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 3, _a);
}
// SIGNAL 4
void QCustomPlot::mouseWheel(QWheelEvent * _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 4, _a);
}
// SIGNAL 5
void QCustomPlot::plottableClick(QCPAbstractPlottable * _t1, QMouseEvent * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 5, _a);
}
// SIGNAL 6
void QCustomPlot::plottableDoubleClick(QCPAbstractPlottable * _t1, QMouseEvent * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 6, _a);
}
// SIGNAL 7
void QCustomPlot::itemClick(QCPAbstractItem * _t1, QMouseEvent * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 7, _a);
}
// SIGNAL 8
void QCustomPlot::itemDoubleClick(QCPAbstractItem * _t1, QMouseEvent * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 8, _a);
}
// SIGNAL 9
void QCustomPlot::axisClick(QCPAxis * _t1, QCPAxis::SelectablePart _t2, QMouseEvent * _t3)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) };
QMetaObject::activate(this, &staticMetaObject, 9, _a);
}
// SIGNAL 10
void QCustomPlot::axisDoubleClick(QCPAxis * _t1, QCPAxis::SelectablePart _t2, QMouseEvent * _t3)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) };
QMetaObject::activate(this, &staticMetaObject, 10, _a);
}
// SIGNAL 11
void QCustomPlot::legendClick(QCPLegend * _t1, QCPAbstractLegendItem * _t2, QMouseEvent * _t3)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) };
QMetaObject::activate(this, &staticMetaObject, 11, _a);
}
// SIGNAL 12
void QCustomPlot::legendDoubleClick(QCPLegend * _t1, QCPAbstractLegendItem * _t2, QMouseEvent * _t3)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)) };
QMetaObject::activate(this, &staticMetaObject, 12, _a);
}
// SIGNAL 13
void QCustomPlot::titleClick(QMouseEvent * _t1, QCPPlotTitle * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 13, _a);
}
// SIGNAL 14
void QCustomPlot::titleDoubleClick(QMouseEvent * _t1, QCPPlotTitle * _t2)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
QMetaObject::activate(this, &staticMetaObject, 14, _a);
}
// SIGNAL 15
void QCustomPlot::selectionChangedByUser()
{
QMetaObject::activate(this, &staticMetaObject, 15, nullptr);
}
// SIGNAL 16
void QCustomPlot::beforeReplot()
{
QMetaObject::activate(this, &staticMetaObject, 16, nullptr);
}
// SIGNAL 17
void QCustomPlot::afterReplot()
{
QMetaObject::activate(this, &staticMetaObject, 17, nullptr);
}
struct qt_meta_stringdata_QCPColorGradient_t {
QByteArrayData data[17];
char stringdata0[164];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPColorGradient_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPColorGradient_t qt_meta_stringdata_QCPColorGradient = {
{
QT_MOC_LITERAL(0, 0, 16), // "QCPColorGradient"
QT_MOC_LITERAL(1, 17, 18), // "ColorInterpolation"
QT_MOC_LITERAL(2, 36, 5), // "ciRGB"
QT_MOC_LITERAL(3, 42, 5), // "ciHSV"
QT_MOC_LITERAL(4, 48, 14), // "GradientPreset"
QT_MOC_LITERAL(5, 63, 11), // "gpGrayscale"
QT_MOC_LITERAL(6, 75, 5), // "gpHot"
QT_MOC_LITERAL(7, 81, 6), // "gpCold"
QT_MOC_LITERAL(8, 88, 7), // "gpNight"
QT_MOC_LITERAL(9, 96, 7), // "gpCandy"
QT_MOC_LITERAL(10, 104, 11), // "gpGeography"
QT_MOC_LITERAL(11, 116, 5), // "gpIon"
QT_MOC_LITERAL(12, 122, 9), // "gpThermal"
QT_MOC_LITERAL(13, 132, 7), // "gpPolar"
QT_MOC_LITERAL(14, 140, 10), // "gpSpectrum"
QT_MOC_LITERAL(15, 151, 5), // "gpJet"
QT_MOC_LITERAL(16, 157, 6) // "gpHues"
},
"QCPColorGradient\0ColorInterpolation\0"
"ciRGB\0ciHSV\0GradientPreset\0gpGrayscale\0"
"gpHot\0gpCold\0gpNight\0gpCandy\0gpGeography\0"
"gpIon\0gpThermal\0gpPolar\0gpSpectrum\0"
"gpJet\0gpHues"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPColorGradient[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
2, 14, // enums/sets
0, 0, // constructors
4, // flags
0, // signalCount
// enums: name, flags, count, data
1, 0x0, 2, 22,
4, 0x0, 12, 26,
// enum data: key, value
2, uint(QCPColorGradient::ciRGB),
3, uint(QCPColorGradient::ciHSV),
5, uint(QCPColorGradient::gpGrayscale),
6, uint(QCPColorGradient::gpHot),
7, uint(QCPColorGradient::gpCold),
8, uint(QCPColorGradient::gpNight),
9, uint(QCPColorGradient::gpCandy),
10, uint(QCPColorGradient::gpGeography),
11, uint(QCPColorGradient::gpIon),
12, uint(QCPColorGradient::gpThermal),
13, uint(QCPColorGradient::gpPolar),
14, uint(QCPColorGradient::gpSpectrum),
15, uint(QCPColorGradient::gpJet),
16, uint(QCPColorGradient::gpHues),
0 // eod
};
QT_INIT_METAOBJECT const QMetaObject QCPColorGradient::staticMetaObject = {
{ nullptr, qt_meta_stringdata_QCPColorGradient.data,
qt_meta_data_QCPColorGradient, nullptr, nullptr, nullptr}
};
struct qt_meta_stringdata_QCPAxisRect_t {
QByteArrayData data[8];
char stringdata0[118];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPAxisRect_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPAxisRect_t qt_meta_stringdata_QCPAxisRect = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCPAxisRect"
QT_MOC_LITERAL(1, 12, 10), // "background"
QT_MOC_LITERAL(2, 23, 16), // "backgroundScaled"
QT_MOC_LITERAL(3, 40, 20), // "backgroundScaledMode"
QT_MOC_LITERAL(4, 61, 19), // "Qt::AspectRatioMode"
QT_MOC_LITERAL(5, 81, 9), // "rangeDrag"
QT_MOC_LITERAL(6, 91, 16), // "Qt::Orientations"
QT_MOC_LITERAL(7, 108, 9) // "rangeZoom"
},
"QCPAxisRect\0background\0backgroundScaled\0"
"backgroundScaledMode\0Qt::AspectRatioMode\0"
"rangeDrag\0Qt::Orientations\0rangeZoom"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPAxisRect[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
5, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPixmap, 0x00095103,
2, QMetaType::Bool, 0x00095103,
3, 0x80000000 | 4, 0x0009510b,
5, 0x80000000 | 6, 0x0009510b,
7, 0x80000000 | 6, 0x0009510b,
0 // eod
};
void QCPAxisRect::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPAxisRect *_t = static_cast<QCPAxisRect *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPixmap*>(_v) = _t->background(); break;
case 1: *reinterpret_cast< bool*>(_v) = _t->backgroundScaled(); break;
case 2: *reinterpret_cast< Qt::AspectRatioMode*>(_v) = _t->backgroundScaledMode(); break;
case 3: *reinterpret_cast< Qt::Orientations*>(_v) = _t->rangeDrag(); break;
case 4: *reinterpret_cast< Qt::Orientations*>(_v) = _t->rangeZoom(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPAxisRect *_t = static_cast<QCPAxisRect *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setBackground(*reinterpret_cast< QPixmap*>(_v)); break;
case 1: _t->setBackgroundScaled(*reinterpret_cast< bool*>(_v)); break;
case 2: _t->setBackgroundScaledMode(*reinterpret_cast< Qt::AspectRatioMode*>(_v)); break;
case 3: _t->setRangeDrag(*reinterpret_cast< Qt::Orientations*>(_v)); break;
case 4: _t->setRangeZoom(*reinterpret_cast< Qt::Orientations*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPAxisRect::staticMetaObject = {
{ &QCPLayoutElement::staticMetaObject, qt_meta_stringdata_QCPAxisRect.data,
qt_meta_data_QCPAxisRect, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPAxisRect::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPAxisRect::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPAxisRect.stringdata0))
return static_cast<void*>(this);
return QCPLayoutElement::qt_metacast(_clname);
}
int QCPAxisRect::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutElement::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 5;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 5;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPAbstractLegendItem_t {
QByteArrayData data[14];
char stringdata0[174];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPAbstractLegendItem_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPAbstractLegendItem_t qt_meta_stringdata_QCPAbstractLegendItem = {
{
QT_MOC_LITERAL(0, 0, 21), // "QCPAbstractLegendItem"
QT_MOC_LITERAL(1, 22, 16), // "selectionChanged"
QT_MOC_LITERAL(2, 39, 0), // ""
QT_MOC_LITERAL(3, 40, 8), // "selected"
QT_MOC_LITERAL(4, 49, 17), // "selectableChanged"
QT_MOC_LITERAL(5, 67, 10), // "selectable"
QT_MOC_LITERAL(6, 78, 13), // "setSelectable"
QT_MOC_LITERAL(7, 92, 11), // "setSelected"
QT_MOC_LITERAL(8, 104, 12), // "parentLegend"
QT_MOC_LITERAL(9, 117, 10), // "QCPLegend*"
QT_MOC_LITERAL(10, 128, 4), // "font"
QT_MOC_LITERAL(11, 133, 9), // "textColor"
QT_MOC_LITERAL(12, 143, 12), // "selectedFont"
QT_MOC_LITERAL(13, 156, 17) // "selectedTextColor"
},
"QCPAbstractLegendItem\0selectionChanged\0"
"\0selected\0selectableChanged\0selectable\0"
"setSelectable\0setSelected\0parentLegend\0"
"QCPLegend*\0font\0textColor\0selectedFont\0"
"selectedTextColor"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPAbstractLegendItem[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
7, 46, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
4, 1, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 1, 40, 2, 0x0a /* Public */,
7, 1, 43, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, QMetaType::Bool, 3,
QMetaType::Void, QMetaType::Bool, 5,
// slots: parameters
QMetaType::Void, QMetaType::Bool, 5,
QMetaType::Void, QMetaType::Bool, 3,
// properties: name, type, flags
8, 0x80000000 | 9, 0x00095009,
10, QMetaType::QFont, 0x00095103,
11, QMetaType::QColor, 0x00095103,
12, QMetaType::QFont, 0x00095103,
13, QMetaType::QColor, 0x00095103,
5, QMetaType::Bool, 0x00495103,
3, QMetaType::Bool, 0x00495103,
// properties: notify_signal_id
0,
0,
0,
0,
0,
0,
1,
0 // eod
};
void QCPAbstractLegendItem::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPAbstractLegendItem *_t = static_cast<QCPAbstractLegendItem *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->selectionChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 1: _t->selectableChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 2: _t->setSelectable((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->setSelected((*reinterpret_cast< bool(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPAbstractLegendItem::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractLegendItem::selectionChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPAbstractLegendItem::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPAbstractLegendItem::selectableChanged)) {
*result = 1;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 0:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPLegend* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPAbstractLegendItem *_t = static_cast<QCPAbstractLegendItem *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCPLegend**>(_v) = _t->parentLegend(); break;
case 1: *reinterpret_cast< QFont*>(_v) = _t->font(); break;
case 2: *reinterpret_cast< QColor*>(_v) = _t->textColor(); break;
case 3: *reinterpret_cast< QFont*>(_v) = _t->selectedFont(); break;
case 4: *reinterpret_cast< QColor*>(_v) = _t->selectedTextColor(); break;
case 5: *reinterpret_cast< bool*>(_v) = _t->selectable(); break;
case 6: *reinterpret_cast< bool*>(_v) = _t->selected(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPAbstractLegendItem *_t = static_cast<QCPAbstractLegendItem *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 1: _t->setFont(*reinterpret_cast< QFont*>(_v)); break;
case 2: _t->setTextColor(*reinterpret_cast< QColor*>(_v)); break;
case 3: _t->setSelectedFont(*reinterpret_cast< QFont*>(_v)); break;
case 4: _t->setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
case 5: _t->setSelectable(*reinterpret_cast< bool*>(_v)); break;
case 6: _t->setSelected(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPAbstractLegendItem::staticMetaObject = {
{ &QCPLayoutElement::staticMetaObject, qt_meta_stringdata_QCPAbstractLegendItem.data,
qt_meta_data_QCPAbstractLegendItem, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPAbstractLegendItem::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPAbstractLegendItem::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPAbstractLegendItem.stringdata0))
return static_cast<void*>(this);
return QCPLayoutElement::qt_metacast(_clname);
}
int QCPAbstractLegendItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutElement::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 7;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPAbstractLegendItem::selectionChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPAbstractLegendItem::selectableChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_QCPPlottableLegendItem_t {
QByteArrayData data[1];
char stringdata0[23];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPPlottableLegendItem_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPPlottableLegendItem_t qt_meta_stringdata_QCPPlottableLegendItem = {
{
QT_MOC_LITERAL(0, 0, 22) // "QCPPlottableLegendItem"
},
"QCPPlottableLegendItem"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPPlottableLegendItem[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void QCPPlottableLegendItem::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPPlottableLegendItem::staticMetaObject = {
{ &QCPAbstractLegendItem::staticMetaObject, qt_meta_stringdata_QCPPlottableLegendItem.data,
qt_meta_data_QCPPlottableLegendItem, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPPlottableLegendItem::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPPlottableLegendItem::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPPlottableLegendItem.stringdata0))
return static_cast<void*>(this);
return QCPAbstractLegendItem::qt_metacast(_clname);
}
int QCPPlottableLegendItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractLegendItem::qt_metacall(_c, _id, _a);
return _id;
}
struct qt_meta_stringdata_QCPLegend_t {
QByteArrayData data[27];
char stringdata0[358];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPLegend_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPLegend_t qt_meta_stringdata_QCPLegend = {
{
QT_MOC_LITERAL(0, 0, 9), // "QCPLegend"
QT_MOC_LITERAL(1, 10, 16), // "selectionChanged"
QT_MOC_LITERAL(2, 27, 0), // ""
QT_MOC_LITERAL(3, 28, 26), // "QCPLegend::SelectableParts"
QT_MOC_LITERAL(4, 55, 5), // "parts"
QT_MOC_LITERAL(5, 61, 17), // "selectableChanged"
QT_MOC_LITERAL(6, 79, 18), // "setSelectableParts"
QT_MOC_LITERAL(7, 98, 15), // "SelectableParts"
QT_MOC_LITERAL(8, 114, 15), // "selectableParts"
QT_MOC_LITERAL(9, 130, 16), // "setSelectedParts"
QT_MOC_LITERAL(10, 147, 13), // "selectedParts"
QT_MOC_LITERAL(11, 161, 9), // "borderPen"
QT_MOC_LITERAL(12, 171, 5), // "brush"
QT_MOC_LITERAL(13, 177, 4), // "font"
QT_MOC_LITERAL(14, 182, 9), // "textColor"
QT_MOC_LITERAL(15, 192, 8), // "iconSize"
QT_MOC_LITERAL(16, 201, 15), // "iconTextPadding"
QT_MOC_LITERAL(17, 217, 13), // "iconBorderPen"
QT_MOC_LITERAL(18, 231, 17), // "selectedBorderPen"
QT_MOC_LITERAL(19, 249, 21), // "selectedIconBorderPen"
QT_MOC_LITERAL(20, 271, 13), // "selectedBrush"
QT_MOC_LITERAL(21, 285, 12), // "selectedFont"
QT_MOC_LITERAL(22, 298, 17), // "selectedTextColor"
QT_MOC_LITERAL(23, 316, 14), // "SelectablePart"
QT_MOC_LITERAL(24, 331, 6), // "spNone"
QT_MOC_LITERAL(25, 338, 11), // "spLegendBox"
QT_MOC_LITERAL(26, 350, 7) // "spItems"
},
"QCPLegend\0selectionChanged\0\0"
"QCPLegend::SelectableParts\0parts\0"
"selectableChanged\0setSelectableParts\0"
"SelectableParts\0selectableParts\0"
"setSelectedParts\0selectedParts\0borderPen\0"
"brush\0font\0textColor\0iconSize\0"
"iconTextPadding\0iconBorderPen\0"
"selectedBorderPen\0selectedIconBorderPen\0"
"selectedBrush\0selectedFont\0selectedTextColor\0"
"SelectablePart\0spNone\0spLegendBox\0"
"spItems"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPLegend[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
14, 46, // properties
2, 102, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
5, 1, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 1, 40, 2, 0x0a /* Public */,
9, 1, 43, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, 4,
// slots: parameters
QMetaType::Void, 0x80000000 | 7, 8,
QMetaType::Void, 0x80000000 | 7, 10,
// properties: name, type, flags
11, QMetaType::QPen, 0x00095103,
12, QMetaType::QBrush, 0x00095103,
13, QMetaType::QFont, 0x00095103,
14, QMetaType::QColor, 0x00095103,
15, QMetaType::QSize, 0x00095103,
16, QMetaType::Int, 0x00095103,
17, QMetaType::QPen, 0x00095103,
8, 0x80000000 | 7, 0x0049510b,
10, 0x80000000 | 7, 0x0049510b,
18, QMetaType::QPen, 0x00095103,
19, QMetaType::QPen, 0x00095103,
20, QMetaType::QBrush, 0x00095103,
21, QMetaType::QFont, 0x00095103,
22, QMetaType::QColor, 0x00095103,
// properties: notify_signal_id
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
// enums: name, flags, count, data
23, 0x1, 3, 110,
7, 0x1, 3, 116,
// enum data: key, value
24, uint(QCPLegend::spNone),
25, uint(QCPLegend::spLegendBox),
26, uint(QCPLegend::spItems),
24, uint(QCPLegend::spNone),
25, uint(QCPLegend::spLegendBox),
26, uint(QCPLegend::spItems),
0 // eod
};
void QCPLegend::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPLegend *_t = static_cast<QCPLegend *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->selectionChanged((*reinterpret_cast< QCPLegend::SelectableParts(*)>(_a[1]))); break;
case 1: _t->selectableChanged((*reinterpret_cast< QCPLegend::SelectableParts(*)>(_a[1]))); break;
case 2: _t->setSelectableParts((*reinterpret_cast< const SelectableParts(*)>(_a[1]))); break;
case 3: _t->setSelectedParts((*reinterpret_cast< const SelectableParts(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPLegend::*)(QCPLegend::SelectableParts );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPLegend::selectionChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPLegend::*)(QCPLegend::SelectableParts );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPLegend::selectableChanged)) {
*result = 1;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPLegend *_t = static_cast<QCPLegend *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->borderPen(); break;
case 1: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 2: *reinterpret_cast< QFont*>(_v) = _t->font(); break;
case 3: *reinterpret_cast< QColor*>(_v) = _t->textColor(); break;
case 4: *reinterpret_cast< QSize*>(_v) = _t->iconSize(); break;
case 5: *reinterpret_cast< int*>(_v) = _t->iconTextPadding(); break;
case 6: *reinterpret_cast< QPen*>(_v) = _t->iconBorderPen(); break;
case 7: *reinterpret_cast<int*>(_v) = QFlag(_t->selectableParts()); break;
case 8: *reinterpret_cast<int*>(_v) = QFlag(_t->selectedParts()); break;
case 9: *reinterpret_cast< QPen*>(_v) = _t->selectedBorderPen(); break;
case 10: *reinterpret_cast< QPen*>(_v) = _t->selectedIconBorderPen(); break;
case 11: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
case 12: *reinterpret_cast< QFont*>(_v) = _t->selectedFont(); break;
case 13: *reinterpret_cast< QColor*>(_v) = _t->selectedTextColor(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPLegend *_t = static_cast<QCPLegend *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setBorderPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 2: _t->setFont(*reinterpret_cast< QFont*>(_v)); break;
case 3: _t->setTextColor(*reinterpret_cast< QColor*>(_v)); break;
case 4: _t->setIconSize(*reinterpret_cast< QSize*>(_v)); break;
case 5: _t->setIconTextPadding(*reinterpret_cast< int*>(_v)); break;
case 6: _t->setIconBorderPen(*reinterpret_cast< QPen*>(_v)); break;
case 7: _t->setSelectableParts(QFlag(*reinterpret_cast<int*>(_v))); break;
case 8: _t->setSelectedParts(QFlag(*reinterpret_cast<int*>(_v))); break;
case 9: _t->setSelectedBorderPen(*reinterpret_cast< QPen*>(_v)); break;
case 10: _t->setSelectedIconBorderPen(*reinterpret_cast< QPen*>(_v)); break;
case 11: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 12: _t->setSelectedFont(*reinterpret_cast< QFont*>(_v)); break;
case 13: _t->setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPLegend::staticMetaObject = {
{ &QCPLayoutGrid::staticMetaObject, qt_meta_stringdata_QCPLegend.data,
qt_meta_data_QCPLegend, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPLegend::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPLegend::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPLegend.stringdata0))
return static_cast<void*>(this);
return QCPLayoutGrid::qt_metacast(_clname);
}
int QCPLegend::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutGrid::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 14;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 14;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 14;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 14;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 14;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 14;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPLegend::selectionChanged(QCPLegend::SelectableParts _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPLegend::selectableChanged(QCPLegend::SelectableParts _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_QCPPlotTitle_t {
QByteArrayData data[13];
char stringdata0[146];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPPlotTitle_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPPlotTitle_t qt_meta_stringdata_QCPPlotTitle = {
{
QT_MOC_LITERAL(0, 0, 12), // "QCPPlotTitle"
QT_MOC_LITERAL(1, 13, 16), // "selectionChanged"
QT_MOC_LITERAL(2, 30, 0), // ""
QT_MOC_LITERAL(3, 31, 8), // "selected"
QT_MOC_LITERAL(4, 40, 17), // "selectableChanged"
QT_MOC_LITERAL(5, 58, 10), // "selectable"
QT_MOC_LITERAL(6, 69, 13), // "setSelectable"
QT_MOC_LITERAL(7, 83, 11), // "setSelected"
QT_MOC_LITERAL(8, 95, 4), // "text"
QT_MOC_LITERAL(9, 100, 4), // "font"
QT_MOC_LITERAL(10, 105, 9), // "textColor"
QT_MOC_LITERAL(11, 115, 12), // "selectedFont"
QT_MOC_LITERAL(12, 128, 17) // "selectedTextColor"
},
"QCPPlotTitle\0selectionChanged\0\0selected\0"
"selectableChanged\0selectable\0setSelectable\0"
"setSelected\0text\0font\0textColor\0"
"selectedFont\0selectedTextColor"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPPlotTitle[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
7, 46, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 34, 2, 0x06 /* Public */,
4, 1, 37, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
6, 1, 40, 2, 0x0a /* Public */,
7, 1, 43, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, QMetaType::Bool, 3,
QMetaType::Void, QMetaType::Bool, 5,
// slots: parameters
QMetaType::Void, QMetaType::Bool, 5,
QMetaType::Void, QMetaType::Bool, 3,
// properties: name, type, flags
8, QMetaType::QString, 0x00095103,
9, QMetaType::QFont, 0x00095103,
10, QMetaType::QColor, 0x00095103,
11, QMetaType::QFont, 0x00095103,
12, QMetaType::QColor, 0x00095103,
5, QMetaType::Bool, 0x00495103,
3, QMetaType::Bool, 0x00495103,
// properties: notify_signal_id
0,
0,
0,
0,
0,
1,
0,
0 // eod
};
void QCPPlotTitle::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPPlotTitle *_t = static_cast<QCPPlotTitle *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->selectionChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 1: _t->selectableChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 2: _t->setSelectable((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->setSelected((*reinterpret_cast< bool(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPPlotTitle::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPPlotTitle::selectionChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPPlotTitle::*)(bool );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPPlotTitle::selectableChanged)) {
*result = 1;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPPlotTitle *_t = static_cast<QCPPlotTitle *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = _t->text(); break;
case 1: *reinterpret_cast< QFont*>(_v) = _t->font(); break;
case 2: *reinterpret_cast< QColor*>(_v) = _t->textColor(); break;
case 3: *reinterpret_cast< QFont*>(_v) = _t->selectedFont(); break;
case 4: *reinterpret_cast< QColor*>(_v) = _t->selectedTextColor(); break;
case 5: *reinterpret_cast< bool*>(_v) = _t->selectable(); break;
case 6: *reinterpret_cast< bool*>(_v) = _t->selected(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPPlotTitle *_t = static_cast<QCPPlotTitle *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setText(*reinterpret_cast< QString*>(_v)); break;
case 1: _t->setFont(*reinterpret_cast< QFont*>(_v)); break;
case 2: _t->setTextColor(*reinterpret_cast< QColor*>(_v)); break;
case 3: _t->setSelectedFont(*reinterpret_cast< QFont*>(_v)); break;
case 4: _t->setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
case 5: _t->setSelectable(*reinterpret_cast< bool*>(_v)); break;
case 6: _t->setSelected(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject QCPPlotTitle::staticMetaObject = {
{ &QCPLayoutElement::staticMetaObject, qt_meta_stringdata_QCPPlotTitle.data,
qt_meta_data_QCPPlotTitle, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPPlotTitle::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPPlotTitle::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPPlotTitle.stringdata0))
return static_cast<void*>(this);
return QCPLayoutElement::qt_metacast(_clname);
}
int QCPPlotTitle::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutElement::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 7;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPPlotTitle::selectionChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPPlotTitle::selectableChanged(bool _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
struct qt_meta_stringdata_QCPColorScaleAxisRectPrivate_t {
QByteArrayData data[7];
char stringdata0[128];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPColorScaleAxisRectPrivate_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPColorScaleAxisRectPrivate_t qt_meta_stringdata_QCPColorScaleAxisRectPrivate = {
{
QT_MOC_LITERAL(0, 0, 28), // "QCPColorScaleAxisRectPrivate"
QT_MOC_LITERAL(1, 29, 20), // "axisSelectionChanged"
QT_MOC_LITERAL(2, 50, 0), // ""
QT_MOC_LITERAL(3, 51, 24), // "QCPAxis::SelectableParts"
QT_MOC_LITERAL(4, 76, 13), // "selectedParts"
QT_MOC_LITERAL(5, 90, 21), // "axisSelectableChanged"
QT_MOC_LITERAL(6, 112, 15) // "selectableParts"
},
"QCPColorScaleAxisRectPrivate\0"
"axisSelectionChanged\0\0QCPAxis::SelectableParts\0"
"selectedParts\0axisSelectableChanged\0"
"selectableParts"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPColorScaleAxisRectPrivate[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 1, 24, 2, 0x09 /* Protected */,
5, 1, 27, 2, 0x09 /* Protected */,
// slots: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 3, 6,
0 // eod
};
void QCPColorScaleAxisRectPrivate::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPColorScaleAxisRectPrivate *_t = static_cast<QCPColorScaleAxisRectPrivate *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->axisSelectionChanged((*reinterpret_cast< QCPAxis::SelectableParts(*)>(_a[1]))); break;
case 1: _t->axisSelectableChanged((*reinterpret_cast< QCPAxis::SelectableParts(*)>(_a[1]))); break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject QCPColorScaleAxisRectPrivate::staticMetaObject = {
{ &QCPAxisRect::staticMetaObject, qt_meta_stringdata_QCPColorScaleAxisRectPrivate.data,
qt_meta_data_QCPColorScaleAxisRectPrivate, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPColorScaleAxisRectPrivate::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPColorScaleAxisRectPrivate::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPColorScaleAxisRectPrivate.stringdata0))
return static_cast<void*>(this);
return QCPAxisRect::qt_metacast(_clname);
}
int QCPColorScaleAxisRectPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAxisRect::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
return _id;
}
struct qt_meta_stringdata_QCPColorScale_t {
QByteArrayData data[23];
char stringdata0[278];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPColorScale_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPColorScale_t qt_meta_stringdata_QCPColorScale = {
{
QT_MOC_LITERAL(0, 0, 13), // "QCPColorScale"
QT_MOC_LITERAL(1, 14, 16), // "dataRangeChanged"
QT_MOC_LITERAL(2, 31, 0), // ""
QT_MOC_LITERAL(3, 32, 8), // "QCPRange"
QT_MOC_LITERAL(4, 41, 8), // "newRange"
QT_MOC_LITERAL(5, 50, 20), // "dataScaleTypeChanged"
QT_MOC_LITERAL(6, 71, 18), // "QCPAxis::ScaleType"
QT_MOC_LITERAL(7, 90, 9), // "scaleType"
QT_MOC_LITERAL(8, 100, 15), // "gradientChanged"
QT_MOC_LITERAL(9, 116, 16), // "QCPColorGradient"
QT_MOC_LITERAL(10, 133, 11), // "newGradient"
QT_MOC_LITERAL(11, 145, 12), // "setDataRange"
QT_MOC_LITERAL(12, 158, 9), // "dataRange"
QT_MOC_LITERAL(13, 168, 16), // "setDataScaleType"
QT_MOC_LITERAL(14, 185, 11), // "setGradient"
QT_MOC_LITERAL(15, 197, 8), // "gradient"
QT_MOC_LITERAL(16, 206, 4), // "type"
QT_MOC_LITERAL(17, 211, 17), // "QCPAxis::AxisType"
QT_MOC_LITERAL(18, 229, 13), // "dataScaleType"
QT_MOC_LITERAL(19, 243, 5), // "label"
QT_MOC_LITERAL(20, 249, 8), // "barWidth"
QT_MOC_LITERAL(21, 258, 9), // "rangeDrag"
QT_MOC_LITERAL(22, 268, 9) // "rangeZoom"
},
"QCPColorScale\0dataRangeChanged\0\0"
"QCPRange\0newRange\0dataScaleTypeChanged\0"
"QCPAxis::ScaleType\0scaleType\0"
"gradientChanged\0QCPColorGradient\0"
"newGradient\0setDataRange\0dataRange\0"
"setDataScaleType\0setGradient\0gradient\0"
"type\0QCPAxis::AxisType\0dataScaleType\0"
"label\0barWidth\0rangeDrag\0rangeZoom"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPColorScale[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
6, 14, // methods
8, 62, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
3, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 44, 2, 0x06 /* Public */,
5, 1, 47, 2, 0x06 /* Public */,
8, 1, 50, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
11, 1, 53, 2, 0x0a /* Public */,
13, 1, 56, 2, 0x0a /* Public */,
14, 1, 59, 2, 0x0a /* Public */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 6, 7,
QMetaType::Void, 0x80000000 | 9, 10,
// slots: parameters
QMetaType::Void, 0x80000000 | 3, 12,
QMetaType::Void, 0x80000000 | 6, 7,
QMetaType::Void, 0x80000000 | 9, 15,
// properties: name, type, flags
16, 0x80000000 | 17, 0x0009510b,
12, 0x80000000 | 3, 0x0049510b,
18, 0x80000000 | 6, 0x0049510b,
15, 0x80000000 | 9, 0x0049510b,
19, QMetaType::QString, 0x00095103,
20, QMetaType::Int, 0x00095103,
21, QMetaType::Bool, 0x00095103,
22, QMetaType::Bool, 0x00095103,
// properties: notify_signal_id
0,
0,
1,
2,
0,
0,
0,
0,
0 // eod
};
void QCPColorScale::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPColorScale *_t = static_cast<QCPColorScale *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->dataRangeChanged((*reinterpret_cast< QCPRange(*)>(_a[1]))); break;
case 1: _t->dataScaleTypeChanged((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 2: _t->gradientChanged((*reinterpret_cast< QCPColorGradient(*)>(_a[1]))); break;
case 3: _t->setDataRange((*reinterpret_cast< const QCPRange(*)>(_a[1]))); break;
case 4: _t->setDataScaleType((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 5: _t->setGradient((*reinterpret_cast< const QCPColorGradient(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPColorScale::*)(QCPRange );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorScale::dataRangeChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPColorScale::*)(QCPAxis::ScaleType );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorScale::dataScaleTypeChanged)) {
*result = 1;
return;
}
}
{
using _t = void (QCPColorScale::*)(QCPColorGradient );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorScale::gradientChanged)) {
*result = 2;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPColorScale *_t = static_cast<QCPColorScale *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCPAxis::AxisType*>(_v) = _t->type(); break;
case 1: *reinterpret_cast< QCPRange*>(_v) = _t->dataRange(); break;
case 2: *reinterpret_cast< QCPAxis::ScaleType*>(_v) = _t->dataScaleType(); break;
case 3: *reinterpret_cast< QCPColorGradient*>(_v) = _t->gradient(); break;
case 4: *reinterpret_cast< QString*>(_v) = _t->label(); break;
case 5: *reinterpret_cast< int*>(_v) = _t->barWidth(); break;
case 6: *reinterpret_cast< bool*>(_v) = _t->rangeDrag(); break;
case 7: *reinterpret_cast< bool*>(_v) = _t->rangeZoom(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPColorScale *_t = static_cast<QCPColorScale *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setType(*reinterpret_cast< QCPAxis::AxisType*>(_v)); break;
case 1: _t->setDataRange(*reinterpret_cast< QCPRange*>(_v)); break;
case 2: _t->setDataScaleType(*reinterpret_cast< QCPAxis::ScaleType*>(_v)); break;
case 3: _t->setGradient(*reinterpret_cast< QCPColorGradient*>(_v)); break;
case 4: _t->setLabel(*reinterpret_cast< QString*>(_v)); break;
case 5: _t->setBarWidth(*reinterpret_cast< int*>(_v)); break;
case 6: _t->setRangeDrag(*reinterpret_cast< bool*>(_v)); break;
case 7: _t->setRangeZoom(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
static const QMetaObject * const qt_meta_extradata_QCPColorScale[] = {
&QCPAxis::staticMetaObject,
nullptr
};
QT_INIT_METAOBJECT const QMetaObject QCPColorScale::staticMetaObject = {
{ &QCPLayoutElement::staticMetaObject, qt_meta_stringdata_QCPColorScale.data,
qt_meta_data_QCPColorScale, qt_static_metacall, qt_meta_extradata_QCPColorScale, nullptr}
};
const QMetaObject *QCPColorScale::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPColorScale::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPColorScale.stringdata0))
return static_cast<void*>(this);
return QCPLayoutElement::qt_metacast(_clname);
}
int QCPColorScale::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPLayoutElement::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 6)
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 6)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 6;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 8;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPColorScale::dataRangeChanged(QCPRange _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPColorScale::dataScaleTypeChanged(QCPAxis::ScaleType _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
// SIGNAL 2
void QCPColorScale::gradientChanged(QCPColorGradient _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
struct qt_meta_stringdata_QCPGraph_t {
QByteArrayData data[23];
char stringdata0[251];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPGraph_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPGraph_t qt_meta_stringdata_QCPGraph = {
{
QT_MOC_LITERAL(0, 0, 8), // "QCPGraph"
QT_MOC_LITERAL(1, 9, 9), // "lineStyle"
QT_MOC_LITERAL(2, 19, 9), // "LineStyle"
QT_MOC_LITERAL(3, 29, 12), // "scatterStyle"
QT_MOC_LITERAL(4, 42, 15), // "QCPScatterStyle"
QT_MOC_LITERAL(5, 58, 9), // "errorType"
QT_MOC_LITERAL(6, 68, 9), // "ErrorType"
QT_MOC_LITERAL(7, 78, 8), // "errorPen"
QT_MOC_LITERAL(8, 87, 12), // "errorBarSize"
QT_MOC_LITERAL(9, 100, 18), // "errorBarSkipSymbol"
QT_MOC_LITERAL(10, 119, 16), // "channelFillGraph"
QT_MOC_LITERAL(11, 136, 9), // "QCPGraph*"
QT_MOC_LITERAL(12, 146, 16), // "adaptiveSampling"
QT_MOC_LITERAL(13, 163, 6), // "lsNone"
QT_MOC_LITERAL(14, 170, 6), // "lsLine"
QT_MOC_LITERAL(15, 177, 10), // "lsStepLeft"
QT_MOC_LITERAL(16, 188, 11), // "lsStepRight"
QT_MOC_LITERAL(17, 200, 12), // "lsStepCenter"
QT_MOC_LITERAL(18, 213, 9), // "lsImpulse"
QT_MOC_LITERAL(19, 223, 6), // "etNone"
QT_MOC_LITERAL(20, 230, 5), // "etKey"
QT_MOC_LITERAL(21, 236, 7), // "etValue"
QT_MOC_LITERAL(22, 244, 6) // "etBoth"
},
"QCPGraph\0lineStyle\0LineStyle\0scatterStyle\0"
"QCPScatterStyle\0errorType\0ErrorType\0"
"errorPen\0errorBarSize\0errorBarSkipSymbol\0"
"channelFillGraph\0QCPGraph*\0adaptiveSampling\0"
"lsNone\0lsLine\0lsStepLeft\0lsStepRight\0"
"lsStepCenter\0lsImpulse\0etNone\0etKey\0"
"etValue\0etBoth"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPGraph[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
8, 14, // properties
2, 38, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x0009510b,
3, 0x80000000 | 4, 0x0009510b,
5, 0x80000000 | 6, 0x0009510b,
7, QMetaType::QPen, 0x00095103,
8, QMetaType::Double, 0x00095103,
9, QMetaType::Bool, 0x00095103,
10, 0x80000000 | 11, 0x0009510b,
12, QMetaType::Bool, 0x00095103,
// enums: name, flags, count, data
2, 0x0, 6, 46,
6, 0x0, 4, 58,
// enum data: key, value
13, uint(QCPGraph::lsNone),
14, uint(QCPGraph::lsLine),
15, uint(QCPGraph::lsStepLeft),
16, uint(QCPGraph::lsStepRight),
17, uint(QCPGraph::lsStepCenter),
18, uint(QCPGraph::lsImpulse),
19, uint(QCPGraph::etNone),
20, uint(QCPGraph::etKey),
21, uint(QCPGraph::etValue),
22, uint(QCPGraph::etBoth),
0 // eod
};
void QCPGraph::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 6:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPGraph* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPGraph *_t = static_cast<QCPGraph *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< LineStyle*>(_v) = _t->lineStyle(); break;
case 1: *reinterpret_cast< QCPScatterStyle*>(_v) = _t->scatterStyle(); break;
case 2: *reinterpret_cast< ErrorType*>(_v) = _t->errorType(); break;
case 3: *reinterpret_cast< QPen*>(_v) = _t->errorPen(); break;
case 4: *reinterpret_cast< double*>(_v) = _t->errorBarSize(); break;
case 5: *reinterpret_cast< bool*>(_v) = _t->errorBarSkipSymbol(); break;
case 6: *reinterpret_cast< QCPGraph**>(_v) = _t->channelFillGraph(); break;
case 7: *reinterpret_cast< bool*>(_v) = _t->adaptiveSampling(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPGraph *_t = static_cast<QCPGraph *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setLineStyle(*reinterpret_cast< LineStyle*>(_v)); break;
case 1: _t->setScatterStyle(*reinterpret_cast< QCPScatterStyle*>(_v)); break;
case 2: _t->setErrorType(*reinterpret_cast< ErrorType*>(_v)); break;
case 3: _t->setErrorPen(*reinterpret_cast< QPen*>(_v)); break;
case 4: _t->setErrorBarSize(*reinterpret_cast< double*>(_v)); break;
case 5: _t->setErrorBarSkipSymbol(*reinterpret_cast< bool*>(_v)); break;
case 6: _t->setChannelFillGraph(*reinterpret_cast< QCPGraph**>(_v)); break;
case 7: _t->setAdaptiveSampling(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPGraph::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPGraph.data,
qt_meta_data_QCPGraph, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPGraph::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPGraph::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPGraph.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPGraph::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 8;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 8;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPCurve_t {
QByteArrayData data[5];
char stringdata0[58];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPCurve_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPCurve_t qt_meta_stringdata_QCPCurve = {
{
QT_MOC_LITERAL(0, 0, 8), // "QCPCurve"
QT_MOC_LITERAL(1, 9, 12), // "scatterStyle"
QT_MOC_LITERAL(2, 22, 15), // "QCPScatterStyle"
QT_MOC_LITERAL(3, 38, 9), // "lineStyle"
QT_MOC_LITERAL(4, 48, 9) // "LineStyle"
},
"QCPCurve\0scatterStyle\0QCPScatterStyle\0"
"lineStyle\0LineStyle"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPCurve[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
2, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x0009510b,
3, 0x80000000 | 4, 0x0009510b,
0 // eod
};
void QCPCurve::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPCurve *_t = static_cast<QCPCurve *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCPScatterStyle*>(_v) = _t->scatterStyle(); break;
case 1: *reinterpret_cast< LineStyle*>(_v) = _t->lineStyle(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPCurve *_t = static_cast<QCPCurve *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setScatterStyle(*reinterpret_cast< QCPScatterStyle*>(_v)); break;
case 1: _t->setLineStyle(*reinterpret_cast< LineStyle*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPCurve::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPCurve.data,
qt_meta_data_QCPCurve, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPCurve::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPCurve::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPCurve.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPCurve::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPBarsGroup_t {
QByteArrayData data[4];
char stringdata0[45];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPBarsGroup_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPBarsGroup_t qt_meta_stringdata_QCPBarsGroup = {
{
QT_MOC_LITERAL(0, 0, 12), // "QCPBarsGroup"
QT_MOC_LITERAL(1, 13, 11), // "spacingType"
QT_MOC_LITERAL(2, 25, 11), // "SpacingType"
QT_MOC_LITERAL(3, 37, 7) // "spacing"
},
"QCPBarsGroup\0spacingType\0SpacingType\0"
"spacing"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPBarsGroup[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
2, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x0009510b,
3, QMetaType::Double, 0x00095103,
0 // eod
};
void QCPBarsGroup::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPBarsGroup *_t = static_cast<QCPBarsGroup *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< SpacingType*>(_v) = _t->spacingType(); break;
case 1: *reinterpret_cast< double*>(_v) = _t->spacing(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPBarsGroup *_t = static_cast<QCPBarsGroup *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setSpacingType(*reinterpret_cast< SpacingType*>(_v)); break;
case 1: _t->setSpacing(*reinterpret_cast< double*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPBarsGroup::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_QCPBarsGroup.data,
qt_meta_data_QCPBarsGroup, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPBarsGroup::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPBarsGroup::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPBarsGroup.stringdata0))
return static_cast<void*>(this);
return QObject::qt_metacast(_clname);
}
int QCPBarsGroup::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPBars_t {
QByteArrayData data[13];
char stringdata0[135];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPBars_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPBars_t qt_meta_stringdata_QCPBars = {
{
QT_MOC_LITERAL(0, 0, 7), // "QCPBars"
QT_MOC_LITERAL(1, 8, 5), // "width"
QT_MOC_LITERAL(2, 14, 9), // "widthType"
QT_MOC_LITERAL(3, 24, 9), // "WidthType"
QT_MOC_LITERAL(4, 34, 9), // "barsGroup"
QT_MOC_LITERAL(5, 44, 13), // "QCPBarsGroup*"
QT_MOC_LITERAL(6, 58, 9), // "baseValue"
QT_MOC_LITERAL(7, 68, 8), // "barBelow"
QT_MOC_LITERAL(8, 77, 8), // "QCPBars*"
QT_MOC_LITERAL(9, 86, 8), // "barAbove"
QT_MOC_LITERAL(10, 95, 10), // "wtAbsolute"
QT_MOC_LITERAL(11, 106, 15), // "wtAxisRectRatio"
QT_MOC_LITERAL(12, 122, 12) // "wtPlotCoords"
},
"QCPBars\0width\0widthType\0WidthType\0"
"barsGroup\0QCPBarsGroup*\0baseValue\0"
"barBelow\0QCPBars*\0barAbove\0wtAbsolute\0"
"wtAxisRectRatio\0wtPlotCoords"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPBars[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
6, 14, // properties
1, 32, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::Double, 0x00095103,
2, 0x80000000 | 3, 0x0009510b,
4, 0x80000000 | 5, 0x0009510b,
6, QMetaType::Double, 0x00095103,
7, 0x80000000 | 8, 0x00095009,
9, 0x80000000 | 8, 0x00095009,
// enums: name, flags, count, data
3, 0x0, 3, 36,
// enum data: key, value
10, uint(QCPBars::wtAbsolute),
11, uint(QCPBars::wtAxisRectRatio),
12, uint(QCPBars::wtPlotCoords),
0 // eod
};
void QCPBars::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 5:
case 4:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPBars* >(); break;
case 2:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPBarsGroup* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPBars *_t = static_cast<QCPBars *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< double*>(_v) = _t->width(); break;
case 1: *reinterpret_cast< WidthType*>(_v) = _t->widthType(); break;
case 2: *reinterpret_cast< QCPBarsGroup**>(_v) = _t->barsGroup(); break;
case 3: *reinterpret_cast< double*>(_v) = _t->baseValue(); break;
case 4: *reinterpret_cast< QCPBars**>(_v) = _t->barBelow(); break;
case 5: *reinterpret_cast< QCPBars**>(_v) = _t->barAbove(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPBars *_t = static_cast<QCPBars *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setWidth(*reinterpret_cast< double*>(_v)); break;
case 1: _t->setWidthType(*reinterpret_cast< WidthType*>(_v)); break;
case 2: _t->setBarsGroup(*reinterpret_cast< QCPBarsGroup**>(_v)); break;
case 3: _t->setBaseValue(*reinterpret_cast< double*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPBars::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPBars.data,
qt_meta_data_QCPBars, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPBars::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPBars::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPBars.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPBars::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPStatisticalBox_t {
QByteArrayData data[16];
char stringdata0[181];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPStatisticalBox_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPStatisticalBox_t qt_meta_stringdata_QCPStatisticalBox = {
{
QT_MOC_LITERAL(0, 0, 17), // "QCPStatisticalBox"
QT_MOC_LITERAL(1, 18, 3), // "key"
QT_MOC_LITERAL(2, 22, 7), // "minimum"
QT_MOC_LITERAL(3, 30, 13), // "lowerQuartile"
QT_MOC_LITERAL(4, 44, 6), // "median"
QT_MOC_LITERAL(5, 51, 13), // "upperQuartile"
QT_MOC_LITERAL(6, 65, 7), // "maximum"
QT_MOC_LITERAL(7, 73, 8), // "outliers"
QT_MOC_LITERAL(8, 82, 15), // "QVector<double>"
QT_MOC_LITERAL(9, 98, 5), // "width"
QT_MOC_LITERAL(10, 104, 12), // "whiskerWidth"
QT_MOC_LITERAL(11, 117, 10), // "whiskerPen"
QT_MOC_LITERAL(12, 128, 13), // "whiskerBarPen"
QT_MOC_LITERAL(13, 142, 9), // "medianPen"
QT_MOC_LITERAL(14, 152, 12), // "outlierStyle"
QT_MOC_LITERAL(15, 165, 15) // "QCPScatterStyle"
},
"QCPStatisticalBox\0key\0minimum\0"
"lowerQuartile\0median\0upperQuartile\0"
"maximum\0outliers\0QVector<double>\0width\0"
"whiskerWidth\0whiskerPen\0whiskerBarPen\0"
"medianPen\0outlierStyle\0QCPScatterStyle"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPStatisticalBox[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
13, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::Double, 0x00095103,
2, QMetaType::Double, 0x00095103,
3, QMetaType::Double, 0x00095103,
4, QMetaType::Double, 0x00095103,
5, QMetaType::Double, 0x00095103,
6, QMetaType::Double, 0x00095103,
7, 0x80000000 | 8, 0x0009510b,
9, QMetaType::Double, 0x00095103,
10, QMetaType::Double, 0x00095103,
11, QMetaType::QPen, 0x00095103,
12, QMetaType::QPen, 0x00095103,
13, QMetaType::QPen, 0x00095103,
14, 0x80000000 | 15, 0x0009510b,
0 // eod
};
void QCPStatisticalBox::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 6:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QVector<double> >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPStatisticalBox *_t = static_cast<QCPStatisticalBox *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< double*>(_v) = _t->key(); break;
case 1: *reinterpret_cast< double*>(_v) = _t->minimum(); break;
case 2: *reinterpret_cast< double*>(_v) = _t->lowerQuartile(); break;
case 3: *reinterpret_cast< double*>(_v) = _t->median(); break;
case 4: *reinterpret_cast< double*>(_v) = _t->upperQuartile(); break;
case 5: *reinterpret_cast< double*>(_v) = _t->maximum(); break;
case 6: *reinterpret_cast< QVector<double>*>(_v) = _t->outliers(); break;
case 7: *reinterpret_cast< double*>(_v) = _t->width(); break;
case 8: *reinterpret_cast< double*>(_v) = _t->whiskerWidth(); break;
case 9: *reinterpret_cast< QPen*>(_v) = _t->whiskerPen(); break;
case 10: *reinterpret_cast< QPen*>(_v) = _t->whiskerBarPen(); break;
case 11: *reinterpret_cast< QPen*>(_v) = _t->medianPen(); break;
case 12: *reinterpret_cast< QCPScatterStyle*>(_v) = _t->outlierStyle(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPStatisticalBox *_t = static_cast<QCPStatisticalBox *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setKey(*reinterpret_cast< double*>(_v)); break;
case 1: _t->setMinimum(*reinterpret_cast< double*>(_v)); break;
case 2: _t->setLowerQuartile(*reinterpret_cast< double*>(_v)); break;
case 3: _t->setMedian(*reinterpret_cast< double*>(_v)); break;
case 4: _t->setUpperQuartile(*reinterpret_cast< double*>(_v)); break;
case 5: _t->setMaximum(*reinterpret_cast< double*>(_v)); break;
case 6: _t->setOutliers(*reinterpret_cast< QVector<double>*>(_v)); break;
case 7: _t->setWidth(*reinterpret_cast< double*>(_v)); break;
case 8: _t->setWhiskerWidth(*reinterpret_cast< double*>(_v)); break;
case 9: _t->setWhiskerPen(*reinterpret_cast< QPen*>(_v)); break;
case 10: _t->setWhiskerBarPen(*reinterpret_cast< QPen*>(_v)); break;
case 11: _t->setMedianPen(*reinterpret_cast< QPen*>(_v)); break;
case 12: _t->setOutlierStyle(*reinterpret_cast< QCPScatterStyle*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPStatisticalBox::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPStatisticalBox.data,
qt_meta_data_QCPStatisticalBox, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPStatisticalBox::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPStatisticalBox::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPStatisticalBox.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPStatisticalBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 13;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPColorMap_t {
QByteArrayData data[25];
char stringdata0[334];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPColorMap_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPColorMap_t qt_meta_stringdata_QCPColorMap = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCPColorMap"
QT_MOC_LITERAL(1, 12, 16), // "dataRangeChanged"
QT_MOC_LITERAL(2, 29, 0), // ""
QT_MOC_LITERAL(3, 30, 8), // "QCPRange"
QT_MOC_LITERAL(4, 39, 8), // "newRange"
QT_MOC_LITERAL(5, 48, 20), // "dataScaleTypeChanged"
QT_MOC_LITERAL(6, 69, 18), // "QCPAxis::ScaleType"
QT_MOC_LITERAL(7, 88, 9), // "scaleType"
QT_MOC_LITERAL(8, 98, 15), // "gradientChanged"
QT_MOC_LITERAL(9, 114, 16), // "QCPColorGradient"
QT_MOC_LITERAL(10, 131, 11), // "newGradient"
QT_MOC_LITERAL(11, 143, 12), // "setDataRange"
QT_MOC_LITERAL(12, 156, 9), // "dataRange"
QT_MOC_LITERAL(13, 166, 16), // "setDataScaleType"
QT_MOC_LITERAL(14, 183, 11), // "setGradient"
QT_MOC_LITERAL(15, 195, 8), // "gradient"
QT_MOC_LITERAL(16, 204, 16), // "updateLegendIcon"
QT_MOC_LITERAL(17, 221, 22), // "Qt::TransformationMode"
QT_MOC_LITERAL(18, 244, 13), // "transformMode"
QT_MOC_LITERAL(19, 258, 9), // "thumbSize"
QT_MOC_LITERAL(20, 268, 13), // "dataScaleType"
QT_MOC_LITERAL(21, 282, 11), // "interpolate"
QT_MOC_LITERAL(22, 294, 13), // "tightBoundary"
QT_MOC_LITERAL(23, 308, 10), // "colorScale"
QT_MOC_LITERAL(24, 319, 14) // "QCPColorScale*"
},
"QCPColorMap\0dataRangeChanged\0\0QCPRange\0"
"newRange\0dataScaleTypeChanged\0"
"QCPAxis::ScaleType\0scaleType\0"
"gradientChanged\0QCPColorGradient\0"
"newGradient\0setDataRange\0dataRange\0"
"setDataScaleType\0setGradient\0gradient\0"
"updateLegendIcon\0Qt::TransformationMode\0"
"transformMode\0thumbSize\0dataScaleType\0"
"interpolate\0tightBoundary\0colorScale\0"
"QCPColorScale*"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPColorMap[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
9, 14, // methods
6, 86, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
3, // signalCount
// signals: name, argc, parameters, tag, flags
1, 1, 59, 2, 0x06 /* Public */,
5, 1, 62, 2, 0x06 /* Public */,
8, 1, 65, 2, 0x06 /* Public */,
// slots: name, argc, parameters, tag, flags
11, 1, 68, 2, 0x0a /* Public */,
13, 1, 71, 2, 0x0a /* Public */,
14, 1, 74, 2, 0x0a /* Public */,
16, 2, 77, 2, 0x0a /* Public */,
16, 1, 82, 2, 0x2a /* Public | MethodCloned */,
16, 0, 85, 2, 0x2a /* Public | MethodCloned */,
// signals: parameters
QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 6, 7,
QMetaType::Void, 0x80000000 | 9, 10,
// slots: parameters
QMetaType::Void, 0x80000000 | 3, 12,
QMetaType::Void, 0x80000000 | 6, 7,
QMetaType::Void, 0x80000000 | 9, 15,
QMetaType::Void, 0x80000000 | 17, QMetaType::QSize, 18, 19,
QMetaType::Void, 0x80000000 | 17, 18,
QMetaType::Void,
// properties: name, type, flags
12, 0x80000000 | 3, 0x0049510b,
20, 0x80000000 | 6, 0x0049510b,
15, 0x80000000 | 9, 0x0049510b,
21, QMetaType::Bool, 0x00095103,
22, QMetaType::Bool, 0x00095103,
23, 0x80000000 | 24, 0x0009510b,
// properties: notify_signal_id
0,
1,
2,
0,
0,
0,
0 // eod
};
void QCPColorMap::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
QCPColorMap *_t = static_cast<QCPColorMap *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->dataRangeChanged((*reinterpret_cast< QCPRange(*)>(_a[1]))); break;
case 1: _t->dataScaleTypeChanged((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 2: _t->gradientChanged((*reinterpret_cast< QCPColorGradient(*)>(_a[1]))); break;
case 3: _t->setDataRange((*reinterpret_cast< const QCPRange(*)>(_a[1]))); break;
case 4: _t->setDataScaleType((*reinterpret_cast< QCPAxis::ScaleType(*)>(_a[1]))); break;
case 5: _t->setGradient((*reinterpret_cast< const QCPColorGradient(*)>(_a[1]))); break;
case 6: _t->updateLegendIcon((*reinterpret_cast< Qt::TransformationMode(*)>(_a[1])),(*reinterpret_cast< const QSize(*)>(_a[2]))); break;
case 7: _t->updateLegendIcon((*reinterpret_cast< Qt::TransformationMode(*)>(_a[1]))); break;
case 8: _t->updateLegendIcon(); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (QCPColorMap::*)(QCPRange );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorMap::dataRangeChanged)) {
*result = 0;
return;
}
}
{
using _t = void (QCPColorMap::*)(QCPAxis::ScaleType );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorMap::dataScaleTypeChanged)) {
*result = 1;
return;
}
}
{
using _t = void (QCPColorMap::*)(QCPColorGradient );
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&QCPColorMap::gradientChanged)) {
*result = 2;
return;
}
}
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 5:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPColorScale* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPColorMap *_t = static_cast<QCPColorMap *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QCPRange*>(_v) = _t->dataRange(); break;
case 1: *reinterpret_cast< QCPAxis::ScaleType*>(_v) = _t->dataScaleType(); break;
case 2: *reinterpret_cast< QCPColorGradient*>(_v) = _t->gradient(); break;
case 3: *reinterpret_cast< bool*>(_v) = _t->interpolate(); break;
case 4: *reinterpret_cast< bool*>(_v) = _t->tightBoundary(); break;
case 5: *reinterpret_cast< QCPColorScale**>(_v) = _t->colorScale(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPColorMap *_t = static_cast<QCPColorMap *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setDataRange(*reinterpret_cast< QCPRange*>(_v)); break;
case 1: _t->setDataScaleType(*reinterpret_cast< QCPAxis::ScaleType*>(_v)); break;
case 2: _t->setGradient(*reinterpret_cast< QCPColorGradient*>(_v)); break;
case 3: _t->setInterpolate(*reinterpret_cast< bool*>(_v)); break;
case 4: _t->setTightBoundary(*reinterpret_cast< bool*>(_v)); break;
case 5: _t->setColorScale(*reinterpret_cast< QCPColorScale**>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
static const QMetaObject * const qt_meta_extradata_QCPColorMap[] = {
&QCPAxis::staticMetaObject,
nullptr
};
QT_INIT_METAOBJECT const QMetaObject QCPColorMap::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPColorMap.data,
qt_meta_data_QCPColorMap, qt_static_metacall, qt_meta_extradata_QCPColorMap, nullptr}
};
const QMetaObject *QCPColorMap::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPColorMap::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPColorMap.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPColorMap::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 9)
qt_static_metacall(this, _c, _id, _a);
_id -= 9;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 9)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 9;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void QCPColorMap::dataRangeChanged(QCPRange _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void QCPColorMap::dataScaleTypeChanged(QCPAxis::ScaleType _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
// SIGNAL 2
void QCPColorMap::gradientChanged(QCPColorGradient _t1)
{
void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 2, _a);
}
struct qt_meta_stringdata_QCPFinancial_t {
QByteArrayData data[11];
char stringdata0[125];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPFinancial_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPFinancial_t qt_meta_stringdata_QCPFinancial = {
{
QT_MOC_LITERAL(0, 0, 12), // "QCPFinancial"
QT_MOC_LITERAL(1, 13, 10), // "chartStyle"
QT_MOC_LITERAL(2, 24, 10), // "ChartStyle"
QT_MOC_LITERAL(3, 35, 5), // "width"
QT_MOC_LITERAL(4, 41, 10), // "twoColored"
QT_MOC_LITERAL(5, 52, 13), // "brushPositive"
QT_MOC_LITERAL(6, 66, 13), // "brushNegative"
QT_MOC_LITERAL(7, 80, 11), // "penPositive"
QT_MOC_LITERAL(8, 92, 11), // "penNegative"
QT_MOC_LITERAL(9, 104, 6), // "csOhlc"
QT_MOC_LITERAL(10, 111, 13) // "csCandlestick"
},
"QCPFinancial\0chartStyle\0ChartStyle\0"
"width\0twoColored\0brushPositive\0"
"brushNegative\0penPositive\0penNegative\0"
"csOhlc\0csCandlestick"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPFinancial[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
7, 14, // properties
1, 35, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, 0x80000000 | 2, 0x0009510b,
3, QMetaType::Double, 0x00095103,
4, QMetaType::Bool, 0x00095103,
5, QMetaType::QBrush, 0x00095103,
6, QMetaType::QBrush, 0x00095103,
7, QMetaType::QPen, 0x00095103,
8, QMetaType::QPen, 0x00095103,
// enums: name, flags, count, data
2, 0x0, 2, 39,
// enum data: key, value
9, uint(QCPFinancial::csOhlc),
10, uint(QCPFinancial::csCandlestick),
0 // eod
};
void QCPFinancial::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPFinancial *_t = static_cast<QCPFinancial *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< ChartStyle*>(_v) = _t->chartStyle(); break;
case 1: *reinterpret_cast< double*>(_v) = _t->width(); break;
case 2: *reinterpret_cast< bool*>(_v) = _t->twoColored(); break;
case 3: *reinterpret_cast< QBrush*>(_v) = _t->brushPositive(); break;
case 4: *reinterpret_cast< QBrush*>(_v) = _t->brushNegative(); break;
case 5: *reinterpret_cast< QPen*>(_v) = _t->penPositive(); break;
case 6: *reinterpret_cast< QPen*>(_v) = _t->penNegative(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPFinancial *_t = static_cast<QCPFinancial *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setChartStyle(*reinterpret_cast< ChartStyle*>(_v)); break;
case 1: _t->setWidth(*reinterpret_cast< double*>(_v)); break;
case 2: _t->setTwoColored(*reinterpret_cast< bool*>(_v)); break;
case 3: _t->setBrushPositive(*reinterpret_cast< QBrush*>(_v)); break;
case 4: _t->setBrushNegative(*reinterpret_cast< QBrush*>(_v)); break;
case 5: _t->setPenPositive(*reinterpret_cast< QPen*>(_v)); break;
case 6: _t->setPenNegative(*reinterpret_cast< QPen*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPFinancial::staticMetaObject = {
{ &QCPAbstractPlottable::staticMetaObject, qt_meta_stringdata_QCPFinancial.data,
qt_meta_data_QCPFinancial, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPFinancial::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPFinancial::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPFinancial.stringdata0))
return static_cast<void*>(this);
return QCPAbstractPlottable::qt_metacast(_clname);
}
int QCPFinancial::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractPlottable::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 7;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 7;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemStraightLine_t {
QByteArrayData data[3];
char stringdata0[36];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemStraightLine_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemStraightLine_t qt_meta_stringdata_QCPItemStraightLine = {
{
QT_MOC_LITERAL(0, 0, 19), // "QCPItemStraightLine"
QT_MOC_LITERAL(1, 20, 3), // "pen"
QT_MOC_LITERAL(2, 24, 11) // "selectedPen"
},
"QCPItemStraightLine\0pen\0selectedPen"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemStraightLine[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
2, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
0 // eod
};
void QCPItemStraightLine::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemStraightLine *_t = static_cast<QCPItemStraightLine *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemStraightLine *_t = static_cast<QCPItemStraightLine *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemStraightLine::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemStraightLine.data,
qt_meta_data_QCPItemStraightLine, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemStraightLine::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemStraightLine::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemStraightLine.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemStraightLine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemLine_t {
QByteArrayData data[6];
char stringdata0[52];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemLine_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemLine_t qt_meta_stringdata_QCPItemLine = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCPItemLine"
QT_MOC_LITERAL(1, 12, 3), // "pen"
QT_MOC_LITERAL(2, 16, 11), // "selectedPen"
QT_MOC_LITERAL(3, 28, 4), // "head"
QT_MOC_LITERAL(4, 33, 13), // "QCPLineEnding"
QT_MOC_LITERAL(5, 47, 4) // "tail"
},
"QCPItemLine\0pen\0selectedPen\0head\0"
"QCPLineEnding\0tail"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemLine[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
4, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, 0x80000000 | 4, 0x0009510b,
5, 0x80000000 | 4, 0x0009510b,
0 // eod
};
void QCPItemLine::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemLine *_t = static_cast<QCPItemLine *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< QCPLineEnding*>(_v) = _t->head(); break;
case 3: *reinterpret_cast< QCPLineEnding*>(_v) = _t->tail(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemLine *_t = static_cast<QCPItemLine *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setHead(*reinterpret_cast< QCPLineEnding*>(_v)); break;
case 3: _t->setTail(*reinterpret_cast< QCPLineEnding*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemLine::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemLine.data,
qt_meta_data_QCPItemLine, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemLine::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemLine::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemLine.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemLine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemCurve_t {
QByteArrayData data[6];
char stringdata0[53];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemCurve_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemCurve_t qt_meta_stringdata_QCPItemCurve = {
{
QT_MOC_LITERAL(0, 0, 12), // "QCPItemCurve"
QT_MOC_LITERAL(1, 13, 3), // "pen"
QT_MOC_LITERAL(2, 17, 11), // "selectedPen"
QT_MOC_LITERAL(3, 29, 4), // "head"
QT_MOC_LITERAL(4, 34, 13), // "QCPLineEnding"
QT_MOC_LITERAL(5, 48, 4) // "tail"
},
"QCPItemCurve\0pen\0selectedPen\0head\0"
"QCPLineEnding\0tail"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemCurve[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
4, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, 0x80000000 | 4, 0x0009510b,
5, 0x80000000 | 4, 0x0009510b,
0 // eod
};
void QCPItemCurve::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemCurve *_t = static_cast<QCPItemCurve *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< QCPLineEnding*>(_v) = _t->head(); break;
case 3: *reinterpret_cast< QCPLineEnding*>(_v) = _t->tail(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemCurve *_t = static_cast<QCPItemCurve *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setHead(*reinterpret_cast< QCPLineEnding*>(_v)); break;
case 3: _t->setTail(*reinterpret_cast< QCPLineEnding*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemCurve::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemCurve.data,
qt_meta_data_QCPItemCurve, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemCurve::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemCurve::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemCurve.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemCurve::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemRect_t {
QByteArrayData data[5];
char stringdata0[48];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemRect_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemRect_t qt_meta_stringdata_QCPItemRect = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCPItemRect"
QT_MOC_LITERAL(1, 12, 3), // "pen"
QT_MOC_LITERAL(2, 16, 11), // "selectedPen"
QT_MOC_LITERAL(3, 28, 5), // "brush"
QT_MOC_LITERAL(4, 34, 13) // "selectedBrush"
},
"QCPItemRect\0pen\0selectedPen\0brush\0"
"selectedBrush"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemRect[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
4, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, QMetaType::QBrush, 0x00095103,
4, QMetaType::QBrush, 0x00095103,
0 // eod
};
void QCPItemRect::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemRect *_t = static_cast<QCPItemRect *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 3: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemRect *_t = static_cast<QCPItemRect *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 3: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemRect::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemRect.data,
qt_meta_data_QCPItemRect, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemRect::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemRect::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemRect.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemRect::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemText_t {
QByteArrayData data[16];
char stringdata0[163];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemText_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemText_t qt_meta_stringdata_QCPItemText = {
{
QT_MOC_LITERAL(0, 0, 11), // "QCPItemText"
QT_MOC_LITERAL(1, 12, 5), // "color"
QT_MOC_LITERAL(2, 18, 13), // "selectedColor"
QT_MOC_LITERAL(3, 32, 3), // "pen"
QT_MOC_LITERAL(4, 36, 11), // "selectedPen"
QT_MOC_LITERAL(5, 48, 5), // "brush"
QT_MOC_LITERAL(6, 54, 13), // "selectedBrush"
QT_MOC_LITERAL(7, 68, 4), // "font"
QT_MOC_LITERAL(8, 73, 12), // "selectedFont"
QT_MOC_LITERAL(9, 86, 4), // "text"
QT_MOC_LITERAL(10, 91, 17), // "positionAlignment"
QT_MOC_LITERAL(11, 109, 13), // "Qt::Alignment"
QT_MOC_LITERAL(12, 123, 13), // "textAlignment"
QT_MOC_LITERAL(13, 137, 8), // "rotation"
QT_MOC_LITERAL(14, 146, 7), // "padding"
QT_MOC_LITERAL(15, 154, 8) // "QMargins"
},
"QCPItemText\0color\0selectedColor\0pen\0"
"selectedPen\0brush\0selectedBrush\0font\0"
"selectedFont\0text\0positionAlignment\0"
"Qt::Alignment\0textAlignment\0rotation\0"
"padding\0QMargins"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemText[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
13, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QColor, 0x00095103,
2, QMetaType::QColor, 0x00095103,
3, QMetaType::QPen, 0x00095103,
4, QMetaType::QPen, 0x00095103,
5, QMetaType::QBrush, 0x00095103,
6, QMetaType::QBrush, 0x00095103,
7, QMetaType::QFont, 0x00095103,
8, QMetaType::QFont, 0x00095103,
9, QMetaType::QString, 0x00095103,
10, 0x80000000 | 11, 0x0009510b,
12, 0x80000000 | 11, 0x0009510b,
13, QMetaType::Double, 0x00095103,
14, 0x80000000 | 15, 0x0009510b,
0 // eod
};
void QCPItemText::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemText *_t = static_cast<QCPItemText *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QColor*>(_v) = _t->color(); break;
case 1: *reinterpret_cast< QColor*>(_v) = _t->selectedColor(); break;
case 2: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 3: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 4: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 5: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
case 6: *reinterpret_cast< QFont*>(_v) = _t->font(); break;
case 7: *reinterpret_cast< QFont*>(_v) = _t->selectedFont(); break;
case 8: *reinterpret_cast< QString*>(_v) = _t->text(); break;
case 9: *reinterpret_cast< Qt::Alignment*>(_v) = _t->positionAlignment(); break;
case 10: *reinterpret_cast< Qt::Alignment*>(_v) = _t->textAlignment(); break;
case 11: *reinterpret_cast< double*>(_v) = _t->rotation(); break;
case 12: *reinterpret_cast< QMargins*>(_v) = _t->padding(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemText *_t = static_cast<QCPItemText *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setColor(*reinterpret_cast< QColor*>(_v)); break;
case 1: _t->setSelectedColor(*reinterpret_cast< QColor*>(_v)); break;
case 2: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 3: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 4: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 5: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 6: _t->setFont(*reinterpret_cast< QFont*>(_v)); break;
case 7: _t->setSelectedFont(*reinterpret_cast< QFont*>(_v)); break;
case 8: _t->setText(*reinterpret_cast< QString*>(_v)); break;
case 9: _t->setPositionAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break;
case 10: _t->setTextAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break;
case 11: _t->setRotation(*reinterpret_cast< double*>(_v)); break;
case 12: _t->setPadding(*reinterpret_cast< QMargins*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemText::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemText.data,
qt_meta_data_QCPItemText, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemText::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemText::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemText.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemText::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 13;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 13;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemEllipse_t {
QByteArrayData data[5];
char stringdata0[51];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemEllipse_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemEllipse_t qt_meta_stringdata_QCPItemEllipse = {
{
QT_MOC_LITERAL(0, 0, 14), // "QCPItemEllipse"
QT_MOC_LITERAL(1, 15, 3), // "pen"
QT_MOC_LITERAL(2, 19, 11), // "selectedPen"
QT_MOC_LITERAL(3, 31, 5), // "brush"
QT_MOC_LITERAL(4, 37, 13) // "selectedBrush"
},
"QCPItemEllipse\0pen\0selectedPen\0brush\0"
"selectedBrush"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemEllipse[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
4, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, QMetaType::QBrush, 0x00095103,
4, QMetaType::QBrush, 0x00095103,
0 // eod
};
void QCPItemEllipse::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemEllipse *_t = static_cast<QCPItemEllipse *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 3: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemEllipse *_t = static_cast<QCPItemEllipse *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 3: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemEllipse::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemEllipse.data,
qt_meta_data_QCPItemEllipse, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemEllipse::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemEllipse::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemEllipse.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemEllipse::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemPixmap_t {
QByteArrayData data[9];
char stringdata0[122];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemPixmap_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemPixmap_t qt_meta_stringdata_QCPItemPixmap = {
{
QT_MOC_LITERAL(0, 0, 13), // "QCPItemPixmap"
QT_MOC_LITERAL(1, 14, 6), // "pixmap"
QT_MOC_LITERAL(2, 21, 6), // "scaled"
QT_MOC_LITERAL(3, 28, 15), // "aspectRatioMode"
QT_MOC_LITERAL(4, 44, 19), // "Qt::AspectRatioMode"
QT_MOC_LITERAL(5, 64, 18), // "transformationMode"
QT_MOC_LITERAL(6, 83, 22), // "Qt::TransformationMode"
QT_MOC_LITERAL(7, 106, 3), // "pen"
QT_MOC_LITERAL(8, 110, 11) // "selectedPen"
},
"QCPItemPixmap\0pixmap\0scaled\0aspectRatioMode\0"
"Qt::AspectRatioMode\0transformationMode\0"
"Qt::TransformationMode\0pen\0selectedPen"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemPixmap[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
6, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPixmap, 0x00095103,
2, QMetaType::Bool, 0x00095103,
3, 0x80000000 | 4, 0x00095009,
5, 0x80000000 | 6, 0x00095009,
7, QMetaType::QPen, 0x00095103,
8, QMetaType::QPen, 0x00095103,
0 // eod
};
void QCPItemPixmap::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemPixmap *_t = static_cast<QCPItemPixmap *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPixmap*>(_v) = _t->pixmap(); break;
case 1: *reinterpret_cast< bool*>(_v) = _t->scaled(); break;
case 2: *reinterpret_cast< Qt::AspectRatioMode*>(_v) = _t->aspectRatioMode(); break;
case 3: *reinterpret_cast< Qt::TransformationMode*>(_v) = _t->transformationMode(); break;
case 4: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 5: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemPixmap *_t = static_cast<QCPItemPixmap *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPixmap(*reinterpret_cast< QPixmap*>(_v)); break;
case 1: _t->setScaled(*reinterpret_cast< bool*>(_v)); break;
case 4: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 5: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemPixmap::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemPixmap.data,
qt_meta_data_QCPItemPixmap, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemPixmap::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemPixmap::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemPixmap.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemPixmap::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemTracer_t {
QByteArrayData data[17];
char stringdata0[156];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemTracer_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemTracer_t qt_meta_stringdata_QCPItemTracer = {
{
QT_MOC_LITERAL(0, 0, 13), // "QCPItemTracer"
QT_MOC_LITERAL(1, 14, 3), // "pen"
QT_MOC_LITERAL(2, 18, 11), // "selectedPen"
QT_MOC_LITERAL(3, 30, 5), // "brush"
QT_MOC_LITERAL(4, 36, 13), // "selectedBrush"
QT_MOC_LITERAL(5, 50, 4), // "size"
QT_MOC_LITERAL(6, 55, 5), // "style"
QT_MOC_LITERAL(7, 61, 11), // "TracerStyle"
QT_MOC_LITERAL(8, 73, 5), // "graph"
QT_MOC_LITERAL(9, 79, 9), // "QCPGraph*"
QT_MOC_LITERAL(10, 89, 8), // "graphKey"
QT_MOC_LITERAL(11, 98, 13), // "interpolating"
QT_MOC_LITERAL(12, 112, 6), // "tsNone"
QT_MOC_LITERAL(13, 119, 6), // "tsPlus"
QT_MOC_LITERAL(14, 126, 11), // "tsCrosshair"
QT_MOC_LITERAL(15, 138, 8), // "tsCircle"
QT_MOC_LITERAL(16, 147, 8) // "tsSquare"
},
"QCPItemTracer\0pen\0selectedPen\0brush\0"
"selectedBrush\0size\0style\0TracerStyle\0"
"graph\0QCPGraph*\0graphKey\0interpolating\0"
"tsNone\0tsPlus\0tsCrosshair\0tsCircle\0"
"tsSquare"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemTracer[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
9, 14, // properties
1, 41, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, QMetaType::QBrush, 0x00095103,
4, QMetaType::QBrush, 0x00095103,
5, QMetaType::Double, 0x00095103,
6, 0x80000000 | 7, 0x0009510b,
8, 0x80000000 | 9, 0x0009510b,
10, QMetaType::Double, 0x00095103,
11, QMetaType::Bool, 0x00095103,
// enums: name, flags, count, data
7, 0x0, 5, 45,
// enum data: key, value
12, uint(QCPItemTracer::tsNone),
13, uint(QCPItemTracer::tsPlus),
14, uint(QCPItemTracer::tsCrosshair),
15, uint(QCPItemTracer::tsCircle),
16, uint(QCPItemTracer::tsSquare),
0 // eod
};
void QCPItemTracer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::RegisterPropertyMetaType) {
switch (_id) {
default: *reinterpret_cast<int*>(_a[0]) = -1; break;
case 6:
*reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< QCPGraph* >(); break;
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
QCPItemTracer *_t = static_cast<QCPItemTracer *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< QBrush*>(_v) = _t->brush(); break;
case 3: *reinterpret_cast< QBrush*>(_v) = _t->selectedBrush(); break;
case 4: *reinterpret_cast< double*>(_v) = _t->size(); break;
case 5: *reinterpret_cast< TracerStyle*>(_v) = _t->style(); break;
case 6: *reinterpret_cast< QCPGraph**>(_v) = _t->graph(); break;
case 7: *reinterpret_cast< double*>(_v) = _t->graphKey(); break;
case 8: *reinterpret_cast< bool*>(_v) = _t->interpolating(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemTracer *_t = static_cast<QCPItemTracer *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 3: _t->setSelectedBrush(*reinterpret_cast< QBrush*>(_v)); break;
case 4: _t->setSize(*reinterpret_cast< double*>(_v)); break;
case 5: _t->setStyle(*reinterpret_cast< TracerStyle*>(_v)); break;
case 6: _t->setGraph(*reinterpret_cast< QCPGraph**>(_v)); break;
case 7: _t->setGraphKey(*reinterpret_cast< double*>(_v)); break;
case 8: _t->setInterpolating(*reinterpret_cast< bool*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemTracer::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemTracer.data,
qt_meta_data_QCPItemTracer, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemTracer::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemTracer::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemTracer.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemTracer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 9;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 9;
}
#endif // QT_NO_PROPERTIES
return _id;
}
struct qt_meta_stringdata_QCPItemBracket_t {
QByteArrayData data[6];
char stringdata0[57];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_QCPItemBracket_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_QCPItemBracket_t qt_meta_stringdata_QCPItemBracket = {
{
QT_MOC_LITERAL(0, 0, 14), // "QCPItemBracket"
QT_MOC_LITERAL(1, 15, 3), // "pen"
QT_MOC_LITERAL(2, 19, 11), // "selectedPen"
QT_MOC_LITERAL(3, 31, 6), // "length"
QT_MOC_LITERAL(4, 38, 5), // "style"
QT_MOC_LITERAL(5, 44, 12) // "BracketStyle"
},
"QCPItemBracket\0pen\0selectedPen\0length\0"
"style\0BracketStyle"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_QCPItemBracket[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
4, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QPen, 0x00095103,
2, QMetaType::QPen, 0x00095103,
3, QMetaType::Double, 0x00095103,
4, 0x80000000 | 5, 0x0009510b,
0 // eod
};
void QCPItemBracket::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
QCPItemBracket *_t = static_cast<QCPItemBracket *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QPen*>(_v) = _t->pen(); break;
case 1: *reinterpret_cast< QPen*>(_v) = _t->selectedPen(); break;
case 2: *reinterpret_cast< double*>(_v) = _t->length(); break;
case 3: *reinterpret_cast< BracketStyle*>(_v) = _t->style(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
QCPItemBracket *_t = static_cast<QCPItemBracket *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setPen(*reinterpret_cast< QPen*>(_v)); break;
case 1: _t->setSelectedPen(*reinterpret_cast< QPen*>(_v)); break;
case 2: _t->setLength(*reinterpret_cast< double*>(_v)); break;
case 3: _t->setStyle(*reinterpret_cast< BracketStyle*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject QCPItemBracket::staticMetaObject = {
{ &QCPAbstractItem::staticMetaObject, qt_meta_stringdata_QCPItemBracket.data,
qt_meta_data_QCPItemBracket, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *QCPItemBracket::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *QCPItemBracket::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_QCPItemBracket.stringdata0))
return static_cast<void*>(this);
return QCPAbstractItem::qt_metacast(_clname);
}
int QCPItemBracket::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QCPAbstractItem::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 4;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 4;
}
#endif // QT_NO_PROPERTIES
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| [
"[email protected]"
] | |
e947ee59720b00c8edf448d1b419d171ecccaf3b | 4ee1a4147938da3265c85e7b447282e0f5d9fcb9 | /Gloggly/GLoggly/HeaderInfo.cpp | b8b0cf1e9fe99a86f41aec75f3111c0f6cd13015 | [] | no_license | YeonchulKim/GeniChartTools | c9f58a024585dbb91acafd049a0f3bce875e4f26 | 58c6fa2929e7c7221889aa8ae03afb30cfde3152 | refs/heads/master | 2021-05-07T15:52:11.207493 | 2017-11-01T23:06:37 | 2017-11-01T23:06:37 | 108,549,939 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 161 | cpp | #include "StdAfx.h"
#include "HeaderInfo.h"
CHeaderInfo::CHeaderInfo(void)
{
m_Header.resize(COUNT);
}
CHeaderInfo::~CHeaderInfo(void)
{
m_Header.clear();
}
| [
"[email protected]"
] | |
2f85401fd10ea58218f877c4b94f9b41baee4be0 | 1337a747db741d24a11cf10d3c4b0c9d173f8a6d | /Libraries/gtkmm/include/glibmm/giomm/private/dbusinterface_p.h | 1afe76642f91936b691e4c23ae35349008bd72a9 | [
"MIT"
] | permissive | iCodeIN/Wings | 0a1c17979439fc17e9bd55c43a7cc993973a3032 | 1dbf0c88cf3cc97b48788c23abc50c32447e228a | refs/heads/master | 2021-06-12T22:29:07.009637 | 2017-03-19T07:10:42 | 2017-03-19T07:10:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,384 | h | // -*- c++ -*-
// Generated by gmmproc 2.46.2 -- DO NOT MODIFY!
#ifndef _GIOMM_DBUSINTERFACE_P_H
#define _GIOMM_DBUSINTERFACE_P_H
#include <glibmm/private/interface_p.h>
#include <gio/gio.h>
#include <glibmm/private/interface_p.h>
namespace Gio
{
namespace DBus
{
class Interface_Class : public Glib::Interface_Class
{
public:
typedef Interface CppObjectType;
typedef GDBusInterface BaseObjectType;
typedef GDBusInterfaceIface BaseClassType;
typedef Glib::Interface_Class CppClassParent;
friend class Interface;
const Glib::Interface_Class& init();
static void iface_init_function(void* g_iface, void* iface_data);
static Glib::ObjectBase* wrap_new(GObject*);
protected:
//Callbacks (default signal handlers):
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
//You could prevent the original default signal handlers being called by overriding the *_impl method.
//Callbacks (virtual functions):
static GDBusInterfaceInfo* get_info_vfunc_callback(GDBusInterface* self);
static GDBusObject* get_object_vfunc_callback(GDBusInterface* self);
static void set_object_vfunc_callback(GDBusInterface* self, GDBusObject* object);
static GDBusObject* dup_object_vfunc_callback(GDBusInterface* self);
};
} // namespace DBus
} // namespace Gio
#endif /* _GIOMM_DBUSINTERFACE_P_H */
| [
"[email protected]"
] | |
3f2780e5578de418ba7356a325d6f05737a00dc9 | 6fd4e46a21502a07ae9dd0ac04691ea6fbda18db | /MusicPlayer2/strcpcvt.cpp | 6a112d1e8fef49932afa992fd0c6e28184535b46 | [
"MIT"
] | permissive | devcxx/MusicPlayerPlus | 27aca3a895c6b77f61240079529c5d342be53930 | ffbcce181308cc516be9377e75a4c8a82cc9c16b | refs/heads/master | 2020-05-22T08:25:51.907575 | 2019-05-13T16:29:00 | 2019-05-13T16:29:00 | 186,277,442 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,669 | cpp | #include "stdafx.h"
#include "strcpcvt.h"
std::string cvt::utf8ts(const std::string& utf8)
{
// convert an utf8 string to widechar
__int32 nLen = ::MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), utf8.size(), NULL, 0);
wchar_t* lpszW = NULL;
lpszW = new wchar_t[nLen];
__int32 nRtn = ::MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), utf8.size(), lpszW, nLen);
if (nRtn != nLen)
{
delete[] lpszW;
return "";
}
// convert widechar string to multibyte
__int32 mbLen = ::WideCharToMultiByte(CP_ACP, 0, lpszW, nLen, NULL, 0, NULL, NULL);
if (mbLen <= 0)
{
return "";
}
std::string _str;
_str.resize(mbLen);
nRtn = ::WideCharToMultiByte(CP_ACP, 0, lpszW, nLen, (LPSTR)_str.c_str(), mbLen, NULL, NULL);
if (nRtn != mbLen)
{
delete[] lpszW;
return "";
}
delete[] lpszW;
return _str;
}
std::wstring cvt::s2ws(std::string s)
{
std::wstring ws;
#ifdef _MSC_VER
int iLen = ::MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, NULL, 0);
if (iLen > 0)
{
wchar_t* pwszDst = new wchar_t[iLen];
if (pwszDst)
{
::MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, pwszDst, iLen);
pwszDst[iLen - 1] = 0;
ws = pwszDst;
delete[]pwszDst;
}
}
#else
std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = "C";
setlocale(LC_ALL, "chs");
size_t _Dsize = 2 * (wcslen(wstr) + 1);
char *_Dest = new char[_Dsize];
memset(_Dest, 0, _Dsize);
wcstombs(_Dest, wstr, _Dsize);
ws = _Dest;
delete[]_Dest;
setlocale(LC_ALL, curLocale.c_str());
#endif
return (ws);
}
std::string cvt::ws2s(std::wstring wstr)
{
std::string str;
#ifdef _MSC_VER
int iLen = ::WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL);
if (iLen > 0)
{
char* pszDst = new char[iLen];
if (pszDst)
{
::WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, pszDst, iLen, NULL, NULL);
pszDst[iLen - 1] = 0;
str = pszDst;
delete[] pszDst;
}
}
#else
std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = "C";
setlocale(LC_ALL, "chs");
size_t _Dsize = 2 * (wcslen(wstr) + 1);
char *_Dest = new char[_Dsize];
memset(_Dest, 0, _Dsize);
wcstombs(_Dest, wstr, _Dsize);
str = _Dest;
delete[]_Dest;
setlocale(LC_ALL, curLocale.c_str());
#endif
return (str);
}
unsigned char cvt::tohex(const unsigned char& x)
{
return x > 9 ? x + 55 : x + 48;
}
std::string cvt::urlencoder(std::string& sIn)
{
std::string sOut;
for (unsigned int ix = 0; ix < sIn.size(); ix++)
{
unsigned char buf[4];
memset(buf, 0, 4);
if (isalnum((unsigned char)sIn[ix]))
{
buf[0] = sIn[ix];
}
else if (isspace((unsigned char)sIn[ix]))
{
buf[0] = '+';
}
else
{
buf[0] = '%';
buf[1] = tohex((unsigned char)sIn[ix] >> 4);
buf[2] = tohex((unsigned char)sIn[ix] % 16);
}
sOut += (char *)buf;
}
return sOut;
}
std::wstring cvt::utf8tws(const std::string& utf8)
{
// convert an utf8 string to widechar
__int32 nLen = ::MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), utf8.size(), NULL, 0);
std::wstring _str;
_str.resize(nLen);
__int32 nRtn = ::MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), utf8.size(), (LPWSTR)_str.c_str(), nLen);
return _str;
}
std::string cvt::s2utf8(const std::string& str)
{
std::string _utf8(str);
__int32 nLen = ::MultiByteToWideChar(CP_ACP, 0, _utf8.c_str(), _utf8.size(), NULL, 0);
wchar_t* lpszW = NULL;
lpszW = new wchar_t[nLen];
__int32 nRtn = ::MultiByteToWideChar(CP_ACP, 0, _utf8.c_str(), _utf8.size(), lpszW, nLen);
if (nRtn != nLen)
{
delete[] lpszW;
return "";
}
// convert widechar string to utf-8
__int32 utf8Len = ::WideCharToMultiByte(CP_UTF8, 0, lpszW, nLen, NULL, 0, NULL, NULL);
if (utf8Len <= 0)
return "";
_utf8.resize(utf8Len);
nRtn = ::WideCharToMultiByte(CP_UTF8, 0, lpszW, nLen, (LPSTR)_utf8.c_str(), utf8Len, NULL, NULL);
delete[] lpszW;
return _utf8;
}
void cvt::replaceSubStr(std::string& strSource, const std::string& strOld, const std::string& strNew)
{
int nPos = 0;
while ((nPos = strSource.find(strOld, nPos)) != strSource.npos)
{
strSource.replace(nPos, strOld.length(), strNew);
nPos += strNew.length();
}
}
void cvt::eraseSubStr(std::string & mainStr, const std::string & toErase)
{
// Search for the substring in string
size_t pos = mainStr.find(toErase);
if (pos != std::string::npos)
{
// If found then erase it from string
mainStr.erase(pos, toErase.length());
}
}
void cvt::eraseAllSubStr(std::string & mainStr, const std::string & toErase)
{
size_t pos = std::string::npos;
// Search for the substring in string in a loop untill nothing is found
while ((pos = mainStr.find(toErase)) != std::string::npos)
{
// If found then erase it from string
mainStr.erase(pos, toErase.length());
}
}
| [
"[email protected]"
] | |
2cb17fe41965aa4a7c6a5f38a3248826e16d8060 | c1a27f6c8f1595b0f595b03ecf026e6121ac1ab4 | /BackupSystem/Trimming.h | 8c828bdf946b4676c7815f7730bfd99d4413e88b | [] | no_license | aogavrilov/Backups | 1e82a7e3d3f2e51b6adacb849f209e0befc334a5 | 6ac5f0dcd42aa141c529360321f8223f04e54d06 | refs/heads/master | 2023-01-13T20:16:45.551109 | 2020-11-27T20:22:25 | 2020-11-27T20:22:25 | 305,348,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,334 | h | //
// Created by Alexey on 20.10.2020.
//
#ifndef BACKUPS_TRIMMING_H
#define BACKUPS_TRIMMING_H
using namespace std;
#include <vector>
#include "Backup.h"
class Trimming{
protected:
Backup backup;
public:
Trimming(Backup backup) : backup(backup){};
virtual vector<bool> FilterPointsForRemove();
Backup Trim();
Backup Trim(vector<bool> DeletingPositions);
Backup AutoTrim();
vector<bool> bools;
};
class PointsTrimmingByCount : public Trimming{
int count;
public:
PointsTrimmingByCount(Backup backup, size_t count) : Trimming(backup), count(count){};
vector<bool> FilterPointsForRemove() override ;
};
class PointsTrimmingByDate : public Trimming{
tm* Date;
public:
PointsTrimmingByDate(Backup backup, tm* Date) : Trimming(backup), Date(Date){};
vector<bool> FilterPointsForRemove() override;
};
class PointsTrimmingByShape : public Trimming{
size_t shape;
public:
PointsTrimmingByShape(Backup backup, size_t shape) : Trimming(backup), shape(shape){};
vector<bool> FilterPointsForRemove() override;
};
class TrimmingMixed {
Backup backup;
vector<Trimming*> politics;
public:
TrimmingMixed(Backup backup, vector<Trimming*> politics) : backup(backup), politics(politics){
}
Backup Trim(PointLimits limit);
};
#endif //BACKUPS_TRIMMING_H
| [
"[email protected]"
] | |
39d07542e30e96fb4e5c9757ba61e4c4c274baa1 | b5e2f65f372c471f0901d3f5c361e2e90dd14cf9 | /Framework/MetroidGameContent/SamusAnimation.h | 4c36c346d441b96c68a5899e3c1c17166d724c4d | [] | no_license | tonykhoapro/Metroid | e6f9089d3b0334126184749dc7e93ade07ed0dc8 | 569e497342f352fef9f4d8240d13c667b7079c76 | refs/heads/master | 2021-05-10T21:55:13.100817 | 2018-01-20T15:52:01 | 2018-01-20T15:52:01 | 118,242,865 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,204 | h | #pragma once
#include "GameFramework\GameComponent\AnimationController.h"
class MetroidCharacter;
class SamusAnimation : public AnimationController
{
public:
SamusAnimation();
virtual ~SamusAnimation();
virtual void OnSpawn() override;
virtual void Update() override;
virtual void LateUpdate() override;
inline void Idle();
inline void Run();
inline void Roll();
inline void Jump();
inline void Rotate();
inline void AimUp();
inline void ShootUp();
inline void RunShootForward();
inline void JumpShootUp();
inline void JumpShootForward();
inline void RunShootUp();
void LockCurrentState(bool locked);
Vec2 playerVelocity;
Animation* idle;
Animation* run;
Animation* jump;
Animation* roll;
Animation* rotate;
Animation* aimup;
Animation* shootup;
Animation* runshootforward;
Animation* jumpshootup;
Animation* jumpshootforward;
Animation* runshootup;
float maxJumpSpeed;
float jumpSpeed;
double jumpTime;
bool stateLocked;
SimulatePhysics* physic;
MetroidCharacter* Samus;
friend class MetroidCharacter;
void (SamusAnimation::*RollFunc)();
void SamusAnimation::Roll_0();
void SamusAnimation::Roll_1();
void EnableRolling();
Vec2 RollingBodySize;
};
| [
"TONY@DESKTOP-3IOI83V"
] | TONY@DESKTOP-3IOI83V |
42de93b3a76c3340c9871be2ee28a7deb8c14249 | 2ad789090db7a377f746413e397b603c76f547fa | /V-REP_PRO_EDU_V3_6_0_Ubuntu16_04/programming/bluezero/include/cppzmq/tests/testutil.hpp | 6bb41fac54e6b5469ec9c07c72f3a0a82cd55ac1 | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | JasonLeeUT/Robotics | 442b8217918a32b3e8df454b9890ab83280ee7f3 | 7e21e5d18b42cfcaafd01b0243f221a051692f11 | refs/heads/master | 2023-01-23T00:14:41.801025 | 2020-11-19T02:23:55 | 2020-11-19T02:23:55 | 314,112,186 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,375 | hpp | #pragma once
#include <gtest/gtest.h>
#include <zmq.hpp>
#if defined(ZMQ_CPP11)
#include <array>
class loopback_ip4_binder
{
public:
loopback_ip4_binder(zmq::socket_t &socket) { bind(socket); }
std::string endpoint() { return endpoint_; }
private:
// Helper function used in constructor
// as Gtest allows ASSERT_* only in void returning functions
// and constructor/destructor are not.
void bind(zmq::socket_t &socket)
{
ASSERT_NO_THROW(socket.bind("tcp://127.0.0.1:*"));
std::array<char, 100> endpoint{};
size_t endpoint_size = endpoint.size();
ASSERT_NO_THROW(
socket.getsockopt(ZMQ_LAST_ENDPOINT, endpoint.data(), &endpoint_size));
ASSERT_TRUE(endpoint_size < endpoint.size());
endpoint_ = std::string{endpoint.data()};
}
std::string endpoint_;
};
struct common_server_client_setup
{
common_server_client_setup(bool initialize = true)
{
if (initialize)
init();
}
void init()
{
endpoint = loopback_ip4_binder{server}.endpoint();
ASSERT_NO_THROW(client.connect(endpoint));
}
zmq::context_t context;
zmq::socket_t server{context, zmq::socket_type::pair};
zmq::socket_t client{context, zmq::socket_type::pair};
std::string endpoint;
};
#endif
| [
"[email protected]"
] | |
766f0c9ef81ecf272efc2d6d12408bc074277607 | 27b4b5e3ed16b47588a182af40c601d9a930a4ba | /side.cpp | 80d5ceda986b700ad95cceab82ef6085c073272e | [] | no_license | awtcode/dylink_static_member | 829414ad51b7a744032e1787195c3644066d8604 | 0d861a9664659b9b97cb1d97d0c00b8b2b10e707 | refs/heads/master | 2020-03-25T13:52:12.567609 | 2018-08-07T09:04:30 | 2018-08-07T09:04:30 | 143,846,746 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 732 | cpp | #include "header.h"
#include "emscripten.h"
#include <dlfcn.h>
#include <stdio.h>
EMSCRIPTEN_KEEPALIVE int x = 123;
EMSCRIPTEN_KEEPALIVE int global::value = 7;
extern "C" {
void loadlib();
}
extern bool sidey2(int i);
typedef bool (*sideyPODfunc)(int num);
EMSCRIPTEN_KEEPALIVE bool sidey(int i) {
loadlib();
void* lib_handle = dlopen("liblib.so", RTLD_NOW);
if (lib_handle == NULL) {
printf("Could not load lib!!!\n");
return false;
} else {
printf("lib loaded!!!\n");
sideyPODfunc onefunc = (sideyPODfunc)dlsym(lib_handle, "sidey2");
printf("sidey: sidey2: %d\n", (bool)onefunc(5));
}
//return global::value == i;
return true;
} | [
"[email protected]"
] | |
32cb3bcf559c6aedc1d3ac0a5cb10693030910ba | 12f89e55b9c1e408eb413c5d1510c8786bdf82ae | /bigger-greater/bigger-greater.cpp | 7b057db364ba4e78e8b347fb4d9972e1561a8c30 | [] | no_license | e-zhang/hackerrank | 519ec4b9b814eed8db40c04675b9700134837323 | b2ca2680b22787e3446a45e0d0362e08349d82ee | refs/heads/master | 2021-01-10T12:27:37.563948 | 2016-02-23T21:54:55 | 2016-02-23T21:54:55 | 48,349,161 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,236 | cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
void lexicographicNext( string& word )
{
if( word.empty() || word.size() < 2 )
{
word = "no answer";
return;
}
int i = word.size() - 2;
// find the largest index from the end where all the indices after are in descending order
while( i >= 0 && word[i] >= word[i+1] ) --i;
// everything is in descending order, so no more permutations
if( i < 0 )
{
word = "no answer";
return;
}
// so we know the index to be increased, so now we find the index of the next greater value
int j = word.size() - 1;
while( j >= i && word[i] >= word[j] ) --j;
if( j < i )
{
word = "no answer";
return;
}
// now we can swap i and j, we know since i and j are the smallest left
char tmp = word[i];
word[i] = word[j];
word[j] = tmp;
// now we reverse the descending indices to be in ascending
std::reverse( word.begin() + i + 1, word.end() );
}
int main()
{
int t;
cin >> t;
for( int i = 0; i < t; ++i )
{
string s;
cin >> s;
lexicographicNext( s );
cout << s << endl;
}
}
| [
"[email protected]"
] | |
0006ab04b28c334050812633bc6645f24896bcdf | e61f5b7a23c3b1ca014e4809e487e95a65fc3e2c | /Source/BansheePhysX/Source/BsPhysXBoxCollider.cpp | ffe440e5fe66393d1a75c76c53918252bc099f73 | [] | no_license | ketoo/BansheeEngine | 83568cb22f2997162905223013f3f6d73ae4227e | 1ce5ec1bb46329695dd7cc13c0556b5bf7278e39 | refs/heads/master | 2021-01-02T08:49:09.416072 | 2017-08-01T15:46:42 | 2017-08-01T15:46:42 | 99,069,699 | 1 | 0 | null | 2017-08-02T03:48:06 | 2017-08-02T03:48:06 | null | UTF-8 | C++ | false | false | 1,638 | cpp | //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
#include "BsPhysXBoxCollider.h"
#include "BsPhysX.h"
#include "PxPhysics.h"
#include "BsFPhysXCollider.h"
using namespace physx;
namespace bs
{
PhysXBoxCollider::PhysXBoxCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation,
const Vector3& extents)
:mExtents(extents)
{
PxBoxGeometry geometry(extents.x, extents.y, extents.z);
PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
shape->setLocalPose(toPxTransform(position, rotation));
shape->userData = this;
mInternal = bs_new<FPhysXCollider>(shape);
applyGeometry();
}
PhysXBoxCollider::~PhysXBoxCollider()
{
bs_delete(mInternal);
}
void PhysXBoxCollider::setScale(const Vector3& scale)
{
BoxCollider::setScale(scale);
applyGeometry();
}
void PhysXBoxCollider::setExtents(const Vector3& extents)
{
mExtents = extents;
applyGeometry();
}
Vector3 PhysXBoxCollider::getExtents() const
{
return mExtents;
}
void PhysXBoxCollider::applyGeometry()
{
PxBoxGeometry geometry(std::max(0.01f, mExtents.x * mScale.x),
std::max(0.01f, mExtents.y * mScale.y), std::max(0.01f, mExtents.z * mScale.z));
getInternal()->_getShape()->setGeometry(geometry);
}
FPhysXCollider* PhysXBoxCollider::getInternal() const
{
return static_cast<FPhysXCollider*>(mInternal);
}
} | [
"[email protected]"
] | |
7dce3de425fdcee13483351dd91259a0ea095b48 | 2da78138f1e76fc90d2c36e68f680104001a8d1c | /include/Usb.h | 4c23e7e211c63e11e53b5b5080297826e9976ded | [] | no_license | chriscottingham/armbase | 134472e24e054c342a8bc661d8f91805bad18769 | 31cb23e70b6daf7791b7f56cb0df8dbd3ad0367b | refs/heads/master | 2023-06-22T19:55:14.662461 | 2021-07-26T05:21:44 | 2021-07-26T05:21:44 | 387,533,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 246 | h | /*
* Usb.h
*
* Created on: Jul 25, 2021
* Author: becomingguru
*/
#ifndef USB_H_
#define USB_H_
class Usb {
public:
Usb() {
// enable HSE and PLL
// USBCLK == 48mhz
// must use crystal
}
virtual ~Usb();
};
#endif /* USB_H_ */
| [
"[email protected]"
] | |
f0fd839430aaf758f5cce1fb8f3194126126394d | 023f436215c061f452a3d29d0b3e6a39c2c2c667 | /C++/RacingCarClassBase.cpp | 88b49b9d08e7a44f0beb73832fa810a07ddf0cc7 | [] | no_license | LeeHwangLae/GitStudyTest | 1d74b55ac7590393992de303e8739e307a1245d1 | 3ef963c95b7385158e07689f98b12e8844de1d1b | refs/heads/master | 2020-12-24T07:28:42.214905 | 2016-08-23T16:17:23 | 2016-08-23T16:17:23 | 58,366,010 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,255 | cpp | #include <iostream>
using namespace std;
namespace CAR_CONST
{
enum MyEnum
{
ID_LEN = 20,
MAX_SPD=200,
FUEL_STEP=2,
ACC_STEP=10,
BRK_STEP=10
};
}
class Car
{
private:
char gamerID[CAR_CONST::ID_LEN];
int fuelGauge;
int curSpeed;
public:
void InitMembers(char*ID, int fuel);
void ShowCarState(); //상태정보
void Accel(); //엑셀, 속도증가
void Break(); //브레이크, 속도감소
};
void Car::InitMembers(char*ID, int fuel)
{
strcpy(gamerID, ID);
fuelGauge = fuel;
curSpeed = 0;
}
void Car::ShowCarState()
{
cout << "소유자ID: " << gamerID << endl;
cout << "연료량: " << fuelGauge << endl;
cout << "현재속도: " << curSpeed << "km/s" << endl << endl;
}
void Car::Accel()
{
if (fuelGauge <= 0)
return;
else
fuelGauge -= CAR_CONST::FUEL_STEP;
if ((curSpeed + CAR_CONST::ACC_STEP) >= CAR_CONST::MAX_SPD)
{
curSpeed = CAR_CONST::MAX_SPD;
return;
}
curSpeed += CAR_CONST::ACC_STEP;
}
void Car::Break()
{
if (curSpeed < CAR_CONST::BRK_STEP)
{
curSpeed = 0;
return;
}
curSpeed -= CAR_CONST::BRK_STEP;
}
int main()
{
Car run99;
run99.InitMembers("run99", 100);
run99.Accel();
run99.Accel();
run99.Accel();
run99.ShowCarState();
run99.Break();
run99.ShowCarState();
return 0;
} | [
"[email protected]"
] | |
981a096fc73d7cd78d35081db9bd5a51ae42846a | 3605efd8f98f1927f142a36aa8511a26d6e5c575 | /src-arduino/xbee/XBee.ino | 49901e70a2f71a0d828990654e83a6371f3c5f7d | [] | no_license | lavirott/iot-com-tutorials | d0f08d8d0c4d3622d958efce0c7608b4efe74578 | fb2b739066aa63db49560a0c3ed180b7549335d7 | refs/heads/master | 2020-04-12T09:49:47.184345 | 2019-03-22T07:28:12 | 2019-03-22T07:28:12 | 162,409,548 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 562 | ino | #include <multiprotocolShield.h>
#include <Wire.h>
#include <MCP23008.h>
char buffer[51] = {0x7E, 0x00, 0x2F, 0x00, 0xE1, 0x00, 0x13, 0xA2, 0x00, 0x40, 0xE4, 0x04, 0x3F, 0x00, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x66, 0x72, 0x6F, 0x6D, 0x20, 0x4E, 0x6F, 0x64, 0x65, 0x2D, 0x52, 0x45, 0x44, 0x21, 0x20, 0x49, 0x74, 0x27, 0x73, 0x20, 0x41, 0x72, 0x64, 0x75, 0x69, 0x6E, 0x6F, 0x2E, 0x2E, 0x2E, 0X78};
void setup() {
socket0.ON();
delay(100);
socket0.setMUX();
Serial.begin(9600);
delay(1000);
}
void loop() {
Serial.print(buffer);
delay(2000);
}
| [
"[email protected]"
] | |
b3be23b4e2cf2d4c307f31d562e328d156d64493 | 85b9ce4fb88972d9b86dce594ae4fb3acfcd0a4b | /build/Android/Preview/Global Pot/app/src/main/include/Fuse.Controls.Navigator.NavPage.h | 0d7e39d8d00d303f0a4afedab0536bc386db8acf | [] | no_license | bgirr/Global-Pot_App | 16431a99e26f1c60dc16223fb388d9fd525cb5fa | c96c5a8fb95acde66fc286bcd9a5cdf160ba8b1b | refs/heads/master | 2021-01-09T06:29:18.255583 | 2017-02-21T23:27:47 | 2017-02-21T23:27:47 | 80,985,681 | 0 | 0 | null | 2017-02-21T23:27:48 | 2017-02-05T10:29:14 | C++ | UTF-8 | C++ | false | false | 1,071 | h | // This file was generated based on C:\Users\EliteBook-User\AppData\Local\Fusetools\Packages\Fuse.Controls.Navigation\0.44.1\$.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Uno.Object.h>
namespace g{namespace Fuse{namespace Controls{struct Navigator__NavPage;}}}
namespace g{namespace Fuse{struct Visual;}}
namespace g{
namespace Fuse{
namespace Controls{
// private sealed class Navigator.NavPage :1382
// {
uType* Navigator__NavPage_typeof();
void Navigator__NavPage__ctor__fn(Navigator__NavPage* __this);
void Navigator__NavPage__CopyFrom_fn(Navigator__NavPage* __this, Navigator__NavPage* o);
void Navigator__NavPage__New1_fn(Navigator__NavPage** __retval);
void Navigator__NavPage__Reset_fn(Navigator__NavPage* __this);
struct Navigator__NavPage : uObject
{
uStrong<uString*> Parameter;
uStrong<uString*> Path;
uStrong< ::g::Fuse::Visual*> Visual;
void ctor_();
void CopyFrom(Navigator__NavPage* o);
void Reset();
static Navigator__NavPage* New1();
};
// }
}}} // ::g::Fuse::Controls
| [
"[email protected]"
] | |
61e72403031bc7480741c7316d48266bf25362f3 | fef58dcd0c1434724a0a0a82e4c84ae906200289 | /usages/0xF5ED37F54CD4D52E.cpp | 492b4c14b1b8a53131413d678fd27d4c3d70eebe | [] | no_license | DottieDot/gta5-additional-nativedb-data | a8945d29a60c04dc202f180e947cbdb3e0842ace | aea92b8b66833f063f391cb86cbcf4d58e1d7da3 | refs/heads/main | 2023-06-14T08:09:24.230253 | 2021-07-11T20:43:48 | 2021-07-11T20:43:48 | 380,364,689 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 399 | cpp | // am_cp_collection.ysc @ L9480
void func_174()
{
int iVar0;
iVar0 = 0;
while (iVar0 < Local_151.f_709)
{
if (HUD::DOES_BLIP_EXIST(vLocal_134[iVar0 /*3*/]))
{
HUD::REMOVE_BLIP(&(vLocal_134[iVar0 /*3*/]));
GRAPHICS::DELETE_CHECKPOINT(vLocal_134[iVar0 /*3*/].f_1);
}
iVar0++;
}
iVar0 = 0;
while (iVar0 < 4)
{
iLocal_124[iVar0] = 0;
iVar0++;
}
} | [
"[email protected]"
] | |
d89453c5eb25525818bb0f93af6296a74b14472e | 3fc84a7fe3cb00d26e971394744fb8af058a46c0 | /Project-qt+chartDirector/chartdir_cpp_win64/ChartDirector/cppdemo/hbarmeterorientation/hbarmeterorientation.cpp | 3a9ad41e1c53f511881a88397a185d3b0f0ee752 | [
"IJG"
] | permissive | BIbiLion/LSWuqiankun | 5f344954b7dafec85d342766f0a3a8cb4961dd42 | 6257db4a3b11612c9b0419ae71104f8dfe33b8e9 | refs/heads/master | 2020-12-24T07:36:08.033393 | 2017-02-03T01:35:14 | 2017-02-03T01:35:14 | 59,795,750 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,406 | cpp | #include "chartdir.h"
void createChart(int chartIndex, const char *filename)
{
// The value to display on the meter
double value = 75.35;
// The bar colors for the meters
int barColor[] = {0x0088ff, 0x00cc00, 0x8833dd, 0xff8800};
// Create a LinearMeter object of size 260 x 80 pixels with very light grey (0xeeeeee)
// backgruond and a light grey (0xccccccc) 3-pixel thick rounded frame
LinearMeter *m = new LinearMeter(260, 80, 0xeeeeee, 0xcccccc);
m->setRoundedFrame(Chart::Transparent);
m->setThickFrame(3);
// This example demonstrates putting the text labels at the top or bottom. This is by setting
// the label alignment, as well as the scale, color scale and label positions.
int alignment[] = {Chart::Top, Chart::Top, Chart::Bottom, Chart::Bottom};
int meterYPos[] = {24, 24, 36, 36};
int labelYPos[] = {65, 65, 16, 16};
int colorScalePos[] = {48, 48, 27, 27};
// Set the scale region
m->setMeter(18, meterYPos[chartIndex], 222, 20, alignment[chartIndex]);
// Set meter scale from 0 - 100, with a tick every 10 units
m->setScale(0, 100, 10);
// Add a 5-pixel thick smooth color scale
double smoothColorScale[] = {0, 0x0000ff, 25, 0x0088ff, 50, 0x00ff00, 75, 0xdddd00, 100,
0xff0000};
m->addColorScale(DoubleArray(smoothColorScale, (int)(sizeof(smoothColorScale) / sizeof(
smoothColorScale[0]))), colorScalePos[chartIndex], 5);
// Add a bar from 0 to value with glass effect and 4 pixel rounded corners
m->addBar(0, value, barColor[chartIndex], Chart::glassEffect(Chart::NormalGlare, Chart::Top), 4)
;
//
// In this example, some charts have the "Temperauture" label on the left side and the value
// readout on the right side, and some charts have the reverse
//
if (chartIndex % 2 == 0) {
// Add a label on the left side using 8pt Arial Bold font
m->addText(15, labelYPos[chartIndex], "Temperature C", "arialbd.ttf", 8, Chart::TextColor,
Chart::Left);
// Add a text box on the right side. Display the value using white (0xffffff) 8pt Arial Bold
// font on a black (0x000000) background with depressed rounded border.
TextBox *t = m->addText(240, labelYPos[chartIndex], m->formatValue(value, "2"), "arial.ttf",
8, 0xffffff, Chart::Right);
t->setBackground(0x000000, 0x000000, -1);
t->setRoundedCorners(3);
} else {
// Add a label on the right side using 8pt Arial Bold font
m->addText(243, labelYPos[chartIndex], "Temperature C", "arialbd.ttf", 8, Chart::TextColor,
Chart::Right);
// Add a text box on the left side. Display the value using white (0xffffff) 8pt Arial Bold
// font on a black (0x000000) background with depressed rounded border.
TextBox *t = m->addText(18, labelYPos[chartIndex], m->formatValue(value, "2"), "arial.ttf",
8, 0xffffff, Chart::Left);
t->setBackground(0x000000, 0x000000, -1);
t->setRoundedCorners(3);
}
// Output the chart
m->makeChart(filename);
//free up resources
delete m;
}
int main(int argc, char *argv[])
{
createChart(0, "hbarmeterorientation0.png");
createChart(1, "hbarmeterorientation1.png");
createChart(2, "hbarmeterorientation2.png");
createChart(3, "hbarmeterorientation3.png");
return 0;
}
| [
"[email protected]"
] | |
364e704cf0dbec608b6df1c1e2c0deec045a598f | 748705e88fc2decb21871dcdacb7392037412c7c | /C++练习/test11-19完成对整数和小数的排序,接口中传入缺省参数(排序规则)/test11-19完成对整数和小数的排序,接口中传入缺省参数(排序规则)/main2.cpp | cfea8789a0c55a5e78c63cbfa83081e6b9601581 | [] | no_license | YangXxin1/persistence | 96ebe1d79e4b179cd3c03fcf5becaa30d7c0e659 | 79916f63576a1fdb5849a8f799696c0ea31036ec | refs/heads/master | 2022-12-06T05:23:48.117569 | 2020-09-02T10:07:44 | 2020-09-02T10:07:44 | 178,318,682 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 952 | cpp | #include <iostream>
using namespace std;
void InsertSort(int * src, int n)
{
int i, j;
int tmp;
for (i = 1; i < n; ++i)
{
tmp = src[i];
for (j = i; j > 0 && src[j - 1] > tmp; --j)
{
src[j] = src[j - 1];
}
src[j] = tmp;
}
}
void shellSort(int* src, int n)
{
int i, j, k;
int gap;
int tmp;
for (gap = n / 2; gap; gap /= 2)
{
for (k = 0; k < gap; ++k)
{
//²åÈëÅÅÐò
for (i = gap + k; i < n; i += gap)
{
tmp = src[i];
for (j = i; j >= gap && src[j - gap] > tmp; j -= gap)
{
src[j] = src[j - gap];
}
src[j] = tmp;
}
}
}
}
void Sort(int * src, int n, int flag = 0)
{
switch (flag)
{
case 0:
InsertSort(src, n);
break;
case 1:
shellSort(src, n);
break;
}
}
int main()
{
int src[11] = { 1, 3, 6, 7, 9, 2, 4, 8, 10, 5, 11 };
//Sort(src, 11);
Sort(src, 11, 1);
for (auto & i : src)
{
cout << i << ' ';
}
cout << endl;
system("pause");
return 0;
} | [
"[email protected]"
] | |
0b72ac34dd3cb8daeb4189a73bcff7021a33a5a8 | ae392a6e5a9996b06df427f1e22e8e4357fc2faf | /src/libwalletqt/PendingTransaction.h | 34576cbca65cd88c564a2b2979f3aa56972fbe9b | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | trublud/kickasscoingui | 6cf5d3f58daf0186bfa00ccc58fe6dafa5e148e1 | 74ac40e5ffed0a83585f09a5b2653eec7b8c3af2 | refs/heads/master | 2020-06-19T15:58:32.629286 | 2019-07-13T23:31:00 | 2019-07-13T23:31:00 | 196,773,529 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,351 | h | // Copyright (c) 2014-2019, The KickAssCoin Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef PENDINGTRANSACTION_H
#define PENDINGTRANSACTION_H
#include <QObject>
#include <QList>
#include <QVariant>
#include <wallet/api/wallet2_api.h>
//namespace KickAssCoin {
//class PendingTransaction;
//}
class PendingTransaction : public QObject
{
Q_OBJECT
Q_PROPERTY(Status status READ status)
Q_PROPERTY(QString errorString READ errorString)
Q_PROPERTY(quint64 amount READ amount)
Q_PROPERTY(quint64 dust READ dust)
Q_PROPERTY(quint64 fee READ fee)
Q_PROPERTY(QStringList txid READ txid)
Q_PROPERTY(quint64 txCount READ txCount)
Q_PROPERTY(QList<QVariant> subaddrIndices READ subaddrIndices)
public:
enum Status {
Status_Ok = KickAssCoin::PendingTransaction::Status_Ok,
Status_Error = KickAssCoin::PendingTransaction::Status_Error,
Status_Critical = KickAssCoin::PendingTransaction::Status_Critical
};
Q_ENUM(Status)
enum Priority {
Priority_Low = KickAssCoin::PendingTransaction::Priority_Low,
Priority_Medium = KickAssCoin::PendingTransaction::Priority_Medium,
Priority_High = KickAssCoin::PendingTransaction::Priority_High
};
Q_ENUM(Priority)
Status status() const;
QString errorString() const;
Q_INVOKABLE bool commit();
quint64 amount() const;
quint64 dust() const;
quint64 fee() const;
QStringList txid() const;
quint64 txCount() const;
QList<QVariant> subaddrIndices() const;
Q_INVOKABLE void setFilename(const QString &fileName);
private:
explicit PendingTransaction(KickAssCoin::PendingTransaction * pt, QObject *parent = 0);
private:
friend class Wallet;
KickAssCoin::PendingTransaction * m_pimpl;
QString m_fileName;
};
#endif // PENDINGTRANSACTION_H
| [
"[email protected]"
] | |
c49ee0176103ee6c3eb498c5bd05e741405e6cbd | fa5b582ea330470071c36f8aa0269b4a79ba211e | /src/main/avikodak/sites/codechef/contest/qbit15/qbit04.h | f959bf098a4c4da6df159c752ee0f1e657d82407 | [] | no_license | umairsajid/algos_v2 | a5cb68a9163cb5483e7b5bd410acbd38115db423 | a3aea98a698b9723693dcb23794be09fbc4e7cd5 | refs/heads/master | 2020-12-26T00:36:12.711989 | 2015-12-17T05:34:11 | 2015-12-17T05:34:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,489 | h | /****************************************************************************************************************************************************
* File Name : qbit04.h
* File Location : /home/avikodak/Desktop/projects/algos_v2/src/main/avikodak/sites/codechef/contest/qbit15/qbit04.h
* Created on : 15-Oct-2015 :: 6:59:05 pm
* Author : avikodak
* Testing Status : Tested
* URL : https://www.codechef.com/QBIT15/problems/QBIT04
****************************************************************************************************************************************************/
/****************************************************************************************************************************************************/
/* NAMESPACE DECLARATION AND IMPORTS */
/****************************************************************************************************************************************************/
using namespace std;
using namespace __gnu_cxx;
/****************************************************************************************************************************************************/
/* INCLUDES */
/****************************************************************************************************************************************************/
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string.h>
#include <hash_map>
#include <stack>
#include <queue>
#include <limits.h>
#include <stdint.h>
#include <iomanip>
#include <lib/constants/constants.h>
#include <lib/ds/commonds.h>
#include <lib/ds/linkedlistds.h>
#include <lib/ds/graphds.h>
#include <lib/ds/mathds.h>
#include <lib/ds/treeds.h>
#include <lib/utils/arrayutil.h>
#include <lib/utils/avltreeutil.h>
#include <lib/utils/bplustreeutil.h>
#include <lib/utils/btreeutil.h>
#include <lib/utils/commonutil.h>
#include <lib/utils/dillutil.h>
#include <lib/utils/graphutil.h>
#include <lib/utils/mathutil.h>
#include <lib/utils/redblacktreeutil.h>
#include <lib/utils/sillutil.h>
#include <lib/utils/treeutil.h>
#include <lib/utils/twofourtreeutil.h>
/****************************************************************************************************************************************************/
/* USER DEFINED CONSTANTS */
/****************************************************************************************************************************************************/
/****************************************************************************************************************************************************/
/* MAIN CODE START */
/****************************************************************************************************************************************************/
#ifndef QBIT04_H_
#define QBIT04_H_
//Tested
void printResults(){
unsigned int testCases,size;
long long int input,sum;
scanf("%u",&testCases);
while(testCases--){
scanf("%lld",&size);
sum = 0;
for(unsigned int counter = 0;counter < size;counter++){
scanf("%lld",&input);
sum += input;
}
if(sum > 0 && sum%size == 0){
printf("%lld\n",sum/size);
}else{
printf("-1\n");
}
}
}
#endif /* QBIT04_H_ */
/****************************************************************************************************************************************************/
/* MAIN CODE END */
/****************************************************************************************************************************************************/
| [
"[email protected]"
] | |
e57074accd8cc21f71a285254d158a13b0319576 | ef6ba4bfd67da540fd8b65124c96158b60f185dd | /04_PlanetInvader/meshfield.h | f42fedb12af3ffa51bc3d3900d67dcbbb8665f8f | [] | no_license | eisuke1222/ESfile | 91d0c7f20aebded38149597380fbc0ccfbc2b194 | 74f4cd3e520981051336053cd04e04d2d1fd7615 | refs/heads/master | 2020-04-27T20:30:56.204189 | 2019-03-18T04:34:24 | 2019-03-18T04:34:24 | 174,650,195 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,308 | h | //=============================================================================
//
// メッシュフィールド処理 [meshfield.h]
// Author : Eisuke Sakagawa
//
//=============================================================================
#ifndef _MESHFIELD_H_
#define _MESHFIELD_H_
//*****************************************************************************
// ヘッダファイルのインクルード
//*****************************************************************************
#include "main.h" // メイン
#include "mesh3d.h" // メッシュ3D
//*****************************************************************************
// マクロ定義
//*****************************************************************************
#define MAX_MESHFIELD_TEXTURE (2) // テクスチャ最大数
#define MESHFIELD_SIZE_X (30) // 大きさ(X)
#define MESHFIELD_SIZE_Y (30) // 大きさ(Y)
//*****************************************************************************
// クラス定義
//*****************************************************************************
class CMeshField : public CMesh3D
{// メッシュフィールド(親:CMesh3D)
public:
typedef enum
{// フィールドタイプ
MESHFIELDTYPE_O = 0, // 海
MESHFIELDTYPE_G, // 陸
MESHFIELDTYPE_MAX
}MESHFIELDTYPE;
CMeshField(); // コンストラクタ
~CMeshField(); // デストラクタ
static HRESULT Load(void); // ロード
static void Unload(void); // アンロード
static CMeshField *Create(MESHTYPE meshType, D3DXVECTOR3 num, D3DXVECTOR3 pos, D3DXVECTOR3 rot, D3DXVECTOR3 size, D3DXCOLOR col, D3DXVECTOR2 TexUV, MESHFIELDTYPE meshfieldType, MESHTEX meshTex); // 生成
HRESULT Init(MESHTYPE meshType, D3DXVECTOR3 num, D3DXVECTOR3 pos, D3DXVECTOR3 rot, D3DXVECTOR3 size, D3DXCOLOR col, D3DXVECTOR2 TexUV, MESHFIELDTYPE meshfieldType, MESHTEX meshTex); // 初期化処理
void Uninit(void); // 終了処理
void Update(void); // 更新処理
void Draw(void); // 描画処理
private:
static LPDIRECT3DTEXTURE9 m_pTexture[MAX_MESHFIELD_TEXTURE]; // テクスチャ情報へのポインタ
static D3DXVECTOR2 m_posUV; // UV位置
MESHFIELDTYPE m_meshfieldType; // フィールドタイプ
protected:
};
#endif | [
"[email protected]"
] | |
81dc22244fdc5b03b610f3951de1a7a23fd5d97f | df19cfb9c58cfd620ca033421f29f52bb8c69511 | /DevMathvector.h | 17c81daec42348baedf042f2fc4cdb02a96fa17c | [] | no_license | devanob/SolarSystem | c987e5084581b34bb28c161c2a8ebc948e1b370a | 623e336d4dd35ee4dd38cb644ad07b5721a73987 | refs/heads/master | 2020-07-12T05:11:14.144938 | 2019-09-07T17:11:59 | 2019-09-07T17:11:59 | 204,727,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,780 | h | #ifndef DevMathVECTOR_H
#define DevMathVECTOR_H
#include <vector>
#include <utility>
#include <algorithm>
#include <stdexcept>
#include <mutex>
namespace DevMath {
class generic_error : public std::exception{
public:
generic_error(){
this->error_mssg =(char*)"Error:Unknown";
}
generic_error(const char* mssg){
this->error_mssg = (char*)mssg;
}
char* error_mssg;
unsigned int error_code;
virtual const char* what() const throw(){
return (const char*) this->error_mssg;
}
};
class EmptyVectorOperation : public generic_error{
public:
EmptyVectorOperation():generic_error((char*)"Exception Error: Operation On Empty Vector"){
}
}; // throws an exception when operations are done on an empty vector
class VectorOperationUnevenLength : public generic_error {
public:
VectorOperationUnevenLength():generic_error((char*)"Exception Error: Even Vector Pair Operation"){
}
};
class IndexOutOfBound : generic_error {
public:
IndexOutOfBound():generic_error((char*)"Exception Error:Index Out Of Bound"){
}
};
template <class type>
class vector {
public:
// mutex function
std::mutex& getMutexLock(); //gets the internel mutex
void lock_vector_mut() ; // lock the internel mutex
void unlock_vector_mut();
bool try_lock_mut ();
//unlock the internel mutex
vector(const vector& vector_); // contructors
vector(vector&& vector_); // move contructor
template <class seperate_type>
vector(const DevMath::vector<seperate_type>& vector_);
template <class seperate_type>
vector(DevMath::vector<seperate_type>&& vector_);
vector();
vector(const unsigned int& intial_size);
//-------------------------------------------------
template <class seperate_type>
inline DevMath::vector<type>& operator=(const DevMath::vector<seperate_type>& vector_);
inline DevMath::vector<type>& operator=(const DevMath::vector<type>& vector_); // copy operator and move operator
template <class seperate_type>
inline DevMath::vector<type>& operator=(DevMath::vector<seperate_type>&& vector_);
inline DevMath::vector<type>& operator=(DevMath::vector<type>&& vector_);
template <class c_type>
inline void assign(const vector<c_type>& vector_);
template <class c_type>
inline void assign(vector<c_type>&&);
//---------------------------------------------------
inline type& operator[](const unsigned int& index); // push pack values//resize
inline const type& operator[](const unsigned int& index) const;
inline void push_back(const type& var);
inline void resize(const unsigned int& size);
inline void clear();
inline const type* data_ptr() const;
inline const std::vector<type>& data_vector() const;
//-------------------------------------------------------------------------
//
template <class c_type>
bool operator==(const vector<c_type>& vector_) const;
template <class c_type>
bool operator!=(const vector<c_type>& vector_) const;
template <class vector_type>
type operator*(const vector<vector_type>& vector_);
vector<type> operator/(const type& divider) const; // vector arthimetic
DevMath::vector<type>& operator/=(const type& divider);
vector<type> operator*(const type& divider) const;
DevMath::vector<type>& operator*=(const type& divider);
template <class vector_type>
vector<type> operator+(const DevMath::vector<vector_type>& vector_) const;
template <class vector_type>
vector<type>& operator+(DevMath::vector<vector_type>&& vector_) const;
template <class vector_type>
DevMath::vector<type>& operator+=(const DevMath::vector<vector_type>& vector_);
template <class vector_type>
DevMath::vector<type>& operator+=(DevMath::vector<vector_type>&& vector_);
unsigned int size() const;
//-------------------------------------------------------------------GENERAL-
template <class vector_type>
type dot(const vector<vector_type>& vector_);
type normVec(unsigned int& norm_count);
type length_n();
type* ptr_vec();
private:
std::mutex vector_lock;
std::vector<type> data;
};
template <class type>
void swap(DevMath::vector<type>& vector1, DevMath::vector<type>& vector2);
template <class type_matrix>
vector<type_matrix> operator*(const type_matrix& numoper, const DevMath::vector<type_matrix>& vec1);
}
template <class type>
DevMath::vector<type>::vector()
{
}
template <class type>
DevMath::vector<type>::vector(const vector& vector_)
{
this->data = vector_.data;
}
template <class type>
template <class seperate_type>
DevMath::vector<type>::vector(const DevMath::vector<seperate_type>& vector_)
{
try {
assign(vector_);
}
catch (std::exception& except) {
throw std::runtime_error("Error Assigning Vector Defualt Contructor");
}
}
template <class type>
template <class seperate_type>
DevMath::vector<type>::vector(DevMath::vector<seperate_type>&& vector_)
{
try {
assign(std::move(vector_));
}
catch (std::exception& except) {
throw std::runtime_error("Error In Vector Assignment in Vector Defualt Contructor-Move");
}
}
template <class type>
DevMath::vector<type>::vector(vector&& vector_)
{
data = std::move(vector_.data);
}
template <class type>
DevMath::vector<type>& DevMath::vector<type>::operator=(const DevMath::vector<type>& vector_)
{
data = vector_.data;
return *this;
}
template <class type>
template <class seperate_type>
DevMath::vector<type>& DevMath::vector<type>::operator=(const DevMath::vector<seperate_type>& vector_)
{
try {
assign(vector_);
}
catch (std::exception& except) {
throw std::runtime_error("Error In Vector Assignment in Vector Operator= ");
}
return *this;
}
template <class type>
DevMath::vector<type>& DevMath::vector<type>::operator=(DevMath::vector<type>&& vector_)
{
try {
assign(std::move(vector_));
}
catch (std::exception& except) {
throw std::runtime_error("Error In Vector Assignment in Vector Operator=move ");
}
return *this;
}
template <class type>
template <class seperate_type>
DevMath::vector<type>& DevMath::vector<type>::operator=(DevMath::vector<seperate_type>&& vector_)
{
try {
assign(std::move(vector_));
}
catch (std::exception& except) {
throw std::runtime_error("Error In Vector Assignment in Vector Operator=move ");
}
return *this;
}
template <class type>
type& DevMath::vector<type>::operator[](const unsigned int& index)
{
if (data.size() == 0 || index >= data.size() || index < 0) {
throw IndexOutOfBound();
}
return data[index];
}
template <class type>
const type& DevMath::vector<type>::operator[](const unsigned int& index) const
{
if (data.size() == 0 || index >= data.size() || index < 0)
IndexOutOfBound();
return data[index];
}
template <class type>
void DevMath::vector<type>::push_back(const type& var)
{
data.push_back(var);
}
template <class type>
DevMath::vector<type>::vector(const unsigned int& intial_size)
{
data.resize(intial_size);
}
template <class type>
DevMath::vector<type> DevMath::vector<type>::operator/(const type& divider) const
{
if (data.size() == 0)
throw EmptyVectorOperation();
else {
const unsigned int& size_vector = data.size();
DevMath::vector<type> temp = *this;
for (unsigned int i = 0; i < size_vector; i++) {
temp.data[i] /= divider;
}
return std::move(temp);
}
}
template <class type>
DevMath::vector<type>& DevMath::vector<type>::operator/=(const type& divider)
{
if (data.size() == 0)
throw EmptyVectorOperation();
else {
const unsigned int& size_vector = data.size();
for (unsigned int i = 0; i < size_vector; i++) {
data[i] /= divider;
}
}
return *this;
}
template <class type>
DevMath::vector<type>& DevMath::vector<type>::operator*=(const type& divider)
{
if (data.size() == 0)
throw EmptyVectorOperation();
else {
const unsigned int& size_vector = data.size();
for (unsigned int i = 0; i < size_vector; i++) {
data[i] *= divider;
}
}
return *this;
}
template <class type>
DevMath::vector<type> DevMath::vector<type>::operator*(const type& divider) const
{
if (data.size() == 0)
throw EmptyVectorOperation();
else {
const unsigned int& size_vector = data.size();
DevMath::vector<type> temp = *this;
for (unsigned int i = 0; i < size_vector; i++) {
temp.data[i] *= divider;
}
return std::move(temp);
}
}
template <class type>
template <class vector_type>
DevMath::vector<type> DevMath::vector<type>::operator+(const DevMath::vector<vector_type>& vector_) const
{
if (vector_.data.size() != data.size()) {
throw VectorOperationUnevenLength();
}
else {
const unsigned int& data_size = vector_.data.size();
DevMath::vector<type> temp(data_size);
for (unsigned int i = 0; i < data_size; i++) {
temp.data[i] = vector_.data[i] + data[i];
};
return std::move(temp);
}
}
template <class type>
template <class vector_type>
DevMath::vector<type>& DevMath::vector<type>::operator+(DevMath::vector<vector_type>&& vector_) const
{
if (vector_.data.size() != data.size()) {
throw VectorOperationUnevenLength();
}
else {
const unsigned int& data_size = vector_.data.size();
for (unsigned int i = 0; i < data_size; i++) {
vector_.data[i] += data[i];
};
return vector_;
}
}
template <class type>
template <class vector_type>
DevMath::vector<type>& DevMath::vector<type>::operator+=(const vector<vector_type>& vector_)
{
if (vector_.data.size() != data.size()) {
throw VectorOperationUnevenLength();
}
else {
const unsigned int& data_size = vector_.data.size();
for (unsigned int i = 0; i < data_size; i++) {
data[i] += vector_.data[i];
};
}
return *this;
}
template <class type>
template <class vector_type>
DevMath::vector<type>& DevMath::vector<type>::operator+=(vector<vector_type>&& vector_)
{
if (vector_.data.size() != data.size()) {
throw VectorOperationUnevenLength();
}
else {
unsigned int data_size = vector_.data.size();
for (unsigned int i = 0; i < data_size; i++) {
data[i] += vector_.data[i];
};
}
return *this;
}
template <class type>
void DevMath::vector<type>::resize(const unsigned int& size)
{
data.resize(size);
}
template <class type>
void DevMath::swap(DevMath::vector<type>& vector1, DevMath::vector<type>& vector2)
{
DevMath::vector<type> temp(std::move(vector1));
vector1 = std::move(vector2);
vector2 = std::move(temp);
}
template <class type>
std::mutex& DevMath::vector<type>::getMutexLock()
{
return vector_lock;
}
template <class type>
unsigned int DevMath::vector<type>::size() const
{
return this->data.size();
}
template<class type>
type DevMath::vector<type>::normVec(unsigned int &norm_count)
{
type norm_count_dim = type(0);
}
template<class type>
type DevMath::vector<type>::length_n()
{
type sqrted_val;
for (unsigned int i = 0; i < this->data.size(); i++){
sqrted_val+= std::pow(data[i],2);
}
return std::sqrt(sqrted_val);
}
template<class type>
type *DevMath::vector<type>::ptr_vec()
{
return data.data();
}
template <class type>
template <class vector_type>
type DevMath::vector<type>::dot(const vector<vector_type>& vector_)
{
type dot_product = 0;
if (vector_.size() != this->size())
throw VectorOperationUnevenLength();
for (unsigned int i = 0; i < vector_.size(); i++) {
dot_product += vector_[i] * data[i];
}
return std::move(dot_product);
}
template <class type>
template <class vector_type>
type DevMath::vector<type>::operator*(const vector<vector_type>& vector_)
{
type dot_product = 0;
if (vector_.size() != this->size())
throw VectorOperationUnevenLength();
for (unsigned int i = 0; i < vector_.size(); i++) {
dot_product += vector_[i] * data[i];
}
return std::move(dot_product);
}
template <class type>
template <class c_type>
void DevMath::vector<type>::assign(const vector<c_type>& vector_)
{
if (vector_.size() == 0) {
this->data.clear();
}
else {
try {
this->data.clear();
this->data.assign(vector_.data_vector().begin(), vector_.data_vector().end());
}
catch (std::exception& expt) {
throw std::runtime_error("Unable To Do Such Assignment On DevMathvector<type,c_type>");
}
}
}
template <class type>
template <class c_type>
void DevMath::vector<type>::assign(vector<c_type>&& vector_)
{
if (vector_.size() == 0) {
this->data.clear();
}
else {
try {
this->data = std::move(vector_.data_vector());
}
catch (const std::exception& expt) {
try {
this->data.assign(vector_.data_vector().begin(), vector_.data_vector().end());
vector_.clear();
}
catch (std::exception& expt) {
throw std::runtime_error("Unable To Do Such Assignment On DevMathvector<type,c_type>");
}
}
vector_.clear();
}
}
template <class type>
void DevMath::vector<type>::clear()
{
data.clear();
}
template <class type>
template <class c_type>
bool DevMath::vector<type>::operator==(const vector<c_type>& vector_) const
{
if (vector_.size() != data.size())
return false;
else {
unsigned int dat_size = vector_.size();
for (unsigned int i = 0; i < dat_size; i++) {
if (data[i] != vector_[i])
return false;
}
}
return true;
}
template <class type>
template <class c_type>
bool DevMath::vector<type>::operator!=(const vector<c_type>& vector_) const
{
if (vector_.size() != data.size())
return true;
else {
unsigned int dat_size = vector_.size();
for (unsigned int i = 0; i < dat_size; i++) {
if (data[i] != vector_[i])
return true;
}
}
return false;
}
template <class type_matrix>
DevMath::vector<type_matrix> operator*(const type_matrix& numoper, const DevMath::vector<type_matrix>& vec1)
{
return std::move(vec1 * numoper);
}
template <class type>
const type* DevMath::vector<type>::data_ptr() const
{
return this->data.data();
}
template <class type>
const std::vector<type>& DevMath::vector<type>::data_vector() const
{
return this->data;
}
template<class type>
void DevMath::vector<type>::lock_vector_mut() {
this->vector_lock.lock();
}
template<class type>
void DevMath::vector<type>::unlock_vector_mut() {
this->vector_lock.unlock();
}
template<class type>
bool DevMath::vector<type>::try_lock_mut() {
return this->vector_lock.try_lock();
}
#endif // DevMathVECTOR_H
| [
"[email protected]"
] | |
b5687d24bd9394b9621e6d42ca7af6aab84cacc0 | 0e98b34801d429bca8020e2a7b73944350ac6f0e | /C+.0406/C+.0406/数据库连接池.cpp | 2d5d1bd9c7873f62994793969380d316903f2765 | [] | no_license | STong01/-2 | a3759734210e3dec7ff97c1e8e7b2c694ca376ee | 546d2e6b02c789e146b07e72e8e738fdaebcf827 | refs/heads/master | 2021-02-03T21:22:14.152907 | 2020-07-21T06:56:52 | 2020-07-21T06:56:52 | 243,542,337 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 495 | cpp | #include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
set<string> pool;
string id, con;
int maxSize = 0;
for (int i = 0; i < n; ++i)
{
cin >> id >> con;
if (con == "connect")
pool.insert(id);
else if (con == "disconnect")
pool.erase(id);
int size = pool.size();
maxSize = max(maxSize, size);
}
cout << maxSize << endl;
}
system("pause");
return 0;
} | [
"[email protected]"
] | |
96fb74b595bce7f400939f1a98727f3046f1745f | ee1423adcd4bfeb2703464996171d103542bad09 | /dali-core/dali-core-HEAD-5d42e5d/automated-tests/dali-test-suite/images/utc-Dali-Image.cpp | 119ed7eabee8013fa8ba16ac426febca10d0ddba | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-flora-1.1"
] | permissive | sak0909/Dali | 26ac61a521ab1de26a7156c51afd3cc839cb705a | 0b383fc316b8b57afcf9a9e8bac6e24a4ba36e49 | refs/heads/master | 2020-12-30T12:10:51.930311 | 2017-05-16T21:56:24 | 2017-05-16T21:57:14 | 91,505,804 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 35,669 | cpp | //
// Copyright (c) 2014 Samsung Electronics Co., Ltd.
//
// Licensed under the Flora License, Version 1.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://floralicense.org/license/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an AS IS BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <tet_api.h>
#include <dali/public-api/dali-core.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-attributes.h>
#include <dali-test-suite-utils.h>
#include <test-native-image.h>
using namespace Dali;
static void Startup();
static void Cleanup();
extern "C" {
void (*tet_startup)() = Startup;
void (*tet_cleanup)() = Cleanup;
}
static const char* gTestImageFilename = "icon_wrt.png";
enum {
POSITIVE_TC_IDX = 0x01,
NEGATIVE_TC_IDX,
};
#define MAX_NUMBER_OF_TESTS 10000
extern "C" {
struct tet_testlist tet_testlist[MAX_NUMBER_OF_TESTS];
}
TEST_FUNCTION( UtcDaliImageNew01, POSITIVE_TC_IDX ); // 01
TEST_FUNCTION( UtcDaliImageNew02, POSITIVE_TC_IDX ); // 02
TEST_FUNCTION( UtcDaliImageNew03, POSITIVE_TC_IDX ); // 03
TEST_FUNCTION( UtcDaliImageNewWithPolicies01, POSITIVE_TC_IDX ); // 04
TEST_FUNCTION( UtcDaliImageNewWithPolicies02, POSITIVE_TC_IDX ); // 05
TEST_FUNCTION( UtcDaliImageNewWithPolicies03, POSITIVE_TC_IDX ); // 06
TEST_FUNCTION( UtcDaliImageNewWithPolicies04, POSITIVE_TC_IDX ); // 07
TEST_FUNCTION( UtcDaliImageNewDistanceField, POSITIVE_TC_IDX ); // 08
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithPolicies01, POSITIVE_TC_IDX ); // 09
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithPolicies02, POSITIVE_TC_IDX ); // 10
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithPolicies03, POSITIVE_TC_IDX ); // 11
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithPolicies04, POSITIVE_TC_IDX ); // 12
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithAttributes, POSITIVE_TC_IDX ); // 13
TEST_FUNCTION( UtcDaliImageNewDistanceFieldWithAttrandPol, POSITIVE_TC_IDX ); // 14
TEST_FUNCTION( UtcDaliImageDownCast, POSITIVE_TC_IDX ); // 15
TEST_FUNCTION( UtcDaliImageGetImageSize, POSITIVE_TC_IDX ); // 16
TEST_FUNCTION( UtcDaliImageGetFilename, POSITIVE_TC_IDX ); // 17
TEST_FUNCTION( UtcDaliImageGetLoadingState01, POSITIVE_TC_IDX ); // 18
TEST_FUNCTION( UtcDaliImageGetLoadingState02, POSITIVE_TC_IDX ); // 19
TEST_FUNCTION( UtcDaliImageGetReleasePolicy, POSITIVE_TC_IDX ); // 20
TEST_FUNCTION( UtcDaliImageGetLoadPolicy, POSITIVE_TC_IDX ); // 21
TEST_FUNCTION( UtcDaliImageSignalLoadingFinished, POSITIVE_TC_IDX ); // 22
TEST_FUNCTION( UtcDaliImageSignalUploaded, POSITIVE_TC_IDX ); // 23
TEST_FUNCTION( UtcDaliImageDiscard01, POSITIVE_TC_IDX ); // 24
TEST_FUNCTION( UtcDaliImageDiscard02, POSITIVE_TC_IDX ); // 25
TEST_FUNCTION( UtcDaliImageDiscard03, POSITIVE_TC_IDX ); // 26
// Called only once before first test is run.
static void Startup()
{
}
// Called only once after last test is run
static void Cleanup()
{
}
// 1.1
static void UtcDaliImageNew01()
{
TestApplication application;
tet_infoline("UtcDaliImageNew01 - Image::New(const std::string&)");
// invoke default handle constructor
Image image;
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::New(gTestImageFilename);
DALI_TEST_CHECK( image );
}
// 1.2
static void UtcDaliImageNew02()
{
TestApplication application;
tet_infoline("UtcDaliImageNew02 - Image::New(const std::string&, const ImageAttributes&)");
// invoke default handle constructor
Image image;
DALI_TEST_CHECK( !image );
// initialise handle
Dali::ImageAttributes imageAttributes;
imageAttributes.SetSize(128, 256);
imageAttributes.SetScalingMode(Dali::ImageAttributes::FitHeight);
image = Image::New(gTestImageFilename, imageAttributes);
DALI_TEST_CHECK( image );
}
// 1.3
static void UtcDaliImageNew03()
{
TestApplication application;
tet_infoline("UtcDaliImageNew03 - Image::New(NativeImage&)");
// invoke default handle constructor
Image image;
TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::New(*(nativeImage.Get()));
DALI_TEST_CHECK( image );
}
// 1.4
static void UtcDaliImageNewWithPolicies01()
{
TestApplication application;
// testing delayed loading
tet_infoline("UtcDaliImageNewWithPolicies01 - Load image with LoadPolicy::OnDemand, ReleasePolicy::Never");
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
Image image = Image::New(gTestImageFilename, Image::OnDemand, Image::Never);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading only when actor added to stage
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
// testing ReleasePolicy::Never
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// never discard texture
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
}
// 1.5
static void UtcDaliImageNewWithPolicies02()
{
TestApplication application;
// testing resource deletion when taken off stage
tet_infoline("UtcDaliImageNewWithPolicies02 - Load image with LoadPolicy::OnDemand, ReleasePolicy::Unused");
Image image = Image::New(gTestImageFilename, Image::OnDemand, Image::Unused);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading only when actor added to stage
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
// testing ReleasePolicy::Unused
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// discard texture when actor comes off stage
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
}
// 1.6
static void UtcDaliImageNewWithPolicies03()
{
TestApplication application;
// load immediately -> resource deletion when taken off stage -> put actor back on stage -> load resource again
tet_infoline("UtcDaliImageNewWithPolicies03 - Load image with LoadPolicy::Immediate, ReleasePolicy::Unused");
Image image = Image::New(gTestImageFilename, Image::Immediate, Image::Unused);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading immediately
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
// testing ReleasePolicy::Unused
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// discard texture when actor comes off stage
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
// check load request when actor added back to stage
application.GetPlatform().ResetTrace();
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
}
// 1.7
static void UtcDaliImageNewWithPolicies04()
{
TestApplication application;
// load immediately, don't release texture when off stage
tet_infoline("UtcDaliImageNewWithPolicies03 - Load image with LoadPolicy::Immediate, ReleasePolicy::Never");
Image image = Image::New(gTestImageFilename, Image::Immediate, Image::Never);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading immediately
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
// testing ReleasePolicy::Never
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// texture is not discarded
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// no load request when actor added back to stage
application.GetPlatform().ResetTrace();
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
}
// 1.8
static void UtcDaliImageNewDistanceField()
{
TestApplication application;
tet_infoline("UtcDaliImageNewDistanceField - Image::NewDistanceField(const std::string&)");
// invoke default handle constructor
Image image;
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::NewDistanceField(gTestImageFilename);
DALI_TEST_CHECK( image );
}
// 1.9
static void UtcDaliImageNewDistanceFieldWithPolicies01()
{
TestApplication application;
// testing delayed loading
tet_infoline("UtcDaliImageNewDistanceFieldWithPolicies01 - Load image with LoadPolicy::OnDemand, ReleasePolicy::Never");
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
Image image = Image::NewDistanceField(gTestImageFilename, Image::OnDemand, Image::Never);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading only when actor added to stage
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
// testing ReleasePolicy::Never
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// never discard texture
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
}
// 1.10
static void UtcDaliImageNewDistanceFieldWithPolicies02()
{
TestApplication application;
// testing resource deletion when taken off stage
tet_infoline("UtcDaliImageNewDistanceFieldWithPolicies02 - Load image with LoadPolicy::OnDemand, ReleasePolicy::Unused");
Image image = Image::NewDistanceField(gTestImageFilename, Image::OnDemand, Image::Unused);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading only when actor added to stage
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
// testing ReleasePolicy::Unused
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// discard texture when actor comes off stage
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
}
// 1.11
static void UtcDaliImageNewDistanceFieldWithPolicies03()
{
TestApplication application;
// load immediately -> resource deletion when taken off stage -> put actor back on stage -> load resource again
tet_infoline("UtcDaliImageNewDistanceFieldWithPolicies03 - Load image with LoadPolicy::Immediate, ReleasePolicy::Unused");
Image image = Image::NewDistanceField(gTestImageFilename, Image::Immediate, Image::Unused);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading immediately
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
// testing ReleasePolicy::Unused
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// discard texture when actor comes off stage
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
// check load request when actor added back to stage
application.GetPlatform().ResetTrace();
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
}
// 1.12
static void UtcDaliImageNewDistanceFieldWithPolicies04()
{
TestApplication application;
// load immediately, don't release texture when off stage
tet_infoline("UtcDaliImageNewDistanceFieldWithPolicies04 - Load image with LoadPolicy::Immediate, ReleasePolicy::Never");
Image image = Image::NewDistanceField(gTestImageFilename, Image::Immediate, Image::Never);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading immediately
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
// testing ReleasePolicy::Never
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// texture is not discarded
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// no load request when actor added back to stage
application.GetPlatform().ResetTrace();
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
}
// 1.13
static void UtcDaliImageNewDistanceFieldWithAttributes()
{
TestApplication application;
tet_infoline("UtcDaliImageNewDistanceFieldWithAttributes - Image::NewDistanceField(const std::string&, const ImageAttributes& attributes)");
// invoke default handle constructor
Image image;
Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::NewDistanceField(6.0f, 12);
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::NewDistanceField(gTestImageFilename, imageAttributes);
DALI_TEST_CHECK( image );
}
// 1.14
static void UtcDaliImageNewDistanceFieldWithAttrandPol()
{
TestApplication application;
tet_infoline("UtcDaliImageNewDistanceFieldWithAttrandPol - Load image with LoadPolicy::OnDemand, ReleasePolicy::Unused");
Dali::ImageAttributes imageAttributes = Dali::ImageAttributes::NewDistanceField(6.0f, 12);
Image image = Image::NewDistanceField(gTestImageFilename, imageAttributes, Image::OnDemand, Image::Unused);
DALI_TEST_CHECK( image );
application.SendNotification();
application.Render(16);
// request file loading only when actor added to stage
DALI_TEST_CHECK( !application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
DALI_TEST_CHECK( application.GetPlatform().WasCalled(TestPlatformAbstraction::LoadResourceFunc) );
// testing ReleasePolicy::Unused
// fake loading image
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( !application.GetGlAbstraction().CheckTextureDeleted(23) );
// discard texture when actor comes off stage
Stage::GetCurrent().Remove(actor);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK ( application.GetGlAbstraction().CheckTextureDeleted(23) );
}
// 1.15
static void UtcDaliImageDownCast()
{
TestApplication application;
tet_infoline("Testing Dali::Image::DownCast()");
Image image = Image::New(gTestImageFilename);
BaseHandle object(image);
Image image2 = Image::DownCast(object);
DALI_TEST_CHECK(image2);
Image image3 = DownCast< Image >(object);
DALI_TEST_CHECK(image3);
BaseHandle unInitializedObject;
Image image4 = Image::DownCast(unInitializedObject);
DALI_TEST_CHECK(!image4);
Image image5 = DownCast< Image >(unInitializedObject);
DALI_TEST_CHECK(!image5);
}
// 1.16
static void UtcDaliImageGetImageSize()
{
TestApplication application;
TestPlatformAbstraction& platform = application.GetPlatform();
tet_infoline("UtcDaliImageGetImageSize - Image::GetImageSize()");
Vector2 testSize(8.0f, 16.0f);
platform.SetClosestImageSize(testSize);
Vector2 size = Image::GetImageSize(gTestImageFilename);
DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethod("GetClosestImageSize"));
DALI_TEST_EQUALS( size, testSize, TEST_LOCATION);
}
// 1.17
static void UtcDaliImageGetFilename()
{
TestApplication application;
tet_infoline("UtcDaliImageGetFilename");
// invoke default handle constructor
Image image;
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::New(gTestImageFilename);
DALI_TEST_EQUALS( image.GetFilename(), gTestImageFilename, TEST_LOCATION);
}
// 1.18
static void UtcDaliImageGetLoadingState01()
{
TestApplication application;
tet_infoline("UtcDaliImageGetLoadingState01");
Image image = Image::New(gTestImageFilename);
DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoading);
application.SendNotification();
application.Render(16);
// simulate load success
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
// Test state == ResourceLoadingSucceeded
DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingSucceeded);
}
// 1.19
static void UtcDaliImageGetLoadingState02()
{
TestApplication application;
tet_infoline("UtcDaliImageGetLoadingState02");
// invoke default handle constructor
Image image;
DALI_TEST_CHECK( !image );
// initialise handle
image = Image::New(gTestImageFilename);
// Test state == ResourceLoading
DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoading);
application.SendNotification();
application.Render(16);
// simulate load failure
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
if(request)
{
application.GetPlatform().SetResourceLoadFailed(request->GetId(), Integration::FailureUnknown);
}
application.Render(16);
application.SendNotification();
// Test state == ResourceLoadingFailed
DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingFailed);
}
// 1.20
static void UtcDaliImageGetReleasePolicy()
{
TestApplication application;
tet_infoline("UtcDaliImageGetReleasePolicy");
Image image = Image::New(gTestImageFilename, Image::Immediate, Image::Unused);
DALI_TEST_CHECK( image );
DALI_TEST_CHECK( Image::Unused == image.GetReleasePolicy() );
}
// 1.21
static void UtcDaliImageGetLoadPolicy()
{
TestApplication application;
tet_infoline("UtcDaliImageGetLoadPolicy");
Image image = Image::New(gTestImageFilename, Image::OnDemand, Image::Never);
DALI_TEST_CHECK( image );
DALI_TEST_CHECK( Image::OnDemand == image.GetLoadPolicy());
}
static bool SignalLoadFlag = false;
static void SignalLoadHandler(Image image)
{
tet_infoline("Received image load finished signal");
SignalLoadFlag = true;
}
static bool SignalUploadedFlag = false;
static void SignalUploadedHandler(Image image)
{
tet_infoline("Received image uploaded signal");
SignalUploadedFlag = true;
}
// 1.22
static void UtcDaliImageSignalLoadingFinished()
{
TestApplication application;
tet_infoline("UtcDaliImageSignalLoadingFinished");
SignalLoadFlag = false;
Image image = Image::New(gTestImageFilename);
image.LoadingFinishedSignal().Connect( SignalLoadHandler );
application.SendNotification();
application.Render(16);
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(Integration::Bitmap::New(Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true)));
}
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK( SignalLoadFlag == true );
}
// 1.23
static void UtcDaliImageSignalUploaded()
{
TestApplication application;
tet_infoline("UtcDaliImageSignalUploaded - Image::SignalUploaded()");
// set up image in fake platform abstraction
Vector2 testSize(80.0f, 80.0f);
application.GetPlatform().SetClosestImageSize(testSize);
Image image = Image::New(gTestImageFilename);
image.LoadingFinishedSignal().Connect( SignalLoadHandler );
// Load image
application.SendNotification();
application.Render(16);
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
image.UploadedSignal().Connect( SignalUploadedHandler );
Dali::ImageActor imageActor = ImageActor::New(image);
Stage::GetCurrent().Add(imageActor);
imageActor.SetSize(80, 80);
imageActor.SetVisible(true);
application.SendNotification();
application.Render(0);
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK( SignalLoadFlag == true );
DALI_TEST_CHECK( SignalUploadedFlag == true );
SignalLoadFlag = false;
SignalUploadedFlag = false;
image.Reload();
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 160, 160, 160, 160);
application.SendNotification();
application.Render(16);
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK( SignalLoadFlag == true );
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
DALI_TEST_CHECK( SignalUploadedFlag == true );
}
// 1.24
static void UtcDaliImageDiscard01()
{
TestApplication application;
tet_infoline("UtcDaliImageDiscard01 - no actors");
{
Image image = Image::New(gTestImageFilename);
// Load image
application.SendNotification();
application.Render(16);
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
} // Drop image handle
application.SendNotification();
application.Render(16);
application.Render(16);
application.SendNotification();
// Shouldn't have been sent to GL...
const std::vector<GLuint>& texIds = application.GetGlAbstraction().GetNextTextureIds();
DALI_TEST_CHECK( texIds.size() == 1 );
DALI_TEST_CHECK( texIds[0] == 23 );
}
// 1.25
static void UtcDaliImageDiscard02()
{
TestApplication application;
tet_infoline("UtcDaliImageDiscard02 - one actor, tests TextureCache::DiscardTexture");
{
{
ImageActor actor;
{
Image image = Image::New(gTestImageFilename);
actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
} // lose image handle, actor should still keep one
application.SendNotification();
application.Render(16);
Stage::GetCurrent().Remove(actor);
application.SendNotification();
application.Render(16);
} // lose actor
application.SendNotification();
application.Render(16);
}
// Cleanup
application.SendNotification();
application.Render(16);
application.Render(16);
application.SendNotification();
// texture should have been removed:
DALI_TEST_CHECK( application.GetGlAbstraction().CheckTextureDeleted( 23 ));
}
// 1.26
static void UtcDaliImageDiscard03()
{
TestApplication application;
tet_infoline("UtcDaliImageDiscard03 - one actor, tests TextureCache::RemoveObserver");
Image image = Image::New(gTestImageFilename);
ImageActor actor = ImageActor::New(image);
Stage::GetCurrent().Add(actor);
application.SendNotification();
application.Render(16);
std::vector<GLuint> ids;
ids.push_back( 23 );
application.GetGlAbstraction().SetNextTextureIds( ids );
Integration::ResourceRequest* request = application.GetPlatform().GetRequest();
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, true );
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
if(request)
{
application.GetPlatform().SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
}
application.Render(16);
application.SendNotification();
application.SendNotification();
application.Render(16);
const std::vector<GLuint>& texIds = application.GetGlAbstraction().GetNextTextureIds();
DALI_TEST_CHECK( texIds.size() == 0 );
const std::vector<GLuint>& boundTexIds = application.GetGlAbstraction().GetBoundTextures();
DALI_TEST_CHECK( boundTexIds[0] == 23 );
Stage::GetCurrent().Remove(actor);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16);
application.SendNotification();
application.Render(16); // Should remove image renderer
// Test what?!
}
| [
"[email protected]"
] | |
151be93d32cd64d5c962f4a9f496744a3f46d0cf | 24402270bbae693e18316e7519e4043261d7e9f5 | /PAT-Advanced-1029.cpp | 9be100df1a5c7a2345f0a97da94f2719603ada73 | [] | no_license | Lemon-XQ/PAT-Advanced | e240a69a65c0af5ebe83fd1144af3c86ff6ee60c | 4a32066b4781315960e58e108b2d1466d44a0a73 | refs/heads/master | 2020-03-29T18:15:04.105405 | 2018-10-04T16:14:00 | 2018-10-04T16:14:00 | 150,201,653 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 749 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int INF=0x7fffffff;
#define size 200001
int arr[size];
int main(){
int N1,N2,i=0,j=0;
scanf("%d",&N1);
for(int i=0;i<N1;i++){
scanf("%d",&arr[i]);
}
arr[N1]=INF;
scanf("%d",&N2);
int mid=(N1+N2-1)/2,count=0,num;
scanf("%d",&num);
for(count=0;count<mid;count++){// 遍历arr所有数,排序到中位数为止
if(num>arr[i]) i++;// 找到插入的地方
else{
j++;
if(j<N2) scanf("%d",&num);
else if(j==N2) num=INF;
else break;
}
}
cout<<min(arr[i],num)<<endl;
// for(int j=i;j<N+i;j++){
// scanf("%d",&arr[j]);
// }
// sort(arr,arr+N+i);// 最后一个测试点MLE
// cout<<arr[(N+i-1)/2]<<endl;
return 0;
}
| [
"[email protected]"
] | |
81579646f273e3626b3d180bd262fa407ddfe97f | c67459b3e834e044db19e8d58e460ec69713e503 | /include/polynomial/Polynomial.h | d18ecfc3761c6f514dc07a3d5b5260896c589cde | [] | no_license | levistovall/dog-ate-loaf | 17db38c011b8c48dac29c5a64c3239ec3ad72174 | 100d6536f5a88876d898412a0c65ad81c016f9b3 | refs/heads/master | 2021-04-27T12:51:26.388838 | 2019-05-05T20:01:58 | 2019-05-05T20:01:58 | 122,427,876 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,102 | h | #ifndef POLYNOMIAL_H_
#define POLYNOMIAL_H_
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <typeinfo>
#include <initializer_list>
#include "Rational.h"
/*
* The class template Polynomial<T> can represent a sum of products of scalars and variables
* of any order but cannot represent anything with a polynomial in the denominator.
* It achieves this by inheriting std::map<std::map<std::string, T>, T>, which might be more
* helpfully represented as std::map<std::map<VARIABLE_NAME, DEGREE>, COEFFICIENT>
*/
template<typename T>
class Polynomial : public std::map<std::map<std::string, T>, T>
{
public:
/*
* Plain ol' constructor
*/
Polynomial();
/*
* This constructor uses an initializer list which is available courtesy of
* std::map so that polynomials can be constructed in a *relatively* concise way
* as opposed to being built term by term
*/
Polynomial(std::initializer_list<std::pair<const std::map<std::string, T>, T>> il);
/*
* The method addTerm takes a term, e.g. a(x^2)(y^3) and adds it to
* this Polynomial, adding a to the coefficient of a like term if it exists,
* deleting the like term if the existing coefficient is -a, or creating a new
* key-value pairing if a like term did not previously exist
*/
void addTerm(const std::pair<std::map<std::string, T>, T> &term);
/*
* The method getProductOfTwoTerms takes two pairings of coefficients
* to variable-degree maps and returns a product. For example, the two terms
* could respectively represent 6(x^2) and 2(x)(y^2). In that case this method
* would return a term to represent 12(x^3)(y^2).
*/
static std::pair<std::map<std::string, T>, T> getProductOfTwoTerms(
const std::pair<std::map<std::string, T>, T> &term1,
const std::pair<std::map<std::string, T>, T> &term2);
std::string toString() const;
/*
* Returns as a Polynomial the value of this Polynomial when evaluated when its variables
* corresponding to the keys of the map varNameToValueMap have the values specified by the
* values of the same map.
* For example, if the Polynomial was x + y + 1 then passing a map {{x : 5}} to this
* method would yield the Polynomial y + 6. If the map {{x : 3}, {y : 2}} were
* passed instead, this method would yield a Polynomial with only a constant term, 6.
*/
Polynomial<T> evaluateWithVariableValues(std::map<std::string, T> varNameToValueMap);
/*
* The method containsVariable determines whether this Polynomial has
* any terms with a variable that has the name passed as varName
*/
bool containsVariable(std::string varName);
};
/*
* This operator achieves scalar multiplication of a Polynomial
*/
template<typename T1, typename T2>
auto operator*(const T1 &scalar, const Polynomial<T2> &p) -> Polynomial<decltype(T1{} * T2{})>
{
Polynomial<decltype(T1{} * T2{})> scalarMultiple;
typename std::map<std::map<std::string, T2>, T2>::const_iterator p_it;
/*
* iterate over the terms in the polynomial, get the product with the scalar,
* and add the result to the returned polynomial
*/
for(p_it = p.begin(); p_it != p.end(); p_it++)
{
std::pair<std::map<std::string, decltype(T1{} * T2{})>, decltype(T1{} * T2{})> multipliedTerm;
multipliedTerm.first = p_it->first;
multipliedTerm.second = p_it->second * scalar;
scalarMultiple.addTerm(multipliedTerm);
}
return scalarMultiple;
}
/*
* This operator achieves scalar multiplication of Polynomial in the opposite order
* to the above
*/
template<typename T1, typename T2>
auto operator*(const Polynomial<T1> &p, const T2 &scalar) -> Polynomial<decltype(T1{} * T2{})>
{
return scalar * p;
}
/*
* This operator achieves multiplication of two polynomials
*/
template<typename T1, typename T2>
auto operator*(const Polynomial<T1> &p, const Polynomial<T2> &q) -> Polynomial<decltype(T1{} * T2{})>
{
Polynomial<decltype(T1{} * T2{})> product;
typename std::map<std::map<std::string, T1>, T1>::const_iterator p_it;
typename std::map<std::map<std::string, T2>, T2>::const_iterator q_it;
/*
* Iterate over the first polynomial
*/
for(p_it = p.begin(); p_it != p.end(); p_it++)
{
/*
* For every term in the first polynomial,
* iterate over all the terms in the second polynomial
*/
std::map<std::string, decltype(T1{} * T2{})> variableOrderMap;
for(q_it = q.begin(); q_it != q.end(); q_it++)
{
/*
* Get the product of the current term of the first polynomial
* with the current term of the second polynomial.
*/
std::pair<std::map<std::string, decltype(T1{} * T2{})>, decltype(T1{} * T2{})> termProduct =
Polynomial<decltype(T1{} * T2{})>::getProductOfTwoTerms(*p_it, *q_it);
/*
* Add it to the polynomial which will be returned.
*/
product.addTerm(termProduct);
}
}
return product;
}
/*
* This operator achieves addition of two polynomials.
*/
template<typename T1, typename T2>
auto operator+(const Polynomial<T1> &p, const Polynomial<T2> &q) -> Polynomial<decltype(T1{} * T2{})>
{
/*
* Make a new polynomial to return.
*/
Polynomial<decltype(T1{} * T2{})> sum;
/*
* Add all terms from the first polynomial.
*/
typename std::map<std::map<std::string, T1>, T1>::const_iterator p_it;
for(p_it = p.begin(); p_it != p.end(); p_it++)
{
sum.addTerm(*p_it);
}
/*
* Add all terms from the second polynomial.
*/
typename std::map<std::map<std::string, T2>, T2>::const_iterator q_it;
for(q_it = q.begin(); q_it != q.end(); q_it++)
{
sum.addTerm(*q_it);
}
return sum;
}
/*
* This operator achieves subtraction from polynomial of another
*/
template<typename T1, typename T2>
auto operator-(const Polynomial<T1> &p, const Polynomial<T2> &q) -> Polynomial<decltype(T1{} * T2{})>
{
return p + (-1 * q);
}
/*
* This operator allows ostreams to handle Polynomials
*/
template<typename T>
std::ostream &operator<<(std::ostream &out, Polynomial<T> const &p)
{
out << p.toString();
return out;
}
#endif
| [
"[email protected]"
] | |
907bf3ada8475e18c2b859d1e42755430132cbfd | 607e69f9e4440ef3ab9c33b7b6e85e95b5e982fb | /deps/museum/6.0.1/art/runtime/base/histogram.h | 1dbc6595bd233c155c8d9b8bba9ebed634702e0f | [
"Apache-2.0"
] | permissive | simpleton/profilo | 8bda2ebf057036a55efd4dea1564b1f114229d1a | 91ef4ba1a8316bad2b3080210316dfef4761e180 | refs/heads/master | 2023-03-12T13:34:27.037783 | 2018-04-24T22:45:58 | 2018-04-24T22:45:58 | 125,419,173 | 0 | 0 | Apache-2.0 | 2018-03-15T19:54:00 | 2018-03-15T19:54:00 | null | UTF-8 | C++ | false | false | 4,558 | h | /*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_BASE_HISTOGRAM_H_
#define ART_RUNTIME_BASE_HISTOGRAM_H_
#include <museum/6.0.1/external/libcxx/vector>
#include <museum/6.0.1/external/libcxx/string>
#include <museum/6.0.1/art/runtime/base/logging.h>
namespace facebook { namespace museum { namespace MUSEUM_VERSION { namespace art {
// Creates a data histogram for a better understanding of statistical data.
// Histogram analysis goes beyond simple mean and standard deviation to provide
// percentiles values, describing where the $% of the input data lies.
// Designed to be simple and used with timing logger in art.
template <class Value> class Histogram {
const double kAdjust;
const size_t kInitialBucketCount;
public:
class CumulativeData {
friend class Histogram<Value>;
std::vector<uint64_t> freq_;
std::vector<double> perc_;
};
// Used by the cumulative timing logger to search the histogram set using for an existing split
// with the same name using CumulativeLogger::HistogramComparator.
explicit Histogram(const char* name);
// This is the expected constructor when creating new Histograms.
Histogram(const char* name, Value initial_bucket_width, size_t max_buckets = 100);
void AddValue(Value);
void AdjustAndAddValue(Value); // Add a value after dividing it by kAdjust.
// Builds the cumulative distribution function from the frequency data.
// Accumulative summation of frequencies.
// cumulative_freq[i] = sum(frequency[j] : 0 < j < i )
// Accumulative summation of percentiles; which is the frequency / SampleSize
// cumulative_perc[i] = sum(frequency[j] / SampleSize : 0 < j < i )
void CreateHistogram(CumulativeData* data) const;
// Reset the cumulative values, next time CreateHistogram is called it will recreate the cache.
void Reset();
double Mean() const;
double Variance() const;
double Percentile(double per, const CumulativeData& data) const;
void PrintConfidenceIntervals(std::ostream& os, double interval,
const CumulativeData& data) const;
void PrintBins(std::ostream& os, const CumulativeData& data) const;
void DumpBins(std::ostream& os) const;
Value GetRange(size_t bucket_idx) const;
size_t GetBucketCount() const;
uint64_t SampleSize() const {
return sample_size_;
}
Value Sum() const {
return sum_;
}
Value AdjustedSum() const {
return sum_ * kAdjust;
}
Value Min() const {
return min_value_added_;
}
Value Max() const {
return max_value_added_;
}
const std::string& Name() const {
return name_;
}
private:
void Initialize();
size_t FindBucket(Value val) const;
void BucketiseValue(Value val);
// Add more buckets to the histogram to fill in a new value that exceeded
// the max_read_value_.
void GrowBuckets(Value val);
std::string name_;
// Maximum number of buckets.
const size_t max_buckets_;
// Number of samples placed in histogram.
size_t sample_size_;
// Width of the bucket range. The lower the value is the more accurate
// histogram percentiles are. Grows adaptively when we hit max buckets.
Value bucket_width_;
// How many occurrences of values fall within a bucket at index i where i covers the range
// starting at min_ + i * bucket_width_ with size bucket_size_.
std::vector<uint32_t> frequency_;
// Summation of all the elements inputed by the user.
Value sum_;
// Minimum value that can fit in the histogram. Fixed to zero for now.
Value min_;
// Maximum value that can fit in the histogram, grows adaptively.
Value max_;
// Summation of the values entered. Used to calculate variance.
Value sum_of_squares_;
// Maximum value entered in the histogram.
Value min_value_added_;
// Minimum value entered in the histogram.
Value max_value_added_;
DISALLOW_COPY_AND_ASSIGN(Histogram);
};
} } } } // namespace facebook::museum::MUSEUM_VERSION::art
#endif // ART_RUNTIME_BASE_HISTOGRAM_H_
| [
"[email protected]"
] | |
1e09821d3208339891c684245ac764e867daa037 | 56ee04007eac69701f0bb4421046eb558b24f6d6 | /abc187/d.cpp | 99bdd5a67d6331727d373dca44b84b90dbc886bb | [] | no_license | tsuba3/atcoder | e5789515d96079a386843f744f0cf594ec663a24 | d397e98686cae982b431c098ec288d2994c33152 | refs/heads/master | 2021-07-01T21:31:45.429120 | 2021-02-20T13:40:24 | 2021-02-20T13:40:24 | 224,573,527 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,461 | cpp | /* _
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||_ \
| | \\\ - /'| | |
| \_| `\`---'// |_/ |
\ .-\__ `-. -'__/-. /
___`. .' /--.--\ `. .'___
."" '< `.___\_<|>_/___.' _> \"".
| | : `- \`. ;`. _/; .'/ / .' ; |
\ \ `-. \_\_`. _.'_/_/ -' _.' /
===========`-.`___`-.__\ \___ /__.-'_.'_.-'================
Please give me AC.
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>
using namespace std;
using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#ifdef ONLINE_JUDGE
#define debug(x)
#define debug2(x, y)
#define debug3(x, y, z)
#define dbg(v)
#else
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
#endif
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
template<typename T> T gcd(T a, T b) {
if (a < b) return gcd(b, a);
T r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
template<typename T> T lcm(const T a, const T b) {
return a / gcd(a, b) * b;
}
template<typename T> bool chmin(T& a, const T& b) {
if (a > b) return a = b, true; else return false;
}
template<typename T> bool chmax(T& a, const T& b) {
if (a < b) return a = b, true; else return false;
}
// End of template.
int main() {
cout << fixed << setprecision(15);
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cerr.tie(nullptr);
int n;
int64 d[200200];
int64 aoki = 0;
cin >> n;
rep(i, n) {
int64 a, b;
cin >> a >> b;
aoki += a;
d[i] = a + b + a;
}
sort(begin(d), begin(d) + n);
int ans = 0;
for (int i = n - 1; i >= 0; --i) {
ans += 1;
aoki -= d[i];
if (aoki < 0) {
print(ans);
return 0;
}
}
return 0;
}
/*
_
__| | ___ _ __ _ __
/ _` | / __| '_ \| '_ \
| (_| || (__| |_) | |_) |
\__,_(_)___| .__/| .__/
|_| |_|
*/
| [
"[email protected]"
] | |
f5237409496c3a653a11282f8f3256c7ea99714d | 19d41c4ae325277636383885388c83dd1555f8cf | /zerojudge/d105.cpp | f2a3dc5a401adf02d34e24c73888b9df545bf258 | [] | no_license | henrytsui000/online-judge | 5fd0f7b5c747fb5bfd5f84fb616b9f7346e8abaf | 337aa1d52d587fb653ceeb8b3ee64668804f5b13 | refs/heads/master | 2022-05-28T13:56:04.705485 | 2022-05-19T13:33:43 | 2022-05-19T13:33:43 | 226,999,858 | 3 | 0 | null | 2022-02-02T03:22:06 | 2019-12-10T01:10:15 | C++ | UTF-8 | C++ | false | false | 521 | cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define endl '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
using ll = long long;
#define ij i<<','<<j<<": "
ll n,m;
#define MAXN 30
ll dp[30][30];
ll ans=0;
int main(){
IOS;
cin>>n>>m;
rep(i,n)
rep(j,m)
dp[i][j]=0;
dp[0][0]=1;
for(int j=1;j<m+1;j++){
rep(i,n){
dp[i][j]=dp[(i-1+n)%n][j-1]+dp[(i+1)%n][j-1];
}
}
cout<<dp[0][m]<<endl;
return 0;
} | [
"[email protected]"
] | |
bb84d14479e0d62b13fe0d9c4c8f98a1a555c13d | 8124ed12e1c37d204f697f35e941e007b330535e | /TestWork_2/B.2.cpp | 8eea323b0d70f6ac1af2ced7a4f9089799a3ec59 | [] | no_license | Alexkkir/Sphere-Algorithms | 28c9010d26746a113c2a07a40f11b91f987486dc | 8c360b3d7222f67dbbd7a134b54395e6a95469a2 | refs/heads/master | 2022-12-18T22:59:28.465737 | 2020-09-18T10:08:12 | 2020-09-18T10:08:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 402 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
multiset<long long> S;
int N, K;
long long a;
cin >> N >> K;
for(int i = 0; i < N; ++i) {
cin >> a;
if(S.size() < K)
S.insert(a);
else
if(a > *(S.begin())) {
S.erase(S.begin());
S.insert(a);
}
}
for(auto it = S.rbegin(); it != S.rend(); ++it)
cout << *(it) << '\n';
} | [
"[email protected]"
] | |
ff87ab58cd18081dbc29a2694ef88aca6c8aa14c | ba4db75b9d1f08c6334bf7b621783759cd3209c7 | /src_main/engine/audio/private/snd_dev_common.h | f32c1741434c029fc28be5b907aa8a7eccffbf8f | [] | no_license | equalent/source-2007 | a27326c6eb1e63899e3b77da57f23b79637060c0 | d07be8d02519ff5c902e1eb6430e028e1b302c8b | refs/heads/master | 2020-03-28T22:46:44.606988 | 2017-03-27T18:05:57 | 2017-03-27T18:05:57 | 149,257,460 | 2 | 0 | null | 2018-09-18T08:52:10 | 2018-09-18T08:52:09 | null | WINDOWS-1252 | C++ | false | false | 2,851 | h | //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Device Common Routines
//
//=====================================================================================//
#ifndef SND_DEV_COMMON_H
#define SND_DEV_COMMON_H
#pragma once
class CAudioDeviceBase : public IAudioDevice
{
public:
virtual bool IsActive( void ) { return false; }
virtual bool Init( void ) { return false; }
virtual void Shutdown( void ) {}
virtual void Pause( void ) {}
virtual void UnPause( void ) {}
virtual float MixDryVolume( void ) { return 0; }
virtual bool Should3DMix( void ) { return m_bSurround; }
virtual void StopAllSounds( void ) {}
virtual int PaintBegin( float, int soundtime, int paintedtime ) { return 0; }
virtual void PaintEnd( void ) {}
virtual void SpatializeChannel( int volume[CCHANVOLUMES/2], int master_vol, const Vector& sourceDir, float gain, float mono );
virtual void ApplyDSPEffects( int idsp, portable_samplepair_t *pbuffront, portable_samplepair_t *pbufrear, portable_samplepair_t *pbufcenter, int samplecount );
virtual int GetOutputPosition( void ) { return 0; }
virtual void ClearBuffer( void ) {}
virtual void UpdateListener( const Vector& position, const Vector& forward, const Vector& right, const Vector& up ) {}
virtual void MixBegin( int sampleCount );
virtual void MixUpsample( int sampleCount, int filtertype );
virtual void Mix8Mono( channel_t *pChannel, char *pData, int outputOffset, int inputOffset, fixedint rateScaleFix, int outCount, int timecompress );
virtual void Mix8Stereo( channel_t *pChannel, char *pData, int outputOffset, int inputOffset, fixedint rateScaleFix, int outCount, int timecompress );
virtual void Mix16Mono( channel_t *pChannel, short *pData, int outputOffset, int inputOffset, fixedint rateScaleFix, int outCount, int timecompress );
virtual void Mix16Stereo( channel_t *pChannel, short *pData, int outputOffset, int inputOffset, fixedint rateScaleFix, int outCount, int timecompress );
virtual void ChannelReset( int entnum, int channelIndex, float distanceMod ) {}
virtual void TransferSamples( int end ) {}
virtual const char *DeviceName( void ) { return NULL; }
virtual int DeviceChannels( void ) { return 0; }
virtual int DeviceSampleBits( void ) { return 0; }
virtual int DeviceSampleBytes( void ) { return 0; }
virtual int DeviceDmaSpeed( void ) { return 1; }
virtual int DeviceSampleCount( void ) { return 0; }
virtual bool IsSurround( void ) { return m_bSurround; }
virtual bool IsSurroundCenter( void ) { return m_bSurroundCenter; }
virtual bool IsHeadphone( void ) { return m_bHeadphone; }
bool m_bSurround;
bool m_bSurroundCenter;
bool m_bHeadphone;
};
#endif // SND_DEV_COMMON_H
| [
"[email protected]"
] | |
9f9a20bd2f60ecddec11a7fa9f97a846ca8725cc | f81b774e5306ac01d2c6c1289d9e01b5264aae70 | /content/common/service_manager/service_manager_connection_impl.cc | d1cad99be3a53640d5d035b3c28f9be9b805887f | [
"BSD-3-Clause"
] | permissive | waaberi/chromium | a4015160d8460233b33fe1304e8fd9960a3650a9 | 6549065bd785179608f7b8828da403f3ca5f7aab | refs/heads/master | 2022-12-13T03:09:16.887475 | 2020-09-05T20:29:36 | 2020-09-05T20:29:36 | 293,153,821 | 1 | 1 | BSD-3-Clause | 2020-09-05T21:02:50 | 2020-09-05T21:02:49 | null | UTF-8 | C++ | false | false | 13,787 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/service_manager/service_manager_connection_impl.h"
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/task/current_thread.h"
#include "base/thread_annotations.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_receiver.h"
#include "services/service_manager/public/mojom/constants.mojom.h"
#include "services/service_manager/public/mojom/interface_provider.mojom.h"
#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
#include "content/public/android/content_jni_headers/ServiceManagerConnectionImpl_jni.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#endif
namespace content {
namespace {
base::LazyInstance<std::unique_ptr<ServiceManagerConnection>>::Leaky
g_connection_for_process = LAZY_INSTANCE_INITIALIZER;
ServiceManagerConnection::Factory* service_manager_connection_factory = nullptr;
} // namespace
// A ref-counted object which owns the IO thread state of a
// ServiceManagerConnectionImpl. This includes Service and ServiceFactory
// bindings.
class ServiceManagerConnectionImpl::IOThreadContext
: public base::RefCountedThreadSafe<IOThreadContext>,
public service_manager::Service {
public:
IOThreadContext(
mojo::PendingReceiver<service_manager::mojom::Service> service_receiver,
scoped_refptr<base::SequencedTaskRunner> io_task_runner,
mojo::PendingReceiver<service_manager::mojom::Connector>
connector_receiver)
: pending_service_receiver_(std::move(service_receiver)),
io_task_runner_(io_task_runner),
pending_connector_receiver_(std::move(connector_receiver)) {
// This will be reattached by any of the IO thread functions on first call.
io_thread_checker_.DetachFromThread();
}
void SetDefaultServiceRequestHandler(
const ServiceManagerConnection::DefaultServiceRequestHandler& handler) {
DCHECK(!started_);
default_request_handler_ = handler;
}
// Safe to call from any thread.
void Start(base::OnceClosure stop_callback) {
DCHECK(!started_);
started_ = true;
callback_task_runner_ = base::ThreadTaskRunnerHandle::Get();
stop_callback_ = std::move(stop_callback);
io_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&IOThreadContext::StartOnIOThread, this));
}
void Stop() {
io_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&IOThreadContext::StopOnIOThread, this));
}
// Safe to call from whichever thread called Start() (or may have called
// Start()). Must be called before IO thread shutdown.
void ShutDown() {
if (!started_)
return;
bool posted = io_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&IOThreadContext::ShutDownOnIOThread, this));
DCHECK(posted);
}
void AddServiceRequestHandler(const std::string& name,
const ServiceRequestHandler& handler) {
AddServiceRequestHandlerWithCallback(
name,
base::BindRepeating(&WrapServiceRequestHandlerNoCallback, handler));
}
void AddServiceRequestHandlerWithCallback(
const std::string& name,
const ServiceRequestHandlerWithCallback& handler) {
io_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&ServiceManagerConnectionImpl::IOThreadContext::
AddServiceRequestHandlerOnIoThread,
this, name, handler));
}
private:
friend class base::RefCountedThreadSafe<IOThreadContext>;
class MessageLoopObserver : public base::CurrentThread::DestructionObserver {
public:
explicit MessageLoopObserver(base::WeakPtr<IOThreadContext> context)
: context_(context) {
base::CurrentThread::Get()->AddDestructionObserver(this);
}
~MessageLoopObserver() override {
base::CurrentThread::Get()->RemoveDestructionObserver(this);
}
void ShutDown() {
if (!is_active_)
return;
// The call into |context_| below may reenter ShutDown(), hence we set
// |is_active_| to false here.
is_active_ = false;
if (context_)
context_->ShutDownOnIOThread();
delete this;
}
private:
void WillDestroyCurrentMessageLoop() override {
DCHECK(is_active_);
ShutDown();
}
bool is_active_ = true;
base::WeakPtr<IOThreadContext> context_;
DISALLOW_COPY_AND_ASSIGN(MessageLoopObserver);
};
~IOThreadContext() override {}
static void WrapServiceRequestHandlerNoCallback(
const ServiceRequestHandler& handler,
mojo::PendingReceiver<service_manager::mojom::Service> receiver,
CreatePackagedServiceInstanceCallback callback) {
handler.Run(std::move(receiver));
std::move(callback).Run(base::GetCurrentProcId());
}
void StartOnIOThread() {
// Should bind |io_thread_checker_| to the context's thread.
DCHECK(io_thread_checker_.CalledOnValidThread());
service_receiver_ = std::make_unique<service_manager::ServiceReceiver>(
this, std::move(pending_service_receiver_));
service_receiver_->GetConnector()->BindConnectorReceiver(
std::move(pending_connector_receiver_));
// MessageLoopObserver owns itself.
message_loop_observer_ =
new MessageLoopObserver(weak_factory_.GetWeakPtr());
}
void StopOnIOThread() {
request_handlers_.clear();
}
void ShutDownOnIOThread() {
DCHECK(io_thread_checker_.CalledOnValidThread());
weak_factory_.InvalidateWeakPtrs();
// Note that this method may be invoked by MessageLoopObserver observing
// MessageLoop destruction. In that case, this call to ShutDown is
// effectively a no-op. In any case it's safe.
if (message_loop_observer_) {
message_loop_observer_->ShutDown();
message_loop_observer_ = nullptr;
}
// Resetting the ServiceContext below may otherwise release the last
// reference to this IOThreadContext. We keep it alive until the stack
// unwinds.
scoped_refptr<IOThreadContext> keepalive(this);
service_receiver_.reset();
StopOnIOThread();
}
void AddServiceRequestHandlerOnIoThread(
const std::string& name,
const ServiceRequestHandlerWithCallback& handler) {
DCHECK(io_thread_checker_.CalledOnValidThread());
auto result = request_handlers_.insert(std::make_pair(name, handler));
DCHECK(result.second) << "ServiceRequestHandler for " << name
<< " already exists.";
}
/////////////////////////////////////////////////////////////////////////////
// service_manager::Service implementation
void OnBindInterface(const service_manager::BindSourceInfo& source_info,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) override {}
void CreatePackagedServiceInstance(
const std::string& service_name,
mojo::PendingReceiver<service_manager::mojom::Service> receiver,
CreatePackagedServiceInstanceCallback callback) override {
DCHECK(io_thread_checker_.CalledOnValidThread());
auto it = request_handlers_.find(service_name);
if (it == request_handlers_.end()) {
if (default_request_handler_) {
callback_task_runner_->PostTask(
FROM_HERE, base::BindOnce(default_request_handler_, service_name,
std::move(receiver)));
} else {
LOG(ERROR) << "Can't create service " << service_name
<< ". No handler found.";
}
std::move(callback).Run(base::nullopt);
} else {
it->second.Run(std::move(receiver), std::move(callback));
}
}
void OnDisconnected() override {
callback_task_runner_->PostTask(FROM_HERE, std::move(stop_callback_));
}
base::ThreadChecker io_thread_checker_;
bool started_ = false;
ServiceManagerConnection::DefaultServiceRequestHandler
default_request_handler_;
// Temporary state established on construction and consumed on the IO thread
// once the connection is started.
mojo::PendingReceiver<service_manager::mojom::Service>
pending_service_receiver_;
scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
mojo::PendingReceiver<service_manager::mojom::Connector>
pending_connector_receiver_;
// TaskRunner on which to run our owner's callbacks, i.e. the ones passed to
// Start().
scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
// Callback to run if the service is stopped by the service manager.
base::OnceClosure stop_callback_;
std::unique_ptr<service_manager::ServiceReceiver> service_receiver_;
// Not owned.
MessageLoopObserver* message_loop_observer_ = nullptr;
std::map<std::string, ServiceRequestHandlerWithCallback> request_handlers_;
base::WeakPtrFactory<IOThreadContext> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(IOThreadContext);
};
#if defined(OS_ANDROID)
// static
jint JNI_ServiceManagerConnectionImpl_GetConnectorMessagePipeHandle(
JNIEnv* env) {
DCHECK(ServiceManagerConnection::GetForProcess());
mojo::PendingRemote<service_manager::mojom::Connector> connector_remote;
ServiceManagerConnection::GetForProcess()
->GetConnector()
->BindConnectorReceiver(
connector_remote.InitWithNewPipeAndPassReceiver());
return connector_remote.PassPipe().release().value();
}
#endif
////////////////////////////////////////////////////////////////////////////////
// ServiceManagerConnection, public:
// static
void ServiceManagerConnection::SetForProcess(
std::unique_ptr<ServiceManagerConnection> connection) {
DCHECK(!g_connection_for_process.Get());
g_connection_for_process.Get() = std::move(connection);
}
// static
ServiceManagerConnection* ServiceManagerConnection::GetForProcess() {
return g_connection_for_process.Get().get();
}
// static
void ServiceManagerConnection::DestroyForProcess() {
// This joins the service manager controller thread.
g_connection_for_process.Get().reset();
}
// static
void ServiceManagerConnection::SetFactoryForTest(Factory* factory) {
DCHECK(!g_connection_for_process.Get());
service_manager_connection_factory = factory;
}
// static
std::unique_ptr<ServiceManagerConnection> ServiceManagerConnection::Create(
mojo::PendingReceiver<service_manager::mojom::Service> receiver,
scoped_refptr<base::SequencedTaskRunner> io_task_runner) {
if (service_manager_connection_factory)
return service_manager_connection_factory->Run();
return std::make_unique<ServiceManagerConnectionImpl>(std::move(receiver),
io_task_runner);
}
ServiceManagerConnection::~ServiceManagerConnection() {}
////////////////////////////////////////////////////////////////////////////////
// ServiceManagerConnectionImpl, public:
ServiceManagerConnectionImpl::ServiceManagerConnectionImpl(
mojo::PendingReceiver<service_manager::mojom::Service> receiver,
scoped_refptr<base::SequencedTaskRunner> io_task_runner) {
mojo::PendingReceiver<service_manager::mojom::Connector> connector_receiver;
connector_ = service_manager::Connector::Create(&connector_receiver);
context_ = new IOThreadContext(std::move(receiver), io_task_runner,
std::move(connector_receiver));
}
ServiceManagerConnectionImpl::~ServiceManagerConnectionImpl() {
context_->ShutDown();
}
////////////////////////////////////////////////////////////////////////////////
// ServiceManagerConnectionImpl, ServiceManagerConnection implementation:
void ServiceManagerConnectionImpl::Start() {
context_->Start(
base::BindOnce(&ServiceManagerConnectionImpl::OnConnectionLost,
weak_factory_.GetWeakPtr()));
}
void ServiceManagerConnectionImpl::Stop() {
context_->Stop();
}
service_manager::Connector* ServiceManagerConnectionImpl::GetConnector() {
return connector_.get();
}
void ServiceManagerConnectionImpl::SetConnectionLostClosure(
base::OnceClosure closure) {
connection_lost_handler_ = std::move(closure);
}
void ServiceManagerConnectionImpl::AddServiceRequestHandler(
const std::string& name,
const ServiceRequestHandler& handler) {
context_->AddServiceRequestHandler(name, handler);
}
void ServiceManagerConnectionImpl::AddServiceRequestHandlerWithCallback(
const std::string& name,
const ServiceRequestHandlerWithCallback& handler) {
context_->AddServiceRequestHandlerWithCallback(name, handler);
}
void ServiceManagerConnectionImpl::SetDefaultServiceRequestHandler(
const DefaultServiceRequestHandler& handler) {
context_->SetDefaultServiceRequestHandler(handler);
}
void ServiceManagerConnectionImpl::OnConnectionLost() {
if (!connection_lost_handler_.is_null())
std::move(connection_lost_handler_).Run();
}
void ServiceManagerConnectionImpl::GetInterface(
service_manager::mojom::InterfaceProvider* provider,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle request_handle) {
provider->GetInterface(interface_name, std::move(request_handle));
}
} // namespace content
| [
"[email protected]"
] |
Subsets and Splits